use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class SingleActivityConcurrentCompensationScenarioTest method testInitActivityInstanceTree.
@Test
@ScenarioUnderTest("init.3")
public void testInitActivityInstanceTree() {
// given
ProcessInstance instance = rule.processInstance();
// when compensation is thrown
Task beforeCompensationTask = rule.taskQuery().taskDefinitionKey("beforeCompensate").singleResult();
rule.getTaskService().complete(beforeCompensationTask.getId());
// then the activity instance tree is meaningful
ActivityInstance activityInstance = rule.getRuntimeService().getActivityInstance(instance.getId());
Assert.assertNotNull(activityInstance);
assertThat(activityInstance).hasStructure(describeActivityInstanceTree(instance.getProcessDefinitionId()).activity("throwCompensate").activity("undoTask").activity("concurrentTask").done());
}
use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class SingleActivityConcurrentCompensationScenarioTest method testInitTriggerCompensationActivityInstanceTree.
@Test
@ScenarioUnderTest("init.triggerCompensation.3")
public void testInitTriggerCompensationActivityInstanceTree() {
// given active compensation
ProcessInstance instance = rule.processInstance();
// then the activity instance tree is meaningful
ActivityInstance activityInstance = rule.getRuntimeService().getActivityInstance(instance.getId());
Assert.assertNotNull(activityInstance);
assertThat(activityInstance).hasStructure(describeActivityInstanceTree(instance.getProcessDefinitionId()).activity("throwCompensate").activity("undoTask").activity("concurrentTask").done());
}
use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class SingleActivityConcurrentCompensationScenarioTest method testInitCompletion.
@Test
@ScenarioUnderTest("init.1")
public void testInitCompletion() {
// given
Task beforeCompensationTask = rule.taskQuery().taskDefinitionKey("beforeCompensate").singleResult();
Task concurrentTask = rule.taskQuery().taskDefinitionKey("concurrentTask").singleResult();
// when compensation is thrown
rule.getTaskService().complete(beforeCompensationTask.getId());
// then there is an active compensation handler task
Task compensationHandlerTask = rule.taskQuery().taskDefinitionKey("undoTask").singleResult();
Assert.assertNotNull(compensationHandlerTask);
Assert.assertEquals("undoTask", compensationHandlerTask.getTaskDefinitionKey());
// and it can be completed such that the process instance ends successfully
rule.getTaskService().complete(compensationHandlerTask.getId());
Task afterCompensateTask = rule.taskQuery().taskDefinitionKey("afterCompensate").singleResult();
Assert.assertNotNull(afterCompensateTask);
Assert.assertEquals("afterCompensate", afterCompensateTask.getTaskDefinitionKey());
rule.getTaskService().complete(afterCompensateTask.getId());
rule.getTaskService().complete(concurrentTask.getId());
rule.assertScenarioEnded();
}
use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class SentryScenarioTest method testTriggerTaskEntryCriterion.
@Test
@ScenarioUnderTest("triggerTaskEntryCriterion.1")
public void testTriggerTaskEntryCriterion() {
// given
// enabled human task inside a stage instance
String firstHumanTaskId = rule.caseExecutionQuery().activityId("PI_HumanTask_1").singleResult().getId();
// when
// start and complete human task
caseService.manuallyStartCaseExecution(firstHumanTaskId);
caseService.completeCaseExecution(firstHumanTaskId);
// then
// entry criterion of the second human task inside the stage instance
// will be triggered
CaseExecution secondHumanTask = rule.caseExecutionQuery().activityId("PI_HumanTask_2").singleResult();
// ... and the task is enabled
assertTrue(secondHumanTask.isEnabled());
CaseSentryPartEntity sentryPart = createCaseSentryPartQuery().sourceCaseExecutionId(firstHumanTaskId).singleResult();
// the associated sentry part is not satisfied
assertFalse(sentryPart.isSatisfied());
// the source is null (because this sentry part
// has been migrated into 7.4)
assertNull(sentryPart.getSource());
}
use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class CreateProcessInstanceWithJsonVariablesTest method testCreateProcessInstanceWithVariable.
@ScenarioUnderTest("initProcessInstance.1")
@Test
public void testCreateProcessInstanceWithVariable() {
// then
ProcessInstance processInstance = engineRule.getRuntimeService().createProcessInstanceQuery().processInstanceBusinessKey("processWithJsonVariables").singleResult();
List<VariableInstance> variables = engineRule.getRuntimeService().createVariableInstanceQuery().processInstanceIdIn(processInstance.getId()).list();
assertEquals(4, variables.size());
final Object objectVariable = engineRule.getRuntimeService().getVariable(processInstance.getId(), "objectVariable");
assertObjectVariable(objectVariable);
final Object plainTypeArrayVariable = engineRule.getRuntimeService().getVariable(processInstance.getId(), "plainTypeArrayVariable");
assertPlainTypeArrayVariable(plainTypeArrayVariable);
final Object notGenericObjectListVariable = engineRule.getRuntimeService().getVariable(processInstance.getId(), "notGenericObjectListVariable");
assertNotGenericObjectListVariable(notGenericObjectListVariable);
final TypedValue serializedObject = engineRule.getRuntimeService().getVariableTyped(processInstance.getId(), "serializedMapVariable", true);
assertSerializedMap(serializedObject);
}
Aggregations