use of org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition in project camunda-bpm-platform by camunda.
the class CaseTaskPlanItemHandlerTest method testWithParent.
@Test
public void testWithParent() {
// given:
// a new activity as parent
CmmnCaseDefinition parent = new CmmnCaseDefinition("aParentActivity");
context.setParent(parent);
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
assertEquals(parent, activity.getParent());
assertTrue(parent.getActivities().contains(activity));
}
use of org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition in project camunda-bpm-platform by camunda.
the class DecisionTaskPlanItemHandlerTest method testWithParent.
@Test
public void testWithParent() {
// given
CmmnCaseDefinition parent = new CmmnCaseDefinition("aParentActivity");
context.setParent(parent);
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
assertEquals(parent, activity.getParent());
assertTrue(parent.getActivities().contains(activity));
}
use of org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition in project camunda-bpm-platform by camunda.
the class CmmnTransformerTest method testCasePlanModel.
/**
* +-----------------+ +-----------------+
* | Case1 \ | aCaseDefinition |
* +-------------------+---+ +-----------------+
* | | |
* | | ==> +-----------------+
* | | | aCasePlanModel |
* | | +-----------------+
* | |
* +-----------------------+
*/
@Test
public void testCasePlanModel() {
// given
// when
List<CaseDefinitionEntity> caseDefinitions = transform();
// then
assertEquals(1, caseDefinitions.size());
CmmnCaseDefinition caseModel = caseDefinitions.get(0);
List<CmmnActivity> activities = caseModel.getActivities();
assertEquals(1, activities.size());
CmmnActivity casePlanModelActivity = activities.get(0);
assertEquals(casePlanModel.getId(), casePlanModelActivity.getId());
assertTrue(casePlanModelActivity.getActivities().isEmpty());
}
use of org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition 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.model.CmmnCaseDefinition 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());
}
Aggregations