Search in sources :

Example 11 with EmbeddedProcessApplication

use of org.camunda.bpm.application.impl.EmbeddedProcessApplication 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)

Example 12 with EmbeddedProcessApplication

use of org.camunda.bpm.application.impl.EmbeddedProcessApplication in project camunda-bpm-platform by camunda.

the class EnvScriptCachingTest method testDisabledPaEnvScriptCaching.

public void testDisabledPaEnvScriptCaching() {
    // given
    processEngineConfiguration.setEnableFetchScriptEngineFromProcessApplication(false);
    EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication();
    ProcessApplicationDeployment deployment = repositoryService.createDeployment(processApplication.getReference()).addClasspathResource(PROCESS_PATH).deploy();
    // when
    executeScript(processApplication);
    // then
    Map<String, List<ExecutableScript>> environmentScripts = processApplication.getEnvironmentScripts();
    assertNotNull(environmentScripts);
    assertNull(environmentScripts.get(SCRIPT_LANGUAGE));
    repositoryService.deleteDeployment(deployment.getId(), true);
    processEngineConfiguration.setEnableFetchScriptEngineFromProcessApplication(true);
}
Also used : ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) EmbeddedProcessApplication(org.camunda.bpm.application.impl.EmbeddedProcessApplication) List(java.util.List)

Example 13 with EmbeddedProcessApplication

use of org.camunda.bpm.application.impl.EmbeddedProcessApplication in project camunda-bpm-platform by camunda.

the class ScriptEngineCachingTest method testDisableFetchScriptEngineFromProcessApplication.

public void testDisableFetchScriptEngineFromProcessApplication() {
    // when
    processEngineConfiguration.setEnableFetchScriptEngineFromProcessApplication(false);
    EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication();
    ProcessApplicationDeployment deployment = repositoryService.createDeployment(processApplication.getReference()).addClasspathResource(PROCESS_PATH).deploy();
    // when
    ScriptEngine engine = getScriptEngineFromPa(SCRIPT_LANGUAGE, processApplication);
    // then
    assertNotNull(engine);
    assertEquals(engine, getScriptEngineFromPa(SCRIPT_LANGUAGE, processApplication));
    // not cached in pa
    assertFalse(engine.equals(processApplication.getScriptEngineForName(SCRIPT_LANGUAGE, true)));
    repositoryService.deleteDeployment(deployment.getId(), true);
    processEngineConfiguration.setEnableFetchScriptEngineFromProcessApplication(true);
}
Also used : ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) EmbeddedProcessApplication(org.camunda.bpm.application.impl.EmbeddedProcessApplication) ScriptEngine(javax.script.ScriptEngine)

Example 14 with EmbeddedProcessApplication

use of org.camunda.bpm.application.impl.EmbeddedProcessApplication in project camunda-bpm-platform by camunda.

the class ScriptEngineCachingTest method testDisableCachingOfScriptEngineInProcessApplication.

public void testDisableCachingOfScriptEngineInProcessApplication() {
    // given
    EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication();
    // when
    ScriptEngine engine = processApplication.getScriptEngineForName(SCRIPT_LANGUAGE, false);
    // then
    assertNotNull(engine);
    assertFalse(engine.equals(processApplication.getScriptEngineForName(SCRIPT_LANGUAGE, false)));
}
Also used : EmbeddedProcessApplication(org.camunda.bpm.application.impl.EmbeddedProcessApplication) ScriptEngine(javax.script.ScriptEngine)

Example 15 with EmbeddedProcessApplication

use of org.camunda.bpm.application.impl.EmbeddedProcessApplication in project camunda-bpm-platform by camunda.

the class EnvScriptCachingTest method testEnabledPaEnvScriptCaching.

public void testEnabledPaEnvScriptCaching() {
    // given
    EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication();
    ProcessApplicationDeployment deployment = repositoryService.createDeployment(processApplication.getReference()).addClasspathResource(PROCESS_PATH).deploy();
    // when
    executeScript(processApplication);
    // then
    Map<String, List<ExecutableScript>> environmentScripts = processApplication.getEnvironmentScripts();
    assertNotNull(environmentScripts);
    List<ExecutableScript> groovyEnvScripts = environmentScripts.get(SCRIPT_LANGUAGE);
    assertNotNull(groovyEnvScripts);
    assertFalse(groovyEnvScripts.isEmpty());
    assertEquals(processEngineConfiguration.getEnvScriptResolvers().size(), groovyEnvScripts.size());
    repositoryService.deleteDeployment(deployment.getId(), true);
}
Also used : ProcessApplicationDeployment(org.camunda.bpm.engine.repository.ProcessApplicationDeployment) EmbeddedProcessApplication(org.camunda.bpm.application.impl.EmbeddedProcessApplication) SourceExecutableScript(org.camunda.bpm.engine.impl.scripting.SourceExecutableScript) ExecutableScript(org.camunda.bpm.engine.impl.scripting.ExecutableScript) List(java.util.List)

Aggregations

EmbeddedProcessApplication (org.camunda.bpm.application.impl.EmbeddedProcessApplication)30 Deployment (org.camunda.bpm.engine.test.Deployment)11 DelegateExecution (org.camunda.bpm.engine.delegate.DelegateExecution)9 ExecutionListener (org.camunda.bpm.engine.delegate.ExecutionListener)9 ProcessApplicationDeployment (org.camunda.bpm.engine.repository.ProcessApplicationDeployment)8 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)7 ProcessApplicationReference (org.camunda.bpm.application.ProcessApplicationReference)6 ScriptEngine (javax.script.ScriptEngine)5 ProcessApplicationRegistration (org.camunda.bpm.application.ProcessApplicationRegistration)4 DelegateTask (org.camunda.bpm.engine.delegate.DelegateTask)4 Task (org.camunda.bpm.engine.task.Task)4 ArrayList (java.util.ArrayList)3 AuthorizationException (org.camunda.bpm.engine.AuthorizationException)3 Resource (org.camunda.bpm.engine.repository.Resource)3 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)3 List (java.util.List)2 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)2 TaskListener (org.camunda.bpm.engine.delegate.TaskListener)1 UserOperationLogEntry (org.camunda.bpm.engine.history.UserOperationLogEntry)1 ExecutableScript (org.camunda.bpm.engine.impl.scripting.ExecutableScript)1