use of org.jbpm.services.api.model.ProcessInstanceDesc in project jbpm by kiegroup.
the class RuntimeDataServiceImplSecurityTest method testGetProcessInstancesByPartialProcessIdAndState.
@Test
public void testGetProcessInstancesByPartialProcessIdAndState() {
// let's grant managers role so process can be started
List<String> roles = new ArrayList<String>();
roles.add("managers");
roles.add("employees");
identityProvider.setRoles(roles);
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.getProcessInstancesByProcessId(states, "org.jbpm%", null, new QueryContext());
assertNotNull(instances);
assertEquals(0, instances.size());
processService.abortProcessInstance(processInstanceId);
processInstanceId = null;
instances = runtimeDataService.getProcessInstancesByProcessId(states, "org.jbpm%", 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 RuntimeDataServiceImplSecurityTest method testGetProcessInstancesByPartialProcessIdAndStateNoAccess.
@Test
public void testGetProcessInstancesByPartialProcessIdAndStateNoAccess() {
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.getProcessInstancesByProcessId(states, "org.jbpm%", null, new QueryContext());
assertNotNull(instances);
assertEquals(0, instances.size());
processService.abortProcessInstance(processInstanceId);
processInstanceId = null;
instances = runtimeDataService.getProcessInstancesByProcessId(states, "org.jbpm%", null, new QueryContext());
assertNotNull(instances);
assertEquals(0, instances.size());
}
use of org.jbpm.services.api.model.ProcessInstanceDesc in project jbpm by kiegroup.
the class RuntimeDataServiceImplSecurityTest method testGetProcessInstancesWithTimer.
@Test(timeout = 10000)
public void testGetProcessInstancesWithTimer() throws Exception {
// let's grant managers role so process can be started
List<String> roles = new ArrayList<String>();
roles.add("managers");
roles.add("employees");
identityProvider.setRoles(roles);
Collection<ProcessInstanceDesc> instances = runtimeDataService.getProcessInstances(new QueryContext());
assertNotNull(instances);
assertEquals(0, instances.size());
processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "timerprocess");
assertNotNull(processInstanceId);
instances = runtimeDataService.getProcessInstances(new QueryContext());
assertNotNull(instances);
assertEquals(1, instances.size());
assertEquals(1, (int) instances.iterator().next().getState());
identityProvider.setRoles(new ArrayList<>());
CountDownListenerFactory.getExisting("securityTest").waitTillCompleted();
identityProvider.setRoles(roles);
instances = runtimeDataService.getProcessInstances(new QueryContext());
assertNotNull(instances);
assertEquals(1, instances.size());
assertEquals(2, (int) instances.iterator().next().getState());
}
use of org.jbpm.services.api.model.ProcessInstanceDesc in project jbpm by kiegroup.
the class RuntimeDataServiceImplSecurityTest method testGetProcessInstances.
@Test
public void testGetProcessInstances() {
// let's grant managers role so process can be started
List<String> roles = new ArrayList<String>();
roles.add("managers");
roles.add("employees");
identityProvider.setRoles(roles);
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 RuntimeDataServiceImplTest method testGetProcessInstancesByProcessIdAndState.
@Test
public void testGetProcessInstancesByProcessIdAndState() {
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.getProcessInstancesByProcessId(states, "org.jbpm.writedocument", null, new QueryContext());
assertNotNull(instances);
assertEquals(0, instances.size());
processService.abortProcessInstance(processInstanceId);
processInstanceId = null;
instances = runtimeDataService.getProcessInstancesByProcessId(states, "org.jbpm.writedocument", null, new QueryContext());
assertNotNull(instances);
assertEquals(1, instances.size());
assertEquals(3, (int) instances.iterator().next().getState());
}
Aggregations