use of org.camunda.bpm.engine.impl.cmmn.execution.CmmnActivityExecution in project camunda-bpm-platform by camunda.
the class CaseExecutionReactivateTest method testReactivateCaseInstance.
@Test
public void testReactivateCaseInstance() {
// given ///////////////////////////////////////////////////////////////
// a case definition
CmmnCaseDefinition caseDefinition = new CaseDefinitionBuilder("Case1").createActivity("X").behavior(new StageActivityBehavior()).createActivity("A").behavior(new TaskWaitState()).property(ItemHandler.PROPERTY_MANUAL_ACTIVATION_RULE, defaultManualActivation()).endActivity().createActivity("B").behavior(new TaskWaitState()).property(ItemHandler.PROPERTY_MANUAL_ACTIVATION_RULE, defaultManualActivation()).endActivity().endActivity().buildCaseDefinition();
// an active case instance
CmmnCaseInstance caseInstance = caseDefinition.createCaseInstance();
caseInstance.create();
// a case execution associated with Stage X
CmmnActivityExecution stageX = caseInstance.findCaseExecution("X");
// a case execution associated with Task A
CmmnActivityExecution taskA = caseInstance.findCaseExecution("A");
// a case execution associated with Task B
CmmnActivityExecution taskB = caseInstance.findCaseExecution("B");
caseInstance.suspend();
// when
caseInstance.reactivate();
// then
assertTrue(caseInstance.isActive());
assertTrue(stageX.isActive());
assertTrue(taskA.isEnabled());
assertTrue(taskB.isEnabled());
}
use of org.camunda.bpm.engine.impl.cmmn.execution.CmmnActivityExecution in project camunda-bpm-platform by camunda.
the class CaseExecutionTerminationTest method testTerminateTask.
@Test
public void testTerminateTask() {
// given ///////////////////////////////////////////////////////////////
// a case definition
CmmnCaseDefinition caseDefinition = new CaseDefinitionBuilder("Case1").createActivity("X").behavior(new StageActivityBehavior()).createActivity("A").behavior(new TaskWaitState()).endActivity().createActivity("B").behavior(new TaskWaitState()).property(ItemHandler.PROPERTY_MANUAL_ACTIVATION_RULE, defaultManualActivation()).endActivity().endActivity().buildCaseDefinition();
// an active case instance
CmmnCaseInstance caseInstance = caseDefinition.createCaseInstance();
caseInstance.create();
// a case execution associated with Stage X
CmmnActivityExecution stageX = caseInstance.findCaseExecution("X");
// a case execution associated with Task A
CmmnActivityExecution taskA = caseInstance.findCaseExecution("A");
// a case execution associated with Task B
CmmnActivityExecution taskB = caseInstance.findCaseExecution("B");
// when
taskA.terminate();
// then
assertTrue(caseInstance.isActive());
assertTrue(stageX.isActive());
assertTrue(taskA.isTerminated());
assertTrue(taskB.isEnabled());
}
use of org.camunda.bpm.engine.impl.cmmn.execution.CmmnActivityExecution in project camunda-bpm-platform by camunda.
the class CaseExecutionTerminationTest method testTerminateCaseInstance.
@Test
public void testTerminateCaseInstance() {
// given ///////////////////////////////////////////////////////////////
// a case definition
CmmnCaseDefinition caseDefinition = new CaseDefinitionBuilder("Case1").createActivity("X").behavior(new StageActivityBehavior()).createActivity("A").behavior(new TaskWaitState()).endActivity().createActivity("B").behavior(new TaskWaitState()).endActivity().endActivity().buildCaseDefinition();
// an active case instance
CmmnCaseInstance caseInstance = caseDefinition.createCaseInstance();
caseInstance.create();
// a case execution associated with Stage X
CmmnActivityExecution stageX = caseInstance.findCaseExecution("X");
// a case execution associated with Task A
CmmnActivityExecution taskA = caseInstance.findCaseExecution("A");
// a case execution associated with Task B
CmmnActivityExecution taskB = caseInstance.findCaseExecution("B");
// when
caseInstance.terminate();
// then
assertTrue(caseInstance.isTerminated());
assertTrue(stageX.isTerminated());
assertTrue(taskA.isTerminated());
assertTrue(taskB.isTerminated());
}
use of org.camunda.bpm.engine.impl.cmmn.execution.CmmnActivityExecution in project camunda-bpm-platform by camunda.
the class CaseExecutionTerminationTest method testTerminateStage.
@Test
public void testTerminateStage() {
// given ///////////////////////////////////////////////////////////////
// a case definition
CmmnCaseDefinition caseDefinition = new CaseDefinitionBuilder("Case1").createActivity("X").behavior(new StageActivityBehavior()).createActivity("A").behavior(new TaskWaitState()).endActivity().createActivity("B").behavior(new TaskWaitState()).endActivity().endActivity().buildCaseDefinition();
// an active case instance
CmmnCaseInstance caseInstance = caseDefinition.createCaseInstance();
caseInstance.create();
// a case execution associated with Stage X
CmmnActivityExecution stageX = caseInstance.findCaseExecution("X");
// a case execution associated with Task A
CmmnActivityExecution taskA = caseInstance.findCaseExecution("A");
// a case execution associated with Task B
CmmnActivityExecution taskB = caseInstance.findCaseExecution("B");
// when
stageX.terminate();
// then
assertTrue(caseInstance.isCompleted());
assertTrue(stageX.isTerminated());
assertTrue(taskA.isTerminated());
assertTrue(taskB.isTerminated());
}
use of org.camunda.bpm.engine.impl.cmmn.execution.CmmnActivityExecution in project camunda-bpm-platform by camunda.
the class CaseExecutionResumeTest method testResumeStage.
@Test
public void testResumeStage() {
// given ///////////////////////////////////////////////////////////////
// a case definition
CmmnCaseDefinition caseDefinition = new CaseDefinitionBuilder("Case1").createActivity("X").behavior(new StageActivityBehavior()).createActivity("A").behavior(new TaskWaitState()).property(ItemHandler.PROPERTY_MANUAL_ACTIVATION_RULE, defaultManualActivation()).endActivity().createActivity("B").behavior(new TaskWaitState()).property(ItemHandler.PROPERTY_MANUAL_ACTIVATION_RULE, defaultManualActivation()).endActivity().endActivity().buildCaseDefinition();
// an active case instance
CmmnCaseInstance caseInstance = caseDefinition.createCaseInstance();
caseInstance.create();
// a case execution associated with Stage X
CmmnActivityExecution stageX = caseInstance.findCaseExecution("X");
stageX.suspend();
// a case execution associated with Task A
CmmnActivityExecution taskA = caseInstance.findCaseExecution("A");
assertTrue(taskA.isSuspended());
// a case execution associated with Task B
CmmnActivityExecution taskB = caseInstance.findCaseExecution("B");
assertTrue(taskB.isSuspended());
// when
stageX.resume();
// then
assertTrue(caseInstance.isActive());
assertTrue(stageX.isActive());
assertTrue(taskA.isEnabled());
assertTrue(taskB.isEnabled());
}
Aggregations