Search in sources :

Example 21 with ProcessEngine

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

the class InjectionUtil method getProcessEngines.

public static List<ProcessEngine> getProcessEngines(DeploymentOperation operationContext) {
    final PlatformServiceContainer serviceContainer = operationContext.getServiceContainer();
    final ProcessApplicationInfo processApplicationInfo = getProcessApplicationInfo(operationContext);
    List<ProcessEngine> processEngines = new ArrayList<ProcessEngine>();
    for (ProcessApplicationDeploymentInfo deploymentInfo : processApplicationInfo.getDeploymentInfo()) {
        String processEngineName = deploymentInfo.getProcessEngineName();
        processEngines.add((ProcessEngine) serviceContainer.getServiceValue(ServiceTypes.PROCESS_ENGINE, processEngineName));
    }
    return processEngines;
}
Also used : ProcessApplicationDeploymentInfo(org.camunda.bpm.application.ProcessApplicationDeploymentInfo) PlatformServiceContainer(org.camunda.bpm.container.impl.spi.PlatformServiceContainer) ArrayList(java.util.ArrayList) ProcessApplicationInfo(org.camunda.bpm.application.ProcessApplicationInfo) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Example 22 with ProcessEngine

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

the class SpringProcessEngineTestCase method initializeProcessEngine.

@Override
protected void initializeProcessEngine() {
    ContextConfiguration contextConfiguration = getClass().getAnnotation(ContextConfiguration.class);
    processEngine = applicationContext.getBean(ProcessEngine.class);
}
Also used : ContextConfiguration(org.springframework.test.context.ContextConfiguration) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Example 23 with ProcessEngine

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

the class MockedProcessEngineProvider method mockProcessEngine.

private ProcessEngine mockProcessEngine(String engineName) {
    ProcessEngine engine = mock(ProcessEngine.class);
    when(engine.getName()).thenReturn(engineName);
    mockServices(engine);
    mockProcessEngineConfiguration(engine);
    return engine;
}
Also used : ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Example 24 with ProcessEngine

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

the class RuntimeContainerDelegateImpl method getProcessEngineNames.

@Override
public Set<String> getProcessEngineNames() {
    Set<String> processEngineNames = new HashSet<String>();
    List<ProcessEngine> processEngines = getProcessEngines();
    for (ProcessEngine processEngine : processEngines) {
        processEngineNames.add(processEngine.getName());
    }
    return processEngineNames;
}
Also used : HashSet(java.util.HashSet) JmxManagedProcessEngine(org.camunda.bpm.container.impl.jmx.services.JmxManagedProcessEngine) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Example 25 with ProcessEngine

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

the class DeployProcessArchiveStep method performOperationStep.

