use of org.jbpm.services.api.ProcessInstanceNotFoundException in project jbpm by kiegroup.
the class UserTaskServiceImplTest method cleanup.
@After
public void cleanup() {
if (processInstanceId != null) {
try {
// let's abort process instance to leave the system in clear state
processService.abortProcessInstance(processInstanceId);
ProcessInstance pi = processService.getProcessInstance(processInstanceId);
assertNull(pi);
} catch (ProcessInstanceNotFoundException e) {
// ignore it as it might already be completed/aborted
}
}
cleanupSingletonSessionId();
if (units != null && !units.isEmpty()) {
for (DeploymentUnit unit : units) {
try {
deploymentService.undeploy(unit);
} catch (Exception e) {
// do nothing in case of some failed tests to avoid next test to fail as well
}
}
units.clear();
}
close();
}
use of org.jbpm.services.api.ProcessInstanceNotFoundException in project jbpm by kiegroup.
the class ProcessServiceImplWithDeploymentIdTest method testStartProcessAndAbortAlreadyAborted.
@Test
public void testStartProcessAndAbortAlreadyAborted() {
assertNotNull(deploymentService);
KModuleDeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
Map<String, Object> params = new HashMap<String, Object>();
params.put("approval_document", "test");
params.put("approval_reviewComment", "need review");
long processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument", params);
assertNotNull(processInstanceId);
processService.abortProcessInstance(deploymentUnit.getIdentifier(), processInstanceId);
ProcessInstance pi = processService.getProcessInstance(deploymentUnit.getIdentifier(), processInstanceId);
assertNull(pi);
try {
processService.abortProcessInstance(deploymentUnit.getIdentifier(), processInstanceId);
fail("Process instance was aborted so process instance does not exist any more");
} catch (ProcessInstanceNotFoundException e) {
// expected
}
}
use of org.jbpm.services.api.ProcessInstanceNotFoundException in project jbpm by kiegroup.
the class RuntimeDataServiceImplSecurityTest method cleanup.
@After
public void cleanup() {
if (processInstanceId != null) {
try {
// let's abort process instance to leave the system in clear state
processService.abortProcessInstance(processInstanceId);
ProcessInstance pi = processService.getProcessInstance(processInstanceId);
assertNull(pi);
} catch (ProcessInstanceNotFoundException e) {
// ignore it as it was already completed/aborted
}
}
cleanupSingletonSessionId();
if (units != null && !units.isEmpty()) {
for (DeploymentUnit unit : units) {
try {
deploymentService.undeploy(unit);
} catch (Exception e) {
// do nothing in case of some failed tests to avoid next test to fail as well
}
}
units.clear();
}
close();
CountDownListenerFactory.clear();
}
use of org.jbpm.services.api.ProcessInstanceNotFoundException in project jbpm by kiegroup.
the class ProcessServiceImplPerProcessInstanceTest method testExecuteCommandWithContextOnAbortedProcess.
@Test
public void testExecuteCommandWithContextOnAbortedProcess() {
long processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), PROCESS_ID_HUMAN_TASK);
assertNotNull(processInstanceId);
processService.abortProcessInstance(processInstanceId);
try {
processService.execute(deploymentUnit.getIdentifier(), ProcessInstanceIdContext.get(processInstanceId), new GetProcessInstanceCommand(processInstanceId));
fail("Executing command with context on already aborted process instance should throw ProcessInstanceNotFoundException.");
} catch (ProcessInstanceNotFoundException e) {
// expected
}
}
use of org.jbpm.services.api.ProcessInstanceNotFoundException in project jbpm by kiegroup.
the class ProcessServiceImplTest method testStartProcessAndAbortAlreadyAborted.
@Test
public void testStartProcessAndAbortAlreadyAborted() {
assertNotNull(deploymentService);
KModuleDeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION);
deploymentService.deploy(deploymentUnit);
units.add(deploymentUnit);
Map<String, Object> params = new HashMap<String, Object>();
params.put("approval_document", "test");
params.put("approval_reviewComment", "need review");
long processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument", params);
assertNotNull(processInstanceId);
processService.abortProcessInstance(processInstanceId);
ProcessInstance pi = processService.getProcessInstance(processInstanceId);
assertNull(pi);
try {
processService.abortProcessInstance(processInstanceId);
fail("Process instance was aborted so process instance does not exist any more");
} catch (ProcessInstanceNotFoundException e) {
// expected
}
}
Aggregations