3 Replies Latest reply on Feb 9, 2006 2:53 PM by eskina eskina

    TaskAssignmentDbTestPooled

    eskina eskina Newbie

      Hi!

      I'm working with jbpm-starters-kit-3.1-beta3 and DB2...and I'm testing this class:

      package org.jbpm.taskmgmt.exe;

      import java.util.Arrays;
      import java.util.HashSet;
      import java.util.Iterator;
      import java.util.List;
      import java.util.Set;

      import org.apache.commons.logging.Log;
      import org.apache.commons.logging.LogFactory;
      import org.jbpm.db.AbstractDbTestCase;
      import org.jbpm.graph.def.ProcessDefinition;
      import org.jbpm.graph.exe.ExecutionContext;
      import org.jbpm.graph.exe.ProcessInstance;
      import org.jbpm.taskmgmt.def.AssignmentHandler;

      public class TaskAssignmentDbTestPooled extends AbstractDbTestCase {

      public static class PoolAssignmentHandler implements AssignmentHandler {
      private static final long serialVersionUID = 1L;
      public void assign(Assignable assignable, ExecutionContext executionContext) throws Exception {
      assignable.setPooledActors(new String[]{"bert", "ernie", "flavio"});
      System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>PoolAssignmentHandler: " + assignable);
      }
      }

      public void testPooledTasklist() {
      ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
      "<process-definition>" +
      " <start-state name='pooledActorAssignment'>" +
      " " +
      " </start-state>" +
      " <task-node name='work'>" +
      " " +
      " " +
      " " +
      " </task-node>" +
      "</process-definition>"
      );
      graphSession.saveProcessDefinition(processDefinition);

      ProcessInstance processInstance = new ProcessInstance(processDefinition);
      processInstance.signal();
      jbpmContext.save(processInstance);

      newTransaction();

      List taskInstances = taskMgmtSession.findPooledTaskInstances("bert");
      assertNotNull(taskInstances);
      assertEquals(1, taskInstances.size());
      TaskInstance taskInstance = (TaskInstance) taskInstances.get(0);
      assertEquals("teste", taskInstance.getName());
      assertNull(taskInstance.getActorId());
      }

      private static final Log log = LogFactory.getLog(TaskAssignmentDbTestPooled.class);

      }


      After testing I have this results on the table(DB2):

      JBPM_POOLEDACTOR
      ID ACTORID_
      1 flavio
      2 ernie
      3 bert

      JBPM_TASKACTORPOOL
      TASKINSTANCE_ POOLEDACTOR_
      1 1
      1 2
      1 3

      JBPM_TASKINSTANCE
      ID_ CLASS_ NAME_ DESCRIPTION_ ACTORID_
      1 T teste null null


      Can't assignment TASKINSTANCE for POOLEDACTOR, ACTORID_ in TASKINSTANCE is null....

      Please help me!