Search in sources :

Example 76 with ScenarioUnderTest

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();
}
Also used : Task(org.camunda.bpm.engine.task.Task) Test(org.junit.Test) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest)

Example 77 with ScenarioUnderTest

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());
}
Also used : Task(org.camunda.bpm.engine.task.Task) ActivityInstance(org.camunda.bpm.engine.runtime.ActivityInstance) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Test(org.junit.Test) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest)

Example 78 with ScenarioUnderTest

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();
}
Also used : Task(org.camunda.bpm.engine.task.Task) Test(org.junit.Test) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest)

Example 79 with ScenarioUnderTest

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());
}
Also used : Task(org.camunda.bpm.engine.task.Task) ActivityInstance(org.camunda.bpm.engine.runtime.ActivityInstance) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Test(org.junit.Test) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest)

Example 80 with ScenarioUnderTest

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());
}
Also used : ActivityInstance(org.camunda.bpm.engine.runtime.ActivityInstance) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Test(org.junit.Test) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest)

Aggregations

ScenarioUnderTest (org.camunda.bpm.qa.upgrade.ScenarioUnderTest)314 Test (org.junit.Test)311 Task (org.camunda.bpm.engine.task.Task)190 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)183 ActivityInstance (org.camunda.bpm.engine.runtime.ActivityInstance)80 ThrowBpmnErrorDelegateException (org.camunda.bpm.qa.upgrade.util.ThrowBpmnErrorDelegate.ThrowBpmnErrorDelegateException)19 Job (org.camunda.bpm.engine.runtime.Job)14 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)6 JobDefinition (org.camunda.bpm.engine.management.JobDefinition)4 TaskQuery (org.camunda.bpm.engine.task.TaskQuery)4 Ignore (org.junit.Ignore)4 HistoricActivityInstance (org.camunda.bpm.engine.history.HistoricActivityInstance)3 HistoricTaskInstanceQuery (org.camunda.bpm.engine.history.HistoricTaskInstanceQuery)3 HistoricVariableInstance (org.camunda.bpm.engine.history.HistoricVariableInstance)3 CaseSentryPartEntity (org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseSentryPartEntity)3 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)2 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)2 CaseExecution (org.camunda.bpm.engine.runtime.CaseExecution)2 Execution (org.camunda.bpm.engine.runtime.Execution)2 VariableInstance (org.camunda.bpm.engine.runtime.VariableInstance)2