Search in sources :

Example 1 with ElValueProvider

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

Example 2 with ElValueProvider

use of org.camunda.bpm.engine.impl.el.ElValueProvider in project camunda-bpm-platform by camunda.

the class ProcessTaskPlanItemHandlerTest method testInputSourceExpression.

@Test
public void testInputSourceExpression() {
    // given:
    String source = "${a}";
    ExtensionElements extensionElements = addExtensionElements(processTask);
    CamundaIn sourceElement = createElement(extensionElements, null, CamundaIn.class);
    sourceElement.setCamundaSourceExpression(source);
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    ProcessTaskActivityBehavior behavior = (ProcessTaskActivityBehavior) activity.getActivityBehavior();
    CallableElement callableElement = behavior.getCallableElement();
    CallableElementParameter parameter = callableElement.getInputs().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());
}
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) 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) CamundaIn(org.camunda.bpm.model.cmmn.instance.camunda.CamundaIn) Test(org.junit.Test)

Example 3 with ElValueProvider

use of org.camunda.bpm.engine.impl.el.ElValueProvider 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 4 with ElValueProvider

use of org.camunda.bpm.engine.impl.el.ElValueProvider in project camunda-bpm-platform by camunda.

the class CaseTaskPlanItemHandlerTest method testOutputSourceExpression.

@Test
public void testOutputSourceExpression() {
    // given:
    String source = "${a}";
    ExtensionElements extensionElements = addExtensionElements(caseTask);
    CamundaOut sourceElement = createElement(extensionElements, null, CamundaOut.class);
    sourceElement.setCamundaSourceExpression(source);
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    CaseTaskActivityBehavior behavior = (CaseTaskActivityBehavior) 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());
}
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) ElValueProvider(org.camunda.bpm.engine.impl.el.ElValueProvider) CamundaOut(org.camunda.bpm.model.cmmn.instance.camunda.CamundaOut) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) CaseTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.CaseTaskActivityBehavior) Test(org.junit.Test)

Example 5 with ElValueProvider

use of org.camunda.bpm.engine.impl.el.ElValueProvider 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)

Aggregations

ParameterValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider)14 ElValueProvider (org.camunda.bpm.engine.impl.el.ElValueProvider)14 CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)13 Test (org.junit.Test)13 CallableElement (org.camunda.bpm.engine.impl.core.model.CallableElement)10 ExtensionElements (org.camunda.bpm.model.cmmn.instance.ExtensionElements)6 CaseTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.CaseTaskActivityBehavior)5 ProcessTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.ProcessTaskActivityBehavior)5 CallableElementParameter (org.camunda.bpm.engine.impl.core.model.CallableElementParameter)4 CamundaIn (org.camunda.bpm.model.cmmn.instance.camunda.CamundaIn)4 DecisionTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.DecisionTaskActivityBehavior)3 DmnDecisionTaskActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.DmnDecisionTaskActivityBehavior)3 BaseCallableElement (org.camunda.bpm.engine.impl.core.model.BaseCallableElement)3 CamundaOut (org.camunda.bpm.model.cmmn.instance.camunda.CamundaOut)2 ArrayList (java.util.ArrayList)1 TreeMap (java.util.TreeMap)1 BpmnParseException (org.camunda.bpm.engine.BpmnParseException)1 ListValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.ListValueProvider)1 MapValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.MapValueProvider)1 NullValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.NullValueProvider)1