package
com.test;
import
junit.framework.TestCase;
import
org.jbpm.api.Configuration;import
org.jbpm.api.Execution;import
org.jbpm.api.ExecutionService;import
org.jbpm.api.HistoryService;import
org.jbpm.api.IdentityService;import
org.jbpm.api.ManagementService;import
org.jbpm.api.ProcessEngine;import
org.jbpm.api.ProcessInstance;import
org.jbpm.api.RepositoryService;import
org.jbpm.api.TaskService;
public
class TestJBPM extends TestCase{
protected static ProcessEngine processEngine = null;
protected static RepositoryService repositoryService;
protected static ExecutionService executionService;
protected static ManagementService managementService;
protected static TaskService taskService;
protected static HistoryService historyService;
protected static IdentityService identityService;
@Override
protected void setUp() throws Exception {
super.setUp();
if (processEngine==null) {
processEngine = Configuration.getProcessEngine();
repositoryService = processEngine.get(RepositoryService.class);
executionService = processEngine.getExecutionService();
historyService = processEngine.getHistoryService();
managementService = processEngine.getManagementService();
taskService = processEngine.getTaskService();
identityService = processEngine.getIdentityService();}
}
public void testFindOne() {
repositoryService.createDeployment().addResourceFromClasspath(
"com/test/Proc.jpdl.xml").deploy();
ProcessInstance processInstance =
executionService.startProcessInstanceByKey("Proc","t");System.
out.println("process id "+processInstance.getId());
Execution executionInA = processInstance.findActiveExecutionIn(
"a");assertNotNull(executionInA);
//processInstance = executionService.signalExecutionById(executionInA.getId());processInstance =
executionService.findProcessInstanceById("Proc.t");assertNotNull(processInstance);
}
public void testFindTwo() {
ProcessInstance processInstance =
executionService.findProcessInstanceById("Proc.t");assertNotNull(processInstance);
}
public void testFindThree() {
repositoryService.createDeployment().addResourceFromClasspath(
"com/test/Proc.jpdl.xml").deploy();
ProcessInstance processInstance =
executionService.findProcessInstanceById("Proc.t");assertNotNull(processInstance);
}
}