use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.
the class MilestonePlanItemHandlerTest method testMilestoneActivityName.
@Test
public void testMilestoneActivityName() {
// given:
// the Milestone has a name "A Milestone"
String name = "A Milestone";
milestone.setName(name);
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
assertEquals(name, activity.getName());
}
use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.
the class MilestonePlanItemHandlerTest method testMilestoneDescription.
@Test
public void testMilestoneDescription() {
// given
String description = "This is a milestone";
milestone.setDescription(description);
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
assertEquals(description, activity.getProperty(PROPERTY_ACTIVITY_DESCRIPTION));
}
use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.
the class MilestonePlanItemHandlerTest 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);
conditionExpression.setText("${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));
}
use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.
the class ProcessTaskPlanItemHandlerTest method testOutputSourceExpression.
@Test
public void testOutputSourceExpression() {
// given:
String source = "${a}";
ExtensionElements extensionElements = addExtensionElements(processTask);
CamundaOut sourceElement = createElement(extensionElements, null, CamundaOut.class);
sourceElement.setCamundaSourceExpression(source);
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
ProcessTaskActivityBehavior behavior = (ProcessTaskActivityBehavior) activity.getActivityBehavior();
CallableElement callableElement = behavior.getCallableElement();
CallableElementParameter parameter = callableElement.getOutputs().get(0);
assertNotNull(parameter);
assertFalse(parameter.isAllVariables());
ParameterValueProvider sourceExpressionValueProvider = parameter.getSourceValueProvider();
assertNotNull(sourceExpressionValueProvider);
assertTrue(sourceExpressionValueProvider instanceof ElValueProvider);
ElValueProvider valueProvider = (ElValueProvider) sourceExpressionValueProvider;
assertEquals(source, valueProvider.getExpression().getExpressionText());
}
use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.
the class ProcessTaskPlanItemHandlerTest 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));
}
Aggregations