org.camunda.bpm.engine.ProcessEngines Java Examples
The following examples show how to use
org.camunda.bpm.engine.ProcessEngines.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultProcessEngineConfiguration.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
private void setProcessEngineName(SpringProcessEngineConfiguration configuration) { String processEngineName = StringUtils.trimAllWhitespace(camundaBpmProperties.getProcessEngineName()); if (!StringUtils.isEmpty(processEngineName) && !processEngineName.contains("-")) { if (camundaBpmProperties.getGenerateUniqueProcessEngineName()) { if (!processEngineName.equals(ProcessEngines.NAME_DEFAULT)) { throw new RuntimeException(String.format("A unique processEngineName cannot be generated " + "if a custom processEngineName is already set: %s", processEngineName)); } processEngineName = CamundaBpmProperties.getUniqueName(camundaBpmProperties.UNIQUE_ENGINE_NAME_PREFIX); } configuration.setProcessEngineName(processEngineName); } else { logger.warn("Ignoring invalid processEngineName='{}' - must not be null, blank or contain hyphen", camundaBpmProperties.getProcessEngineName()); } }
Example #2
Source File: ConcurrentProcessEngineJobExecutorHistoryCleanupJobTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Override protected void closeDownProcessEngine() { super.closeDownProcessEngine(); final ProcessEngine otherProcessEngine = ProcessEngines.getProcessEngine(PROCESS_ENGINE_NAME); if (otherProcessEngine != null) { ((ProcessEngineConfigurationImpl)otherProcessEngine.getProcessEngineConfiguration()).getCommandExecutorTxRequired().execute(new Command<Void>() { public Void execute(CommandContext commandContext) { List<Job> jobs = otherProcessEngine.getManagementService().createJobQuery().list(); if (jobs.size() > 0) { assertEquals(1, jobs.size()); String jobId = jobs.get(0).getId(); commandContext.getJobManager().deleteJob((JobEntity) jobs.get(0)); commandContext.getHistoricJobLogManager().deleteHistoricJobLogByJobId(jobId); } return null; } }); otherProcessEngine.close(); ProcessEngines.unregister(otherProcessEngine); } }
Example #3
Source File: ProcessEngineImpl.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Override public void close() { ProcessEngines.unregister(this); if(processEngineConfiguration.isMetricsEnabled()) { processEngineConfiguration.getDbMetricsReporter().stop(); } if ((jobExecutor != null)) { // unregister process engine with Job Executor jobExecutor.unregisterProcessEngine(this); } commandExecutorSchemaOperations.execute(new SchemaOperationProcessEngineClose()); processEngineConfiguration.close(); LOG.processEngineClosed(name); }
Example #4
Source File: ManagedProcessEngineFactoryImplTest.java From camunda-bpm-platform-osgi with Apache License 2.0 | 6 votes |
@SuppressWarnings({ "unchecked", "rawtypes" }) @Test public void deleteEngine() throws Throwable{ String engineName = "TestEngine"; Bundle bundle = mock(Bundle.class); // mock stuff the BundleDelegatingClassLoader does/needs mockGetResource(bundle); mockLoadClass(bundle); BundleContext bundleContext = mock(BundleContext.class); when(bundle.getBundleContext()).thenReturn(bundleContext); ServiceRegistration registrationMock = mock(ServiceRegistration.class); when(bundleContext.registerService(eq(ProcessEngine.class), any(ProcessEngine.class), any(Dictionary.class))).thenReturn(registrationMock); ManagedProcessEngineFactoryImpl factory = new ManagedProcessEngineFactoryImpl(bundle); Hashtable<String, String> properties = createEngineProperties(engineName); factory.updated("id", properties); factory.deleted("id"); verify(registrationMock, times(1)).unregister(); assertThat(ProcessEngines.getProcessEngine(engineName), is(nullValue())); }
Example #5
Source File: ManagedProcessEngineFactoryImplTest.java From camunda-bpm-platform-osgi with Apache License 2.0 | 6 votes |
@SuppressWarnings({ "rawtypes", "unchecked" }) @Test public void updatedNewConfiguration() throws Exception { String engineName = "TestEngine"; Bundle bundle = mock(Bundle.class); // mock stuff the BundleDelegatingClassLoader does/needs mockGetResource(bundle); mockLoadClass(bundle); BundleContext bundleContext = mock(BundleContext.class); when(bundle.getBundleContext()).thenReturn(bundleContext); when(bundleContext.registerService(eq(ProcessEngine.class), any(ProcessEngine.class), any(Dictionary.class))).thenReturn(mock(ServiceRegistration.class)); ManagedProcessEngineFactoryImpl factory = new ManagedProcessEngineFactoryImpl(bundle); Hashtable<String, String> properties = createEngineProperties(engineName); factory.updated("id", properties); ArgumentCaptor<Dictionary> propsCapture = ArgumentCaptor.forClass(Dictionary.class); ArgumentCaptor<ProcessEngine> engineCapture = ArgumentCaptor.forClass(ProcessEngine.class); verify(bundleContext, times(1)).registerService(eq(ProcessEngine.class), engineCapture.capture(), propsCapture.capture()); assertThat(engineCapture.getValue(), is(notNullValue())); assertThat(propsCapture.getValue().get("process-engine-name"), is((Object) engineName)); assertThat(ProcessEngines.getProcessEngine(engineName), is(notNullValue())); }
Example #6
Source File: StandaloneDebugWebsocketBootstrap.java From camunda-bpm-workbench with GNU Affero General Public License v3.0 | 6 votes |
public static void main(String[] args) { // start process engine StandaloneInMemProcessEngineConfiguration processEngineConfiguration = new StandaloneInMemProcessEngineConfiguration(); processEngineConfiguration.setProcessEngineName(ProcessEngines.NAME_DEFAULT); // add plugins List<ProcessEnginePlugin> processEnginePlugins = processEngineConfiguration.getProcessEnginePlugins(); processEnginePlugins.add(new DebuggerPlugin()); processEnginePlugins.add(new SpinProcessEnginePlugin()); processEnginePlugins.add(new ConnectProcessEnginePlugin()); processEngineConfiguration.buildProcessEngine(); DebugSessionFactory.getInstance().setSuspend(false); // start debug server DebugWebsocket debugWebsocket = null; try { // configure & start the server debugWebsocket = new DebugWebsocketConfiguration() .port(9090) .startServer(); // block debugWebsocket.waitForShutdown(); } finally { if(debugWebsocket != null) { debugWebsocket.shutdown(); } } }
Example #7
Source File: ScenarioImpl.java From camunda-bpm-assert-scenario with Apache License 2.0 | 6 votes |
protected void init() { if (executed) throw new IllegalStateException("Scenarios may use execute() just once per Scenario.run(). " + "Please create a new Scenario.run()."); executed = true; if (processEngine == null) { Map<String, ProcessEngine> processEngines = ProcessEngines.getProcessEngines(); if (processEngines.size() == 1) { init(processEngines.values().iterator().next()); } else { String message = processEngines.size() == 0 ? "No ProcessEngine found to be " + "registered with " + ProcessEngines.class.getSimpleName() + "!" : String.format(processEngines.size() + " ProcessEngines initialized. " + "Explicitely initialise engine by calling " + ScenarioImpl.class.getSimpleName() + "(scenario, engine)"); throw new IllegalStateException(message); } } }
Example #8
Source File: DefaultProcessEngineConfiguration.java From camunda-bpm-spring-boot-starter with Apache License 2.0 | 6 votes |
private void setProcessEngineName(SpringProcessEngineConfiguration configuration) { String processEngineName = StringUtils.trimAllWhitespace(camundaBpmProperties.getProcessEngineName()); if (!StringUtils.isEmpty(processEngineName) && !processEngineName.contains("-")) { if (camundaBpmProperties.getGenerateUniqueProcessEngineName()) { if (!processEngineName.equals(ProcessEngines.NAME_DEFAULT)) { throw new RuntimeException(String.format("A unique processEngineName cannot be generated " + "if a custom processEngineName is already set: %s", processEngineName)); } processEngineName = CamundaBpmProperties.getUniqueName(camundaBpmProperties.UNIQUE_ENGINE_NAME_PREFIX); } configuration.setProcessEngineName(processEngineName); } else { logger.warn("Ignoring invalid processEngineName='{}' - must not be null, blank or contain hyphen", camundaBpmProperties.getProcessEngineName()); } }
Example #9
Source File: PaContextCacheTest2.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Override @Test public void testEngineName() { assertThat(processEngine.getName()).isNotEqualTo(ProcessEngines.NAME_DEFAULT); assertThat(processEngine.getName()).containsPattern("processEngine\\w{10}"); }
Example #10
Source File: DbSchemaDrop.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public static void main(String[] args) { ProcessEngineImpl processEngine = (ProcessEngineImpl) ProcessEngines.getDefaultProcessEngine(); CommandExecutor commandExecutor = processEngine.getProcessEngineConfiguration().getCommandExecutorTxRequired(); commandExecutor.execute(new Command<Object> (){ public Object execute(CommandContext commandContext) { commandContext .getSession(PersistenceSession.class) .dbSchemaDrop(); return null; } }); processEngine.close(); }
Example #11
Source File: DbSchemaPrune.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public static void main(String[] args) { ProcessEngineImpl processEngine = (ProcessEngineImpl) ProcessEngines.getDefaultProcessEngine(); CommandExecutor commandExecutor = processEngine.getProcessEngineConfiguration().getCommandExecutorTxRequired(); commandExecutor.execute(new Command<Object> (){ public Object execute(CommandContext commandContext) { commandContext .getSession(PersistenceSession.class) .dbSchemaPrune(); return null; } }); }
Example #12
Source File: HistoryCleanupOnEngineBootstrapTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void testConsecutiveEngineBootstrapHistoryCleanupJobReconfiguration() { // given // create history cleanup job ProcessEngineConfiguration .createProcessEngineConfigurationFromResource("org/camunda/bpm/engine/test/history/batchwindow.camunda.cfg.xml") .buildProcessEngine() .close(); // when // suspend history cleanup job ProcessEngineConfiguration .createProcessEngineConfigurationFromResource("org/camunda/bpm/engine/test/history/no-batchwindow.camunda.cfg.xml") .buildProcessEngine() .close(); // then // reconfigure history cleanup job ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration .createProcessEngineConfigurationFromResource("org/camunda/bpm/engine/test/history/batchwindow.camunda.cfg.xml"); processEngineConfiguration.setProcessEngineName(ENGINE_NAME); ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine(); assertNotNull(ProcessEngines.getProcessEngine(ENGINE_NAME)); closeProcessEngine(processEngine); }
Example #13
Source File: ProcessEnginesTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public void testProcessEngineInfo() { List<ProcessEngineInfo> processEngineInfos = ProcessEngines.getProcessEngineInfos(); assertEquals(1, processEngineInfos.size()); ProcessEngineInfo processEngineInfo = processEngineInfos.get(0); assertNull(processEngineInfo.getException()); assertNotNull(processEngineInfo.getName()); assertNotNull(processEngineInfo.getResourceUrl()); ProcessEngine processEngine = ProcessEngines.getProcessEngine(ProcessEngines.NAME_DEFAULT); assertNotNull(processEngine); }
Example #14
Source File: AbstractContextCacheTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void testEngineRegistration() { // do ProcessEngine registeredEngine = ProcessEngines.getProcessEngine("default"); assertThat(registeredEngine).isNotSameAs(processEngine); }
Example #15
Source File: NonPaContextCacheTest4.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Override @Test public void testEngineName() { assertThat(processEngine.getName()).isNotEqualTo(ProcessEngines.NAME_DEFAULT); assertThat(processEngine.getName()).containsPattern("processEngine\\w{10}"); }
Example #16
Source File: NonPaContextCacheTest5.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Override @Test public void testEngineName() { assertThat(processEngine.getName()).isNotEqualTo(ProcessEngines.NAME_DEFAULT); assertThat(processEngine.getName()).containsPattern("processEngine\\w{10}"); }
Example #17
Source File: NonPaContextCacheTest2.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Override @Test public void testEngineName() { assertThat(processEngine.getName()).isNotEqualTo(ProcessEngines.NAME_DEFAULT); assertThat(processEngine.getName()).containsPattern("processEngine\\w{10}"); }
Example #18
Source File: PaContextCacheTest5.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Override @Test public void testEngineName() { assertThat(processEngine.getName()).isNotEqualTo(ProcessEngines.NAME_DEFAULT); assertThat(processEngine.getName()).containsPattern("processEngine\\w{10}"); }
Example #19
Source File: PaContextCacheTest4.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Override @Test public void testEngineName() { assertThat(processEngine.getName()).isNotEqualTo(ProcessEngines.NAME_DEFAULT); assertThat(processEngine.getName()).containsPattern("processEngine\\w{10}"); }
Example #20
Source File: PaContextCacheTest4.java From camunda-bpm-spring-boot-starter with Apache License 2.0 | 5 votes |
@Override @Test public void testEngineName() { assertThat(processEngine.getName()).isNotEqualTo(ProcessEngines.NAME_DEFAULT); assertThat(processEngine.getName()).containsPattern("processEngine\\w{10}"); }
Example #21
Source File: ContainerManagedProcessEngineProvider.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Override public ProcessEngine getDefaultProcessEngine() { ProcessEngine defaultProcessEngine = BpmPlatform.getDefaultProcessEngine(); if(defaultProcessEngine != null) { return defaultProcessEngine; } else { return ProcessEngines.getDefaultProcessEngine(false); } }
Example #22
Source File: PaContextCacheTest5.java From camunda-bpm-spring-boot-starter with Apache License 2.0 | 5 votes |
@Override @Test public void testEngineName() { assertThat(processEngine.getName()).isNotEqualTo(ProcessEngines.NAME_DEFAULT); assertThat(processEngine.getName()).containsPattern("processEngine\\w{10}"); }
Example #23
Source File: NonPaContextCacheTest2.java From camunda-bpm-spring-boot-starter with Apache License 2.0 | 5 votes |
@Override @Test public void testEngineName() { assertThat(processEngine.getName()).isNotEqualTo(ProcessEngines.NAME_DEFAULT); assertThat(processEngine.getName()).containsPattern("processEngine\\w{10}"); }
Example #24
Source File: NonPaContextCacheTest5.java From camunda-bpm-spring-boot-starter with Apache License 2.0 | 5 votes |
@Override @Test public void testEngineName() { assertThat(processEngine.getName()).isNotEqualTo(ProcessEngines.NAME_DEFAULT); assertThat(processEngine.getName()).containsPattern("processEngine\\w{10}"); }
Example #25
Source File: NonPaContextCacheTest4.java From camunda-bpm-spring-boot-starter with Apache License 2.0 | 5 votes |
@Override @Test public void testEngineName() { assertThat(processEngine.getName()).isNotEqualTo(ProcessEngines.NAME_DEFAULT); assertThat(processEngine.getName()).containsPattern("processEngine\\w{10}"); }
Example #26
Source File: AbstractContextCacheTest.java From camunda-bpm-spring-boot-starter with Apache License 2.0 | 5 votes |
@Test public void testEngineRegistration() { // do ProcessEngine registeredEngine = ProcessEngines.getProcessEngine("default"); assertThat(registeredEngine).isNotSameAs(processEngine); }
Example #27
Source File: SequentialJobAcquisitionTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@After public void closeProcessEngines() { Iterator<ProcessEngine> iterator = createdProcessEngines.iterator(); while (iterator.hasNext()) { ProcessEngine processEngine = iterator.next(); processEngine.close(); ProcessEngines.unregister(processEngine); iterator.remove(); } }
Example #28
Source File: ProcessEngineBootstrapRule.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Override protected void finished(Description description) { deleteHistoryCleanupJob(); processEngine.close(); ProcessEngines.unregister(processEngine); processEngine = null; }
Example #29
Source File: DeploymentAwareJobExecutorTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected void closeDownProcessEngine() { super.closeDownProcessEngine(); if (otherProcessEngine != null) { otherProcessEngine.close(); ProcessEngines.unregister(otherProcessEngine); otherProcessEngine = null; } }
Example #30
Source File: PaContextCacheTest2.java From camunda-bpm-spring-boot-starter with Apache License 2.0 | 5 votes |
@Override @Test public void testEngineName() { assertThat(processEngine.getName()).isNotEqualTo(ProcessEngines.NAME_DEFAULT); assertThat(processEngine.getName()).containsPattern("processEngine\\w{10}"); }