use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class InterruptingEventSubprocessCompensationScenarioTest method testInitCompletion.
@Test
@ScenarioUnderTest("init.1")
public void testInitCompletion() {
// when compensation is thrown
Task beforeCompensationTask = rule.taskQuery().singleResult();
rule.getTaskService().complete(beforeCompensationTask.getId());
// then there is an active compensation handler task
Task compensationHandlerTask = rule.taskQuery().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().singleResult();
Assert.assertNotNull(afterCompensateTask);
Assert.assertEquals("afterCompensate", afterCompensateTask.getTaskDefinitionKey());
rule.getTaskService().complete(afterCompensateTask.getId());
rule.assertScenarioEnded();
}
use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class InterruptingEventSubprocessCompensationScenarioTest method testInitActivityInstanceTree.
@Test
@ScenarioUnderTest("init.3")
public void testInitActivityInstanceTree() {
// given
ProcessInstance instance = rule.processInstance();
// when compensation is thrown
Task beforeCompensationTask = rule.taskQuery().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()).beginScope("subProcess").beginScope("throwCompensate").activity("undoTask").done());
}
use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class SubprocessCompensationScenarioTest method testInitConcurrentCompletion.
@Test
@ScenarioUnderTest("init.concurrent.1")
public void testInitConcurrentCompletion() {
// when compensation is thrown
Task beforeCompensationTask = rule.taskQuery().singleResult();
rule.getTaskService().complete(beforeCompensationTask.getId());
// then there are two active compensation handler task
Assert.assertEquals(2, rule.taskQuery().count());
Task undoTask1 = rule.taskQuery().taskDefinitionKey("undoTask1").singleResult();
Assert.assertNotNull(undoTask1);
Task undoTask2 = rule.taskQuery().taskDefinitionKey("undoTask2").singleResult();
Assert.assertNotNull(undoTask2);
// and they can be completed such that the process instance ends successfully
rule.getTaskService().complete(undoTask1.getId());
rule.getTaskService().complete(undoTask2.getId());
Task afterCompensateTask = rule.taskQuery().singleResult();
Assert.assertNotNull(afterCompensateTask);
Assert.assertEquals("afterCompensate", afterCompensateTask.getTaskDefinitionKey());
rule.getTaskService().complete(afterCompensateTask.getId());
rule.assertScenarioEnded();
}
use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class SubprocessCompensationScenarioTest method testInitConcurrentActivityInstanceTree.
@Test
@ScenarioUnderTest("init.concurrent.3")
public void testInitConcurrentActivityInstanceTree() {
// given
ProcessInstance instance = rule.processInstance();
// when compensation is thrown
Task beforeCompensationTask = rule.taskQuery().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").beginScope("subProcess").activity("undoTask1").activity("undoTask2").done());
}
use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class SubprocessCompensationScenarioTest method testInitConcurrentTriggerCompensationActivityInstanceTree.
@Test
@ScenarioUnderTest("init.concurrent.triggerCompensation.3")
public void testInitConcurrentTriggerCompensationActivityInstanceTree() {
// 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()).beginScope("throwCompensate").activity("undoTask1").activity("undoTask2").done());
}
Aggregations