@Override
public void performOperationStep(DeploymentOperation operationContext) {
    final PlatformServiceContainer serviceContainer = operationContext.getServiceContainer();
    final AbstractProcessApplication processApplication = operationContext.getAttachment(Attachments.PROCESS_APPLICATION);
    final ClassLoader processApplicationClassloader = processApplication.getProcessApplicationClassloader();
    ProcessEngine processEngine = getProcessEngine(serviceContainer);
    // start building deployment map
    Map<String, byte[]> deploymentMap = new HashMap<String, byte[]>();
    // add all processes listed in the processes.xml
    List<String> listedProcessResources = processArchive.getProcessResourceNames();
    for (String processResource : listedProcessResources) {
        InputStream resourceAsStream = null;
        try {
            resourceAsStream = processApplicationClassloader.getResourceAsStream(processResource);
            byte[] bytes = IoUtil.readInputStream(resourceAsStream, processResource);
            deploymentMap.put(processResource, bytes);
        } finally {
            IoUtil.closeSilently(resourceAsStream);
        }
    }
    // scan for additional process definitions if not turned off
    if (PropertyHelper.getBooleanProperty(processArchive.getProperties(), ProcessArchiveXml.PROP_IS_SCAN_FOR_PROCESS_DEFINITIONS, true)) {
        String paResourceRoot = processArchive.getProperties().get(ProcessArchiveXml.PROP_RESOURCE_ROOT_PATH);
        String[] additionalResourceSuffixes = StringUtil.split(processArchive.getProperties().get(ProcessArchiveXml.PROP_ADDITIONAL_RESOURCE_SUFFIXES), ProcessArchiveXml.PROP_ADDITIONAL_RESOURCE_SUFFIXES_SEPARATOR);
        deploymentMap.putAll(findResources(processApplicationClassloader, paResourceRoot, additionalResourceSuffixes));
    }
    // perform process engine deployment
    RepositoryService repositoryService = processEngine.getRepositoryService();
    ProcessApplicationDeploymentBuilder deploymentBuilder = repositoryService.createDeployment(processApplication.getReference());
    // set the name for the deployment
    String deploymentName = processArchive.getName();
    if (deploymentName == null || deploymentName.isEmpty()) {
        deploymentName = processApplication.getName();
    }
    deploymentBuilder.name(deploymentName);
    // set the tenant id for the deployment
    String tenantId = processArchive.getTenantId();
    if (tenantId != null && !tenantId.isEmpty()) {
        deploymentBuilder.tenantId(tenantId);
    }
    // enable duplicate filtering
    deploymentBuilder.enableDuplicateFiltering(PropertyHelper.getBooleanProperty(processArchive.getProperties(), ProcessArchiveXml.PROP_IS_DEPLOY_CHANGED_ONLY, false));
    if (PropertyHelper.getBooleanProperty(processArchive.getProperties(), ProcessArchiveXml.PROP_IS_RESUME_PREVIOUS_VERSIONS, true)) {
        enableResumingOfPreviousVersions(deploymentBuilder);
    }
    // add all resources obtained through the processes.xml and through scanning
    for (Entry<String, byte[]> deploymentResource : deploymentMap.entrySet()) {
        deploymentBuilder.addInputStream(deploymentResource.getKey(), new ByteArrayInputStream(deploymentResource.getValue()));
    }
    // allow the process application to add additional resources to the deployment
    processApplication.createDeployment(processArchive.getName(), deploymentBuilder);
    Collection<String> deploymentResourceNames = deploymentBuilder.getResourceNames();
    if (!deploymentResourceNames.isEmpty()) {
        LOG.deploymentSummary(deploymentResourceNames, deploymentName);
        // perform the process engine deployment
        deployment = deploymentBuilder.deploy();
        // add attachment
        Map<String, DeployedProcessArchive> processArchiveDeploymentMap = operationContext.getAttachment(Attachments.PROCESS_ARCHIVE_DEPLOYMENT_MAP);
        if (processArchiveDeploymentMap == null) {
            processArchiveDeploymentMap = new HashMap<String, DeployedProcessArchive>();
            operationContext.addAttachment(Attachments.PROCESS_ARCHIVE_DEPLOYMENT_MAP, processArchiveDeploymentMap);
        }
        processArchiveDeploymentMap.put(processArchive.getName(), new DeployedProcessArchive(deployment));
    } else {
        LOG.notCreatingPaDeployment(processApplication.getName());
    }
}
Also used : DeployedProcessArchive(org.camunda.bpm.container.impl.deployment.util.DeployedProcessArchive) HashMap(java.util.HashMap) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) ProcessApplicationDeploymentBuilder(org.camunda.bpm.engine.repository.ProcessApplicationDeploymentBuilder) AbstractProcessApplication(org.camunda.bpm.application.AbstractProcessApplication) ByteArrayInputStream(java.io.ByteArrayInputStream) PlatformServiceContainer(org.camunda.bpm.container.impl.spi.PlatformServiceContainer) ProcessEngine(org.camunda.bpm.engine.ProcessEngine) RepositoryService(org.camunda.bpm.engine.RepositoryService)

Aggregations

ProcessEngine (org.camunda.bpm.engine.ProcessEngine)162 DescribesScenario (org.camunda.bpm.qa.upgrade.DescribesScenario)60 ScenarioSetup (org.camunda.bpm.qa.upgrade.ScenarioSetup)60 Task (org.camunda.bpm.engine.task.Task)52 Times (org.camunda.bpm.qa.upgrade.Times)52 Test (org.junit.Test)26 ExtendsScenario (org.camunda.bpm.qa.upgrade.ExtendsScenario)18 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)17 ArrayList (java.util.ArrayList)16 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)15 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)14 AbstractFoxPlatformIntegrationTest (org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)14 RepositoryService (org.camunda.bpm.engine.RepositoryService)13 PooledDataSource (org.apache.ibatis.datasource.pooled.PooledDataSource)7 StandaloneInMemProcessEngineConfiguration (org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration)6 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)5 Job (org.camunda.bpm.engine.runtime.Job)5 Connection (java.sql.Connection)4 CaseService (org.camunda.bpm.engine.CaseService)4 StandaloneProcessEngineConfiguration (org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration)4