use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.
the class RedeploymentRegistrationTest method processDefinitionTestProvider.
protected static TestProvider processDefinitionTestProvider() {
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();
ProcessDefinitionEntity definition = deploymentCache.findDeployedProcessDefinitionById(definitionId);
return ProcessApplicationContextUtil.getTargetProcessApplication(definition);
}
};
}
@Override
public String getLatestDefinitionIdByKey(RepositoryService repositoryService, String key) {
return repositoryService.createProcessDefinitionQuery().processDefinitionKey(key).latestVersion().singleResult().getId();
}
};
}
use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.
the class RedeploymentRegistrationTest method registrationNotFoundByDeploymentId.
@Test
public void registrationNotFoundByDeploymentId() {
// given
ProcessApplicationReference reference = processApplication.getReference();
Deployment deployment1 = repositoryService.createDeployment(reference).name(DEPLOYMENT_NAME).addClasspathResource(resource1).deploy();
assertEquals(reference, getProcessApplicationForDeployment(deployment1.getId()));
// when
Deployment deployment2 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResources(deployment1.getId()).deploy();
// then
assertNull(getProcessApplicationForDeployment(deployment2.getId()));
}
use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.
the class RedeploymentRegistrationTest method decisionDefinitionTestProvider.
protected static TestProvider decisionDefinitionTestProvider() {
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();
DecisionDefinitionEntity definition = deploymentCache.findDeployedDecisionDefinitionById(definitionId);
return ProcessApplicationContextUtil.getTargetProcessApplication(definition);
}
};
}
@Override
public String getLatestDefinitionIdByKey(RepositoryService repositoryService, String key) {
return repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(key).latestVersion().singleResult().getId();
}
};
}
use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.
the class RedeploymentRegistrationTest method registrationFoundFromDifferentDeployment.
@Test
public void registrationFoundFromDifferentDeployment() {
// given
// first deployment
ProcessApplicationReference reference1 = processApplication.getReference();
Deployment deployment1 = repositoryService.createDeployment(reference1).name(DEPLOYMENT_NAME).addClasspathResource(resource1).addClasspathResource(resource2).deploy();
// second deployment
ProcessApplicationReference reference2 = processApplication.getReference();
repositoryService.createDeployment(reference2).name(DEPLOYMENT_NAME).addClasspathResource(resource1).deploy();
// when
repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResources(deployment1.getId()).deploy();
String firstDefinitionId = getLatestDefinitionIdByKey(definitionKey1);
String secondDefinitionId = getLatestDefinitionIdByKey(definitionKey2);
// then
assertEquals(reference2, getProcessApplicationForDefinition(firstDefinitionId));
assertEquals(reference1, getProcessApplicationForDefinition(secondDefinitionId));
}
Aggregations