use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.
the class CommandContext method performOperation.
public void performOperation(final CmmnAtomicOperation executionOperation, final CaseExecutionEntity execution) {
ProcessApplicationReference targetProcessApplication = getTargetProcessApplication(execution);
if (requiresContextSwitch(targetProcessApplication)) {
Context.executeWithinProcessApplication(new Callable<Void>() {
public Void call() throws Exception {
performOperation(executionOperation, execution);
return null;
}
}, targetProcessApplication, new InvocationContext(execution));
} else {
try {
Context.setExecutionContext(execution);
LOG.debugExecutingAtomicOperation(executionOperation, execution);
executionOperation.execute(execution);
} finally {
Context.removeExecutionContext();
}
}
}
use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.
the class DeploymentAuthorizationTest method testRegisterProcessApplicationAsCamundaAdmin.
public void testRegisterProcessApplicationAsCamundaAdmin() {
// given
identityService.setAuthentication(userId, Collections.singletonList(Groups.CAMUNDA_ADMIN));
EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication();
ProcessApplicationReference reference = processApplication.getReference();
String deploymentId = createDeployment(null, FIRST_RESOURCE).getId();
// when
ProcessApplicationRegistration registration = managementService.registerProcessApplication(deploymentId, reference);
// then
assertNotNull(registration);
assertNotNull(getProcessApplicationForDeployment(deploymentId));
deleteDeployment(deploymentId);
}
use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.
the class DeploymentAuthorizationTest method testRegisterProcessApplicationWithoutAuthorization.
// register process application ///////////////////////////////////
public void testRegisterProcessApplicationWithoutAuthorization() {
// given
EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication();
ProcessApplicationReference reference = processApplication.getReference();
String deploymentId = createDeployment(null, FIRST_RESOURCE).getId();
try {
// when
managementService.registerProcessApplication(deploymentId, reference);
fail("Exception expected: It should not be possible to register a process application");
} catch (AuthorizationException e) {
// then
String message = e.getMessage();
assertTextPresent("ENGINE-03029 Required authenticated group 'camunda-admin'", message);
}
deleteDeployment(deploymentId);
}
use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.
the class DeploymentAuthorizationTest method testUnregisterProcessApplicationAsCamundaAdmin.
public void testUnregisterProcessApplicationAsCamundaAdmin() {
// given
identityService.setAuthentication(userId, Collections.singletonList(Groups.CAMUNDA_ADMIN));
EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication();
String deploymentId = createDeployment(null, FIRST_RESOURCE).getId();
ProcessApplicationReference reference = processApplication.getReference();
registerProcessApplication(deploymentId, reference);
// when
managementService.unregisterProcessApplication(deploymentId, true);
// then
assertNull(getProcessApplicationForDeployment(deploymentId));
deleteDeployment(deploymentId);
}
use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.
the class RedeploymentRegistrationTest method registrationNotFoundWhenDeletingDeployment.
@Test
public void registrationNotFoundWhenDeletingDeployment() {
// given
// first deployment
Deployment deployment1 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addClasspathResource(resource1).deploy();
// second deployment
ProcessApplicationReference reference2 = processApplication.getReference();
Deployment deployment2 = 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)
deleteDeployment(deployment2);
// then (2)
assertNull(getProcessApplicationForDefinition(firstDefinitionId));
}
Aggregations