Search in sources :

Example 6 with ProcessApplicationReference

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

Example 7 with ProcessApplicationReference

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

Example 8 with ProcessApplicationReference

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

Example 9 with ProcessApplicationReference

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

Example 10 with ProcessApplicationReference

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));
}
Also used : ProcessApplicationReference(org.camunda.bpm.application.ProcessApplicationReference) Deployment(org.camunda.bpm.engine.repository.Deployment) Test(org.junit.Test)

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