JBoss Community

jBPM 3.2 Setting parameter in SeamTest FacesRequest

created by maelstorm in jBPM - View the full discussion

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

 

@Stateful

@Name("taskController")

public class TaskController implements TaskControllerAction{

     ...

     @In(required=false)

     ProcessInstance processInstance;

   

     @In(required=false)

     TaskInstance taskInstance;

     ...

     @StartTask

     @EndTask

     public void completeTask(){

          ...

     }

     ...

}

 

 

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

But on calling

 

taskController.completeTask();

 

 

or inside FacesRequest invokeApplication method

 

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

 

 

I get exception

 

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

 

 

 

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.

 

<s:button value="Go To Node 4" action="#{taskController.completeAndGoTo4()}" taskInstance="#error.notfound.task" />

 

 

I am using jBPM 3.2 and Seam 2.2

 

Thanks in advance

Reply to this message by going to Community

Start a new discussion in jBPM at Community