Search in sources :

Example 16 with ParameterValueProvider

use of org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider in project camunda-bpm-platform by camunda.

the class CaseTaskPlanItemHandlerTest method testInputSource.

@Test
public void testInputSource() {
    // given:
    String source = "a";
    ExtensionElements extensionElements = addExtensionElements(caseTask);
    CamundaIn sourceElement = createElement(extensionElements, null, CamundaIn.class);
    sourceElement.setCamundaSource(source);
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    CaseTaskActivityBehavior behavior = (CaseTaskActivityBehavior) activity.getActivityBehavior();
    CallableElement callableElement = behavior.getCallableElement();
    CallableElementParameter parameter = callableElement.getInputs().get(0);
    assertNotNull(parameter);
    assertFalse(parameter.isAllVariables());
    ParameterValueProvider sourceValueProvider = parameter.getSourceValueProvider();
    assertNotNull(sourceValueProvider);
    assertTrue(sourceValueProvider instanceof ConstantValueProvider);
    assertEquals(source, sourceValueProvider.getValue(null));
}
Also used : CallableElement(org.camunda.bpm.engine.impl.core.model.CallableElement) ExtensionElements(org.camunda.bpm.model.cmmn.instance.ExtensionElements) ParameterValueProvider(org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider) CallableElementParameter(org.camunda.bpm.engine.impl.core.model.CallableElementParameter) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) ConstantValueProvider(org.camunda.bpm.engine.impl.core.variable.mapping.value.ConstantValueProvider) CamundaIn(org.camunda.bpm.model.cmmn.instance.camunda.CamundaIn) CaseTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.CaseTaskActivityBehavior) Test(org.junit.Test)

Example 17 with ParameterValueProvider

use of org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider in project camunda-bpm-platform by camunda.

the class CaseTaskPlanItemHandlerTest method testBusinessKeyExpression.

@Test
public void testBusinessKeyExpression() {
    // given:
    String businessKey = "${myBusinessKey}";
    ExtensionElements extensionElements = addExtensionElements(caseTask);
    CamundaIn businessKeyElement = createElement(extensionElements, null, CamundaIn.class);
    businessKeyElement.setCamundaBusinessKey(businessKey);
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    CaseTaskActivityBehavior behavior = (CaseTaskActivityBehavior) activity.getActivityBehavior();
    CallableElement callableElement = behavior.getCallableElement();
    ParameterValueProvider businessKeyValueProvider = callableElement.getBusinessKeyValueProvider();
    assertNotNull(businessKeyValueProvider);
    assertTrue(businessKeyValueProvider instanceof ElValueProvider);
    ElValueProvider valueProvider = (ElValueProvider) businessKeyValueProvider;
    assertEquals(businessKey, valueProvider.getExpression().getExpressionText());
}
Also used : CallableElement(org.camunda.bpm.engine.impl.core.model.CallableElement) ExtensionElements(org.camunda.bpm.model.cmmn.instance.ExtensionElements) ParameterValueProvider(org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider) ElValueProvider(org.camunda.bpm.engine.impl.el.ElValueProvider) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) CamundaIn(org.camunda.bpm.model.cmmn.instance.camunda.CamundaIn) CaseTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.CaseTaskActivityBehavior) Test(org.junit.Test)

Example 18 with ParameterValueProvider

use of org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider in project camunda-bpm-platform by camunda.

the class CaseTaskPlanItemHandlerTest method testBusinessKeyConstant.

@Test
public void testBusinessKeyConstant() {
    // given:
    String businessKey = "myBusinessKey";
    ExtensionElements extensionElements = addExtensionElements(caseTask);
    CamundaIn businessKeyElement = createElement(extensionElements, null, CamundaIn.class);
    businessKeyElement.setCamundaBusinessKey(businessKey);
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    CaseTaskActivityBehavior behavior = (CaseTaskActivityBehavior) activity.getActivityBehavior();
    CallableElement callableElement = behavior.getCallableElement();
    ParameterValueProvider businessKeyValueProvider = callableElement.getBusinessKeyValueProvider();
    assertNotNull(businessKeyValueProvider);
    assertTrue(businessKeyValueProvider instanceof ConstantValueProvider);
    assertEquals(businessKey, businessKeyValueProvider.getValue(null));
}
Also used : CallableElement(org.camunda.bpm.engine.impl.core.model.CallableElement) ExtensionElements(org.camunda.bpm.model.cmmn.instance.ExtensionElements) ParameterValueProvider(org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) ConstantValueProvider(org.camunda.bpm.engine.impl.core.variable.mapping.value.ConstantValueProvider) CamundaIn(org.camunda.bpm.model.cmmn.instance.camunda.CamundaIn) CaseTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.CaseTaskActivityBehavior) Test(org.junit.Test)

