use of org.jbpm.services.api.model.ProcessInstanceDesc in project jbpm by kiegroup.
the class RuntimeDataServiceEJBIntegrationTest method testGetProcessInstanceById.
@Test
public void testGetProcessInstanceById() {
Collection<ProcessInstanceDesc> instances = runtimeDataService.getProcessInstances(new QueryContext());
assertNotNull(instances);
assertEquals(0, instances.size());
processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
assertNotNull(processInstanceId);
ProcessInstanceDesc instance = runtimeDataService.getProcessInstanceById(processInstanceId);
assertNotNull(instance);
assertEquals(1, (int) instance.getState());
assertEquals("org.jbpm.writedocument", instance.getProcessId());
processService.abortProcessInstance(processInstanceId);
instance = runtimeDataService.getProcessInstanceById(processInstanceId);
processInstanceId = null;
assertNotNull(instance);
assertEquals(3, (int) instance.getState());
assertEquals("org.jbpm.writedocument", instance.getProcessId());
}
use of org.jbpm.services.api.model.ProcessInstanceDesc in project jbpm by kiegroup.
the class RuntimeDataServiceEJBIntegrationTest method testGetProcessInstances.
@Test
public void testGetProcessInstances() {
Collection<ProcessInstanceDesc> instances = runtimeDataService.getProcessInstances(new QueryContext());
assertNotNull(instances);
assertEquals(0, instances.size());
processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
assertNotNull(processInstanceId);
instances = runtimeDataService.getProcessInstances(new QueryContext());
assertNotNull(instances);
assertEquals(1, instances.size());
assertEquals(1, (int) instances.iterator().next().getState());
processService.abortProcessInstance(processInstanceId);
processInstanceId = null;
instances = runtimeDataService.getProcessInstances(new QueryContext());
assertNotNull(instances);
assertEquals(1, instances.size());
assertEquals(3, (int) instances.iterator().next().getState());
}
use of org.jbpm.services.api.model.ProcessInstanceDesc in project jbpm by kiegroup.
the class RuntimeDataServiceEJBIntegrationTest method testGetProcessInstancesByVariable.
@Test
public void testGetProcessInstancesByVariable() {
Map<String, Object> params = new HashMap<String, Object>();
params.put("approval_document", "initial content");
processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument", params);
assertNotNull(processInstanceId);
Collection<ProcessInstanceDesc> processInstanceLogs = runtimeDataService.getProcessInstancesByVariable("approval_document", null, new QueryContext());
assertNotNull(processInstanceLogs);
assertEquals(1, processInstanceLogs.size());
processService.setProcessVariable(processInstanceId, "approval_document", "updated content");
processInstanceLogs = runtimeDataService.getProcessInstancesByVariable("approval_reviewComment", null, new QueryContext());
assertNotNull(processInstanceLogs);
assertEquals(0, processInstanceLogs.size());
processService.setProcessVariable(processInstanceId, "approval_reviewComment", "under review - content");
processInstanceLogs = runtimeDataService.getProcessInstancesByVariable("approval_reviewComment", null, new QueryContext());
assertNotNull(processInstanceLogs);
assertEquals(1, processInstanceLogs.size());
processService.abortProcessInstance(processInstanceId);
processInstanceId = null;
}
use of org.jbpm.services.api.model.ProcessInstanceDesc in project jbpm by kiegroup.
the class RuntimeDataServiceEJBIntegrationTest method testGetProcessInstancesByProcessNameAndState.
@Test
public void testGetProcessInstancesByProcessNameAndState() {
Collection<ProcessInstanceDesc> instances = runtimeDataService.getProcessInstances(new QueryContext());
assertNotNull(instances);
assertEquals(0, instances.size());
processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
assertNotNull(processInstanceId);
List<Integer> states = new ArrayList<Integer>();
// search for aborted only
states.add(3);
instances = runtimeDataService.getProcessInstancesByProcessName(states, "humanTaskSample", null, new QueryContext());
assertNotNull(instances);
assertEquals(0, instances.size());
processService.abortProcessInstance(processInstanceId);
processInstanceId = null;
instances = runtimeDataService.getProcessInstancesByProcessName(states, "humanTaskSample", null, new QueryContext());
assertNotNull(instances);
assertEquals(1, instances.size());
assertEquals(3, (int) instances.iterator().next().getState());
}
use of org.jbpm.services.api.model.ProcessInstanceDesc in project jbpm by kiegroup.
the class RuntimeDataServiceEJBIntegrationTest method testGetProcessInstancesByStateAndInitiator.
@Test
public void testGetProcessInstancesByStateAndInitiator() {
Collection<ProcessInstanceDesc> instances = runtimeDataService.getProcessInstances(new QueryContext());
assertNotNull(instances);
assertEquals(0, instances.size());
processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument");
assertNotNull(processInstanceId);
List<Integer> states = new ArrayList<Integer>();
// search for active only
states.add(1);
instances = runtimeDataService.getProcessInstances(states, "anonymous", new QueryContext());
assertNotNull(instances);
assertEquals(1, instances.size());
assertEquals(1, (int) instances.iterator().next().getState());
instances = runtimeDataService.getProcessInstances(states, "wrongUser", new QueryContext());
assertNotNull(instances);
assertEquals(0, instances.size());
processService.abortProcessInstance(processInstanceId);
processInstanceId = null;
instances = runtimeDataService.getProcessInstances(states, "anonymous", new QueryContext());
assertNotNull(instances);
assertEquals(0, instances.size());
}
Aggregations