use of org.kie.server.api.model.instance.NodeInstance in project droolsjbpm-integration by kiegroup.
the class ProcessInstanceAdminServiceIntegrationTest method testRetrigger.
@Test
public void testRetrigger() throws Exception {
Map<String, Object> parameters = new HashMap<String, Object>();
Long processInstanceId = null;
try {
processInstanceId = processClient.startProcess(CONTAINER_ID, PROCESS_ID_EVALUATION, parameters);
assertNotNull(processInstanceId);
assertTrue(processInstanceId.longValue() > 0);
List<NodeInstance> activeNodeInstances = processAdminClient.getActiveNodeInstances(CONTAINER_ID, processInstanceId);
assertNotNull(activeNodeInstances);
assertEquals(1, activeNodeInstances.size());
NodeInstance active = activeNodeInstances.get(0);
assertEquals("Evaluate items?", active.getName());
processAdminClient.retriggerNodeInstance(CONTAINER_ID, processInstanceId, active.getId());
activeNodeInstances = processAdminClient.getActiveNodeInstances(CONTAINER_ID, processInstanceId);
assertNotNull(activeNodeInstances);
assertEquals(1, activeNodeInstances.size());
NodeInstance activeTriggered = activeNodeInstances.get(0);
assertEquals("Evaluate items?", activeTriggered.getName());
assertFalse(activeTriggered.getId().longValue() == active.getId().longValue());
} finally {
if (processInstanceId != null) {
processClient.abortProcessInstance(CONTAINER_ID, processInstanceId);
}
}
}
use of org.kie.server.api.model.instance.NodeInstance in project droolsjbpm-integration by kiegroup.
the class KieClientServicesIntegrationTest method testSolverServiceCamelProducer.
@Test
public void testSolverServiceCamelProducer() throws Exception {
MockEndpoint mockEndpoint = getMockEndpoint("mock:result");
mockEndpoint.expectedMessageCount(1);
Map<String, Object> headers = new HashMap<>();
headers.put(KIE_CLIENT, "solver");
headers.put(KIE_OPERATION, "getSolvers");
headers.put(asCamelKieName("containerId"), "my-container");
template.sendBodyAndHeaders("direct:start", null, headers);
assertMockEndpointsSatisfied();
List<NodeInstance> nodeInstanceList = getResultMessage(mockEndpoint.getExchanges().get(0)).getBody(List.class);
assertCollectionSize(nodeInstanceList, 0);
}
use of org.kie.server.api.model.instance.NodeInstance in project droolsjbpm-integration by kiegroup.
the class KieClientServicesIntegrationTest method testQueryServiceCamelProducer.
@Test
public void testQueryServiceCamelProducer() throws Exception {
MockEndpoint mockEndpoint = getMockEndpoint("mock:result");
mockEndpoint.expectedMessageCount(1);
Map<String, Object> headers = new HashMap<>();
headers.put(KIE_CLIENT, "query");
headers.put(KIE_OPERATION, "findCompletedNodeInstances");
headers.put(asCamelKieName("processInstanceId"), 100L);
headers.put(asCamelKieName("page"), 1);
headers.put(asCamelKieName("pageSize"), 10);
template.sendBodyAndHeaders("direct:start", null, headers);
assertMockEndpointsSatisfied();
List<NodeInstance> nodeInstanceList = getResultMessage(mockEndpoint.getExchanges().get(0)).getBody(List.class);
assertCollectionSize(nodeInstanceList, 0);
}
use of org.kie.server.api.model.instance.NodeInstance in project droolsjbpm-integration by kiegroup.
the class ConvertUtils method convertToNodeInstanceList.
public static NodeInstanceList convertToNodeInstanceList(Collection<NodeInstanceDesc> definitions) {
if (definitions == null) {
return new NodeInstanceList(new NodeInstance[0]);
}
List<NodeInstance> processes = new ArrayList<NodeInstance>(definitions.size());
for (NodeInstanceDesc ni : definitions) {
NodeInstance nodeInstance = convertToNodeInstance(ni);
processes.add(nodeInstance);
}
return new NodeInstanceList(processes);
}
use of org.kie.server.api.model.instance.NodeInstance in project droolsjbpm-integration by kiegroup.
the class RuntimeDataServiceIntegrationTest method testGetNodeInstances.
@Test
public void testGetNodeInstances() throws Exception {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("stringData", "waiting for signal");
parameters.put("personData", createPersonInstance(USER_JOHN));
Long processInstanceId = processClient.startProcess(CONTAINER_ID, PROCESS_ID_USERTASK, parameters);
try {
List<NodeInstance> instances = queryClient.findActiveNodeInstances(processInstanceId, 0, 10);
assertNotNull(instances);
assertEquals(1, instances.size());
NodeInstance expectedFirstTask = NodeInstance.builder().name("First task").containerId(CONTAINER_ID).nodeType("HumanTaskNode").completed(false).processInstanceId(processInstanceId).build();
NodeInstance nodeInstance = instances.get(0);
assertNodeInstance(expectedFirstTask, nodeInstance);
assertNotNull(nodeInstance.getWorkItemId());
assertNotNull(nodeInstance.getDate());
nodeInstance = queryClient.findNodeInstanceByWorkItemId(processInstanceId, nodeInstance.getWorkItemId());
assertNodeInstance(expectedFirstTask, nodeInstance);
assertNotNull(nodeInstance.getWorkItemId());
assertNotNull(nodeInstance.getDate());
instances = queryClient.findCompletedNodeInstances(processInstanceId, 0, 10);
assertNotNull(instances);
assertEquals(1, instances.size());
NodeInstance expectedStart = NodeInstance.builder().name("start").containerId(CONTAINER_ID).nodeType("StartNode").completed(true).processInstanceId(processInstanceId).build();
nodeInstance = instances.get(0);
assertNodeInstance(expectedStart, nodeInstance);
assertNull(nodeInstance.getWorkItemId());
assertNotNull(nodeInstance.getDate());
instances = queryClient.findNodeInstances(processInstanceId, 0, 10);
assertNotNull(instances);
assertEquals(3, instances.size());
nodeInstance = instances.get(0);
assertNodeInstance(expectedFirstTask, nodeInstance);
assertNotNull(nodeInstance.getWorkItemId());
assertNotNull(nodeInstance.getDate());
nodeInstance = instances.get(1);
assertNodeInstance(expectedStart, nodeInstance);
assertNull(nodeInstance.getWorkItemId());
assertNotNull(nodeInstance.getDate());
nodeInstance = instances.get(2);
expectedStart.setCompleted(false);
assertNodeInstance(expectedStart, nodeInstance);
assertNull(nodeInstance.getWorkItemId());
assertNotNull(nodeInstance.getDate());
} finally {
processClient.abortProcessInstance(CONTAINER_ID, processInstanceId);
}
}
Aggregations