6 Replies Latest reply on Jan 3, 2007 8:29 PM by Ronald van Kuijk

    Ok, what am I missing?

    Steve Otto Newbie

      I'm trying to understand the jBPM system.

      I've gone through the examples in the distro and I can successfully run all of them as JUnit tests. I did find one assertion failure BTW, where I had to change the number of tasks from 1 to 3. Small glitch, no biggie.

      So here is my question: how do I step a workflow through a processdefinition that has a fork/join in it? I'm trying to step along using things like processInstance.signal()....but in the case of a fork, I will have multiple paths of execution yet there is only one RootToken. What do I do?

      In a sense, I'm trying to simulate the workflow....and I saw somewhere in the FAQs that jBPM does NOT support simulation. This remark by Tom has me concerned -- it seems like I am trying to do something that I cannot do.

      Thanks for any help,

      Steve (lost in Oregon)

        • 1. Re: Ok, what am I missing?
          Steve Otto Newbie


          Please, someone? If I am being stupid, just tell me where I should look...

          • 2. Re: Ok, what am I missing?
            Ronald van Kuijk Master

            be patient... you posted on thursday and expect an answer the next day??? come on....

            Stepping through a process with forks means you have to know which token to signal..... just store it somewhere with your other data

            Regarding the simulation, this means that jBPM ide does not support it. Since jbpm has a clean api, you can 'simulate' via unittests but this is not as advanced as other, high cost, engines have it.

            • 3. Re: Ok, what am I missing?
              Steve Otto Newbie

              Ronald, thanks for your help.

              I've been trying to follow your suggestion but I have been unable to get some thing to work.

              I've added the following test case to the HelloWorld test program in the distro.
              Could you tell me what I should do to follow the execution down "path2"?

              --steve

              public void testProcessWithForkAndJoin() {
               ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
               "<process-definition>" +
               " <start-state>" +
               " <transition to='phase one' />" +
               " </start-state>" +
               " <state name='phase one'>" +
               " <transition to='fork1' />" +
               " </state>" +
               " <fork name='fork1'>" +
               " <transition name='tr1' to='path1' />" +
               " <transition name='tr2' to='path2' />" +
               " </fork>" +
               " <state name='path1'>" +
               " <transition to='join1' />" +
               " </state>" +
               " <state name='path2'>" +
               " <transition to='join1' />" +
               " </state>" +
               " <join name='join1'>" +
               " <transition to='end' />" +
               " </join>" +
               " <end-state name='end' />" +
               "</process-definition>"
               );
              
               ProcessInstance processInstance =
               new ProcessInstance(processDefinition);
               Token token = processInstance.getRootToken();
               assertSame(processDefinition.getStartState(), token.getNode());
              
               token.signal();
               assertSame(processDefinition.getNode("phase one"), token.getNode());
              
               token.signal();
               assertSame(processDefinition.getNode("fork1"), token.getNode());
              
               token.signal("tr1");
               assertEquals("path1", token.getNode().getName());
              
               // correct up to here
               // how do I take path2? Nothing I've tried seems to work
              
               }
              


              • 4. Re: Ok, what am I missing?
                Ronald van Kuijk Master

                look at the testcases... there you will find exactely what you are looking for.

                • 5. Re: Ok, what am I missing?
                  Steve Otto Newbie

                  Ah!

                  Thanks again, Ronald.

                  I found what I was looking for in the directory java.jbpm.test, in the package:
                  org.jbpm.jpdl.patterns

                  Hopefully now I can progress up the learning curve.

                  --Steve

                  • 6. Re: Ok, what am I missing?
                    Ronald van Kuijk Master

                    you'll be surprised. it's not that steap or long. Just do *not* think in terms of prgrogramming (loops etc...)