Example 19 with ParameterValueProvider

use of org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider in project camunda-bpm-platform by camunda.

the class DecisionTaskPlanItemHandlerTest method testVersionConstant.

@Test
public void testVersionConstant() {
    // given:
    String caseVersion = "2";
    decisionTask.setCamundaDecisionVersion(caseVersion);
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    DecisionTaskActivityBehavior behavior = (DecisionTaskActivityBehavior) activity.getActivityBehavior();
    BaseCallableElement callableElement = behavior.getCallableElement();
    ParameterValueProvider caseVersionValueProvider = callableElement.getVersionValueProvider();
    assertNotNull(caseVersionValueProvider);
    assertTrue(caseVersionValueProvider instanceof ConstantValueProvider);
    assertEquals(caseVersion, caseVersionValueProvider.getValue(null));
}
Also used : ParameterValueProvider(org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider) DecisionTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.DecisionTaskActivityBehavior) DmnDecisionTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.DmnDecisionTaskActivityBehavior) BaseCallableElement(org.camunda.bpm.engine.impl.core.model.BaseCallableElement) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) ConstantValueProvider(org.camunda.bpm.engine.impl.core.variable.mapping.value.ConstantValueProvider) Test(org.junit.Test)

Example 20 with ParameterValueProvider

use of org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider in project camunda-bpm-platform by camunda.

the class DecisionTaskPlanItemHandlerTest method testConstantDecisionRefExpression.

@Test
public void testConstantDecisionRefExpression() {
    // given:
    String decision = "aDecisionToCall";
    DecisionRefExpression decisionRefExpression = createElement(decisionTask, DecisionRefExpression.class);
    decisionRefExpression.setText(decision);
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    DecisionTaskActivityBehavior behavior = (DecisionTaskActivityBehavior) activity.getActivityBehavior();
    BaseCallableElement callableElement = behavior.getCallableElement();
    ParameterValueProvider decisionRefValueProvider = callableElement.getDefinitionKeyValueProvider();
    assertNotNull(decisionRefValueProvider);
    assertTrue(decisionRefValueProvider instanceof ConstantValueProvider);
    ConstantValueProvider valueProvider = (ConstantValueProvider) decisionRefValueProvider;
    assertEquals(decision, valueProvider.getValue(null));
}
Also used : ParameterValueProvider(org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider) DecisionTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.DecisionTaskActivityBehavior) DmnDecisionTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.DmnDecisionTaskActivityBehavior) BaseCallableElement(org.camunda.bpm.engine.impl.core.model.BaseCallableElement) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) ConstantValueProvider(org.camunda.bpm.engine.impl.core.variable.mapping.value.ConstantValueProvider) DecisionRefExpression(org.camunda.bpm.model.cmmn.instance.DecisionRefExpression) Test(org.junit.Test)

Aggregations

ParameterValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider)42 CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)26 Test (org.junit.Test)26 CallableElement (org.camunda.bpm.engine.impl.core.model.CallableElement)20 ConstantValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.ConstantValueProvider)14 ElValueProvider (org.camunda.bpm.engine.impl.el.ElValueProvider)14 ExtensionElements (org.camunda.bpm.model.cmmn.instance.ExtensionElements)12 CaseTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.CaseTaskActivityBehavior)10 ProcessTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.ProcessTaskActivityBehavior)10 CallableElementParameter (org.camunda.bpm.engine.impl.core.model.CallableElementParameter)10 CamundaIn (org.camunda.bpm.model.cmmn.instance.camunda.CamundaIn)9 DecisionTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.DecisionTaskActivityBehavior)6 DmnDecisionTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.DmnDecisionTaskActivityBehavior)6 BaseCallableElement (org.camunda.bpm.engine.impl.core.model.BaseCallableElement)6 ExpressionManager (org.camunda.bpm.engine.impl.el.ExpressionManager)5 CamundaOut (org.camunda.bpm.model.cmmn.instance.camunda.CamundaOut)5 BpmnParseException (org.camunda.bpm.engine.BpmnParseException)3 NullValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.NullValueProvider)2 Element (org.camunda.bpm.engine.impl.util.xml.Element)2 DecisionRefExpression (org.camunda.bpm.model.cmmn.instance.DecisionRefExpression)2