use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.
the class RedeploymentRegistrationTest method registrationFoundByDeploymentId.
@Test
public void registrationFoundByDeploymentId() {
// given
ProcessApplicationReference reference1 = processApplication.getReference();
Deployment deployment1 = repositoryService.createDeployment(reference1).name(DEPLOYMENT_NAME).addClasspathResource(resource1).deploy();
assertEquals(reference1, getProcessApplicationForDeployment(deployment1.getId()));
// when
ProcessApplicationReference reference2 = processApplication.getReference();
Deployment deployment2 = repositoryService.createDeployment(reference2).name(DEPLOYMENT_NAME).addDeploymentResources(deployment1.getId()).deploy();
// then
assertEquals(reference2, getProcessApplicationForDeployment(deployment2.getId()));
}
use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.
the class RedeploymentRegistrationTest method registrationFoundOnlyForOneProcessDefinition.
@Test
public void registrationFoundOnlyForOneProcessDefinition() {
// given
// first deployment
Deployment deployment1 = repositoryService.createDeployment().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));
assertNull(getProcessApplicationForDefinition(secondDefinitionId));
}
use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.
the class RedeploymentRegistrationTest method caseDefinitionTestProvider.
protected static TestProvider caseDefinitionTestProvider() {
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();
CaseDefinitionEntity definition = deploymentCache.findDeployedCaseDefinitionById(definitionId);
return ProcessApplicationContextUtil.getTargetProcessApplication(definition);
}
};
}
@Override
public String getLatestDefinitionIdByKey(RepositoryService repositoryService, String key) {
return repositoryService.createCaseDefinitionQuery().caseDefinitionKey(key).latestVersion().singleResult().getId();
}
};
}
use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.
the class RedeploymentRegistrationTest method registrationFoundAfterDiscardingDeploymentCache.
@Test
public void registrationFoundAfterDiscardingDeploymentCache() {
// given
// first deployment
Deployment deployment1 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addClasspathResource(resource1).deploy();
// second deployment
ProcessApplicationReference reference2 = processApplication.getReference();
repositoryService.createDeployment(reference2).name(DEPLOYMENT_NAME).addDeploymentResources(deployment1.getId()).deploy();
// when (1)
// third deployment
repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResources(deployment1.getId()).deploy();
String firstDefinitionId = getLatestDefinitionIdByKey(definitionKey1);
// then (1)
assertEquals(reference2, getProcessApplicationForDefinition(firstDefinitionId));
// when (2)
discardDefinitionCache();
// then (2)
assertEquals(reference2, getProcessApplicationForDefinition(firstDefinitionId));
}
use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.
the class TypedValueField method getCurrentPaSerializers.
protected static VariableSerializers getCurrentPaSerializers() {
if (Context.getCurrentProcessApplication() != null) {
ProcessApplicationReference processApplicationReference = Context.getCurrentProcessApplication();
try {
ProcessApplicationInterface processApplicationInterface = processApplicationReference.getProcessApplication();
ProcessApplicationInterface rawPa = processApplicationInterface.getRawObject();
if (rawPa instanceof AbstractProcessApplication) {
return ((AbstractProcessApplication) rawPa).getVariableSerializers();
} else {
return null;
}
} catch (ProcessApplicationUnavailableException e) {
throw LOG.cannotDeterminePaDataformats(e);
}
} else {
return null;
}
}
Aggregations