use of org.drools.core.command.runtime.process.GetProcessInstanceCommand 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.drools.core.command.runtime.process.GetProcessInstanceCommand in project jbpm by kiegroup.
the class ProcessServiceEJBIntegrationTest method testStartProcessAndExecuteCmd.
@Test
public void testStartProcessAndExecuteCmd() {
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.execute(deploymentUnit.getIdentifier(), new GetProcessInstanceCommand(processInstanceId));
assertNotNull(pi);
processService.abortProcessInstance(processInstanceId);
pi = processService.getProcessInstance(processInstanceId);
assertNull(pi);
}
use of org.drools.core.command.runtime.process.GetProcessInstanceCommand in project drools by kiegroup.
the class CommandBasedStatefulKnowledgeSession method getProcessInstance.
public ProcessInstance getProcessInstance(long id, boolean readOnly) {
GetProcessInstanceCommand command = new GetProcessInstanceCommand();
command.setProcessInstanceId(id);
command.setReadOnly(readOnly);
return runner.execute(command);
}
use of org.drools.core.command.runtime.process.GetProcessInstanceCommand in project jbpm by kiegroup.
the class ProcessServiceImplPerProcessInstanceTest method testExecuteCommandOnAbortedProcess.
@Test
public void testExecuteCommandOnAbortedProcess() {
long processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), PROCESS_ID_HUMAN_TASK);
assertNotNull(processInstanceId);
processService.abortProcessInstance(processInstanceId);
try {
processService.execute(deploymentUnit.getIdentifier(), new GetProcessInstanceCommand(processInstanceId));
fail("Executing command on already aborted process instance should throw ProcessInstanceNotFoundException.");
} catch (ProcessInstanceNotFoundException e) {
// expected
}
}
use of org.drools.core.command.runtime.process.GetProcessInstanceCommand in project jbpm by kiegroup.
the class ProcessServiceImplTest method testStartProcessAndExecuteCmd.
@Test
public void testStartProcessAndExecuteCmd() {
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.execute(deploymentUnit.getIdentifier(), new GetProcessInstanceCommand(processInstanceId));
assertNotNull(pi);
processService.abortProcessInstance(processInstanceId);
pi = processService.getProcessInstance(processInstanceId);
assertNull(pi);
}
Aggregations