Search in sources :

Example 1 with MilestoneActivityBehavior

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);
}
Also used : MilestoneActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.MilestoneActivityBehavior) CmmnActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.CmmnActivityBehavior) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) Test(org.junit.Test)

Example 2 with 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);
}
Also used : MilestoneActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.MilestoneActivityBehavior) CmmnActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.CmmnActivityBehavior) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) Test(org.junit.Test)

Example 3 with 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());
}
Also used : MilestoneActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.MilestoneActivityBehavior) CmmnSentryDeclaration(org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration) CmmnActivityExecution(org.camunda.bpm.engine.impl.cmmn.execution.CmmnActivityExecution) CaseExecutionImpl(org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionImpl) CmmnCaseDefinition(org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition) CmmnCaseInstance(org.camunda.bpm.engine.impl.cmmn.execution.CmmnCaseInstance) CmmnOnPartDeclaration(org.camunda.bpm.engine.impl.cmmn.model.CmmnOnPartDeclaration) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) CaseDefinitionBuilder(org.camunda.bpm.engine.impl.cmmn.model.CaseDefinitionBuilder) Test(org.junit.Test)

Aggregations

MilestoneActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.MilestoneActivityBehavior)3 CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)3 Test (org.junit.Test)3 CmmnActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.CmmnActivityBehavior)2 CaseExecutionImpl (org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionImpl)1 CmmnActivityExecution (org.camunda.bpm.engine.impl.cmmn.execution.CmmnActivityExecution)1 CmmnCaseInstance (org.camunda.bpm.engine.impl.cmmn.execution.CmmnCaseInstance)1 CaseDefinitionBuilder (org.camunda.bpm.engine.impl.cmmn.model.CaseDefinitionBuilder)1 CmmnCaseDefinition (org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition)1 CmmnOnPartDeclaration (org.camunda.bpm.engine.impl.cmmn.model.CmmnOnPartDeclaration)1 CmmnSentryDeclaration (org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration)1