`
oywl2008
  • 浏览: 1001734 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

Jbpm test

    博客分类:
  • jBPM
 
阅读更多
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());  
     } 
     
}

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics