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));
}
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());
}
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));
}
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));
}
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));
}
Aggregations