0 Replies Latest reply on Jul 26, 2013 7:50 AM by maelstorm

    jBPM 3.2 Setting parameter in SeamTest FacesRequest

    maelstorm

      Hi guys,

      I am trying to write test for my testing application. I have component containing method for beginning and ending task at the same time. I wrote test (using TestNG, test class extends SeamTest) where I start Process (in Component test). token moves correctly to next Node. Then I try to call method completeTask

       

      {code}

      @Stateful

      @Name("taskController")

      public class TaskController implements TaskControllerAction{

           ...

           @In(required=false)

           ProcessInstance processInstance;

       

           @In(required=false)

           TaskInstance taskInstance;

           ...

           @StartTask

           @EndTask

           public void completeTask(){

                ...

           }

           ...

      }

      {code}

       

      on my Seam component, where ProcessInstance and TaskInstance are injected.

      But on calling

       

      {code}taskController.completeTask();{code}

       

      or inside FacesRequest invokeApplication method

       

      {code}invokeMethod("#{taskController.completeTask}");{code}

       

      I get exception

       

      {code}javax.ejb.EJBException: java.lang.IllegalStateException: task/process id may not be null{code}

       

       

      I tried to create new FacesRequest, where I set context variables using setPageParameter, setValue and Contexts.getBusinessProcessContext().set methods (lots of combinations), but none of them actually works, still getting same error). I tried to set manually processInstance and taskInstance variables in mentioned component, but it doesn't work.

      I know I can call singal() method to go further in graph, but in this case, next transition depends on what method is called.

       

      Is there any way how to set TaskInstance parameter in FacesRequest? Something like the way in s:button it is done.

       

      {code}<s:button value="Go To Node 3" action="#{taskController.completeTask}" taskInstance="#{task}" />{code}

       

      I am using jBPM 3.2 and Seam 2.2

       

      Thanks in advance