use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.
the class CommandInvocationContext method performNext.
protected void performNext() {
AtomicOperationInvocation nextInvocation = queuedInvocations.get(0);
if (nextInvocation.operation.isAsyncCapable() && isExecuting) {
// will be picked up by while loop below
return;
}
ProcessApplicationReference targetProcessApplication = getTargetProcessApplication(nextInvocation.execution);
if (requiresContextSwitch(targetProcessApplication)) {
Context.executeWithinProcessApplication(new Callable<Void>() {
public Void call() throws Exception {
performNext();
return null;
}
}, targetProcessApplication, new InvocationContext(nextInvocation.execution));
} else {
if (!nextInvocation.operation.isAsyncCapable()) {
// if operation is not async capable, perform right away.
invokeNext();
} else {
try {
isExecuting = true;
while (!queuedInvocations.isEmpty()) {
// assumption: all operations are executed within the same process application...
nextInvocation = queuedInvocations.get(0);
invokeNext();
}
} finally {
isExecuting = false;
}
}
}
}
use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.
the class ScriptingEnvironment method getEnv.
protected Map<String, List<ExecutableScript>> getEnv(String language) {
ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
ProcessApplicationReference processApplication = Context.getCurrentProcessApplication();
Map<String, List<ExecutableScript>> result = null;
if (config.isEnableFetchScriptEngineFromProcessApplication()) {
if (processApplication != null) {
result = getPaEnvScripts(processApplication);
}
}
return result != null ? result : env;
}
use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.
the class DeploymentAuthorizationTest method testGetProcessApplicationForDeploymentWithoutAuthorization.
// get process application for deployment ///////////////////////////////////
public void testGetProcessApplicationForDeploymentWithoutAuthorization() {
// given
EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication();
String deploymentId = createDeployment(null, FIRST_RESOURCE).getId();
ProcessApplicationReference reference = processApplication.getReference();
registerProcessApplication(deploymentId, reference);
try {
// when
managementService.getProcessApplicationForDeployment(deploymentId);
fail("Exception expected: It should not be possible to get the 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 testUnregisterProcessApplicationWithoutAuthorization.
// unregister process application ///////////////////////////////////
public void testUnregisterProcessApplicationWithoutAuthorization() {
// given
EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication();
String deploymentId = createDeployment(null, FIRST_RESOURCE).getId();
ProcessApplicationReference reference = processApplication.getReference();
registerProcessApplication(deploymentId, reference);
try {
// when
managementService.unregisterProcessApplication(deploymentId, true);
fail("Exception expected: It should not be possible to unregister 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 testGetProcessApplicationForDeploymentAsCamundaAdmin.
public void testGetProcessApplicationForDeploymentAsCamundaAdmin() {
// 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
String application = managementService.getProcessApplicationForDeployment(deploymentId);
// then
assertNotNull(application);
deleteDeployment(deploymentId);
}
Aggregations