JBoss Community

Re: How to make a process instance go on with jBPM5?

created by Esteban Aliverti in jBPM - View the full discussion

If you want to start a process in one test and complete it in another, you will need to follow these steps:

  • Your process must have a wait-state. If it doesn't the process will start and end in the startProcess() call.
  • You need to enable persistence. When the process reaches the wait-state in the first test it will be persisted in the DB.
  • The second test needs to know the session id generated in the first test. You can get this id from the session object created in the first test. You wil need to store it in a place reachable by the second test. If you want to keep it simple, just use a static variable.
  • Whithin the first test, your process will eventually execute the Handler you have configured for your Work Item. This handler will need to store the workItem id somewhere (again, in a place reachable by test number 2)
  • In the second test, using the session id stored in th efirst test, you need to retrieve the session from the database. The best way to do this is using JPAKnowledgeService.
  • Once you have the session, you need to call session.getWorkItemManager().completeWorkItem() using the work item id previously saved. 

 

Best Regards,

Reply to this message by going to Community

Start a new discussion in jBPM at Community