[JBoss jBPM] - Re: jBPM/Spring/jUnit
by pojomonkey
Handler code is:
import org.apache.commons.logging.Log;
| import org.apache.commons.logging.LogFactory;
| import org.jbpm.graph.def.ProcessDefinition;
| import org.jbpm.graph.exe.ExecutionContext;
| import org.jbpm.graph.exe.ProcessInstance;
| import org.jbpm.taskmgmt.def.AssignmentHandler;
| import org.jbpm.taskmgmt.exe.Assignable;
|
|
|
| public class NewProcessHandler implements AssignmentHandler {
| private static final long serialVersionUID = 1L;
|
| private final Log log = LogFactory.getLog(NewProcessHandler.class);
|
| public void assign(final Assignable assignable, final ExecutionContext executionContext) throws Exception {
| final ProcessInstance pi = executionContext.getProcessInstance();
| final ProcessDefinition pd = executionContext.getProcessInstance().getProcessDefinition();
| log.info("New process started: " + pd + " version " + pd.getVersion() + " key:" + pi.getKey());
| // Starts process
| executionContext.leaveNode();
| }
The only bit of stack trace I have handy is this:
anonymous wrote : org.jbpm.graph.def.DelegationException: com.xxx.bus.process.handler.NewProcessHandler
| at org.jbpm.taskmgmt.exe.TaskMgmtInstance.performAssignment(TaskMgmtInstance.java:216)
| at org.jbpm.taskmgmt.exe.TaskInstance.assign(TaskInstance.java:204)
| at org.jbpm.taskmgmt.exe.TaskMgmtInstance.createTaskInstance(TaskMgmtInstance.java:154)
| at org.jbpm.taskmgmt.exe.TaskMgmtInstance.createStartTaskInstance(TaskMgmtInstance.java:285)
| at com.xxx.bus.process.ProcessManagerImpl$2.doInJbpm(ProcessManagerImpl.java:174)
| at org.springmodules.workflow.jbpm31.JbpmTemplate.execute(JbpmTemplate.java:92)
| at com.xxx.bus.process.ProcessManagerImpl.startProcess(ProcessManagerImpl.java:150)
|
The actual ClassCastException is thrown in TaskMgmtInstance.performAssignmentDelegation():
AssignmentHandler assignmentHandler = (AssignmentHandler) assignmentDelegation.instantiate();
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4194049#4194049
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4194049
17 years, 4 months
[JBoss jBPM] - jBPM/Spring/jUnit
by pojomonkey
I am working on a application using Spring and jBPM. I'm also using springmodules for jBPM.
The application works fine, but so far I have avoided trying to create jUnit tests for the code that interacts with jBPM. This is in part due to the asynchronous activity associated with that, which makes it difficult to write application level tests.
Now that I've got a better grasp on it all, I'm trying to extend test coverage to include the application process flow elements.
The jUnit tests are base on Spring's AbstractJpaTests, and when the process is started, it should invoke the start-task assigment handler, but I get a DelegationException. This doesn't happen when the application runs normally.
Having spent about a day searching, reading and debugging, I could do with some clues as to where to look next.
I'd very much appreciate your suggestions. Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4193988#4193988
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4193988
17 years, 4 months