public ProcessEngine getProcessEngine(String name) { return processEngineServiceDelegate.getProcessEngine(name); }
@Produces @ProcessEngineName("") public ProcessEngine processEngine(InjectionPoint ip) { ProcessEngineName annotation = ip.getAnnotated().getAnnotation(ProcessEngineName.class); String processEngineName = annotation.value(); if(processEngineName == null || processEngineName.length() == 0) { throw new ProcessEngineException("Cannot determine which process engine to inject: @ProcessEngineName must specify the name of a process engine."); } try { ProcessEngineService processEngineService = BpmPlatform.getProcessEngineService(); return processEngineService.getProcessEngine(processEngineName); }catch (Exception e) { throw new ProcessEngineException("Cannot find process engine named '"+processEngineName+"' specified using @ProcessEngineName: "+e.getMessage(), e); } }
@Test public void testDeployProcessArchive() { Assert.assertNotNull(processEngineService.getProcessEngine("engine1")); Assert.assertNotNull(processEngineService.getProcessEngine("engine2")); Assert.assertNotNull(processEngineService.getProcessEngine("engine3")); }
@Test public void testDeployProcessArchive() { Assert.assertNotNull(processEngineService.getProcessEngine("engine1")); }
@Test public void testDeployProcessArchive() { Assert.assertNotNull(processEngineService.getProcessEngine("engine1")); }
@Before public void setEngines() { ProcessEngineService engineService = BpmPlatform.getProcessEngineService(); engine1 = engineService.getProcessEngine("engine1"); engine1Configuration = ((ProcessEngineImpl) engine1).getProcessEngineConfiguration(); }
@Before public void setEngines() { ProcessEngineService engineService = BpmPlatform.getProcessEngineService(); engine1 = engineService.getProcessEngine("engine1"); // unregister process application so that context switch cannot be performed unregisterProcessApplication(); }
@Test @OperateOnDeployment("test1") public void testNonExistingEngineRetrieval() { ProcessEngineService engineService = BpmPlatform.getProcessEngineService(); ProcessEngine engine = engineService.getProcessEngine("aNonExistingEngineName"); Assert.assertNull(engine); } }
@Test public void shouldNotActiateJobExecutor() { ProcessEngine processEngine = processEngineService.getProcessEngine("jobExecutorActivate-FALSE-engine"); ProcessEngineConfiguration configuration = processEngine.getProcessEngineConfiguration(); JobExecutor jobExecutor = ((ProcessEngineConfigurationImpl)configuration).getJobExecutor(); assertFalse(jobExecutor.isActive()); processEngine = processEngineService.getProcessEngine("jobExecutorActivate-UNDEFINED-engine"); configuration = processEngine.getProcessEngineConfiguration(); jobExecutor = ((ProcessEngineConfigurationImpl)configuration).getJobExecutor(); assertTrue(jobExecutor.isActive()); } }
public ProcessEngine getProcessEngine(String name) { return processEngineServiceDelegate.getProcessEngine(name); }
@Test @OperateOnDeployment("engine1") public void testResolveBean() throws Exception { //given final ProcessEngine processEngine1 = processEngineService.getProcessEngine("engine1"); Assert.assertEquals("engine1", processEngine1.getName()); createAuthorizations(processEngine1); //when we operate the process under authenticated user processEngine1.getIdentityService().setAuthentication("user1", Arrays.asList("group1")); processEngine1.getRuntimeService().startProcessInstanceByKey("testProcess"); final List<Task> tasks = processEngine1.getTaskService().createTaskQuery().list(); Assert.assertEquals(1, tasks.size()); processEngine1.getTaskService().complete(tasks.get(0).getId()); //then //identityService resolution respects the engine, on which the process is being executed final List<VariableInstance> variableInstances = processEngine1.getRuntimeService().createVariableInstanceQuery().variableName("changeInitiatorUsername") .list(); Assert.assertEquals(1, variableInstances.size()); Assert.assertEquals("user1", variableInstances.get(0).getValue()); }
@Override public ProcessEngine getProcessEngine(String name) { return BpmPlatform.getProcessEngineService().getProcessEngine(name); }
@Test public void testPAGroovyProcessEnginePlugin() { ProcessEngine groovyEngine = processEngineService.getProcessEngine("groovy"); Assert.assertNotNull(groovyEngine); ProcessInstance pi = groovyEngine.getRuntimeService().startProcessInstanceByKey("groovy"); HistoricProcessInstance hpi = groovyEngine.getHistoryService() .createHistoricProcessInstanceQuery().processDefinitionKey("groovy").finished().singleResult(); assertEquals(pi.getId(), hpi.getId()); }
@Test public void testPAGroovyAsyncProcessEnginePlugin() { ProcessEngine groovyEngine = processEngineService.getProcessEngine("groovy"); Assert.assertNotNull(groovyEngine); ProcessInstance pi = groovyEngine.getRuntimeService().startProcessInstanceByKey("groovyAsync"); waitForJobExecutorToProcessAllJobs(); HistoricProcessInstance hpi = groovyEngine.getHistoryService() .createHistoricProcessInstanceQuery().processDefinitionKey("groovyAsync").finished().singleResult(); assertEquals(pi.getId(), hpi.getId()); }
public void testDeployAppWithCustomEngine() { TestApplicationWithCustomEngine processApplication = new TestApplicationWithCustomEngine(); processApplication.deploy(); ProcessEngine processEngine = BpmPlatform.getProcessEngineService().getProcessEngine("embeddedEngine"); assertNotNull(processEngine); assertEquals("embeddedEngine", processEngine.getName()); ProcessEngineConfiguration configuration = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration(); // assert engine properties specified assertTrue(configuration.isJobExecutorDeploymentAware()); assertTrue(configuration.isJobExecutorPreferTimerJobs()); assertTrue(configuration.isJobExecutorAcquireByDueDate()); assertEquals(5, configuration.getJdbcMaxActiveConnections()); processApplication.undeploy(); }
@Produces @ProcessEngineName("") public ProcessEngine processEngine(InjectionPoint ip) { ProcessEngineName annotation = ip.getAnnotated().getAnnotation(ProcessEngineName.class); String processEngineName = annotation.value(); if(processEngineName == null || processEngineName.length() == 0) { throw new ProcessEngineException("Cannot determine which process engine to inject: @ProcessEngineName must specify the name of a process engine."); } try { ProcessEngineService processEngineService = BpmPlatform.getProcessEngineService(); return processEngineService.getProcessEngine(processEngineName); }catch (Exception e) { throw new ProcessEngineException("Cannot find process engine named '"+processEngineName+"' specified using @ProcessEngineName: "+e.getMessage(), e); } }
public void testDeployAppWithCustomEngine() { TestApplicationWithCustomEngine processApplication = new TestApplicationWithCustomEngine(); processApplication.deploy(); ProcessEngine processEngine = BpmPlatform.getProcessEngineService().getProcessEngine("embeddedEngine"); assertNotNull(processEngine); assertEquals("embeddedEngine", processEngine.getName()); ProcessEngineConfiguration configuration = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration(); // assert engine properties specified assertTrue(configuration.isJobExecutorDeploymentAware()); assertTrue(configuration.isJobExecutorPreferTimerJobs()); assertTrue(configuration.isJobExecutorAcquireByDueDate()); assertEquals(5, configuration.getJdbcMaxActiveConnections()); processApplication.undeploy(); }