use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class TwoLevelNestedNonInterruptingEventSubprocessScenarioTest method testInitLevel1ThrowError.
@ScenarioUnderTest("initLevel1.6")
public void testInitLevel1ThrowError() {
// given
ProcessInstance instance = rule.processInstance();
rule.messageCorrelation("InnerEventSubProcessMessage").correlate();
Task innerEventSubprocessTask = rule.taskQuery().taskDefinitionKey("innerEventSubProcessTask").singleResult();
// when
rule.getRuntimeService().setVariable(instance.getId(), ThrowBpmnErrorDelegate.ERROR_INDICATOR_VARIABLE, true);
rule.getTaskService().complete(innerEventSubprocessTask.getId());
// then
Task escalatedTask = rule.taskQuery().singleResult();
Assert.assertEquals("escalatedTask", escalatedTask.getTaskDefinitionKey());
Assert.assertNotNull(escalatedTask);
rule.getTaskService().complete(escalatedTask.getId());
rule.assertScenarioEnded();
}
use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class TwoLevelNestedNonInterruptingEventSubprocessScenarioTest method testInitLevel1InitLevel2CompletionCase2.
@Test
@ScenarioUnderTest("initLevel1.initLevel2.2")
public void testInitLevel1InitLevel2CompletionCase2() {
// given
Task outerTask = rule.taskQuery().taskDefinitionKey("outerTask").singleResult();
Task innerTask = rule.taskQuery().taskDefinitionKey("subProcessTask").singleResult();
Task innerEventSubprocessTask = rule.taskQuery().taskDefinitionKey("innerEventSubProcessTask").singleResult();
// when
rule.getTaskService().complete(innerEventSubprocessTask.getId());
rule.getTaskService().complete(innerTask.getId());
rule.getTaskService().complete(outerTask.getId());
// then
rule.assertScenarioEnded();
}
use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class TwoLevelNestedNonInterruptingEventSubprocessScenarioTest method testInitLevel1InitLevel2ThrowUnhandledException.
@Test
@ScenarioUnderTest("initLevel1.initLevel2.7")
public void testInitLevel1InitLevel2ThrowUnhandledException() {
// given
ProcessInstance instance = rule.processInstance();
Task innerEventSubprocessTask = rule.taskQuery().taskDefinitionKey("innerEventSubProcessTask").singleResult();
// when
rule.getRuntimeService().setVariable(instance.getId(), ThrowBpmnErrorDelegate.EXCEPTION_INDICATOR_VARIABLE, true);
rule.getRuntimeService().setVariable(instance.getId(), ThrowBpmnErrorDelegate.EXCEPTION_MESSAGE_VARIABLE, "unhandledException");
// then
try {
rule.getTaskService().complete(innerEventSubprocessTask.getId());
Assert.fail("should throw a ThrowBpmnErrorDelegateException");
} catch (ThrowBpmnErrorDelegateException e) {
Assert.assertEquals("unhandledException", e.getMessage());
}
}
use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class TwoLevelNestedNonInterruptingEventSubprocessScenarioTest method testInitLevel1Deletion.
@Test
@ScenarioUnderTest("initLevel1.5")
public void testInitLevel1Deletion() {
// given
ProcessInstance instance = rule.processInstance();
// when
rule.getRuntimeService().deleteProcessInstance(instance.getId(), null);
// then
rule.assertScenarioEnded();
}
use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.
the class TwoLevelNestedNonInterruptingEventSubprocessScenarioTest method testInitLevel1InitLevel2CompletionCase3.
@Test
@ScenarioUnderTest("initLevel1.initLevel2.3")
public void testInitLevel1InitLevel2CompletionCase3() {
// given
Task outerTask = rule.taskQuery().taskDefinitionKey("outerTask").singleResult();
Task innerTask = rule.taskQuery().taskDefinitionKey("subProcessTask").singleResult();
// when (the inner subprocess is triggered another time)
rule.messageCorrelation("InnerEventSubProcessMessage").correlate();
// then
Assert.assertEquals(4, rule.taskQuery().count());
List<Task> innerEventSubprocessTasks = rule.taskQuery().taskDefinitionKey("innerEventSubProcessTask").list();
Assert.assertEquals(2, innerEventSubprocessTasks.size());
// and
rule.getTaskService().complete(innerTask.getId());
rule.getTaskService().complete(innerEventSubprocessTasks.get(0).getId());
rule.getTaskService().complete(outerTask.getId());
rule.getTaskService().complete(innerEventSubprocessTasks.get(1).getId());
rule.assertScenarioEnded();
}
Aggregations