use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.
the class HumanTaskPlanItemHandlerTest 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));
}
use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.
the class HumanTaskPlanItemHandlerTest method testRepetitionRuleStandardEventsByDefaultPlanItemControl.
@Test
public void testRepetitionRuleStandardEventsByDefaultPlanItemControl() {
// given
PlanItemControl defaultControl = createElement(humanTask, "DefaultControl_1", DefaultControl.class);
RepetitionRule repetitionRule = createElement(defaultControl, "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.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.
the class HumanTaskPlanItemHandlerTest method testTaskDefinitionPriorityExpression.
@Test
public void testTaskDefinitionPriorityExpression() {
// given
String aPriority = "aPriority";
humanTask.setCamundaPriority(aPriority);
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
HumanTaskActivityBehavior behavior = (HumanTaskActivityBehavior) activity.getActivityBehavior();
TaskDefinition taskDefinition = behavior.getTaskDefinition();
Expression priorityExpression = taskDefinition.getPriorityExpression();
assertNotNull(priorityExpression);
assertEquals(aPriority, priorityExpression.getExpressionText());
}
use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.
the class HumanTaskPlanItemHandlerTest method testIsBlockingEqualsFalseProperty.
@Test
public void testIsBlockingEqualsFalseProperty() {
// given:
// a humanTask with isBlocking = false
humanTask.setIsBlocking(false);
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
// According to the specification:
// When a HumanTask is not 'blocking'
// (isBlocking is 'false'), it can be
// considered a 'manual' Task, i.e.,
// the Case management system is not
// tracking the lifecycle of the HumanTask (instance).
assertNull(activity);
}
use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.
the class HumanTaskPlanItemHandlerTest method testTaskDefinitionFollowUpDateExpression.
@Test
public void testTaskDefinitionFollowUpDateExpression() {
// given
String aFollowUpDate = "aFollowDate";
humanTask.setCamundaFollowUpDate(aFollowUpDate);
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
HumanTaskActivityBehavior behavior = (HumanTaskActivityBehavior) activity.getActivityBehavior();
TaskDefinition taskDefinition = behavior.getTaskDefinition();
Expression followUpDateExpression = taskDefinition.getFollowUpDateExpression();
assertNotNull(followUpDateExpression);
assertEquals(aFollowUpDate, followUpDateExpression.getExpressionText());
}
Aggregations