cancel
Showing results for 
Search instead for 
Did you mean: 

TaskListener doesn't call

yuriyk
Champ in-the-making
Champ in-the-making
Hello everyone,

I'm trying to use TaslListener for dynamic assining candidads.

    <userTask id="HTask" name="HTask" activiti:assignee="${initiator}">
    <documentation>Write something.</documentation>
      <extensionElements>
        <activiti:taskListener event="assignment" class="org.bpmnwithactiviti.dzone.pizzaorder.MyAssignmentHandler"></activiti:taskListener>
        <activiti:taskListener event="create" class="org.bpmnwithactiviti.dzone.pizzaorder.MyAssignmentHandler"></activiti:taskListener>
      </extensionElements>
    </userTask>

public class MyAssignmentHandler implements TaskListener {   public void notify(TaskEntity task) {
                  task.addCandidateUser("testUser1");
   }

The problem is that when I try to test it with JUnit, my class "MyAssignmentHandler" isn't called at all. Essentially I can enev wrtite "bla-bla-bla" instead classname in XML and test complete successful.

I don't understand what is wrong wit my code?
6 REPLIES 6

yuriyk
Champ in-the-making
Champ in-the-making
Here is the task description
    <userTask id="HTask" name="HTask" activiti:candidateUsers="${initiator}">
      <extensionElements>
        <activiti:taskListener event="assignment" class="org.bpmnwithactiviti.dzone.pizzaorder.MyAssignmentHandler"></activiti:taskListener>
        <activiti:taskListener event="create" class="org.bpmnwithactiviti.dzone.pizzaorder.MyAssignmentHandler"></activiti:taskListener>
      </extensionElements>
    </userTask>

trademak
Star Contributor
Star Contributor
From first sight it looks ok. Can you create a unit test project and attach it to this post? Then I'll give it a try and see what's wrong.

Best regards,

yuriyk
Champ in-the-making
Champ in-the-making
I don't know how attach project because only text files can be attached.
So I attached Unit test class.

-
Yuriy

trademak
Star Contributor
Star Contributor
Just attach a project with a .txt extension.

Best regards,

yuriyk
Champ in-the-making
Champ in-the-making
Renamed project from *.zip to *.zip.txt and attached.
Let me know if you need somthing else.

-
Yuriy

yuriyk
Champ in-the-making
Champ in-the-making
Sorry, it was my mistake.
I used old activity libraries. I changed the libraries hope the prolems will be resolved.

-
Yuriy