Search in sources :

Example 21 with ScenarioUnderTest

use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.

the class SingleActivityConcurrentCompensationScenarioTest method testInitActivityInstanceTree.

@Test
@ScenarioUnderTest("init.3")
public void testInitActivityInstanceTree() {
    // given
    ProcessInstance instance = rule.processInstance();
    // when compensation is thrown
    Task beforeCompensationTask = rule.taskQuery().taskDefinitionKey("beforeCompensate").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").activity("undoTask").activity("concurrentTask").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 22 with ScenarioUnderTest

use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.

the class SingleActivityConcurrentCompensationScenarioTest method testInitTriggerCompensationActivityInstanceTree.

@Test
@ScenarioUnderTest("init.triggerCompensation.3")
public void testInitTriggerCompensationActivityInstanceTree() {
    // 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()).activity("throwCompensate").activity("undoTask").activity("concurrentTask").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)

Example 23 with ScenarioUnderTest

use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.

the class SingleActivityConcurrentCompensationScenarioTest method testInitCompletion.

@Test
@ScenarioUnderTest("init.1")
public void testInitCompletion() {
    // given
    Task beforeCompensationTask = rule.taskQuery().taskDefinitionKey("beforeCompensate").singleResult();
    Task concurrentTask = rule.taskQuery().taskDefinitionKey("concurrentTask").singleResult();
    // when compensation is thrown
    rule.getTaskService().complete(beforeCompensationTask.getId());
    // then there is an active compensation handler task
    Task compensationHandlerTask = rule.taskQuery().taskDefinitionKey("undoTask").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().taskDefinitionKey("afterCompensate").singleResult();
    Assert.assertNotNull(afterCompensateTask);
    Assert.assertEquals("afterCompensate", afterCompensateTask.getTaskDefinitionKey());
    rule.getTaskService().complete(afterCompensateTask.getId());
    rule.getTaskService().complete(concurrentTask.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 24 with ScenarioUnderTest

use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.

the class SentryScenarioTest method testTriggerTaskEntryCriterion.

@Test
@ScenarioUnderTest("triggerTaskEntryCriterion.1")
public void testTriggerTaskEntryCriterion() {
    // given
    // enabled human task inside a stage instance
    String firstHumanTaskId = rule.caseExecutionQuery().activityId("PI_HumanTask_1").singleResult().getId();
    // when
    // start and complete human task
    caseService.manuallyStartCaseExecution(firstHumanTaskId);
    caseService.completeCaseExecution(firstHumanTaskId);
    // then
    // entry criterion of the second human task inside the stage instance
    // will be triggered
    CaseExecution secondHumanTask = rule.caseExecutionQuery().activityId("PI_HumanTask_2").singleResult();
    // ... and the task is enabled
    assertTrue(secondHumanTask.isEnabled());
    CaseSentryPartEntity sentryPart = createCaseSentryPartQuery().sourceCaseExecutionId(firstHumanTaskId).singleResult();
    // the associated sentry part is not satisfied
    assertFalse(sentryPart.isSatisfied());
    // the source is null (because this sentry part
    // has been migrated into 7.4)
    assertNull(sentryPart.getSource());
}
Also used : CaseExecution(org.camunda.bpm.engine.runtime.CaseExecution) CaseSentryPartEntity(org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseSentryPartEntity) Test(org.junit.Test) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest)

Example 25 with ScenarioUnderTest

use of org.camunda.bpm.qa.upgrade.ScenarioUnderTest in project camunda-bpm-platform by camunda.

the class CreateProcessInstanceWithJsonVariablesTest method testCreateProcessInstanceWithVariable.

@ScenarioUnderTest("initProcessInstance.1")
@Test
public void testCreateProcessInstanceWithVariable() {
    // then
    ProcessInstance processInstance = engineRule.getRuntimeService().createProcessInstanceQuery().processInstanceBusinessKey("processWithJsonVariables").singleResult();
    List<VariableInstance> variables = engineRule.getRuntimeService().createVariableInstanceQuery().processInstanceIdIn(processInstance.getId()).list();
    assertEquals(4, variables.size());
    final Object objectVariable = engineRule.getRuntimeService().getVariable(processInstance.getId(), "objectVariable");
    assertObjectVariable(objectVariable);
    final Object plainTypeArrayVariable = engineRule.getRuntimeService().getVariable(processInstance.getId(), "plainTypeArrayVariable");
    assertPlainTypeArrayVariable(plainTypeArrayVariable);
    final Object notGenericObjectListVariable = engineRule.getRuntimeService().getVariable(processInstance.getId(), "notGenericObjectListVariable");
    assertNotGenericObjectListVariable(notGenericObjectListVariable);
    final TypedValue serializedObject = engineRule.getRuntimeService().getVariableTyped(processInstance.getId(), "serializedMapVariable", true);
    assertSerializedMap(serializedObject);
}
Also used : ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) HistoricVariableInstance(org.camunda.bpm.engine.history.HistoricVariableInstance) VariableInstance(org.camunda.bpm.engine.runtime.VariableInstance) TypedValue(org.camunda.bpm.engine.variable.value.TypedValue) 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