use of org.camunda.bpm.application.impl.EmbeddedProcessApplication in project camunda-bpm-platform by camunda.
the class ScriptEngineCachingTest method testCachingOfScriptEngineInProcessApplication.
public void testCachingOfScriptEngineInProcessApplication() {
// given
EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication();
// when
ScriptEngine engine = processApplication.getScriptEngineForName(SCRIPT_LANGUAGE, true);
// then
assertNotNull(engine);
assertEquals(engine, processApplication.getScriptEngineForName(SCRIPT_LANGUAGE, true));
}
use of org.camunda.bpm.application.impl.EmbeddedProcessApplication in project camunda-bpm-platform by camunda.
the class ScriptEngineCachingTest method testFetchScriptEngineFromPaEnableCaching.
public void testFetchScriptEngineFromPaEnableCaching() {
// then
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));
// cached in pa
assertEquals(engine, processApplication.getScriptEngineForName(SCRIPT_LANGUAGE, true));
repositoryService.deleteDeployment(deployment.getId(), true);
}
use of org.camunda.bpm.application.impl.EmbeddedProcessApplication in project camunda-bpm-platform by camunda.
the class ScriptEngineCachingTest method testFetchScriptEngineFromPaDisableCaching.
public void testFetchScriptEngineFromPaDisableCaching() {
// then
processEngineConfiguration.setEnableScriptEngineCaching(false);
getScriptingEngines().setEnableScriptEngineCaching(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);
assertFalse(engine.equals(getScriptEngineFromPa(SCRIPT_LANGUAGE, processApplication)));
// not cached in pa
assertFalse(engine.equals(processApplication.getScriptEngineForName(SCRIPT_LANGUAGE, false)));
repositoryService.deleteDeployment(deployment.getId(), true);
processEngineConfiguration.setEnableScriptEngineCaching(true);
getScriptingEngines().setEnableScriptEngineCaching(true);
}
use of org.camunda.bpm.application.impl.EmbeddedProcessApplication in project camunda-bpm-platform by camunda.
the class RedeploymentTest method testProcessApplicationDeploymentResumePreviousVersionsByDeploymentName.
public void testProcessApplicationDeploymentResumePreviousVersionsByDeploymentName() {
// 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().resumePreviousVersionsBy(ResumePreviousBy.RESUME_BY_DEPLOYMENT_NAME).addDeploymentResourceById(deployment1.getId(), resource1.getId()).deploy();
// then
// old deployment was resumed
ProcessApplicationRegistration registration = deployment3.getProcessApplicationRegistration();
Set<String> deploymentIds = registration.getDeploymentIds();
assertEquals(3, deploymentIds.size());
deleteDeployments(deployment1, deployment2, deployment3);
}
use of org.camunda.bpm.application.impl.EmbeddedProcessApplication in project camunda-bpm-platform by camunda.
the class RedeploymentTest method testSimpleProcessApplicationDeployment.
public void testSimpleProcessApplicationDeployment() {
// given
EmbeddedProcessApplication processApplication = new EmbeddedProcessApplication();
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);
// when
ProcessApplicationDeployment deployment2 = repositoryService.createDeployment(processApplication.getReference()).name(DEPLOYMENT_NAME).addDeploymentResourceById(deployment1.getId(), resource1.getId()).deploy();
// then
// registration was performed:
ProcessApplicationRegistration registration = deployment2.getProcessApplicationRegistration();
Set<String> deploymentIds = registration.getDeploymentIds();
assertEquals(1, deploymentIds.size());
assertTrue(deploymentIds.contains(deployment2.getId()));
deleteDeployments(deployment1, deployment2);
}
Aggregations