use of org.camunda.bpm.engine.impl.cmmn.behavior.MilestoneActivityBehavior in project camunda-bpm-platform by camunda.
the class MilestoneDiscretionaryItemHandlerTest method testActivityBehavior.
@Test
public void testActivityBehavior() {
// given: a planItem
// when
CmmnActivity activity = handler.handleElement(discretionaryItem, context);
// then
CmmnActivityBehavior behavior = activity.getActivityBehavior();
assertTrue(behavior instanceof MilestoneActivityBehavior);
}
use of org.camunda.bpm.engine.impl.cmmn.behavior.MilestoneActivityBehavior in project camunda-bpm-platform by camunda.
the class MilestonePlanItemHandlerTest method testActivityBehavior.
@Test
public void testActivityBehavior() {
// given: a planItem
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
CmmnActivityBehavior behavior = activity.getActivityBehavior();
assertTrue(behavior instanceof MilestoneActivityBehavior);
}
use of org.camunda.bpm.engine.impl.cmmn.behavior.MilestoneActivityBehavior in project camunda-bpm-platform by camunda.
the class CaseExecutionOccurTest method testOccurMilestone.
@Test
public void testOccurMilestone() {
// given
// a case definition
CmmnCaseDefinition caseDefinition = new CaseDefinitionBuilder("Case1").createActivity("A").behavior(new MilestoneActivityBehavior()).endActivity().buildCaseDefinition();
CmmnActivity activity = caseDefinition.findActivity("A");
// a pseudo sentry
CmmnSentryDeclaration sentryDeclaration = new CmmnSentryDeclaration("X");
caseDefinition.findActivity("Case1").addSentry(sentryDeclaration);
activity.addEntryCriteria(sentryDeclaration);
CmmnOnPartDeclaration onPartDeclaration = new CmmnOnPartDeclaration();
onPartDeclaration.setSource(new CmmnActivity("B", caseDefinition));
onPartDeclaration.setStandardEvent("complete");
sentryDeclaration.addOnPart(onPartDeclaration);
// an active case instance
CmmnCaseInstance caseInstance = caseDefinition.createCaseInstance();
caseInstance.create();
// task A as a child of the case instance
CmmnActivityExecution milestoneA = caseInstance.findCaseExecution("A");
// when
// completing
milestoneA.occur();
// then
// task A is completed ...
assertTrue(milestoneA.isCompleted());
// ... and the case instance is also completed
assertTrue(caseInstance.isCompleted());
// task A is not part of the case instance anymore
assertNull(caseInstance.findCaseExecution("A"));
// the case instance has no children
assertTrue(((CaseExecutionImpl) caseInstance).getCaseExecutions().isEmpty());
}
Aggregations