assertEquals(2, processDefinitionsModel2.size());
assertEquals(1, processDefinitionsModel2.get(0).getVersion());
assertEquals(2, processDefinitionsModel2.get(1).getVersion());
// old deployment was resumed
ProcessApplicationRegistration registration = deployment2.getProcessApplicationRegistration();
Set<String> deploymentIds = registration.getDeploymentIds();
assertEquals(2, deploymentIds.size());
BpmnModelInstance anotherChangedModel2 = Bpmn.createExecutableProcess("process2").startEvent().endEvent().done();
// testing with a third deployment to ensure the change check is not only performed against
// the last version of the deployment
ProcessApplicationDeployment deployment3 = repositoryService.createDeployment(processApplication.getReference())
.enableDuplicateFiltering(true)
.resumePreviousVersions()
.addModelInstance("process1.bpmn20.xml", model1)
.addModelInstance("process2.bpmn20.xml", anotherChangedModel2)
.name("deployment")
.deploy();
// there should still be one version of process 1
assertEquals(1, repositoryService.createProcessDefinitionQuery().processDefinitionKey("process1").count());
// there should be three versions of process 2
assertEquals(3, repositoryService.createProcessDefinitionQuery().processDefinitionKey("process2").count());
// old deployments are resumed
registration = deployment3.getProcessApplicationRegistration();
deploymentIds = registration.getDeploymentIds();
assertEquals(3, deploymentIds.size());
repositoryService.deleteDeployment(deployment1.getId(), true);
repositoryService.deleteDeployment(deployment2.getId(), true);
repositoryService.deleteDeployment(deployment3.getId(), true);