@Test public void testInputSourceExpression() { // given: String source = "${a}"; ExtensionElements extensionElements = addExtensionElements(caseTask); CamundaIn sourceElement = createElement(extensionElements, null, CamundaIn.class); sourceElement.setCamundaSourceExpression(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 sourceExpressionValueProvider = parameter.getSourceValueProvider(); assertNotNull(sourceExpressionValueProvider); assertTrue(sourceExpressionValueProvider instanceof ElValueProvider); ElValueProvider valueProvider = (ElValueProvider) sourceExpressionValueProvider; assertEquals(source, valueProvider.getExpression().getExpressionText()); }
@Test public void testInputVariables() { // given: ExtensionElements extensionElements = addExtensionElements(caseTask); CamundaIn variablesElement = createElement(extensionElements, null, CamundaIn.class); variablesElement.setCamundaVariables("all"); // 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); assertTrue(parameter.isAllVariables()); }
@Test public void testInputTarget() { // given: String target = "b"; ExtensionElements extensionElements = addExtensionElements(caseTask); CamundaIn sourceElement = createElement(extensionElements, null, CamundaIn.class); sourceElement.setCamundaTarget(target); // 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()); assertEquals(target, parameter.getTarget()); }
@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)); }
@Test public void testInputs() { // given: ExtensionElements extensionElements = addExtensionElements(caseTask); 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 CaseTaskActivityBehavior behavior = (CaseTaskActivityBehavior) activity.getActivityBehavior(); CallableElement callableElement = behavior.getCallableElement(); List<CallableElementParameter> inputs = callableElement.getInputs(); assertNotNull(inputs); assertFalse(inputs.isEmpty()); assertEquals(3, inputs.size()); }