BpmnDeployer implements Deployer { protected void makeProcessDefinitionsConsistentWithPersistedVersions(ParsedDeployment parsedDeployment) { for (ProcessDefinitionEntity processDefinition : parsedDeployment.getAllProcessDefinitions()) { ProcessDefinitionEntity persistedProcessDefinition = bpmnDeploymentHelper.getPersistedInstanceOfProcessDefinition(processDefinition); if (persistedProcessDefinition != null) { processDefinition.setId(persistedProcessDefinition.getId()); processDefinition.setVersion(persistedProcessDefinition.getVersion()); processDefinition.setAppVersion(persistedProcessDefinition.getAppVersion()); processDefinition.setSuspensionState(persistedProcessDefinition.getSuspensionState()); } } }  @Override void deploy(DeploymentEntity deployment,
                       Map<String, Object> deploymentSettings); IdGenerator getIdGenerator(); void setIdGenerator(IdGenerator idGenerator); ParsedDeploymentBuilderFactory getExParsedDeploymentBuilderFactory(); void setParsedDeploymentBuilderFactory(ParsedDeploymentBuilderFactory parsedDeploymentBuilderFactory); BpmnDeploymentHelper getBpmnDeploymentHelper(); void setBpmnDeploymentHelper(BpmnDeploymentHelper bpmnDeploymentHelper); CachingAndArtifactsManager getCachingAndArtifcatsManager(); void setCachingAndArtifactsManager(CachingAndArtifactsManager manager);  }
@Test public void makeProcessDefinitionsConsistentWithPersistedVersions_should_setAppVersion() { ParsedDeployment parsedDeployment = mock(ParsedDeployment.class); ProcessDefinitionEntityImpl parsedProcessDefinition = new ProcessDefinitionEntityImpl(); given(parsedDeployment.getAllProcessDefinitions()).willReturn(singletonList(parsedProcessDefinition)); ProcessDefinitionEntityImpl persistedProcessDefinition = new ProcessDefinitionEntityImpl(); persistedProcessDefinition.setId("procId"); persistedProcessDefinition.setVersion(1); persistedProcessDefinition.setAppVersion(2); given(bpmnDeploymentHelper.getPersistedInstanceOfProcessDefinition(parsedProcessDefinition)) .willReturn(persistedProcessDefinition); bpmnDeployer.makeProcessDefinitionsConsistentWithPersistedVersions( parsedDeployment); assertThat(parsedProcessDefinition.getId()).isEqualTo(persistedProcessDefinition.getId()); assertThat(parsedProcessDefinition.getVersion()).isEqualTo(persistedProcessDefinition.getVersion()); assertThat(parsedProcessDefinition.getAppVersion()).isEqualTo(persistedProcessDefinition.getAppVersion()); assertThat(parsedProcessDefinition.getSuspensionState()).isEqualTo(persistedProcessDefinition.getSuspensionState()); }