use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class InterruptingEventSubProcessNestedCompensationSenarioTest method testInitThrowCompensateCompletionCase1.
@Test
@ScenarioUnderTest("init.throwCompensate.1")
public void testInitThrowCompensateCompletionCase1() {
// given
Task undoTask = rule.taskQuery().singleResult();
// when
rule.getTaskService().complete(undoTask.getId());
// then it is possible to complete the process successfully
// by completing the sub process regularly
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 InterruptingEventSubProcessNestedCompensationSenarioTest method testInitThrowCompensateCompletionCase2.
/**
* Fails because wrongly destroy the sub process scope execution when completing the
* compensation throw event. See CAM-4914
*/
@Ignore
@Test
@ScenarioUnderTest("init.throwCompensate.2")
public void testInitThrowCompensateCompletionCase2() {
// given
Task undoTask = rule.taskQuery().singleResult();
// when
rule.getTaskService().complete(undoTask.getId());
// then it is possible to complete the process successfully
// by triggering the message boundary event
rule.messageCorrelation("BoundaryEventMessage").correlate();
Task afterBoundaryTask = rule.taskQuery().singleResult();
Assert.assertNotNull(afterBoundaryTask);
Assert.assertEquals("afterBoundaryTask", afterBoundaryTask.getTaskDefinitionKey());
rule.getTaskService().complete(afterBoundaryTask.getId());
rule.assertScenarioEnded();
}
use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class InterruptingEventSubProcessNestedCompensationSenarioTest method testInitThrowCompensateActivityInstanceTree.
@Test
@ScenarioUnderTest("init.throwCompensate.4")
public void testInitThrowCompensateActivityInstanceTree() {
// given
ProcessInstance processInstance = rule.processInstance();
// when
ActivityInstance tree = rule.getRuntimeService().getActivityInstance(processInstance.getId());
// then
Assert.assertNotNull(tree);
assertThat(tree).hasStructure(describeActivityInstanceTree(processInstance.getProcessDefinitionId()).beginScope("innerSubProcess").beginScope("throwCompensate").activity("undoTask").done());
}
use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class NestedCompensationScenarioTest method testHistory.
@Test
@ScenarioUnderTest("init.throwCompensate.1")
public void testHistory() {
// given
Task compensationHandler = rule.taskQuery().singleResult();
// when
rule.getTaskService().complete(compensationHandler.getId());
// then history is written for the remaining activity instances
HistoricProcessInstance historicProcessInstance = rule.historicProcessInstance();
Assert.assertNotNull(historicProcessInstance);
Assert.assertNotNull(historicProcessInstance.getEndTime());
HistoricActivityInstance subProcessInstance = rule.getHistoryService().createHistoricActivityInstanceQuery().processInstanceId(historicProcessInstance.getId()).activityId("subProcess").singleResult();
Assert.assertNotNull(subProcessInstance);
Assert.assertNotNull(subProcessInstance.getEndTime());
Assert.assertEquals(historicProcessInstance.getId(), subProcessInstance.getParentActivityInstanceId());
HistoricActivityInstance compensationThrowInstance = rule.getHistoryService().createHistoricActivityInstanceQuery().processInstanceId(historicProcessInstance.getId()).activityId("throwCompensate").singleResult();
Assert.assertNotNull(compensationThrowInstance);
Assert.assertNotNull(compensationThrowInstance.getEndTime());
Assert.assertEquals(subProcessInstance.getId(), compensationThrowInstance.getParentActivityInstanceId());
HistoricActivityInstance compensationHandlerInstance = rule.getHistoryService().createHistoricActivityInstanceQuery().processInstanceId(historicProcessInstance.getId()).activityId("undoTask").singleResult();
Assert.assertNotNull(compensationHandlerInstance);
Assert.assertNotNull(compensationHandlerInstance.getEndTime());
Assert.assertEquals(subProcessInstance.getId(), compensationHandlerInstance.getParentActivityInstanceId());
}
use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class NonInterruptingEventSubProcessCompensationSenarioTest method testInitThrowCompensateCompletionCase1.
@Test
@ScenarioUnderTest("init.throwCompensate.1")
public void testInitThrowCompensateCompletionCase1() {
// given
Task outerTask = rule.taskQuery().taskDefinitionKey("outerTask").singleResult();
Task undoTask = rule.taskQuery().taskDefinitionKey("undoTask").singleResult();
// when
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.getTaskService().complete(outerTask.getId());
rule.assertScenarioEnded();
}
Aggregations