Java Code Examples for org.camunda.bpm.engine.runtime.VariableInstance#getName()
The following examples show how to use
org.camunda.bpm.engine.runtime.VariableInstance#getName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VariableInstanceDto.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public static VariableInstanceDto fromVariableInstance(VariableInstance variableInstance) { VariableInstanceDto dto = new VariableInstanceDto(); dto.id = variableInstance.getId(); dto.name = variableInstance.getName(); dto.processDefinitionId = variableInstance.getProcessDefinitionId(); dto.processInstanceId = variableInstance.getProcessInstanceId(); dto.executionId = variableInstance.getExecutionId(); dto.caseExecutionId = variableInstance.getCaseExecutionId(); dto.caseInstanceId = variableInstance.getCaseInstanceId(); dto.taskId = variableInstance.getTaskId(); dto.activityInstanceId = variableInstance.getActivityInstanceId(); dto.tenantId = variableInstance.getTenantId(); if(variableInstance.getErrorMessage() == null) { VariableValueDto.fromTypedValue(dto, variableInstance.getTypedValue()); } else { dto.errorMessage = variableInstance.getErrorMessage(); dto.type = VariableValueDto.toRestApiTypeName(variableInstance.getTypeName()); } return dto; }
Example 2
Source File: HalVariableValue.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public static HalVariableValue fromVariableInstance(VariableInstance variableInstance) { HalVariableValue dto = new HalVariableValue(); VariableValueDto variableValueDto = VariableValueDto.fromTypedValue(variableInstance.getTypedValue()); dto.name = variableInstance.getName(); dto.value = variableValueDto.getValue(); dto.type = variableValueDto.getType(); dto.valueInfo = variableValueDto.getValueInfo(); return dto; }
Example 3
Source File: CaseCallActivityTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/callactivity/CaseCallActivityTest.testInputSourceDifferentTarget.bpmn20.xml", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" }) public void testInputSourceDifferentTarget() { // given VariableMap parameters = Variables.createVariables() .putValue("aVariable", "abc") .putValue("anotherVariable", 999) .putValue("aThirdVariable", "def"); // when String superProcessInstanceId = startProcessInstanceByKey(PROCESS_DEFINITION_KEY, parameters).getId(); // then CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance(); assertNotNull(subCaseInstance); List<VariableInstance> variables = runtimeService .createVariableInstanceQuery() .caseInstanceIdIn(subCaseInstance.getId()) .list(); assertFalse(variables.isEmpty()); assertEquals(2, variables.size()); for (VariableInstance variable : variables) { String name = variable.getName(); if ("myVariable".equals(name)) { assertEquals("myVariable", name); assertEquals("abc", variable.getValue()); } else if ("myAnotherVariable".equals(name)) { assertEquals("myAnotherVariable", name); assertEquals(999, variable.getValue()); } else { fail("Found an unexpected variable: '"+name+"'"); } } // complete //////////////////////////////////////////////////////// String humanTaskId = queryCaseExecutionByActivityId(HUMAN_TASK_ID).getId(); complete(humanTaskId); close(subCaseInstance.getId()); assertProcessEnded(superProcessInstanceId); }
Example 4
Source File: ProcessTaskTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/processtask/ProcessTaskTest.testVariablesRoundtrip.cmmn", "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" }) public void testVariablesRoundtrip() { // given String caseInstanceId = createCaseInstanceByKey(ONE_PROCESS_TASK_CASE).getId(); String processTaskId = queryCaseExecutionByActivityId(PROCESS_TASK).getId(); caseService .withCaseExecution(processTaskId) .setVariable("aVariable", "xyz") .setVariable("anotherVariable", 123); String processInstanceId = queryProcessInstance().getId(); String taskId = queryTask().getId(); runtimeService.setVariable(processInstanceId, "aVariable", "abc"); runtimeService.setVariable(processInstanceId, "anotherVariable", 999); // when // should also complete process instance taskService.complete(taskId); // then List<VariableInstance> variables = runtimeService .createVariableInstanceQuery() .caseInstanceIdIn(caseInstanceId) .list(); assertEquals(2, variables.size()); assertFalse(variables.get(0).getName().equals(variables.get(1).getName())); for (VariableInstance variable : variables) { String name = variable.getName(); if ("aVariable".equals(name)) { assertEquals("aVariable", name); assertEquals("abc", variable.getValue()); } else if ("anotherVariable".equals(name)) { assertEquals("anotherVariable", name); assertEquals(999, variable.getValue()); } else { fail("Found an unexpected variable: '"+name+"'"); } } // complete //////////////////////////////////////////////////////// assertProcessEnded(processInstanceId); close(caseInstanceId); assertCaseEnded(caseInstanceId); }
Example 5
Source File: CaseCallActivityTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/callactivity/CaseCallActivityTest.testOutputAll.bpmn20.xml", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" }) public void testOutputAll() { // given String superProcessInstanceId = startProcessInstanceByKey(PROCESS_DEFINITION_KEY).getId(); String subCaseInstanceId = queryOneTaskCaseInstance().getId(); caseService .withCaseExecution(subCaseInstanceId) .setVariable("aVariable", "abc") .setVariable("anotherVariable", 999) .execute(); String humanTaskId = queryCaseExecutionByActivityId(HUMAN_TASK_ID).getId(); // when complete(humanTaskId); // then List<VariableInstance> variables = runtimeService .createVariableInstanceQuery() .processInstanceIdIn(superProcessInstanceId) .list(); assertFalse(variables.isEmpty()); assertEquals(2, variables.size()); for (VariableInstance variable : variables) { String name = variable.getName(); if ("aVariable".equals(name)) { assertEquals("aVariable", name); assertEquals("abc", variable.getValue()); } else if ("anotherVariable".equals(name)) { assertEquals("anotherVariable", name); assertEquals(999, variable.getValue()); } else { fail("Found an unexpected variable: '"+name+"'"); } } // complete //////////////////////////////////////////////////////// close(subCaseInstanceId); assertCaseEnded(subCaseInstanceId); String taskId = queryTaskByActivityId(USER_TASK_ID).getId(); taskService.complete(taskId); assertProcessEnded(superProcessInstanceId); }
Example 6
Source File: ProcessTaskTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/processtask/ProcessTaskTest.testInputOverlapping.cmmn", "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" }) public void testInputOverlapping() { // specifics should override "all" // given String caseInstanceId = createCaseInstanceByKey(ONE_PROCESS_TASK_CASE).getId(); String processTaskId = queryCaseExecutionByActivityId(PROCESS_TASK).getId(); // when caseService .withCaseExecution(processTaskId) .setVariable("aVariable", "abc") .setVariable("anotherVariable", 999) .manualStart(); // then // there exists a process instance ProcessInstance processInstance = queryProcessInstance(); assertNotNull(processInstance); List<VariableInstance> variables = runtimeService .createVariableInstanceQuery() .processInstanceIdIn(processInstance.getId()) .list(); assertEquals(2, variables.size()); assertFalse(variables.get(0).getName().equals(variables.get(1).getName())); for (VariableInstance variable : variables) { String name = variable.getName(); if ("aVariable".equals(name)) { assertEquals("aVariable", name); assertEquals("abc", variable.getValue()); } else if ("anotherVariable".equals(name)) { assertEquals("anotherVariable", name); assertEquals((long) 1000, variable.getValue()); } else { fail("Found an unexpected variable: '"+name+"'"); } } // complete //////////////////////////////////////////////////////// taskService.complete(queryTask().getId()); assertProcessEnded(processInstance.getId()); close(caseInstanceId); assertCaseEnded(caseInstanceId); }
Example 7
Source File: ProcessTaskTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/processtask/ProcessTaskTest.testInputAll.cmmn", "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" }) public void testInputAll() { // given String caseInstanceId = createCaseInstanceByKey(ONE_PROCESS_TASK_CASE, Variables.createVariables().putValue("aVariable", "abc").putValue("anotherVariable", 999)).getId(); String processTaskId = queryCaseExecutionByActivityId(PROCESS_TASK).getId(); // then // there exists a process instance ProcessInstance processInstance = queryProcessInstance(); assertNotNull(processInstance); List<VariableInstance> variables = runtimeService .createVariableInstanceQuery() .processInstanceIdIn(processInstance.getId()) .list(); assertEquals(2, variables.size()); assertFalse(variables.get(0).getName().equals(variables.get(1).getName())); for (VariableInstance variable : variables) { String name = variable.getName(); if ("aVariable".equals(name)) { assertEquals("aVariable", name); assertEquals("abc", variable.getValue()); } else if ("anotherVariable".equals(name)) { assertEquals("anotherVariable", name); assertEquals(999, variable.getValue()); } else { fail("Found an unexpected variable: '"+name+"'"); } } // complete //////////////////////////////////////////////////////// taskService.complete(queryTask().getId()); assertProcessEnded(processInstance.getId()); close(caseInstanceId); assertCaseEnded(caseInstanceId); }
Example 8
Source File: ProcessTaskTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/processtask/ProcessTaskTest.testOutputAll.cmmn", "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" }) public void testOutputAll() { // given String caseInstanceId = createCaseInstanceByKey(ONE_PROCESS_TASK_CASE).getId(); String processTaskId = queryCaseExecutionByActivityId(PROCESS_TASK).getId(); String processInstanceId = queryProcessInstance().getId(); String taskId = queryTask().getId(); runtimeService.setVariable(processInstanceId, "aVariable", "abc"); runtimeService.setVariable(processInstanceId, "anotherVariable", 999); // when // should also complete process instance taskService.complete(taskId); // then List<VariableInstance> variables = runtimeService .createVariableInstanceQuery() .caseInstanceIdIn(caseInstanceId) .list(); assertEquals(2, variables.size()); assertFalse(variables.get(0).getName().equals(variables.get(1).getName())); for (VariableInstance variable : variables) { String name = variable.getName(); if ("aVariable".equals(name)) { assertEquals("aVariable", name); assertEquals("abc", variable.getValue()); } else if ("anotherVariable".equals(name)) { assertEquals("anotherVariable", name); assertEquals(999, variable.getValue()); } else { fail("Found an unexpected variable: '"+name+"'"); } } // complete //////////////////////////////////////////////////////// assertProcessEnded(processInstanceId); close(caseInstanceId); assertCaseEnded(caseInstanceId); }
Example 9
Source File: CaseCallActivityTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/callactivity/CaseCallActivityTest.testOutputSourceDifferentTarget.bpmn20.xml", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" }) public void testOutputSourceDifferentTarget() { // given String superProcessInstanceId = startProcessInstanceByKey(PROCESS_DEFINITION_KEY).getId(); String subCaseInstanceId = queryOneTaskCaseInstance().getId(); caseService .withCaseExecution(subCaseInstanceId) .setVariable("aVariable", "abc") .setVariable("anotherVariable", 999) .execute(); String humanTaskId = queryCaseExecutionByActivityId(HUMAN_TASK_ID).getId(); // when complete(humanTaskId); // then List<VariableInstance> variables = runtimeService .createVariableInstanceQuery() .processInstanceIdIn(superProcessInstanceId) .list(); assertFalse(variables.isEmpty()); assertEquals(2, variables.size()); for (VariableInstance variable : variables) { String name = variable.getName(); if ("myVariable".equals(name)) { assertEquals("myVariable", name); assertEquals("abc", variable.getValue()); } else if ("myAnotherVariable".equals(name)) { assertEquals("myAnotherVariable", name); assertEquals(999, variable.getValue()); } else { fail("Found an unexpected variable: '"+name+"'"); } } // complete //////////////////////////////////////////////////////// close(subCaseInstanceId); assertCaseEnded(subCaseInstanceId); String taskId = queryTaskByActivityId(USER_TASK_ID).getId(); taskService.complete(taskId); assertProcessEnded(superProcessInstanceId); }
Example 10
Source File: CaseCallActivityTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/callactivity/CaseCallActivityTest.testOutputSourceAsCompositeExpression.bpmn20.xml", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" }) public void testOutputSourceAsCompositeExpression() { // given String superProcessInstanceId = startProcessInstanceByKey(PROCESS_DEFINITION_KEY).getId(); String subCaseInstanceId = queryOneTaskCaseInstance().getId(); caseService .withCaseExecution(subCaseInstanceId) .setVariable("aVariable", "abc") .setVariable("anotherVariable", 999) .execute(); String humanTaskId = queryCaseExecutionByActivityId(HUMAN_TASK_ID).getId(); // when complete(humanTaskId); // then List<VariableInstance> variables = runtimeService .createVariableInstanceQuery() .processInstanceIdIn(superProcessInstanceId) .list(); assertFalse(variables.isEmpty()); assertEquals(2, variables.size()); for (VariableInstance variable : variables) { String name = variable.getName(); if ("aVariable".equals(name)) { assertEquals("aVariable", name); assertEquals("Prefixabc", variable.getValue()); } else if ("anotherVariable".equals(name)) { assertEquals("anotherVariable", name); assertEquals("Prefix"+(long) 1000, variable.getValue()); } else { fail("Found an unexpected variable: '"+name+"'"); } } // complete //////////////////////////////////////////////////////// close(subCaseInstanceId); assertCaseEnded(subCaseInstanceId); String taskId = queryTaskByActivityId(USER_TASK_ID).getId(); taskService.complete(taskId); assertProcessEnded(superProcessInstanceId); }
Example 11
Source File: CaseCallActivityTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/callactivity/CaseCallActivityTest.testOutputSource.bpmn20.xml", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" }) public void testOutputSourceNullValue() { // given String superProcessInstanceId = startProcessInstanceByKey(PROCESS_DEFINITION_KEY).getId(); String subCaseInstanceId = queryOneTaskCaseInstance().getId(); String humanTaskId = queryCaseExecutionByActivityId(HUMAN_TASK_ID).getId(); // when complete(humanTaskId); // then List<VariableInstance> variables = runtimeService .createVariableInstanceQuery() .processInstanceIdIn(superProcessInstanceId) .list(); assertFalse(variables.isEmpty()); assertEquals(2, variables.size()); for (VariableInstance variable : variables) { String name = variable.getName(); if ("aVariable".equals(name)) { assertEquals("aVariable", name); } else if ("anotherVariable".equals(name)) { assertEquals("anotherVariable", name); } else { fail("Found an unexpected variable: '"+name+"'"); } assertNull(variable.getValue()); } // complete //////////////////////////////////////////////////////// close(subCaseInstanceId); assertCaseEnded(subCaseInstanceId); String taskId = queryTaskByActivityId(USER_TASK_ID).getId(); taskService.complete(taskId); assertProcessEnded(superProcessInstanceId); }
Example 12
Source File: CaseTaskTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
/** * default manual activation behaviour changed - remove manual activation statement */ @Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testInputSourceDifferentTarget.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" }) public void testInputSourceDifferentTarget() { // given VariableMap vars = new VariableMapImpl(); vars.putValue("aVariable", "abc"); vars.putValue("anotherVariable", 999); String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE, vars).getId(); String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId(); // then CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance(); assertNotNull(subCaseInstance); List<VariableInstance> variables = runtimeService .createVariableInstanceQuery() .caseInstanceIdIn(subCaseInstance.getId()) .list(); assertFalse(variables.isEmpty()); assertEquals(2, variables.size()); for (VariableInstance variable : variables) { String name = variable.getName(); if ("myVariable".equals(name)) { assertEquals("myVariable", name); assertEquals("abc", variable.getValue()); } else if ("myAnotherVariable".equals(name)) { assertEquals("myAnotherVariable", name); assertEquals(999, variable.getValue()); } else { fail("Found an unexpected variable: '"+name+"'"); } } // complete //////////////////////////////////////////////////////// terminate(subCaseInstance.getId()); close(subCaseInstance.getId()); assertCaseEnded(subCaseInstance.getId()); terminate(caseTaskId); close(superCaseInstanceId); assertCaseEnded(superCaseInstanceId); }
Example 13
Source File: CaseCallActivityTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/callactivity/CaseCallActivityTest.testOutputSource.bpmn20.xml", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" }) public void testOutputSource() { // given String superProcessInstanceId = startProcessInstanceByKey(PROCESS_DEFINITION_KEY).getId(); String subCaseInstanceId = queryOneTaskCaseInstance().getId(); caseService .withCaseExecution(subCaseInstanceId) .setVariable("aVariable", "abc") .setVariable("anotherVariable", 999) .setVariable("aThirdVariable", "def") .execute(); String humanTaskId = queryCaseExecutionByActivityId(HUMAN_TASK_ID).getId(); // when complete(humanTaskId); // then List<VariableInstance> variables = runtimeService .createVariableInstanceQuery() .processInstanceIdIn(superProcessInstanceId) .list(); assertFalse(variables.isEmpty()); assertEquals(2, variables.size()); for (VariableInstance variable : variables) { String name = variable.getName(); if ("aVariable".equals(name)) { assertEquals("aVariable", name); assertEquals("abc", variable.getValue()); } else if ("anotherVariable".equals(name)) { assertEquals("anotherVariable", name); assertEquals(999, variable.getValue()); } else { fail("Found an unexpected variable: '"+name+"'"); } } // complete //////////////////////////////////////////////////////// close(subCaseInstanceId); assertCaseEnded(subCaseInstanceId); String taskId = queryTaskByActivityId(USER_TASK_ID).getId(); taskService.complete(taskId); assertProcessEnded(superProcessInstanceId); }
Example 14
Source File: CaseTaskTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
/** * assertion on variables - change process definition * manual start on case not needed enaymore and therefore removed */ @Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testOutputSourceExpression.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCaseWithManualActivation.cmmn" }) public void testOutputSourceExpression() { // given String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId(); String subCaseInstanceId = queryOneTaskCaseInstance().getId(); caseService .withCaseExecution(subCaseInstanceId) .setVariable("aVariable", "abc") .setVariable("anotherVariable", 999) .execute(); String humanTaskId = queryCaseExecutionByActivityId("PI_HumanTask_1").getId(); caseService .withCaseExecution(humanTaskId) .manualStart(); caseService .withCaseExecution(humanTaskId) .complete(); // when caseService .withCaseExecution(subCaseInstanceId) .close(); // then List<VariableInstance> variables = runtimeService .createVariableInstanceQuery() .caseInstanceIdIn(superCaseInstanceId) .list(); assertFalse(variables.isEmpty()); assertEquals(2, variables.size()); for (VariableInstance variable : variables) { String name = variable.getName(); if ("aVariable".equals(name)) { assertEquals("aVariable", name); assertEquals("abc", variable.getValue()); } else if ("anotherVariable".equals(name)) { assertEquals("anotherVariable", name); assertEquals((long) 1000, variable.getValue()); } else { fail("Found an unexpected variable: '"+name+"'"); } } // complete //////////////////////////////////////////////////////// close(superCaseInstanceId); assertCaseEnded(superCaseInstanceId); }
Example 15
Source File: CaseTaskTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
/** * assertion on default behaviour - remove manual activations */ @Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testOutputSource.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" }) public void testOutputSourceNullValue() { // given String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId(); String subCaseInstanceId = queryOneTaskCaseInstance().getId(); String humanTaskId = queryCaseExecutionByActivityId("PI_HumanTask_1").getId(); caseService .withCaseExecution(humanTaskId) .complete(); // when caseService .withCaseExecution(subCaseInstanceId) .close(); // then List<VariableInstance> variables = runtimeService .createVariableInstanceQuery() .caseInstanceIdIn(superCaseInstanceId) .list(); assertFalse(variables.isEmpty()); assertEquals(2, variables.size()); for (VariableInstance variable : variables) { String name = variable.getName(); if ("aVariable".equals(name)) { assertEquals("aVariable", name); } else if ("anotherVariable".equals(name)) { assertEquals("anotherVariable", name); } else { fail("Found an unexpected variable: '"+name+"'"); } assertNull(variable.getValue()); } // complete //////////////////////////////////////////////////////// close(superCaseInstanceId); assertCaseEnded(superCaseInstanceId); }
Example 16
Source File: CaseTaskTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
/** * default behaviour of manual activation changed - remove manual activation */ @Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testOutputSourceDifferentTarget.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" }) public void testOutputSourceDifferentTarget() { // given String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId(); String subCaseInstanceId = queryOneTaskCaseInstance().getId(); caseService .withCaseExecution(subCaseInstanceId) .setVariable("aVariable", "abc") .setVariable("anotherVariable", 999) .execute(); String humanTaskId = queryCaseExecutionByActivityId("PI_HumanTask_1").getId(); caseService .withCaseExecution(humanTaskId) .complete(); // when caseService .withCaseExecution(subCaseInstanceId) .close(); // then List<VariableInstance> variables = runtimeService .createVariableInstanceQuery() .caseInstanceIdIn(superCaseInstanceId) .list(); assertFalse(variables.isEmpty()); assertEquals(2, variables.size()); for (VariableInstance variable : variables) { String name = variable.getName(); if ("myVariable".equals(name)) { assertEquals("myVariable", name); assertEquals("abc", variable.getValue()); } else if ("myAnotherVariable".equals(name)) { assertEquals("myAnotherVariable", name); assertEquals(999, variable.getValue()); } else { fail("Found an unexpected variable: '"+name+"'"); } } // complete //////////////////////////////////////////////////////// close(superCaseInstanceId); assertCaseEnded(superCaseInstanceId); }
Example 17
Source File: CaseCallActivityTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/callactivity/CaseCallActivityTest.testInputAll.bpmn20.xml", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" }) public void testInputAll() { // given VariableMap parameters = Variables.createVariables() .putValue("aVariable", "abc") .putValue("anotherVariable", 999); // when String superProcessInstanceId = startProcessInstanceByKey(PROCESS_DEFINITION_KEY, parameters).getId(); // then CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance(); assertNotNull(subCaseInstance); List<VariableInstance> variables = runtimeService .createVariableInstanceQuery() .caseInstanceIdIn(subCaseInstance.getId()) .list(); assertFalse(variables.isEmpty()); assertEquals(2, variables.size()); for (VariableInstance variable : variables) { String name = variable.getName(); if ("aVariable".equals(name)) { assertEquals("aVariable", name); assertEquals("abc", variable.getValue()); } else if ("anotherVariable".equals(name)) { assertEquals("anotherVariable", name); assertEquals(999, variable.getValue()); } else { fail("Found an unexpected variable: '"+name+"'"); } } // complete //////////////////////////////////////////////////////// String humanTaskId = queryCaseExecutionByActivityId(HUMAN_TASK_ID).getId(); complete(humanTaskId); close(subCaseInstance.getId()); assertProcessEnded(superProcessInstanceId); }
Example 18
Source File: CaseTaskTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testInputAll.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" }) public void testInputAll() { // given VariableMap vars = new VariableMapImpl(); vars.putValue("aVariable", "abc"); vars.putValue("anotherVariable", 999); String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE, vars).getId(); String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId(); // then CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance(); assertNotNull(subCaseInstance); List<VariableInstance> variables = runtimeService .createVariableInstanceQuery() .caseInstanceIdIn(subCaseInstance.getId()) .list(); assertFalse(variables.isEmpty()); assertEquals(2, variables.size()); for (VariableInstance variable : variables) { String name = variable.getName(); if ("aVariable".equals(name)) { assertEquals("aVariable", name); assertEquals("abc", variable.getValue()); } else if ("anotherVariable".equals(name)) { assertEquals("anotherVariable", name); assertEquals(999, variable.getValue()); } else { fail("Found an unexpected variable: '"+name+"'"); } } // complete //////////////////////////////////////////////////////// terminate(subCaseInstance.getId()); close(subCaseInstance.getId()); assertCaseEnded(subCaseInstance.getId()); terminate(caseTaskId); close(superCaseInstanceId); assertCaseEnded(superCaseInstanceId); }
Example 19
Source File: CaseTaskTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
/** * Default manual activation changed - add variables to case instantiation, remove manual activation */ @Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testInputSourceExpression.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" }) public void testInputSourceExpression() { // given VariableMap vars = new VariableMapImpl(); vars.putValue("aVariable", "abc"); vars.putValue("anotherVariable", 999); String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE,vars).getId(); String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId(); // then CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance(); assertNotNull(subCaseInstance); List<VariableInstance> variables = runtimeService .createVariableInstanceQuery() .caseInstanceIdIn(subCaseInstance.getId()) .list(); assertFalse(variables.isEmpty()); assertEquals(2, variables.size()); for (VariableInstance variable : variables) { String name = variable.getName(); if ("aVariable".equals(name)) { assertEquals("aVariable", name); assertEquals("abc", variable.getValue()); } else if ("anotherVariable".equals(name)) { assertEquals("anotherVariable", name); assertEquals((long)1000, variable.getValue()); } else { fail("Found an unexpected variable: '"+name+"'"); } } // complete //////////////////////////////////////////////////////// terminate(subCaseInstance.getId()); close(subCaseInstance.getId()); assertCaseEnded(subCaseInstance.getId()); terminate(caseTaskId); close(superCaseInstanceId); assertCaseEnded(superCaseInstanceId); }
Example 20
Source File: CaseTaskTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
/** * assertion on default execution - take manual start out */ @Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/casetask/CaseTaskTest.testInputSource.cmmn", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" }) public void testInputSourceNullValue() { // given String superCaseInstanceId = createCaseInstanceByKey(ONE_CASE_TASK_CASE).getId(); String caseTaskId = queryCaseExecutionByActivityId(CASE_TASK).getId(); // then CaseExecutionEntity subCaseInstance = (CaseExecutionEntity) queryOneTaskCaseInstance(); assertNotNull(subCaseInstance); List<VariableInstance> variables = runtimeService .createVariableInstanceQuery() .caseInstanceIdIn(subCaseInstance.getId()) .list(); assertFalse(variables.isEmpty()); assertEquals(2, variables.size()); for (VariableInstance variable : variables) { String name = variable.getName(); if ("aVariable".equals(name)) { assertEquals("aVariable", name); } else if ("anotherVariable".equals(name)) { assertEquals("anotherVariable", name); } else { fail("Found an unexpected variable: '"+name+"'"); } assertNull(variable.getValue()); } // complete //////////////////////////////////////////////////////// terminate(subCaseInstance.getId()); close(subCaseInstance.getId()); assertCaseEnded(subCaseInstance.getId()); terminate(caseTaskId); close(superCaseInstanceId); assertCaseEnded(superCaseInstanceId); }