1 2 Previous Next 20 Replies Latest reply on Aug 12, 2006 11:06 AM by kukeltje Go to original post
      • 15. Re: Error in node-->TaskNode
        kukeltje

        oh.. and btw, try making a unit test of it, is easier for me to help out with

        • 16. Re: Error in node-->TaskNode
          kukeltje

          ok, out of curiosity, I made a unit test out of it and cannot reproduce your problem.

          The following testcase works with both jbpm 3.1 and cvs-head

          package my.tests.jbpm;
          
          import org.jbpm.graph.def.Node;
          import org.jbpm.graph.def.ProcessDefinition;
          import org.jbpm.graph.def.Transition;
          import org.jbpm.graph.node.TaskNode;
          import org.jbpm.instantiation.Delegation;
          import org.jbpm.taskmgmt.def.Task;
          
          
          import junit.framework.TestCase;
          
          public class MyTest extends TestCase {
          
           public void testStartNode() {
           ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
           "<process-definition xmlns='' name='myProcess'>" +
           " <start-state name='start'>" +
           " <transition name='to_task1' to='task1'></transition>" +
           " </start-state>" +
           " <task-node name='task1'>" +
           " <task name='first'>" +
           " <assignment class='com.test.assignment.PartMaster' config-type='bean'>" +
           " <groupName>leader</groupName>" +
           " </assignment>" +
           " </task>" +
           " <transition name='to_end1' to='end1'></transition>" +
           " </task-node>" +
           " <end-state name='end1'></end-state>" +
           "</process-definition>"
           );
          
           Node node = processDefinition.getNode("start");
           Transition tran = node.getLeavingTransition("to_task1");
           assertNotNull( tran );
           Node node2 = tran.getTo();
           assertEquals("task1", node2.getName());
           TaskNode tn = (TaskNode) node2;
           Task task = tn.getTask("first");
           assertNotNull("task is not 'first'", task);
           String delegationName = task.getAssignmentDelegation().getClassName();
           assertEquals("com.test.assignment.PartMaster", delegationName);
           }
          }
          


          So you are doing something wrong....

          • 17. Re: Error in node-->TaskNode
            kukeltje

            But I cannot see what. You have to find that out yourself

            • 18. Re: Error in node-->TaskNode

              thank you very much!
              i am debugging in my code:

              public class AjaxServletTest extends HttpServlet {
               protected void processRequest(HttpServletRequest request,
               HttpServletResponse response, String method)
               throws ServletException, IOException {
              
               JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
              
               String taskInstanceID = request.getParameter("taskInstanceID");
               String transitionIndex = request.getParameter("transitionIndex");
              
               long tasdInstanceIDLong = (new Long(taskInstanceID)).longValue();
               int transitionIndexInt = (new Integer(transitionIndex)).intValue();
              
               TaskMgmtSession taskMgmtSession = jbpmContext.getTaskMgmtSession();
              
               TaskInstance taskInstance = taskMgmtSession
               .loadTaskInstance(tasdInstanceIDLong);
              
               List availableTransitions = taskInstance.getAvailableTransitions();
               Transition transition = (Transition) availableTransitions.get(transitionIndexInt);
               Node node = transition.getTo();
               TaskNode taskNode=(TaskNode) node;
               Task tptask = taskNode.getTask("JiHongFirstTask");
               PartMaster parma = (PartMaster) tptask.getAssignmentDelegation().getInstance();
               String tpstr = parma.getGroupName();
               }
              }

              hope you understand this!

              • 19. Re: Error in node-->TaskNode

                oh,sorry!
                "JiHongFirstTask" should be changed "first" of taskname of ProcessDefinition in upper code!

                • 20. Re: Error in node-->TaskNode
                  kukeltje

                  PLEASE WRITE A UNIT TEST!!!!!! OR POST THE FULL STACKTRACE WHERE YOU GET THE ERROR (no my keyboard is not stuck)

                  and now you posted at least some additional code it is clear that I did something completely different in my test. I used a process definition and you use a process instance. Ok, so I changed my test case a little, and it still works.

                  So you are either in a different node type or something else. If you do not post a good stacktrace with a unit test in the next post, I have to stop helping you. It is taking up to much from my time and leads to nothing

                  _________________
                  Ronald
                  A kind jBPM user and forum addict

                  1 2 Previous Next