cancel
Showing results for 
Search instead for 
Did you mean: 

Unit Testing for versions

zze_one
Champ on-the-rise
Champ on-the-rise
Hi,

I'm currently working on a customized version management of workflows.
So far so good, everything is working fine: A main process can call a specific version of a subprocess.

So next step is for me to write unit tests for this implementation.
For this, I simply need to deploy a main process, two sub processes, and direct my call activity to the correct sub process.

Unfortunately, using Activiti unit testing methodology, it looks like I can't deploy 2 bpmn files that have the same key (the equivalent of deploying twice the same bpmn file).

Is there a way for me to achieve this ?
Bellow is my simplified code and the error i get.

Thanks a lot,

Yohann


   @Deployment(resources = {"com/yo/poc/rest/CallActivityTest.myfirstMainProcess010.bpmn20.xml",
    "com/yo/poc/rest/CallActivityTest.myfirstCalledProcess010.bpmn20.xml",
    "com/yo/poc/rest/CallActivityTest.myfirstCalledProcess020.bpmn20.xml"})
   public void testMainProcessCallingLatestSubProcess() throws Exception {

      try {
      
         //TODO wrong if some process still in the db –> do your own test db
         List<ProcessDefinition> procDefs = repositoryService.createProcessDefinitionQuery().list();
         assertEquals(3, procDefs.size());
         
      } catch (Exception e) {
         Assert.fail("Something is wrong: " + e);
      }
      
   }


error : org.activiti.engine.ActivitiException: The deployment contains process definitions with the same key (process id atrribute), this is not allowed
3 REPLIES 3

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Yohann.


{"com/yo/poc/rest/CallActivityTest.myfirstMainProcess010.bpmn20.xml",
    "com/yo/poc/rest/CallActivityTest.myfirstCalledProcess010.bpmn20.xml",
    "com/yo/poc/rest/CallActivityTest.myfirstCalledProcess020.bpmn20.xml"})
Do your processes have same key?
Each process in one deployment has to have unique key.

Regards
Martin

zze_one
Champ on-the-rise
Champ on-the-rise
Yes they do have the same key.
And it make sens that for a deployment those should be unique.

But in order to test two versions of the same workflow, i need those two process definition that have the same id.
So what I'll try to deploy twice, but it looks like I can't do that with the @Deployment annotation.

Thanks Martin

jbarrez
Star Contributor
Star Contributor
No, the @Deployment can't have the same id twice. You will need to inspire you with that annotation and write one that does indeed do multiple deployments (one/file). Shouldn't be hard to do that I believe.