Search in sources :

Example 1 with ProcessApplicationDeployment

use of org.camunda.bpm.engine.repository.ProcessApplicationDeployment in project camunda-bpm-platform by camunda.

the class ProcessApplicationStartService method start.

@Override
public void start(StartContext context) throws StartException {
    ManagedReference reference = null;
    try {
        // get the process application component
        ProcessApplicationInterface processApplication = null;
        ComponentView componentView = paComponentViewInjector.getOptionalValue();
        if (componentView != null) {
            reference = componentView.createInstance();
            processApplication = (ProcessApplicationInterface) reference.getInstance();
        } else {
            processApplication = noViewProcessApplication.getValue();
        }
        // create & populate the process application info object
        processApplicationInfo = new ProcessApplicationInfoImpl();
        processApplicationInfo.setName(processApplication.getName());
        processApplicationInfo.setProperties(processApplication.getProperties());
        referencedProcessEngines = new HashSet<ProcessEngine>();
        List<ProcessApplicationDeploymentInfo> deploymentInfos = new ArrayList<ProcessApplicationDeploymentInfo>();
        for (ServiceName deploymentServiceName : deploymentServiceNames) {
            ProcessApplicationDeploymentService value = getDeploymentService(context, deploymentServiceName);
            referencedProcessEngines.add(value.getProcessEngineInjector().getValue());
            ProcessApplicationDeployment deployment = value.getDeployment();
            if (deployment != null) {
                for (String deploymentId : deployment.getProcessApplicationRegistration().getDeploymentIds()) {
                    ProcessApplicationDeploymentInfoImpl deploymentInfo = new ProcessApplicationDeploymentInfoImpl();
                    deploymentInfo.setDeploymentId(deploymentId);
                    deploymentInfo.setProcessEngineName(value.getProcessEngineName());
                    deploymentInfos.add(deploymentInfo);
                }
            }
        }
        processApplicationInfo.setDeploymentInfo(deploymentInfos);
        notifyBpmPlatformPlugins(platformPluginsInjector.getValue(), processApplication);
        if (postDeployDescription != null) {
            invokePostDeploy(processApplication);
        }
        // install the ManagedProcessApplication Service as a child to this service
        // if this service stops (at undeployment) the ManagedProcessApplication service is removed as well.
        ServiceName serviceName = ServiceNames.forManagedProcessApplication(processApplicationInfo.getName());
        MscManagedProcessApplication managedProcessApplication = new MscManagedProcessApplication(processApplicationInfo, processApplication.getReference());
        context.getChildTarget().addService(serviceName, managedProcessApplication).install();
    } catch (StartException e) {
        throw e;
    } catch (Exception e) {
        throw new StartException(e);
    } finally {
        if (reference != null) {
            reference.release();
        }
    }
}
Also used : ProcessApplicationDeploymentInfoImpl(org.camunda.bpm.application.impl.ProcessApplicationDeploymentInfoImpl) ProcessApplicationDeploymentInfo(org.camunda.bpm.application.ProcessApplicationDeploymentInfo) ProcessApplicationInfoImpl(org.camunda.bpm.application.impl.ProcessApplicationInfoImpl) ArrayList(java.util.ArrayList) ManagedReference(org.jboss.as.naming.ManagedReference) ProcessApplicationInterface(org.camunda.bpm.application.ProcessApplicationInterface) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) StartException(org.jboss.msc.service.StartException) ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) ComponentView(org.jboss.as.ee.component.ComponentView) ServiceName(org.jboss.msc.service.ServiceName) StartException(org.jboss.msc.service.StartException) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Example 2 with ProcessApplicationDeployment

use of org.camunda.bpm.engine.repository.ProcessApplicationDeployment in project camunda-bpm-platform by camunda.

the class CmmnDisabledTest method testVariableInstanceQuery.

public void testVariableInstanceQuery() {
    ProcessApplicationDeployment deployment = repositoryService.createDeployment(processApplication.getReference()).addClasspathResource("org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml").deploy();
    VariableMap variables = Variables.createVariables().putValue("my-variable", "a-value");
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess", variables);
    // variable instance query
    List<VariableInstance> result = runtimeService.createVariableInstanceQuery().list();
    assertEquals(1, result.size());
    VariableInstance variableInstance = result.get(0);
    assertEquals("my-variable", variableInstance.getName());
    // get variable
    assertNotNull(runtimeService.getVariable(processInstance.getId(), "my-variable"));
    // get variable local
    assertNotNull(runtimeService.getVariableLocal(processInstance.getId(), "my-variable"));
    repositoryService.deleteDeployment(deployment.getId(), true);
}
Also used : ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) VariableMap(org.camunda.bpm.engine.variable.VariableMap) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) VariableInstance(org.camunda.bpm.engine.runtime.VariableInstance)

Example 3 with ProcessApplicationDeployment

use of org.camunda.bpm.engine.repository.ProcessApplicationDeployment in project camunda-bpm-platform by camunda.

the class CmmnDisabledTest method testCmmnDisabled.

