Search in sources :

Example 26 with ProcessApplicationReference

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;
            }
        }
    }
}
Also used : ProcessApplicationReference(org.camunda.bpm.application.ProcessApplicationReference) InvocationContext(org.camunda.bpm.application.InvocationContext) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) PersistenceException(org.apache.ibatis.exceptions.PersistenceException)

Example 27 with ProcessApplicationReference

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;
}
Also used : ProcessApplicationReference(org.camunda.bpm.application.ProcessApplicationReference) ArrayList(java.util.ArrayList) List(java.util.List) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)

Example 28 with ProcessApplicationReference

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);
}
Also used : ProcessApplicationReference(org.camunda.bpm.application.ProcessApplicationReference) EmbeddedProcessApplication(org.camunda.bpm.application.impl.EmbeddedProcessApplication) AuthorizationException(org.camunda.bpm.engine.AuthorizationException)

Example 29 with ProcessApplicationReference

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);
}
Also used : ProcessApplicationReference(org.camunda.bpm.application.ProcessApplicationReference) EmbeddedProcessApplication(org.camunda.bpm.application.impl.EmbeddedProcessApplication) AuthorizationException(org.camunda.bpm.engine.AuthorizationException)

Example 30 with ProcessApplicationReference

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);
}
Also used : ProcessApplicationReference(org.camunda.bpm.application.ProcessApplicationReference) EmbeddedProcessApplication(org.camunda.bpm.application.impl.EmbeddedProcessApplication)

Aggregations

ProcessApplicationReference (org.camunda.bpm.application.ProcessApplicationReference)39 Deployment (org.camunda.bpm.engine.repository.Deployment)10 Test (org.junit.Test)10 ProcessApplicationUnavailableException (org.camunda.bpm.application.ProcessApplicationUnavailableException)7 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)7 EmbeddedProcessApplication (org.camunda.bpm.application.impl.EmbeddedProcessApplication)6 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)5 ProcessApplicationInterface (org.camunda.bpm.application.ProcessApplicationInterface)4 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)4 RepositoryService (org.camunda.bpm.engine.RepositoryService)4 Command (org.camunda.bpm.engine.impl.interceptor.Command)4 DeploymentCache (org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)4 InvocationContext (org.camunda.bpm.application.InvocationContext)3 AuthorizationException (org.camunda.bpm.engine.AuthorizationException)3 ProcessApplicationManager (org.camunda.bpm.engine.impl.application.ProcessApplicationManager)2 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Callable (java.util.concurrent.Callable)1