@Before public void instantiateProcesses() { processManager = new ProcessManagement(); HashMap<String, Object> variables = new HashMap<String, Object>(); variables.put("key", "variable"); processManager.newInstance("Minimal"); processManager.newInstance("UserTask", variables); processManager.newInstance("UserTask", variables); }
@Test public void testGetInstanceData() { HashMap<String, Object> variables = new HashMap<String, Object>(); variables.put("key2", "variable2"); String instanceID = processManager.newInstance("UserTask", variables).getId(); assertEquals(variables, processManager.getInstanceData(instanceID)); }
@Test(expected = IllegalArgumentException.class) public void testEndInstance() { HashMap<String, Object> variables = new HashMap<String, Object>(); variables.put("key3", "variable3"); String instanceID = processManager.newInstance("UserTask", variables).getId(); processManager.endInstance(instanceID, RESULT.ERROR); assertEquals(false, processManager.getInstanceData(instanceID).isEmpty()); }
@Test(expected = IllegalArgumentException.class) public void testDeleteInstance() { HashMap<String, Object> variables = new HashMap<String, Object>(); variables.put("key3", "variable3"); String instanceID = processManager.newInstance("UserTask", variables).getId(); processManager.deleteInstance(instanceID); processManager.getInstanceData(instanceID); }
@Test @Ignore public void testNewProcessInstanceWithVariables() { HashMap<String, Object> variables = new HashMap<String, Object>(); variables.put("key2", "variable2"); ProcessInstanceRef instanceRef = processManager.newInstance("UserTask", variables); assertEquals("UserTask", instanceRef.getDefinitionId()); assertEquals(3, processManager.getProcessInstances("UserTask").size()); assertEquals("variable2", processManager.getInstanceData(instanceRef.getId()).get("key2")); }
@Test @Ignore public void testNewProcessInstance() { assertEquals("UserTask", processManager.newInstance("UserTask").getDefinitionId()); assertEquals(3, processManager.getProcessInstances("UserTask").size()); }