use of org.jbpm.services.api.model.NodeInstanceDesc in project jbpm by kiegroup.
the class ProcessInstanceAdminServiceImplTest method testRetriggerNodeInstance.
@Test
public void testRetriggerNodeInstance() {
processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
assertNotNull(processInstanceId);
Collection<NodeInstanceDesc> activeNodes = processAdminService.getActiveNodeInstances(processInstanceId);
assertNotNull(activeNodes);
assertEquals(1, activeNodes.size());
NodeInstanceDesc active = activeNodes.iterator().next();
assertEquals("Write a Document", active.getName());
List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter());
assertEquals(1, tasks.size());
TaskSummary task = tasks.get(0);
processAdminService.retriggerNodeInstance(processInstanceId, active.getId());
activeNodes = processAdminService.getActiveNodeInstances(processInstanceId);
assertNotNull(activeNodes);
assertEquals(1, activeNodes.size());
NodeInstanceDesc activeRetriggered = activeNodes.iterator().next();
assertFalse(active.getId().longValue() == activeRetriggered.getId().longValue());
tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter());
assertEquals(1, tasks.size());
TaskSummary taskRetriggered = tasks.get(0);
assertFalse(task.getId().longValue() == taskRetriggered.getId().longValue());
}
use of org.jbpm.services.api.model.NodeInstanceDesc in project jbpm by kiegroup.
the class RuntimeDataServiceEJBIntegrationTest method testGetNodeInstanceForWorkItem.
@Test
public void testGetNodeInstanceForWorkItem() {
processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
assertNotNull(processInstanceId);
ProcessInstance instance = processService.getProcessInstance(processInstanceId);
assertNotNull(instance);
Collection<NodeInstance> activeNodes = ((WorkflowProcessInstanceImpl) instance).getNodeInstances();
assertNotNull(activeNodes);
assertEquals(1, activeNodes.size());
NodeInstance node = activeNodes.iterator().next();
assertNotNull(node);
assertTrue(node instanceof WorkItemNodeInstance);
Long workItemId = ((WorkItemNodeInstance) node).getWorkItemId();
assertNotNull(workItemId);
NodeInstanceDesc desc = runtimeDataService.getNodeInstanceForWorkItem(workItemId);
assertNotNull(desc);
assertEquals(processInstanceId, desc.getProcessInstanceId());
assertEquals("Write a Document", desc.getName());
assertEquals("HumanTaskNode", desc.getNodeType());
}
use of org.jbpm.services.api.model.NodeInstanceDesc in project jbpm by kiegroup.
the class RuntimeDataServiceEJBIntegrationTest method testGetProcessInstanceHistory.
@Test
public void testGetProcessInstanceHistory() {
processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
assertNotNull(processInstanceId);
// get active nodes as history view
Collection<NodeInstanceDesc> instances = runtimeDataService.getProcessInstanceHistoryActive(processInstanceId, new QueryContext());
assertNotNull(instances);
assertEquals(1, instances.size());
// get completed nodes as history view
instances = runtimeDataService.getProcessInstanceHistoryCompleted(processInstanceId, new QueryContext());
assertNotNull(instances);
assertEquals(1, instances.size());
// get both active and completed nodes as history view
instances = runtimeDataService.getProcessInstanceFullHistory(processInstanceId, new QueryContext());
assertNotNull(instances);
assertEquals(3, instances.size());
// get nodes filtered by type - start
instances = runtimeDataService.getProcessInstanceFullHistoryByType(processInstanceId, EntryType.START, new QueryContext());
assertNotNull(instances);
assertEquals(2, instances.size());
// get nodes filtered by type - end
instances = runtimeDataService.getProcessInstanceFullHistoryByType(processInstanceId, EntryType.END, new QueryContext());
assertNotNull(instances);
assertEquals(1, instances.size());
}
use of org.jbpm.services.api.model.NodeInstanceDesc in project jbpm by kiegroup.
the class ProcessServiceEJBIntegrationTest method testStartProcessAndAbortWorkItem.
@Test
public void testStartProcessAndAbortWorkItem() {
assertNotNull(deploymentService);
KModuleDeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
boolean isDeployed = deploymentService.isDeployed(deploymentUnit.getIdentifier());
assertTrue(isDeployed);
assertNotNull(processService);
long processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
assertNotNull(processInstanceId);
ProcessInstance pi = processService.getProcessInstance(processInstanceId);
assertNotNull(pi);
Collection<NodeInstanceDesc> activeNodes = runtimeDataService.getProcessInstanceHistoryActive(processInstanceId, new QueryContext());
assertNotNull(activeNodes);
assertEquals(1, activeNodes.size());
assertEquals("Write a Document", activeNodes.iterator().next().getName());
processService.abortWorkItem(activeNodes.iterator().next().getWorkItemId());
activeNodes = runtimeDataService.getProcessInstanceHistoryActive(processInstanceId, new QueryContext());
assertNotNull(activeNodes);
assertEquals(2, activeNodes.size());
Object variableValue = processService.getProcessInstanceVariable(processInstanceId, "approval_document");
assertNull(variableValue);
processService.abortProcessInstance(processInstanceId);
pi = processService.getProcessInstance(processInstanceId);
assertNull(pi);
}
use of org.jbpm.services.api.model.NodeInstanceDesc in project jbpm by kiegroup.
the class ProcessServiceEJBIntegrationTest method testStartProcessAndGetWorkItems.
@Test
public void testStartProcessAndGetWorkItems() {
assertNotNull(deploymentService);
KModuleDeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
boolean isDeployed = deploymentService.isDeployed(deploymentUnit.getIdentifier());
assertTrue(isDeployed);
assertNotNull(processService);
long processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
assertNotNull(processInstanceId);
ProcessInstance pi = processService.getProcessInstance(processInstanceId);
assertNotNull(pi);
Collection<NodeInstanceDesc> activeNodes = runtimeDataService.getProcessInstanceHistoryActive(processInstanceId, new QueryContext());
assertNotNull(activeNodes);
assertEquals(1, activeNodes.size());
assertEquals("Write a Document", activeNodes.iterator().next().getName());
List<WorkItem> wis = processService.getWorkItemByProcessInstance(processInstanceId);
assertNotNull(wis);
assertEquals(1, wis.size());
assertEquals("Human Task", wis.get(0).getName());
assertEquals("Write a Document", wis.get(0).getParameter("NodeName"));
processService.abortProcessInstance(processInstanceId);
pi = processService.getProcessInstance(processInstanceId);
assertNull(pi);
}
Aggregations