AnsweredAssumed Answered

Variables Not Populated in Some ServiceTask in Unit Test but Working in Activiti Explorer

Question asked by xsa on Nov 9, 2015
Latest reply on Nov 12, 2015 by xsa
Hi All,

I'm a new user of Activiti BPMS. Now I have very strange behavior. I have Activiti's model as follow:
[img]http://s29.postimg.org/dumgzpdd3/reinsurance_v2.png[/img]

As we can see, it contains:
  • User Tasks: Receive an Offers, Input Ceding Application, and Ceding Application Acceptance Process, and
  • Service Tasks: Check for Facultative Code …. , Saving Ceding Application, and Update Master Data.
The problem is, when executing in unit test:

  • Receive an Offers -> Check for Facultative Code …. : On this task, all variables from "Receive an Offers" is obtained without any problem.
  • Input Ceding Application -> Save Ceding Application: Only variables from "Receive an Offers" is available. No variables that comes from "Input Ceding Application" is available.
  • Ceding Application Acceptance Process -> Update Master Data: Only variables from "Receive and offers" and "Input Ceding Application" is available. Form data from "Ceding Application Acceptance Process" is not available.
This is log comes when executing the unit test code:

>>> execute() in FacultativeCodeAndBusinessClassifiedHandler. Variables={business_classified=Others, facultative_code=F004.25102015.0001, initiator=null}
….
>>> execute() method on CedingApplicationCreator. Variables:{facultative_code_and_business_class_valid=true, business_classified=Others, facultative_code=F004.25102015.0001, initiator=null}
….
>>> execute() in CedingApplicationUpdater. Variables={facultative_code_and_business_class_valid=true, business_classified=Others, facultative_code=F004.25102015.0002, ceding_address=Rasuna Said street, Central Jakarta, Indonesia, application_amount=0, ceding_contact_phone=+628123456789, share_in_percent=0.0, ceding_contact_email=someotherceding@mailinator.com, initiator=null, application_status=P11_Offer_In_Progress, ceding_name=Some Other Ceding}


On the other side, when I'm deploying the process to activiti explorer, I think I got the expected result. This is the logs from activiti explorer tomcat log:

>>> execute() in FacultativeCodeAndBusinessClassifiedHandler. Variables={business_classified=Others, facultative_code=123123, initiator=kermit}

>>> execute() method on CedingApplicationCreator. Variables:{facultative_code_and_business_class_valid=true, business_classified=Others, facultative_code=123123, ceding_address=Address 123, application_amount=0, ceding_contact_phone=123123123, share_in_percent=0, ceding_contact_email=email123@email.com, initiator=kermit, application_status=P11 - Offer In Process, ceding_name=Ceding 123}

>>> execute() in CedingApplicationUpdater. Variables={facultative_code_and_business_class_valid=true, business_classified=Others, facultative_code=123123, ceding_address=Address 123, application_amount=0, ceding_contact_phone=123123123, share_in_percent=0, ceding_contact_email=email123@email.com, initiator=kermit, ceding_application_accepted=true, application_status=P11 - Offer In Process, ceding_name=Ceding 123}


Currently, all of my JavaDelegate implementations only logging a messages with this one line:
<code language="java">
logger.info(">>> execute() method on CedingApplicationCreator. Variables:{}", execution.getVariables());
</code>

Now my questions:
  1. Is these all above is expected behavior? Is my unit test behave like my explanation above because I'm not including any IdentityService or any ***Service that should be used properly?
  2. What I need to complete to make unit test code works as expected as in activiti explorer?
  3. Do I use Activiti, especially the JavaDelegate in the wrong direction? (For example, use ***Listener in this case is more common instead of JavaDelegate, etc)
Thanks for any comments and suggestions.

Outcomes