package com.test; import junit.framework.TestCase; import org.jbpm.api.Configuration; import org.jbpm.api.ExecutionService; import org.jbpm.api.ProcessEngine; import org.jbpm.api.ProcessInstance; import org.jbpm.api.RepositoryService; public class HelloTest extends TestCase { ProcessEngine processEngine = null; String deployId = null; //主要是用来发布流程 RepositoryService repositoryService = null; //主要用来启动流程,执行流程 ExecutionService executionService = null; protected void setUp() { processEngine = new Configuration().buildProcessEngine(); repositoryService = processEngine.getRepositoryService(); executionService = processEngine.getExecutionService(); //将定义的流程配置文件部署到数据库中 deployId = repositoryService.createDeployment().addResourceFromClasspath("test.jpdl.xml").deploy(); System.out.println("---"+deployId); } protected void tearDown() { // repositoryService.deleteDeploymentCascade(deployId); } public void testEndHelloWorld() { //启动流程实例 ProcessInstance processInstance =executionService.startProcessInstanceByKey("william"); // executionService.startProcessInstanceByKey("test"); //启动流程后我们的流程会自动进入到state1活动,并处在等待状态 assertTrue(processInstance.isActive("state1")); // String pid = processInstance.getId(); // //让state1活动继续往下执行,并进入结束活动,流程结束 // processInstance = executionService.signalExecutionById(pid); // assertTrue(processInstance.isEnded()); } }
Jbpm test
猜你喜欢
转载自oywl2008.iteye.com/blog/1908472
今日推荐
周排行