WorkflowInstance wfi = new WorkflowInstance(); wfi.setWorkflowClassId(tdas.getCalcLevel()); wfi.setStartedBy(authenticatedUser.getBadge());
@SuppressWarnings("unchecked") private WorkflowService makeWorkflowService() { WorkflowService service = mock(WorkflowService.class); when(service.getDefinitionByName(WF_DEF_NAME)).thenReturn(definition); String instanceId = "foo$instanceId"; newInstance = new WorkflowInstance(instanceId, definition, null, null, null, null, true, null, null); WorkflowTask startTask = new WorkflowTask("foo$taskId", null, null, null, null, null, null, null); String pathId = "foo$pathId"; final WorkflowPath path = new WorkflowPath(pathId, newInstance, null, true); when(service.startWorkflow(eq(definition.getId()), anyMap())) .thenAnswer(new Answer<WorkflowPath>() { public WorkflowPath answer(InvocationOnMock invocation) throws Throwable { Object[] arguments = invocation.getArguments(); actualProperties = (Map<QName, Serializable>) arguments[1]; return path; } }); when(service.getTasksForWorkflowPath(path.getId())) .thenReturn(Collections.singletonList(startTask)); when(service.createPackage(null)).thenReturn(PCKG_NODE); return service; }
NodeRef workflowPackage= getNodeVariable(variables, WorkflowModel.ASSOC_PACKAGE); WorkflowInstance workflowInstance = new WorkflowInstance( actualId, definition, description, initiator,
NodeRef workflowPackage= getNodeVariable(variables, WorkflowModel.ASSOC_PACKAGE); WorkflowInstance workflowInstance = new WorkflowInstance( actualId, definition, description, initiator,
private WorkflowTask makeTask(WorkflowTransition... transitions) { String id = TASK_ID; String title = "Test"; WorkflowTaskState state = WorkflowTaskState.IN_PROGRESS; WorkflowTaskDefinition taskDef = makeTaskDefinition(transitions); Map<QName, Serializable> properties = makeTaskProperties(); WorkflowDefinition definition = new WorkflowDefinition("42", "Test", "1.0", "Test", "Test", null); NodeRef wfPackage = PCKG_NODE; WorkflowInstance instance = new WorkflowInstance(null, definition, null, null, wfPackage, null, true, null, null); WorkflowNode node = new WorkflowNode("", "", "", "", true, new WorkflowTransition[0]); WorkflowPath path = new WorkflowPath(null, instance, node, true); return new WorkflowTask(id, taskDef, null, title, null, state, path, properties); }