5 Replies Latest reply on Apr 4, 2007 8:25 AM by viniciuscarvalho

    Wait state how to?

    viniciuscarvalho

      Hello there! I have a simple process with few actions and one decision, one fork and one join. I can't post the actual process here due NDA but I'll change names and if needed I change the whole processdefinition and attach it here.
      My question is regarding wait states. I want to have a wait state on my process, but testing it, it runs an entire path without stopping (It does follow the correct path depending on decisions, but does not wait for other inputs). Here's how I'm testing it:

      @Before
      public void init(){
       this.processDefinition = ProcessDefinition.parseXmlInputStream(getClass().getClassLoader().getResourceAsStream("processdefinition.xml"));
      
       this.startState = (StartState) this.processDefinition.getStartState();
       this.endState = (EndState)this.processDefinition.getNode("end");
       this.processInstance = new ProcessInstance(this.processDefinition);
       this.token = processInstance.getRootToken();
      }
      @Test
       public void testMainFlow() throws Exception{
       this.token.signal();
       }
      


      My first action creates an hypothetical situation, that is latter checked in a transition:

       <start-state name="start">
       <transition name="" to="firstStep">
       <action name="action1" class="*.*.*.*.FirstNodeHandler"></action>
       </transition>
       </start-state>
      .
      .
      .
      <decision name="checkAmount">
      
       <transition name="Yes" to="Wait for approval">
       <condition><![CDATA[#{contagem < 500}]]></condition>
       </transition>
       <transition name="No" to="Approve">
       <condition><![CDATA[#{contagem > 500}]]></condition>
       </transition>
       </decision>
      


      What I'd want is the node "Wait for Approval" stay in a wait state untill other entity signals it. But it's just executing it and continuing the flow.
      What have I missed?

      Regards

        • 1. Re: Wait state how to?
          kukeltje

          look at the testcases in the source... so much info in there

          • 2. Re: Wait state how to?
            wjm

             


            What I'd want is the node "Wait for Approval" stay in a wait state untill other entity signals it. But it's just executing it and continuing the flow.
            What have I missed?


            Assuming "Wait for Approval" is a task-node, you have several options for making it sit on its hands. The node's signal attribute can be set, or its task(s) signalling attribute(s) can may be utilized. See chapter 18.4 (schema) of the userguide for details. Ordinary nodes dont have the signal attributes, but I imagine something could be done with an actionhandler to make things go slower....

            ----
            Bill



            • 3. Re: Wait state how to?
              kukeltje

              in 3.1 ordinary nodes were waitstates, in 3.2 this changed to it not being a wait state (afaik, or was that in the new upcomming core?)

              • 4. Re: Wait state how to?
                viniciuscarvalho

                 

                "kukeltje" wrote:
                in 3.1 ordinary nodes were waitstates, in 3.2 this changed to it not being a wait state (afaik, or was that in the new upcomming core?)


                I'm using 3.2, so does it mean that my ordinary node ain't in a wait state any longer?

                PS: I have checked the source, not the unit tests tough (checking it in a little bit)

                • 5. Re: Wait state how to?
                  viniciuscarvalho

                   

                  "kukeltje" wrote:
                  look at the testcases in the source... so much info in there

                  What I've noticed is the use of taskInstance.end() in every test. Looking at websale's test case I think my tests are just wrong :). But on the jbpm-console my process also starts and ends when I just click on the Start process. It does not sits on any wait states as the websale (waiting for a order for instance).