Search in sources :

Example 11 with Body

use of org.camunda.bpm.model.cmmn.instance.Body in project camunda-bpm-platform by camunda.

the class CaseTaskPlanItemHandlerTest method testMultipleEntryCriteria.

@Test
public void testMultipleEntryCriteria() {
    // given
    // create first sentry containing ifPart
    Sentry sentry1 = createElement(casePlanModel, "Sentry_1", Sentry.class);
    IfPart ifPart1 = createElement(sentry1, "abc", IfPart.class);
    ConditionExpression conditionExpression1 = createElement(ifPart1, "def", ConditionExpression.class);
    Body body1 = createElement(conditionExpression1, null, Body.class);
    body1.setTextContent("${test}");
    // set first entryCriteria
    EntryCriterion criterion1 = createElement(planItem, EntryCriterion.class);
    criterion1.setSentry(sentry1);
    // create first sentry containing ifPart
    Sentry sentry2 = createElement(casePlanModel, "Sentry_2", Sentry.class);
    IfPart ifPart2 = createElement(sentry2, "ghi", IfPart.class);
    ConditionExpression conditionExpression2 = createElement(ifPart2, "jkl", ConditionExpression.class);
    Body body2 = createElement(conditionExpression2, null, Body.class);
    body2.setTextContent("${test}");
    // set second entryCriteria
    EntryCriterion criterion2 = createElement(planItem, EntryCriterion.class);
    criterion2.setSentry(sentry2);
    // transform casePlanModel as parent
    CmmnActivity parent = new CasePlanModelHandler().handleElement(casePlanModel, context);
    context.setParent(parent);
    // transform Sentry
    CmmnSentryDeclaration firstSentryDeclaration = new SentryHandler().handleElement(sentry1, context);
    CmmnSentryDeclaration secondSentryDeclaration = new SentryHandler().handleElement(sentry2, context);
    // when
    CmmnActivity newActivity = handler.handleElement(planItem, context);
    // then
    assertTrue(newActivity.getExitCriteria().isEmpty());
    assertFalse(newActivity.getEntryCriteria().isEmpty());
    assertEquals(2, newActivity.getEntryCriteria().size());
    assertTrue(newActivity.getEntryCriteria().contains(firstSentryDeclaration));
    assertTrue(newActivity.getEntryCriteria().contains(secondSentryDeclaration));
}
Also used : CmmnSentryDeclaration(org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration) SentryHandler(org.camunda.bpm.engine.impl.cmmn.handler.SentryHandler) IfPart(org.camunda.bpm.model.cmmn.instance.IfPart) CasePlanModelHandler(org.camunda.bpm.engine.impl.cmmn.handler.CasePlanModelHandler) ConditionExpression(org.camunda.bpm.model.cmmn.instance.ConditionExpression) Sentry(org.camunda.bpm.model.cmmn.instance.Sentry) EntryCriterion(org.camunda.bpm.model.cmmn.instance.EntryCriterion) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) Body(org.camunda.bpm.model.cmmn.instance.Body) Test(org.junit.Test)

Example 12 with Body

use of org.camunda.bpm.model.cmmn.instance.Body in project camunda-bpm-platform by camunda.

the class DecisionTaskPlanItemHandlerTest method testExitCriteria.

@Test
public void testExitCriteria() {
    // given
    // create sentry containing ifPart
    Sentry sentry = createElement(casePlanModel, "Sentry_1", Sentry.class);
    IfPart ifPart = createElement(sentry, "abc", IfPart.class);
    ConditionExpression conditionExpression = createElement(ifPart, "def", ConditionExpression.class);
    Body body = createElement(conditionExpression, null, Body.class);
    body.setTextContent("${test}");
    // set exitCriteria
    ExitCriterion criterion = createElement(planItem, ExitCriterion.class);
    criterion.setSentry(sentry);
    // transform casePlanModel as parent
    CmmnActivity parent = new CasePlanModelHandler().handleElement(casePlanModel, context);
    context.setParent(parent);
    // transform Sentry
    CmmnSentryDeclaration sentryDeclaration = new SentryHandler().handleElement(sentry, context);
    // when
    CmmnActivity newActivity = handler.handleElement(planItem, context);
    // then
    assertTrue(newActivity.getEntryCriteria().isEmpty());
    assertFalse(newActivity.getExitCriteria().isEmpty());
    assertEquals(1, newActivity.getExitCriteria().size());
    assertEquals(sentryDeclaration, newActivity.getExitCriteria().get(0));
}
Also used : CmmnSentryDeclaration(org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration) SentryHandler(org.camunda.bpm.engine.impl.cmmn.handler.SentryHandler) IfPart(org.camunda.bpm.model.cmmn.instance.IfPart) CasePlanModelHandler(org.camunda.bpm.engine.impl.cmmn.handler.CasePlanModelHandler) ConditionExpression(org.camunda.bpm.model.cmmn.instance.ConditionExpression) Sentry(org.camunda.bpm.model.cmmn.instance.Sentry) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) ExitCriterion(org.camunda.bpm.model.cmmn.instance.ExitCriterion) Body(org.camunda.bpm.model.cmmn.instance.Body) Test(org.junit.Test)

