[jboss-user] [JBoss jBPM] - Help:type of nodes returned by root.getNode() is unnarrowed
gmournos
do-not-reply at jboss.com
Tue Oct 3 08:02:40 EDT 2006
I have created a custom node type and I need to cast to it during the workflow execution.
However, when I cast the result of calling token.getNode() to my custom type, I get a ClassCastException, although the token is at my custom node at the time.
My code is complicated so I created a simple test case, and added it to the already existing GraphSessionDbTest.java (basically I just added three assertions to the existing test case).
The test case breaks, in the third assertion. The node has name 's' but it is not an instance of StartState...
| // added to jbpm-3.1/src/java.jbpm.test/org/jbpm/db/GraphSessionDbTest.java
|
| public void testUpdateProcessInstance2() {
| ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
| "<process-definition>" +
| " <start-state name='s' />" +
| " <node name='n' />" +
| "</process-definition>");
|
| processDefinition = saveAndReload(processDefinition);
|
| ProcessInstance processInstance = new ProcessInstance(processDefinition);
|
| processInstance = saveAndReload(processInstance);
| long pid = processInstance.getId();
|
| //this is the actual part added to the already existing testUpdateProcessInstance() case
| assertNotNull(processInstance.getRootToken().getNode());
| assertTrue(processInstance.getRootToken().getNode() instanceof Node);
| assertTrue(processInstance.getRootToken().getNode() instanceof StartState);
|
| assertEquals("s", processInstance.getRootToken().getNode().getName());
| processInstance.getRootToken().setNode(processInstance.getProcessDefinition().getNode("n"));
|
| processInstance = saveAndReload(processInstance);
| assertEquals("n", processInstance.getRootToken().getNode().getName());
| assertEquals(pid, processInstance.getId());
| }
|
|
Is this normal?
I am not a hibernate expert.
In my normal code (not when I am running the simple test case), during the execution of signal() I get hibernate warnings of the type:
14:01:34,429 [main] WARN StatefulPersistenceContext : Narrowing proxy to class org.jbpm.graph.node.StartState - this operation breaks ==
|
Are these relevant?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3975716#3975716
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3975716
More information about the jboss-user
mailing list