use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.
the class RedeploymentRegistrationTest method registrationFoundFromLatestDeployment.
@Test
public void registrationFoundFromLatestDeployment() {
// given
ProcessApplicationReference reference1 = processApplication.getReference();
Deployment deployment1 = repositoryService.createDeployment(reference1).name(DEPLOYMENT_NAME).addClasspathResource(resource1).deploy();
// when
ProcessApplicationReference reference2 = processApplication.getReference();
Deployment deployment2 = repositoryService.createDeployment(reference2).name(DEPLOYMENT_NAME).addDeploymentResources(deployment1.getId()).deploy();
String definitionId = getLatestDefinitionIdByKey(definitionKey1);
// then
assertEquals(reference2, getProcessApplicationForDefinition(definitionId));
assertEquals(reference2, getProcessApplicationForDeployment(deployment2.getId()));
}
use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.
the class RedeploymentRegistrationTest method decisionRequirementsDefinitionTestProvider.
protected static TestProvider decisionRequirementsDefinitionTestProvider() {
return new TestProvider() {
@Override
public Command<ProcessApplicationReference> createGetProcessApplicationCommand(final String definitionId) {
return new Command<ProcessApplicationReference>() {
public ProcessApplicationReference execute(CommandContext commandContext) {
ProcessEngineConfigurationImpl configuration = commandContext.getProcessEngineConfiguration();
DeploymentCache deploymentCache = configuration.getDeploymentCache();
DecisionRequirementsDefinitionEntity definition = deploymentCache.findDeployedDecisionRequirementsDefinitionById(definitionId);
return ProcessApplicationContextUtil.getTargetProcessApplication(definition);
}
};
}
@Override
public String getLatestDefinitionIdByKey(RepositoryService repositoryService, String key) {
return repositoryService.createDecisionRequirementsDefinitionQuery().decisionRequirementsDefinitionKey(key).latestVersion().singleResult().getId();
}
};
}
use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.
the class RedeploymentRegistrationTest method registrationFoundFromDifferentDeployments.
@Test
public void registrationFoundFromDifferentDeployments() {
// given
// first deployment
ProcessApplicationReference reference1 = processApplication.getReference();
Deployment deployment1 = repositoryService.createDeployment(reference1).name(DEPLOYMENT_NAME + "-1").addClasspathResource(resource1).deploy();
// second deployment
ProcessApplicationReference reference2 = processApplication.getReference();
repositoryService.createDeployment(reference2).name(DEPLOYMENT_NAME + "-2").addClasspathResource(resource2).deploy();
// when
repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResources(deployment1.getId()).deploy();
String firstDefinitionId = getLatestDefinitionIdByKey(definitionKey1);
String secondDefinitionId = getLatestDefinitionIdByKey(definitionKey2);
// then
assertEquals(reference1, getProcessApplicationForDefinition(firstDefinitionId));
assertEquals(reference2, getProcessApplicationForDefinition(secondDefinitionId));
}
use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.
the class RedeploymentRegistrationTest method registrationFoundFromPreviousDefinition.
@Test
public void registrationFoundFromPreviousDefinition() {
// given
ProcessApplicationReference reference = processApplication.getReference();
Deployment deployment1 = repositoryService.createDeployment(reference).name(DEPLOYMENT_NAME).addClasspathResource(resource1).deploy();
// when
Deployment deployment2 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResources(deployment1.getId()).deploy();
String definitionId = getLatestDefinitionIdByKey(definitionKey1);
// then
assertEquals(reference, getProcessApplicationForDefinition(definitionId));
// and the reference is not cached
assertNull(getProcessApplicationForDeployment(deployment2.getId()));
}
use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.
the class RedeploymentRegistrationTest method registrationFoundFromSameDeployment.
@Test
public void registrationFoundFromSameDeployment() {
// given
// first deployment
ProcessApplicationReference reference1 = processApplication.getReference();
Deployment deployment1 = repositoryService.createDeployment(reference1).name(DEPLOYMENT_NAME).addClasspathResource(resource1).addClasspathResource(resource2).deploy();
// second deployment
repositoryService.createDeployment().name(DEPLOYMENT_NAME).addClasspathResource(resource1).deploy();
repositoryService.createDeployment().name(DEPLOYMENT_NAME).addClasspathResource(resource2).deploy();
// when
repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResources(deployment1.getId()).deploy();
String firstDefinitionId = getLatestDefinitionIdByKey(definitionKey1);
String secondDefinitionId = getLatestDefinitionIdByKey(definitionKey1);
// then
assertEquals(reference1, getProcessApplicationForDefinition(firstDefinitionId));
assertEquals(reference1, getProcessApplicationForDefinition(secondDefinitionId));
}
Aggregations