Example 13 with Body

use of org.camunda.bpm.model.cmmn.instance.Body in project camunda-bpm-platform by camunda.

the class DecisionTaskPlanItemHandlerTest method testMultipleEntryCriteria.

@Test
public void testMultipleEntryCriteria() {
    // given
    // create first sentry containing ifPart
    Sentry sentry1 = createElement(casePlanModel, "Sentry_1", Sentry.class);
    IfPart ifPart1 = createElement(sentry1, "abc", IfPart.class);
    ConditionExpression conditionExpression1 = createElement(ifPart1, "def", ConditionExpression.class);
    Body body1 = createElement(conditionExpression1, null, Body.class);
    body1.setTextContent("${test}");
    // set first entryCriteria
    EntryCriterion criterion1 = createElement(planItem, EntryCriterion.class);
    criterion1.setSentry(sentry1);
    // create first sentry containing ifPart
    Sentry sentry2 = createElement(casePlanModel, "Sentry_2", Sentry.class);
    IfPart ifPart2 = createElement(sentry2, "ghi", IfPart.class);
    ConditionExpression conditionExpression2 = createElement(ifPart2, "jkl", ConditionExpression.class);
    Body body2 = createElement(conditionExpression2, null, Body.class);
    body2.setTextContent("${test}");
    // set second entryCriteria
    EntryCriterion criterion2 = createElement(planItem, EntryCriterion.class);
    criterion2.setSentry(sentry2);
    // transform casePlanModel as parent
    CmmnActivity parent = new CasePlanModelHandler().handleElement(casePlanModel, context);
    context.setParent(parent);
    // transform Sentry
    CmmnSentryDeclaration firstSentryDeclaration = new SentryHandler().handleElement(sentry1, context);
    CmmnSentryDeclaration secondSentryDeclaration = new SentryHandler().handleElement(sentry2, context);
    // when
    CmmnActivity newActivity = handler.handleElement(planItem, context);
    // then
    assertTrue(newActivity.getExitCriteria().isEmpty());
    assertFalse(newActivity.getEntryCriteria().isEmpty());
    assertEquals(2, newActivity.getEntryCriteria().size());
    assertTrue(newActivity.getEntryCriteria().contains(firstSentryDeclaration));
    assertTrue(newActivity.getEntryCriteria().contains(secondSentryDeclaration));
}
Also used : CmmnSentryDeclaration(org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration) SentryHandler(org.camunda.bpm.engine.impl.cmmn.handler.SentryHandler) IfPart(org.camunda.bpm.model.cmmn.instance.IfPart) CasePlanModelHandler(org.camunda.bpm.engine.impl.cmmn.handler.CasePlanModelHandler) ConditionExpression(org.camunda.bpm.model.cmmn.instance.ConditionExpression) Sentry(org.camunda.bpm.model.cmmn.instance.Sentry) EntryCriterion(org.camunda.bpm.model.cmmn.instance.EntryCriterion) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) Body(org.camunda.bpm.model.cmmn.instance.Body) Test(org.junit.Test)

Example 14 with Body

use of org.camunda.bpm.model.cmmn.instance.Body in project camunda-bpm-platform by camunda.

the class DecisionTaskPlanItemHandlerTest method testEntryCriteria.

@Test
public void testEntryCriteria() {
    // given
    // create sentry containing ifPart
    Sentry sentry = createElement(casePlanModel, "Sentry_1", Sentry.class);
    IfPart ifPart = createElement(sentry, "abc", IfPart.class);
    ConditionExpression conditionExpression = createElement(ifPart, "def", ConditionExpression.class);
    Body body = createElement(conditionExpression, null, Body.class);
    body.setTextContent("${test}");
    // set entryCriteria
    EntryCriterion criterion = createElement(planItem, EntryCriterion.class);
    criterion.setSentry(sentry);
    // transform casePlanModel as parent
    CmmnActivity parent = new CasePlanModelHandler().handleElement(casePlanModel, context);
    context.setParent(parent);
    // transform Sentry
    CmmnSentryDeclaration sentryDeclaration = new SentryHandler().handleElement(sentry, context);
    // when
    CmmnActivity newActivity = handler.handleElement(planItem, context);
    // then
    assertTrue(newActivity.getExitCriteria().isEmpty());
    assertFalse(newActivity.getEntryCriteria().isEmpty());
    assertEquals(1, newActivity.getEntryCriteria().size());
    assertEquals(sentryDeclaration, newActivity.getEntryCriteria().get(0));
}
Also used : CmmnSentryDeclaration(org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration) SentryHandler(org.camunda.bpm.engine.impl.cmmn.handler.SentryHandler) IfPart(org.camunda.bpm.model.cmmn.instance.IfPart) CasePlanModelHandler(org.camunda.bpm.engine.impl.cmmn.handler.CasePlanModelHandler) ConditionExpression(org.camunda.bpm.model.cmmn.instance.ConditionExpression) Sentry(org.camunda.bpm.model.cmmn.instance.Sentry) EntryCriterion(org.camunda.bpm.model.cmmn.instance.EntryCriterion) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) Body(org.camunda.bpm.model.cmmn.instance.Body) Test(org.junit.Test)

Example 15 with Body

use of org.camunda.bpm.model.cmmn.instance.Body in project camunda-bpm-platform by camunda.

the class DecisionTaskPlanItemHandlerTest method testEntryCriteriaAndExitCriteria.

@Test
public void testEntryCriteriaAndExitCriteria() {
    // given
    // create sentry containing ifPart
    Sentry sentry = createElement(casePlanModel, "Sentry_1", Sentry.class);
    IfPart ifPart = createElement(sentry, "abc", IfPart.class);
    ConditionExpression conditionExpression = createElement(ifPart, "def", ConditionExpression.class);
    Body body = createElement(conditionExpression, null, Body.class);
    body.setTextContent("${test}");
    // set entry-/exitCriteria
    EntryCriterion criterion1 = createElement(planItem, EntryCriterion.class);
    criterion1.setSentry(sentry);
    ExitCriterion criterion2 = createElement(planItem, ExitCriterion.class);
    criterion2.setSentry(sentry);
    // transform casePlanModel as parent
    CmmnActivity parent = new CasePlanModelHandler().handleElement(casePlanModel, context);
    context.setParent(parent);
    // transform Sentry
    CmmnSentryDeclaration sentryDeclaration = new SentryHandler().handleElement(sentry, context);
    // when
    CmmnActivity newActivity = handler.handleElement(planItem, context);
    // then
    assertFalse(newActivity.getExitCriteria().isEmpty());
    assertEquals(1, newActivity.getExitCriteria().size());
    assertEquals(sentryDeclaration, newActivity.getExitCriteria().get(0));
    assertFalse(newActivity.getEntryCriteria().isEmpty());
    assertEquals(1, newActivity.getEntryCriteria().size());
    assertEquals(sentryDeclaration, newActivity.getEntryCriteria().get(0));
}
Also used : CmmnSentryDeclaration(org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration) SentryHandler(org.camunda.bpm.engine.impl.cmmn.handler.SentryHandler) IfPart(org.camunda.bpm.model.cmmn.instance.IfPart) CasePlanModelHandler(org.camunda.bpm.engine.impl.cmmn.handler.CasePlanModelHandler) ConditionExpression(org.camunda.bpm.model.cmmn.instance.ConditionExpression) Sentry(org.camunda.bpm.model.cmmn.instance.Sentry) EntryCriterion(org.camunda.bpm.model.cmmn.instance.EntryCriterion) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) ExitCriterion(org.camunda.bpm.model.cmmn.instance.ExitCriterion) Body(org.camunda.bpm.model.cmmn.instance.Body) Test(org.junit.Test)

Aggregations

Body (org.camunda.bpm.model.cmmn.instance.Body)26 CmmnSentryDeclaration (org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration)25 ConditionExpression (org.camunda.bpm.model.cmmn.instance.ConditionExpression)25 IfPart (org.camunda.bpm.model.cmmn.instance.IfPart)25 Test (org.junit.Test)25 CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)23 Sentry (org.camunda.bpm.model.cmmn.instance.Sentry)23 CasePlanModelHandler (org.camunda.bpm.engine.impl.cmmn.handler.CasePlanModelHandler)22 SentryHandler (org.camunda.bpm.engine.impl.cmmn.handler.SentryHandler)22 ExitCriterion (org.camunda.bpm.model.cmmn.instance.ExitCriterion)14 EntryCriterion (org.camunda.bpm.model.cmmn.instance.EntryCriterion)12 Expression (org.camunda.bpm.engine.delegate.Expression)2 CmmnIfPartDeclaration (org.camunda.bpm.engine.impl.cmmn.model.CmmnIfPartDeclaration)2 CmmnOnPartDeclaration (org.camunda.bpm.engine.impl.cmmn.model.CmmnOnPartDeclaration)1 ModelTypeInstanceContext (org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)1 ModelElementTypeBuilder (org.camunda.bpm.model.xml.type.ModelElementTypeBuilder)1