Search in sources :

Example 81 with CmmnActivity

use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity 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));
}
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) Test(org.junit.Test)

Example 82 with CmmnActivity

use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.

the class ProcessTaskPlanItemHandlerTest method testBinding.

@Test
public void testBinding() {
    // given:
    CallableElementBinding processBinding = CallableElementBinding.LATEST;
    processTask.setCamundaProcessBinding(processBinding.getValue());
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    ProcessTaskActivityBehavior behavior = (ProcessTaskActivityBehavior) activity.getActivityBehavior();
    CallableElement callableElement = behavior.getCallableElement();
    CallableElementBinding binding = callableElement.getBinding();
    assertNotNull(binding);
    assertEquals(processBinding, binding);
}
Also used : CallableElement(org.camunda.bpm.engine.impl.core.model.CallableElement) ProcessTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.ProcessTaskActivityBehavior) CallableElementBinding(org.camunda.bpm.engine.impl.core.model.BaseCallableElement.CallableElementBinding) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) Test(org.junit.Test)

Example 83 with CmmnActivity

use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.

the class ProcessTaskPlanItemHandlerTest method testInputs.

@Test
public void testInputs() {
    // given:
    ExtensionElements extensionElements = addExtensionElements(processTask);
    CamundaIn variablesElement = createElement(extensionElements, null, CamundaIn.class);
    variablesElement.setCamundaVariables("all");
    CamundaIn sourceElement = createElement(extensionElements, null, CamundaIn.class);
    sourceElement.setCamundaSource("a");
    CamundaIn sourceExpressionElement = createElement(extensionElements, null, CamundaIn.class);
    sourceExpressionElement.setCamundaSourceExpression("${b}");
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    ProcessTaskActivityBehavior behavior = (ProcessTaskActivityBehavior) activity.getActivityBehavior();
    CallableElement callableElement = behavior.getCallableElement();
    List<CallableElementParameter> inputs = callableElement.getInputs();
    assertNotNull(inputs);
    assertFalse(inputs.isEmpty());
    assertEquals(3, inputs.size());
}
Also used : CallableElement(org.camunda.bpm.engine.impl.core.model.CallableElement) ExtensionElements(org.camunda.bpm.model.cmmn.instance.ExtensionElements) CallableElementParameter(org.camunda.bpm.engine.impl.core.model.CallableElementParameter) ProcessTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.ProcessTaskActivityBehavior) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) CamundaIn(org.camunda.bpm.model.cmmn.instance.camunda.CamundaIn) Test(org.junit.Test)

Example 84 with CmmnActivity

use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity in project camunda-bpm-platform by camunda.

the class ProcessTaskPlanItemHandlerTest method testProcessRefExpression.

@Test
public void testProcessRefExpression() {
    // given:
    String processRef = "${aProcessToCall}";
    processTask.setProcess(processRef);
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    ProcessTaskActivityBehavior behavior = (ProcessTaskActivityBehavior) activity.getActivityBehavior();
    CallableElement callableElement = behavior.getCallableElement();
    ParameterValueProvider processRefValueProvider = callableElement.getDefinitionKeyValueProvider();
    assertNotNull(processRefValueProvider);
    assertTrue(processRefValueProvider instanceof ElValueProvider);
    ElValueProvider valueProvider = (ElValueProvider) processRefValueProvider;
    assertEquals(processRef, valueProvider.getExpression().getExpressionText());
}
Also used : CallableElement(org.camunda.bpm.engine.impl.core.model.CallableElement) ParameterValueProvider(org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider) ProcessTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.ProcessTaskActivityBehavior) ElValueProvider(org.camunda.bpm.engine.impl.el.ElValueProvider) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) Test(org.junit.Test)

Example 85 with CmmnActivity

use of org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity 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));
}
Also used : RepetitionRule(org.camunda.bpm.model.cmmn.instance.RepetitionRule) ConditionExpression(org.camunda.bpm.model.cmmn.instance.ConditionExpression) PlanItemControl(org.camunda.bpm.model.cmmn.instance.PlanItemControl) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) Test(org.junit.Test)

Aggregations

CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)325 Test (org.junit.Test)298 ConditionExpression (org.camunda.bpm.model.cmmn.instance.ConditionExpression)112 PlanItemControl (org.camunda.bpm.model.cmmn.instance.PlanItemControl)64 CaseControlRule (org.camunda.bpm.engine.impl.cmmn.CaseControlRule)47 CmmnSentryDeclaration (org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration)47 ExtensionElements (org.camunda.bpm.model.cmmn.instance.ExtensionElements)39 Sentry (org.camunda.bpm.model.cmmn.instance.Sentry)39 IfPart (org.camunda.bpm.model.cmmn.instance.IfPart)37 CasePlanModelHandler (org.camunda.bpm.engine.impl.cmmn.handler.CasePlanModelHandler)36 SentryHandler (org.camunda.bpm.engine.impl.cmmn.handler.SentryHandler)35 CallableElement (org.camunda.bpm.engine.impl.core.model.CallableElement)34 ItemControl (org.camunda.bpm.model.cmmn.instance.ItemControl)32 HumanTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.HumanTaskActivityBehavior)29 RepetitionRule (org.camunda.bpm.model.cmmn.instance.RepetitionRule)28 ParameterValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider)26 TaskDefinition (org.camunda.bpm.engine.impl.task.TaskDefinition)23 Body (org.camunda.bpm.model.cmmn.instance.Body)23 EntryCriterion (org.camunda.bpm.model.cmmn.instance.EntryCriterion)21 ExitCriterion (org.camunda.bpm.model.cmmn.instance.ExitCriterion)21