Hi,
I have this problem: some process definition using decisions worked well on JBPM 3.1.4,
but when i tried upgrading to 3.2GA, it always chose the default transition (no decision
was correctly evaluated).
After some tries, I've seen that the conditions simply do not work in that syntax -
using the 'expression' as ATTRIBUTE of the condition tag - but works in the
alternate one: using expression as child element.
Is this normal in 3.2 ?
from the userguide (18.4.29. condition):
"{content} For backwards compatibility, the condition can also be entered with the
'expression' attribute, but that attribute is deprecated since 3.2"
if it's still allowed (even deprecated), i was expecting it to still work, somehow...
this junit test shows this:
| import junit.framework.TestCase;
| import org.jbpm.graph.def.ProcessDefinition;
| import org.jbpm.graph.exe.ProcessInstance;
|
| /**
| * JUnit test of JBPM to check issues regarding the sintax of conditional
transitions.<br>
| * In 3.2 it seems that using the 'expression' ATTRIBUTE of the
<condition> tag does not
| * work! (but only the alternative, where the expression is passed as a child element
of the tag!)
| */
| public class TestDecisionAndConditionalTransitions extends TestCase
| {
|
| public void testDecision( )
| {
| String def1 = "<process-definition>" + "
<start-state>" + " <transition to='d' />"
| + " </start-state>" + " <decision
name='d'>"
| + " <transition name='t1'
to='a'>"
| + " <condition>#{a ==
'1'}</condition>" + " </transition>"
| + " <transition name='t2'
to='b'>"
| + " <condition>#{a ==
'2'}</condition>" + " </transition>"
| + " <transition name='t3'
to='c'>"
| + " <condition>#{a ==
'3'}</condition>" + " </transition>"
| + " </decision>" + " <state
name='a' />" + " <state name='b' />"
| + " <state name='c' />" +
"</process-definition>";
|
| String def2 = "<process-definition>" + "
<start-state>" + " <transition to='d' />"
| + " </start-state>" + " <decision
name='d'>"
| + " <transition name='t1'
to='a'>"
| + " <condition expression=\"#{a ==
'1'\"/>" + " </transition>"
| + " <transition name='t2'
to='b'>"
| + " <condition expression=\"#{a ==
'2'\"/>" + " </transition>"
| + " <transition name='t3'
to='c'>"
| + " <condition expression=\"#{a ==
'3'\"/>" + " </transition>"
| + " </decision>" + " <state
name='a' />" + " <state name='b' />"
| + " <state name='c' />" +
"</process-definition>";
|
| ProcessDefinition processDefinition1 = ProcessDefinition.parseXmlString( def1
);
| ProcessDefinition processDefinition2 = ProcessDefinition.parseXmlString( def2
);
|
| //test def 1 - should work
| ProcessInstance processInstance = new ProcessInstance( processDefinition1 );
| processInstance.getContextInstance( ).setVariable( "a",
"2" );
| processInstance.signal( );
| assertEquals( processDefinition1.getNode( "b" ),
| processInstance.getRootToken( ).getNode( ) );
|
| //test def 2 - doesn't work on JBPM 3.2 ? (but used to work on 3.1.4 ?)
| ProcessInstance processInstance2 = new ProcessInstance( processDefinition2 );
| processInstance2.getContextInstance( ).setVariable( "a",
"2" );
| processInstance2.signal( );
| assertEquals( processDefinition2.getNode( "b" ),
| processInstance2.getRootToken( ).getNode( ) );
| }
| }
| anonymous wrote :
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4039931#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...