0 Replies Latest reply on Feb 15, 2013 5:09 AM by wishmaster7

    jBPM 5.4 - setNode ?

    wishmaster7 Newbie

      Hi all,


      I am quite new with jBPM and in my project the customer wants to be able to change manually the current state of the process. I've red some threads about setNode() but I'm unable to reach this method. Someone could please help me?



      I have a small jUnit test class which extends JbpmJUnitTestCase, and my method looks like :


              // start context

              KnowledgeBase kbase = createKnowledgeBase("bpmn/TestSetNode.bpmn");

              StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);

              TestWorkItemHandler testHandler = new TestWorkItemHandler();

              ksession.getWorkItemManager().registerWorkItemHandler("Human Task", testHandler);


              // start process

              ProcessInstance processInstance = ksession.startProcess("ch.orange.mnp.test.SetNode", null);

              assertNodeTriggered(processInstance.getId(), "Start");


              // find the user task

              assertEquals(ProcessInstance.STATE_ACTIVE, processInstance.getState());

              //ksession = restoreSession(ksession, true);

              WorkItem workItem = testHandler.getWorkItem();


              assertEquals("admin", workItem.getParameter("GroupId"));



      I can call ksession.getWorkItemManager().completeWorkItem(workItem.getId(), null); to complete the User Task. But instead, I want to change the actual state of the process, let's say set it to "Script Task 1". How can I do that?