public void testCmmnDisabled() {
    ProcessApplicationDeployment deployment = repositoryService.createDeployment(processApplication.getReference()).addClasspathResource("org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml").deploy();
    // process is deployed:
    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
    assertNotNull(processDefinition);
    assertEquals(1, processDefinition.getVersion());
    try {
        repositoryService.createCaseDefinitionQuery().singleResult();
        fail("Cmmn Disabled: It should not be possible to query for a case definition.");
    } catch (Exception e) {
    // expected
    }
    repositoryService.deleteDeployment(deployment.getId(), true);
}
Also used : ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition)

Example 4 with ProcessApplicationDeployment

use of org.camunda.bpm.engine.repository.ProcessApplicationDeployment in project camunda-bpm-platform by camunda.

the class ProcessApplicationDeploymentTest method testProcessApplicationDeploymentNoResume.

public void testProcessApplicationDeploymentNoResume() {
    // create initial deployment
    ProcessApplicationDeployment deployment1 = repositoryService.createDeployment(processApplication.getReference()).name("deployment").addClasspathResource("org/camunda/bpm/engine/test/api/repository/version1.bpmn20.xml").deploy();
    assertThatOneProcessIsDeployed();
    // deploy update with changes:
    ProcessApplicationDeployment deployment2 = repositoryService.createDeployment(processApplication.getReference()).name("deployment").enableDuplicateFiltering(false).addClasspathResource("org/camunda/bpm/engine/test/api/repository/version2.bpmn20.xml").deploy();
    List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery().orderByProcessDefinitionVersion().asc().list();
    // now there are 2 process definitions deployed
    assertEquals(1, processDefinitions.get(0).getVersion());
    assertEquals(2, processDefinitions.get(1).getVersion());
    // old deployment was NOT resumed
    ProcessApplicationRegistration registration = deployment2.getProcessApplicationRegistration();
    Set<String> deploymentIds = registration.getDeploymentIds();
    assertEquals(1, deploymentIds.size());
    assertEquals(processEngine.getName(), registration.getProcessEngineName());
    deleteDeployments(deployment1, deployment2);
}
Also used : ProcessApplicationRegistration(org.camunda.bpm.application.ProcessApplicationRegistration) ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition)

Example 5 with ProcessApplicationDeployment

use of org.camunda.bpm.engine.repository.ProcessApplicationDeployment in project camunda-bpm-platform by camunda.

the class RedeploymentTest method testRedeployProcessApplicationDeploymentResumePreviousVersions.

public void testRedeployProcessApplicationDeploymentResumePreviousVersions() {
    // given
    EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication();
    // first deployment
    BpmnModelInstance model = createProcessWithServiceTask(PROCESS_KEY);
    ProcessApplicationDeployment deployment1 = repositoryService.createDeployment(processApplication.getReference()).name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_NAME, model).enableDuplicateFiltering(true).deploy();
    Resource resource1 = getResourceByName(deployment1.getId(), RESOURCE_NAME);
    // second deployment
    model = createProcessWithUserTask(PROCESS_KEY);
    ProcessApplicationDeployment deployment2 = repositoryService.createDeployment(processApplication.getReference()).name(DEPLOYMENT_NAME).addModelInstance(RESOURCE_NAME, model).enableDuplicateFiltering(true).deploy();
    // when
    ProcessApplicationDeployment deployment3 = repositoryService.createDeployment(processApplication.getReference()).name(DEPLOYMENT_NAME).resumePreviousVersions().addDeploymentResourceById(deployment1.getId(), resource1.getId()).deploy();
    // then
    // old deployments was resumed
    ProcessApplicationRegistration registration = deployment3.getProcessApplicationRegistration();
    Set<String> deploymentIds = registration.getDeploymentIds();
    assertEquals(3, deploymentIds.size());
    deleteDeployments(deployment1, deployment2, deployment3);
}
Also used : ProcessApplicationRegistration(org.camunda.bpm.application.ProcessApplicationRegistration) ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) EmbeddedProcessApplication(org.camunda.bpm.application.impl.EmbeddedProcessApplication) Resource(org.camunda.bpm.engine.repository.Resource) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Aggregations

ProcessApplicationDeployment (org.camunda.bpm.engine.repository.ProcessApplicationDeployment)31 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)17 ProcessApplicationRegistration (org.camunda.bpm.application.ProcessApplicationRegistration)15 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)9 EmbeddedProcessApplication (org.camunda.bpm.application.impl.EmbeddedProcessApplication)8 DeploymentQuery (org.camunda.bpm.engine.repository.DeploymentQuery)8 ProcessDefinitionQuery (org.camunda.bpm.engine.repository.ProcessDefinitionQuery)8 ScriptEngine (javax.script.ScriptEngine)3 Resource (org.camunda.bpm.engine.repository.Resource)3 List (java.util.List)2 ArrayList (java.util.ArrayList)1 ProcessApplicationDeploymentInfo (org.camunda.bpm.application.ProcessApplicationDeploymentInfo)1 ProcessApplicationInterface (org.camunda.bpm.application.ProcessApplicationInterface)1 ProcessApplicationDeploymentInfoImpl (org.camunda.bpm.application.impl.ProcessApplicationDeploymentInfoImpl)1 ProcessApplicationInfoImpl (org.camunda.bpm.application.impl.ProcessApplicationInfoImpl)1 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)1 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 ExecutableScript (org.camunda.bpm.engine.impl.scripting.ExecutableScript)1 SourceExecutableScript (org.camunda.bpm.engine.impl.scripting.SourceExecutableScript)1 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)1