Search in sources :

Example 11 with ConstantValueProvider

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

the class ProcessTaskPlanItemHandlerTest method testProcessRefConstant.

@Test
public void testProcessRefConstant() {
    // 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 ConstantValueProvider);
    ConstantValueProvider valueProvider = (ConstantValueProvider) processRefValueProvider;
    assertEquals(processRef, valueProvider.getValue(null));
}
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) 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 12 with ConstantValueProvider

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

the class ProcessTaskPlanItemHandlerTest method testOutputSource.

@Test
public void testOutputSource() {
    // given:
    String source = "a";
    ExtensionElements extensionElements = addExtensionElements(processTask);
    CamundaOut sourceElement = createElement(extensionElements, null, CamundaOut.class);
    sourceElement.setCamundaSource(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 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) ProcessTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.ProcessTaskActivityBehavior) CamundaOut(org.camunda.bpm.model.cmmn.instance.camunda.CamundaOut) 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 13 with ConstantValueProvider

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

the class ProcessTaskPlanItemHandlerTest method testVersionConstant.

@Test
public void testVersionConstant() {
    // given:
    String processVersion = "2";
    processTask.setCamundaProcessVersion(processVersion);
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    ProcessTaskActivityBehavior behavior = (ProcessTaskActivityBehavior) activity.getActivityBehavior();
    CallableElement callableElement = behavior.getCallableElement();
    ParameterValueProvider processVersionValueProvider = callableElement.getVersionValueProvider();
    assertNotNull(processVersionValueProvider);
    assertTrue(processVersionValueProvider instanceof ConstantValueProvider);
    assertEquals(processVersion, processVersionValueProvider.getValue(null));
}
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) 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 14 with ConstantValueProvider

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

the class CaseTaskPlanItemHandlerTest method testVersionConstant.

@Test
public void testVersionConstant() {
    // given:
    String caseVersion = "2";
    caseTask.setCamundaCaseVersion(caseVersion);
    // when
    CmmnActivity activity = handler.handleElement(planItem, context);
    // then
    CaseTaskActivityBehavior behavior = (CaseTaskActivityBehavior) activity.getActivityBehavior();
    CallableElement callableElement = behavior.getCallableElement();
    ParameterValueProvider caseVersionValueProvider = callableElement.getVersionValueProvider();
    assertNotNull(caseVersionValueProvider);
    assertTrue(caseVersionValueProvider instanceof ConstantValueProvider);
    assertEquals(caseVersion, caseVersionValueProvider.getValue(null));
}
Also used : CallableElement(org.camunda.bpm.engine.impl.core.model.CallableElement) 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) CaseTaskActivityBehavior(org.camunda.bpm.engine.impl.cmmn.behavior.CaseTaskActivityBehavior) Test(org.junit.Test)

Aggregations

ConstantValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.ConstantValueProvider)14 ParameterValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider)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 NullValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.NullValueProvider)1 DecisionRefExpression (org.camunda.bpm.model.cmmn.instance.DecisionRefExpression)1