[jboss-user] [jBPM] - Handling process state

David Jeeves do-not-reply at jboss.com
Sat May 29 20:11:24 EDT 2010


David Jeeves [http://community.jboss.org/people/jeevdav] replied to the discussion

"Handling process state"

To view the discussion, visit: http://community.jboss.org/message/545386#545386

--------------------------------------------------------------
This is what i am running.
testFindOne suceeds as expected, but testFindTwo and testFindThree fail unless all three are run together( when they are run together they use the same processengine and execution service)

The bottom line is that findProcessInstanceById works only when the same processengine is used. But in the realworld after i recycle my application how will i be able to resume my incomplete processes?
========================================================================
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);      
    
   }   
      
   

}
===========================
The test process
=======================
+<?xml version="1.0" encoding="UTF-8"?>+
+<process name="Proc" xmlns=" http://jbpm.org/4.3/jpdl http://jbpm.org/4.3/jpdl">
   <start name="start1" g="121,59,48,48">
      <transition name="to a" to="a" g="-25,-20"/>
   </start>
   <state name="a" g="107,134,92,52">
      <transition name="to b" to="b" g="-26,-20"/>
   </state>
   <state name="b" g="111,207,92,52">
      <transition name="to c" to="c" g="-25,-20"/>
   </state>
   <state name="c" g="118,271,92,52">
      <transition name="to end1" to="end1" g="-45,-20"/>
   </state>
   <end name="end1" g="134,344,48,48"/>
</process>+

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/545386#545386]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100529/ad7d21eb/attachment-0001.html 


More information about the jboss-user mailing list