use of org.camunda.bpm.model.cmmn.instance.ConditionExpression in project camunda-bpm-platform by camunda.
the class ProcessTaskPlanItemHandlerTest method testRepetitionRuleStandardEvents.
@Test
public void testRepetitionRuleStandardEvents() {
// given
ItemControl itemControl = createElement(planItem, "ItemControl_1", ItemControl.class);
RepetitionRule repetitionRule = createElement(itemControl, "RepititionRule_1", RepetitionRule.class);
ConditionExpression expression = createElement(repetitionRule, "Expression_1", ConditionExpression.class);
expression.setText("${true}");
Cmmn.validateModel(modelInstance);
// when
CmmnActivity newActivity = handler.handleElement(planItem, context);
// then
List<String> events = newActivity.getProperties().get(CmmnProperties.REPEAT_ON_STANDARD_EVENTS);
assertNotNull(events);
assertEquals(2, events.size());
assertTrue(events.contains(CaseExecutionListener.COMPLETE));
assertTrue(events.contains(CaseExecutionListener.TERMINATE));
}
use of org.camunda.bpm.model.cmmn.instance.ConditionExpression in project camunda-bpm-platform by camunda.
the class ProcessTaskPlanItemHandlerTest 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);
conditionExpression.setText("${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));
}
use of org.camunda.bpm.model.cmmn.instance.ConditionExpression in project camunda-bpm-platform by camunda.
the class ProcessTaskPlanItemHandlerTest method testRepetitionRuleCustomStandardEventsByDefaultPlanItemControl.
@Test
public void testRepetitionRuleCustomStandardEventsByDefaultPlanItemControl() {
// given
PlanItemControl defaultControl = createElement(processTask, "DefaultControl_1", DefaultControl.class);
RepetitionRule repetitionRule = createElement(defaultControl, "RepititionRule_1", RepetitionRule.class);
ConditionExpression expression = createElement(repetitionRule, "Expression_1", ConditionExpression.class);
expression.setText("${true}");
repetitionRule.setCamundaRepeatOnStandardEvent(CaseExecutionListener.DISABLE);
Cmmn.validateModel(modelInstance);
// when
CmmnActivity newActivity = handler.handleElement(planItem, context);
// then
List<String> events = newActivity.getProperties().get(CmmnProperties.REPEAT_ON_STANDARD_EVENTS);
assertNotNull(events);
assertEquals(1, events.size());
assertTrue(events.contains(CaseExecutionListener.DISABLE));
}
use of org.camunda.bpm.model.cmmn.instance.ConditionExpression in project camunda-bpm-platform by camunda.
the class ProcessTaskPlanItemHandlerTest method testManualActivationRule.
@Test
public void testManualActivationRule() {
// given
ItemControl itemControl = createElement(planItem, "ItemControl_1", ItemControl.class);
ManualActivationRule manualActivationRule = createElement(itemControl, "ManualActivationRule_1", ManualActivationRule.class);
ConditionExpression expression = createElement(manualActivationRule, "Expression_1", ConditionExpression.class);
expression.setText("${true}");
Cmmn.validateModel(modelInstance);
// when
CmmnActivity newActivity = handler.handleElement(planItem, context);
// then
Object rule = newActivity.getProperty(PROPERTY_MANUAL_ACTIVATION_RULE);
assertNotNull(rule);
assertTrue(rule instanceof CaseControlRule);
}
use of org.camunda.bpm.model.cmmn.instance.ConditionExpression in project camunda-bpm-platform by camunda.
the class StageDiscretionaryItemHandlerTest method testRequiredRuleByDefaultPlanItemControl.
@Test
public void testRequiredRuleByDefaultPlanItemControl() {
// given
PlanItemControl defaultControl = createElement(stage, "ItemControl_1", DefaultControl.class);
RequiredRule requiredRule = createElement(defaultControl, "RequiredRule_1", RequiredRule.class);
ConditionExpression expression = createElement(requiredRule, "Expression_1", ConditionExpression.class);
expression.setText("${true}");
Cmmn.validateModel(modelInstance);
// when
CmmnActivity newActivity = handler.handleElement(discretionaryItem, context);
// then
Object rule = newActivity.getProperty(PROPERTY_REQUIRED_RULE);
assertNotNull(rule);
assertTrue(rule instanceof CaseControlRule);
}
Aggregations