use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class SequentialMultiInstanceCompensationScenarioTest method testDefaultHandlerThrowCompensateActivityInstanceTree.
@Test
@ScenarioUnderTest("defaultHandler.beforeCompensate.throwCompensate.3")
public void testDefaultHandlerThrowCompensateActivityInstanceTree() {
// given
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", "subProcess").activity("undoTask").activity("undoTask").activity("undoTask").done());
}
use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class SequentialMultiInstanceCompensationScenarioTest method testSingleActivityHandlerThrowCompensateCompletion.
@Test
@ScenarioUnderTest("singleActivityHandler.beforeCompensate.throwCompensate.1")
public void testSingleActivityHandlerThrowCompensateCompletion() {
// given active compensation
List<Task> miCompensationTasks = rule.taskQuery().list();
Assert.assertEquals(3, miCompensationTasks.size());
// when completing the compensation handlers
for (int i = 0; i < miCompensationTasks.size(); i++) {
Assert.assertEquals(3 - i, rule.taskQuery().count());
Task compensationTask = miCompensationTasks.get(i);
Assert.assertEquals("undoTask", compensationTask.getTaskDefinitionKey());
rule.getTaskService().complete(compensationTask.getId());
}
// then it is possible to complete the process successfully
Task afterCompensateTask = rule.taskQuery().singleResult();
Assert.assertNotNull(afterCompensateTask);
rule.getTaskService().complete(afterCompensateTask.getId());
rule.assertScenarioEnded();
}
use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class SequentialMultiInstanceCompensationScenarioTest method testSubProcessHandlerBeforeCompensateActivityInstanceTree.
@Test
@ScenarioUnderTest("subProcessHandler.beforeCompensate.3")
public void testSubProcessHandlerBeforeCompensateActivityInstanceTree() {
// given
ProcessInstance instance = rule.processInstance();
// when throwing compensation
Task beforeCompensateTask = rule.taskQuery().singleResult();
rule.getTaskService().complete(beforeCompensateTask.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("undoSubProcess").activity("undoTask").activity("undoTask").activity("undoTask").done());
}
use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class SequentialMultiInstanceCompensationScenarioTest method testSingleActivityHandlerMultiInstancePartialCompletion.
@Test
@ScenarioUnderTest("singleActivityHandler.multiInstancePartial.1")
public void testSingleActivityHandlerMultiInstancePartialCompletion() {
// given the last multi instance task
Task lastMiTask = rule.taskQuery().singleResult();
// when completing it
rule.getTaskService().complete(lastMiTask.getId());
// then it is possible to throw compensation, compensate the three instances,
// and finish the process successfully
Task beforeCompensateTask = rule.taskQuery().singleResult();
Assert.assertNotNull(beforeCompensateTask);
rule.getTaskService().complete(beforeCompensateTask.getId());
List<Task> miCompensationTasks = rule.taskQuery().list();
Assert.assertEquals(3, miCompensationTasks.size());
for (int i = 0; i < miCompensationTasks.size(); i++) {
Assert.assertEquals(3 - i, rule.taskQuery().count());
Task compensationTask = miCompensationTasks.get(i);
Assert.assertEquals("undoTask", compensationTask.getTaskDefinitionKey());
rule.getTaskService().complete(compensationTask.getId());
}
Task afterCompensateTask = rule.taskQuery().singleResult();
Assert.assertNotNull(afterCompensateTask);
rule.getTaskService().complete(afterCompensateTask.getId());
rule.assertScenarioEnded();
}
use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class SequentialMultiInstanceCompensationScenarioTest method testSubProcessHandlerMultiInstancePartialCompletion.
@Test
@ScenarioUnderTest("subProcessHandler.multiInstancePartial.1")
public void testSubProcessHandlerMultiInstancePartialCompletion() {
// given the last multi instance task
Task lastMiTask = rule.taskQuery().singleResult();
// when completing it
rule.getTaskService().complete(lastMiTask.getId());
// then it is possible to throw compensation, compensate the three instances,
// and finish the process successfully
Task beforeCompensateTask = rule.taskQuery().singleResult();
Assert.assertNotNull(beforeCompensateTask);
rule.getTaskService().complete(beforeCompensateTask.getId());
List<Task> miCompensationTasks = rule.taskQuery().list();
Assert.assertEquals(3, miCompensationTasks.size());
for (int i = 0; i < miCompensationTasks.size(); i++) {
Assert.assertEquals(3 - i, rule.taskQuery().count());
Task compensationTask = miCompensationTasks.get(i);
Assert.assertEquals("undoTask", compensationTask.getTaskDefinitionKey());
rule.getTaskService().complete(compensationTask.getId());
}
Task afterCompensateTask = rule.taskQuery().singleResult();
Assert.assertNotNull(afterCompensateTask);
rule.getTaskService().complete(afterCompensateTask.getId());
rule.assertScenarioEnded();
}
Aggregations