public void testEvaluateDecisionWithVersionTagBinding() { // given deploymentForTenant(TENANT_ONE, DMN_FILE_VERSION_TAG); deployment(Bpmn.createExecutableProcess("process") .startEvent() .businessRuleTask() .camundaDecisionRef("decision") .camundaDecisionRefTenantId(TENANT_ONE) .camundaDecisionRefBinding("versionTag") .camundaDecisionRefVersionTag("0.0.2") .camundaMapDecisionResult("singleEntry") .camundaResultVariable("decisionVar") .endEvent() .camundaAsyncBefore() .done()); // when ProcessInstance processInstance = runtimeService.createProcessInstanceByKey("process") .setVariable("status", "gold") .execute(); // then assertThat((String)runtimeService.getVariable(processInstance.getId(), "decisionVar"), is(RESULT_OF_VERSION_TAG_ONE)); }
public void testFailEvaluateDecisionFromOtherTenantWithVersionTagBinding() { // given BpmnModelInstance process = Bpmn.createExecutableProcess("process") .startEvent() .businessRuleTask() .camundaDecisionRef("decision") .camundaDecisionRefBinding("versionTag") .camundaDecisionRefVersionTag("0.0.2") .camundaMapDecisionResult("singleEntry") .camundaResultVariable("result") .camundaAsyncAfter() .endEvent() .done(); deploymentForTenant(TENANT_ONE, process); deploymentForTenant(TENANT_TWO, DMN_FILE_VERSION_TAG); try { // when runtimeService.createProcessInstanceByKey("process") .processDefinitionTenantId(TENANT_ONE) .execute(); fail("expected exception"); } catch (ProcessEngineException e) { // then assertThat(e.getMessage(), containsString("no decision definition deployed with key = 'decision', versionTag = '0.0.2' and tenant-id 'tenant1': decisionDefinition is null")); } }
public void testEvaluateDecisionWithVersionTagBinding_ResolveTenantFromDefinition() { // given BpmnModelInstance process = Bpmn.createExecutableProcess("process") .startEvent() .businessRuleTask() .camundaDecisionRef("decision") .camundaDecisionRefBinding("versionTag") .camundaDecisionRefVersionTag("0.0.2") .camundaMapDecisionResult("singleEntry") .camundaResultVariable("decisionVar") .endEvent() .camundaAsyncBefore() .done(); deploymentForTenant(TENANT_ONE, DMN_FILE_VERSION_TAG, process); deploymentForTenant(TENANT_TWO, DMN_FILE_VERSION_TAG_TWO, process); ProcessInstance processInstanceOne = runtimeService.createProcessInstanceByKey("process") .setVariable("status", "gold") .processDefinitionTenantId(TENANT_ONE).execute(); ProcessInstance processInstanceTwo = runtimeService.createProcessInstanceByKey("process") .setVariable("status", "gold") .processDefinitionTenantId(TENANT_TWO).execute(); assertThat((String)runtimeService.getVariable(processInstanceOne.getId(), "decisionVar"), is(RESULT_OF_VERSION_TAG_ONE)); assertThat((String)runtimeService.getVariable(processInstanceTwo.getId(), "decisionVar"), is(RESULT_OF_VERSION_TAG_TWO)); }
@Test public void decisionRefVersionTagBindingExpression() { // given testRule.deploy(DECISION_VERSION_TAG_OKAY_DMN); testRule.deploy(Bpmn.createExecutableProcess("process") .startEvent() .businessRuleTask() .camundaDecisionRef("decision") .camundaDecisionRefBinding("versionTag") .camundaDecisionRefVersionTag("${versionTagExpr}") .camundaMapDecisionResult("singleEntry") .camundaResultVariable("result") .endEvent() .camundaAsyncBefore() .done()); // when VariableMap variables = Variables.createVariables() .putValue("versionTagExpr", "0.0.2") .putValue("status", "gold"); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process", variables); // then assertEquals("A", getDecisionResult(processInstance)); }
public void testFailEvaluateDecisionFromOtherTenantWithVersionTagBinding() { // given BpmnModelInstance process = Bpmn.createExecutableProcess("process") .startEvent() .businessRuleTask() .camundaDecisionRef("decision") .camundaDecisionRefBinding("versionTag") .camundaDecisionRefVersionTag("0.0.2") .camundaMapDecisionResult("singleEntry") .camundaResultVariable("result") .camundaAsyncAfter() .endEvent() .done(); deploymentForTenant(TENANT_ONE, process); deploymentForTenant(TENANT_TWO, DMN_FILE_VERSION_TAG); try { // when runtimeService.createProcessInstanceByKey("process") .processDefinitionTenantId(TENANT_ONE) .execute(); fail("expected exception"); } catch (ProcessEngineException e) { // then assertThat(e.getMessage(), containsString("no decision definition deployed with key = 'decision', versionTag = '0.0.2' and tenant-id 'tenant1': decisionDefinition is null")); } }
public void testEvaluateDecisionWithVersionTagBinding() { // given deploymentForTenant(TENANT_ONE, DMN_FILE_VERSION_TAG); deployment(Bpmn.createExecutableProcess("process") .startEvent() .businessRuleTask() .camundaDecisionRef("decision") .camundaDecisionRefTenantId(TENANT_ONE) .camundaDecisionRefBinding("versionTag") .camundaDecisionRefVersionTag("0.0.2") .camundaMapDecisionResult("singleEntry") .camundaResultVariable("decisionVar") .endEvent() .camundaAsyncBefore() .done()); // when ProcessInstance processInstance = runtimeService.createProcessInstanceByKey("process") .setVariable("status", "gold") .execute(); // then assertThat((String)runtimeService.getVariable(processInstance.getId(), "decisionVar"), is(RESULT_OF_VERSION_TAG_ONE)); }
public void testEvaluateDecisionWithVersionTagBinding_ResolveTenantFromDefinition() { // given BpmnModelInstance process = Bpmn.createExecutableProcess("process") .startEvent() .businessRuleTask() .camundaDecisionRef("decision") .camundaDecisionRefBinding("versionTag") .camundaDecisionRefVersionTag("0.0.2") .camundaMapDecisionResult("singleEntry") .camundaResultVariable("decisionVar") .endEvent() .camundaAsyncBefore() .done(); deploymentForTenant(TENANT_ONE, DMN_FILE_VERSION_TAG, process); deploymentForTenant(TENANT_TWO, DMN_FILE_VERSION_TAG_TWO, process); ProcessInstance processInstanceOne = runtimeService.createProcessInstanceByKey("process") .setVariable("status", "gold") .processDefinitionTenantId(TENANT_ONE).execute(); ProcessInstance processInstanceTwo = runtimeService.createProcessInstanceByKey("process") .setVariable("status", "gold") .processDefinitionTenantId(TENANT_TWO).execute(); assertThat((String)runtimeService.getVariable(processInstanceOne.getId(), "decisionVar"), is(RESULT_OF_VERSION_TAG_ONE)); assertThat((String)runtimeService.getVariable(processInstanceTwo.getId(), "decisionVar"), is(RESULT_OF_VERSION_TAG_TWO)); }
@Test public void decisionRefVersionTagBindingExpression() { // given testRule.deploy(DECISION_VERSION_TAG_OKAY_DMN); testRule.deploy(Bpmn.createExecutableProcess("process") .startEvent() .businessRuleTask() .camundaDecisionRef("decision") .camundaDecisionRefBinding("versionTag") .camundaDecisionRefVersionTag("${versionTagExpr}") .camundaMapDecisionResult("singleEntry") .camundaResultVariable("result") .endEvent() .camundaAsyncBefore() .done()); // when VariableMap variables = Variables.createVariables() .putValue("versionTagExpr", "0.0.2") .putValue("status", "gold"); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process", variables); // then assertEquals("A", getDecisionResult(processInstance)); }