.repeat(10) {
val performanceModel : String = DefinitionUtil.getDefinitionAsString("Performance2")
val performanceDefinitionId = "WF7FF447E1-AAA5-4ECF-850F-99702FFE3042"
val headers = Map(
"Authorization" -> ("${tokenType} ${accessToken}"),
"Content-Type" -> "application/vnd.workflow.definition+json",
"Accept" -> "application/vnd.workflow.definition.summary+json"
)
var definitionId = "WF".concat(java.util.UUID.randomUUID().toString)
var name = definitionId
var comment = "Definition ".concat(definitionId)
var model = performanceModel.replace(performanceDefinitionId, definitionId).replace("Performance2", name)
var definitionProperties = Map(
"id" -> definitionId,
"name" -> name,
"comment" -> comment,
"clientRegistrationId" -> clientRegistrationId,
"model" -> model
)
exec(WorkflowAction.createDefinition(definitionProperties))
}
thanks,
Rob
def createTag(name : String) = {
var tagProperties: Map[String, String] = Map("name" -> name)
val body = JsonUtil.mapToJsonString(tagProperties)
val headers = Map(
"Authorization" -> ("${tokenType} ${accessToken}"),
"Content-Type" -> "application/vnd.workflow.tag+json",
"Accept" -> "application/vnd.workflow.tag+json"
)
exec(http("Create Tag")
.post("/workflow/tags")
.headers(headers)
.body(StringBody(body)).asJSON
.check(status.in(201)))
}
I'm creating my scenario using the following class. I'm not sure I understand where the session is being created.
I believe the session is associated with each virtual user, however I'm not sure where the session begins/ends. Is the session not created until the duration block?
In the code below the call in the repeat block does not work, however, making multiple calls does. Not sure I understand why after re-reading the documentation.
class BasicWorkflowScenario(durationMinutes: Int, userFeeder: FeederBuilder[String]) extends
ScenarioCreator {
...
override def getScenario(): ScenarioBuilder = scenario(name)
.exec(LoginAction.administratorLogin)
.feed(userFeeder)
.exec(LoginAction.switchToWorkflowAdmin)
.exec(WorkflowAction.createTag("Tag1"))
.exec(WorkflowAction.createTag("Tag2"))
...
// This results in a http status of 409 b/c it uses the same UUID value for each iteration.
.repeat(10) {
exec(WorkflowAction.createDefinition("WF".concat(java.util.UUID.randomUUID().toString), clientRegistrationId))
}
// However, if I don't use repeat block, but rather make individual calls it produces unique values.
exec(WorkflowAction.createDefinition("WF".concat(java.util.UUID.randomUUID().toString), clientRegistrationId))
exec(WorkflowAction.createDefinition("WF".concat(java.util.UUID.randomUUID().toString), clientRegistrationId))
...
.during(durationMinutes * 60) {
// call other actions
pause(1)}}
}
scenario(name)
.exec( (session:Session) =>
WorkflowAction.createDefinition(
"WF".concat(java.util.UUID.randomUUID().toString()),
clientRegistrationId,
session
)
)
def createDefinition(definitionId: String, clientRegistrationId : String, session : Session) = {
...
}