use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class NonInterruptingEventSubProcessCompensationSenarioTest method testInitThrowCompensateDeletion.
@Test
@ScenarioUnderTest("init.throwCompensate.4")
public void testInitThrowCompensateDeletion() {
// given
ProcessInstance processInstance = rule.processInstance();
// when
rule.getRuntimeService().deleteProcessInstance(processInstance.getId(), null);
// then
rule.assertScenarioEnded();
}
use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class NonInterruptingEventSubProcessCompensationSenarioTest method testInitThrowCompensateCompletionCase2.
@Test
@ScenarioUnderTest("init.throwCompensate.2")
public void testInitThrowCompensateCompletionCase2() {
// given
Task outerTask = rule.taskQuery().taskDefinitionKey("outerTask").singleResult();
Task undoTask = rule.taskQuery().taskDefinitionKey("undoTask").singleResult();
// when
rule.getTaskService().complete(outerTask.getId());
rule.getTaskService().complete(undoTask.getId());
// then it is possible to complete the process successfully
Task afterCompensateTask = rule.taskQuery().taskDefinitionKey("afterCompensate").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 SequentialMultiInstanceCompensationScenarioTest method testSingleActivityHandlerBeforeCompensateDeletion.
@Test
@ScenarioUnderTest("singleActivityHandler.beforeCompensate.2")
public void testSingleActivityHandlerBeforeCompensateDeletion() {
// when throwing compensation
Task beforeCompensateTask = rule.taskQuery().singleResult();
rule.getTaskService().complete(beforeCompensateTask.getId());
// then it is possible to delete the process instance
rule.getRuntimeService().deleteProcessInstance(rule.processInstance().getId(), null);
// and the process is ended
rule.assertScenarioEnded();
}
use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class SequentialMultiInstanceCompensationScenarioTest method testDefaultHandlerBeforeCompensateCompletion.
@Test
@ScenarioUnderTest("defaultHandler.beforeCompensate.1")
public void testDefaultHandlerBeforeCompensateCompletion() {
// given
Task beforeCompensateTask = rule.taskQuery().singleResult();
// when throwing compensation
rule.getTaskService().complete(beforeCompensateTask.getId());
// then it is possible to compensate the three instances,
// and finish the process successfully
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 testSubProcessHandlerThrowCompensateActivityInstanceTree.
@Test
@ScenarioUnderTest("subProcessHandler.beforeCompensate.throwCompensate.3")
public void testSubProcessHandlerThrowCompensateActivityInstanceTree() {
// 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", "undoSubProcess").activity("undoTask").activity("undoTask").activity("undoTask").done());
}
Aggregations