本文整理汇总了Java中org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java StandaloneInMemProcessEngineConfiguration类的具体用法?Java StandaloneInMemProcessEngineConfiguration怎么用?Java StandaloneInMemProcessEngineConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StandaloneInMemProcessEngineConfiguration类属于org.camunda.bpm.engine.impl.cfg包,在下文中一共展示了StandaloneInMemProcessEngineConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration; //导入依赖的package包/类
public static void init() throws SQLException {
Bus.register(new OrderCamunda());
// Configure Camunda engine (in this case using in memory H2)
StandaloneInMemProcessEngineConfiguration conf = new StandaloneInMemProcessEngineConfiguration();
conf.setJobExecutorActivate(true);
conf.setHistoryLevel(HistoryLevel.HISTORY_LEVEL_FULL);
conf.setJdbcUsername("sa");
conf.setJdbcPassword("sa");
camunda = conf.buildProcessEngine();
// and start H2 database server to allow inspection from the outside
Server.createTcpServer(new String[] { "-tcpPort", "8092", "-tcpAllowOthers" }).start();
// Define flow
BpmnModelInstance flow = extendedFlowOfActivities();
// Deploy finished flow to Camunda
camunda.getRepositoryService().createDeployment() //
.addModelInstance("order.bpmn", flow) //
.deploy();
// Only for demo: write flow to file, so we can open it in modeler
Bpmn.writeModelToFile(new File("order.bpmn"), flow);
}
示例2: testFallbackSerializer
import org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration; //导入依赖的package包/类
@Test
public void testFallbackSerializer() {
// given
// that the process engine is configured with a fallback serializer factory
ProcessEngineConfigurationImpl engineConfiguration = new StandaloneInMemProcessEngineConfiguration()
.setJdbcUrl("jdbc:h2:mem:camunda-forceclose")
.setProcessEngineName("engine-forceclose");
engineConfiguration.setFallbackSerializerFactory(new ExampleSerializerFactory());
processEngine = engineConfiguration.buildProcessEngine();
deployOneTaskProcess(processEngine);
// when setting a variable that no regular serializer can handle
ObjectValue objectValue = Variables.objectValue("foo").serializationDataFormat(ExampleSerializer.FORMAT).create();
ProcessInstance pi = processEngine.getRuntimeService().startProcessInstanceByKey("oneTaskProcess",
Variables.createVariables().putValueTyped("var", objectValue));
ObjectValue fetchedValue = processEngine.getRuntimeService().getVariableTyped(pi.getId(), "var", true);
// then the fallback serializer is used
Assert.assertNotNull(fetchedValue);
Assert.assertEquals(ExampleSerializer.FORMAT, fetchedValue.getSerializationDataFormat());
Assert.assertEquals("foo", fetchedValue.getValue());
}
示例3: testForceCloseMybatisConnectionPoolTrue
import org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration; //导入依赖的package包/类
@Test
public void testForceCloseMybatisConnectionPoolTrue() {
// given
// that the process engine is configured with forceCloseMybatisConnectionPool = true
ProcessEngineConfigurationImpl configurationImpl = new StandaloneInMemProcessEngineConfiguration()
.setJdbcUrl("jdbc:h2:mem:camunda-forceclose")
.setProcessEngineName("engine-forceclose")
.setForceCloseMybatisConnectionPool(true);
ProcessEngine processEngine = configurationImpl
.buildProcessEngine();
PooledDataSource pooledDataSource = (PooledDataSource) configurationImpl.getDataSource();
PoolState state = pooledDataSource.getPoolState();
// then
// if the process engine is closed
processEngine.close();
// the idle connections are closed
Assert.assertTrue(state.getIdleConnectionCount() == 0);
}
示例4: main
import org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration; //导入依赖的package包/类
public static void main(String[] args) {
// Configure and startup (in memory) engine
ProcessEngine camunda =
new StandaloneInMemProcessEngineConfiguration()
.buildProcessEngine();
// define saga as BPMN process
ProcessBuilder saga = Bpmn.createExecutableProcess("trip");
// - flow of activities and compensating actions
saga.startEvent()
.serviceTask("car").name("Reserve car").camundaClass(ReserveCarAdapter.class)
.boundaryEvent().compensateEventDefinition().compensateEventDefinitionDone()
.compensationStart().serviceTask("car-compensate").name("Cancel car").camundaClass(CancelCarAdapter.class).compensationDone()
.serviceTask("hotel").name("Book hotel").camundaClass(BookHotelAdapter.class)
.boundaryEvent().compensateEventDefinition().compensateEventDefinitionDone()
.compensationStart().serviceTask("hotel-compensate").name("Hotel car").camundaClass(CancelCarAdapter.class).compensationDone()
.serviceTask("flight").name("Book flight").camundaClass(BookFlightAdapter.class)
.boundaryEvent().compensateEventDefinition().compensateEventDefinitionDone()
.compensationStart().serviceTask("flight-compensate").name("Cancel flight").camundaClass(CancelCarAdapter.class).compensationDone()
.endEvent();
// - trigger compensation in case of any exception (other triggers are possible)
saga.eventSubProcess()
.startEvent().error("java.lang.Throwable")
.intermediateThrowEvent().compensateEventDefinition().compensateEventDefinitionDone()
.endEvent();
// finish Saga and deploy it to Camunda
camunda.getRepositoryService().createDeployment() //
.addModelInstance("trip.bpmn", saga.done()) //
.deploy();
// now we can start running instances of our saga - its state will be persisted
camunda.getRuntimeService().startProcessInstanceByKey("trip", Variables.putValue("name", "trip1"));
camunda.getRuntimeService().startProcessInstanceByKey("trip", Variables.putValue("name", "trip2"));
}
示例5: fails_to_get_eventBus_from_engine
import org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration; //导入依赖的package包/类
@Test
public void fails_to_get_eventBus_from_engine() {
ProcessEngine engine = new StandaloneInMemProcessEngineConfiguration(){{
setDatabaseSchemaUpdate(ProcessEngineConfigurationImpl.DB_SCHEMA_UPDATE_DROP_CREATE);
}}.buildProcessEngine();
try {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("No eventBus found. Make sure the Reactor plugin is configured correctly.");
CamundaReactor.eventBus(engine);
} finally {
engine.close();
}
}
示例6: no_delegate_for_standaloneConfig
import org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration; //导入依赖的package包/类
@Test
public void no_delegate_for_standaloneConfig() throws Exception {
ProcessEngineConfigurationImpl c = new StandaloneInMemProcessEngineConfiguration();
DummySpringPlugin plugin = new DummySpringPlugin();
plugin.preInit(c);
plugin.postInit(c);
assertThat(plugin.preInit).isFalse();
assertThat(plugin.postInit).isFalse();
}
开发者ID:camunda,项目名称:camunda-bpm-spring-boot-starter,代码行数:13,代码来源:SpringBootProcessEnginePluginTest.java
示例7: setUp
import org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration; //导入依赖的package包/类
@Before
public void setUp() {
processEngineConfiguration = new StandaloneInMemProcessEngineConfiguration() {{
historyLevel = HistoryLevel.HISTORY_LEVEL_NONE;
jobExecutorActivate = false;
databaseSchemaUpdate = DB_SCHEMA_UPDATE_FALSE;
expressionManager = new MockExpressionManager();
}};
final DataSource h2 = new DriverDataSource(this.getClass().getClassLoader(), null, "jdbc:h2:mem:process-engine;DB_CLOSE_DELAY=-1", "sa", "sa");
processEngineConfiguration.setDataSource(h2);
showcaseSetup = new ShowcaseSetup(h2);
}
示例8: main
import org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration; //导入依赖的package包/类
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();
}
}
}
示例9: createProcessEngine
import org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration; //导入依赖的package包/类
private ProcessEngine createProcessEngine() {
StandaloneInMemProcessEngineConfiguration configuration = new StandaloneInMemProcessEngineConfiguration();
configuration.setCustomPreBPMNParseListeners(Collections.<BpmnParseListener> singletonList(eventBridgeActivator));
configuration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
ProcessEngineFactoryWithELResolver engineFactory = new ProcessEngineFactoryWithELResolver();
engineFactory.setProcessEngineConfiguration(configuration);
engineFactory.setBundle(bundleContext.getBundle());
engineFactory.setExpressionManager(new OSGiExpressionManager());
engineFactory.init();
return engineFactory.getObject();
}
示例10: start
import org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void start(){
BundleContext context = mock(BundleContext.class);
when(context.getBundle()).thenReturn(mock(Bundle.class));
BundleClassloaderAwareProcessEngineController controller = new TestBundleClassloaderAwareProcessEngineController(new StandaloneInMemProcessEngineConfiguration(), context);
controller.start(mock(PlatformServiceContainer.class));
verify(context, atLeastOnce()).registerService(eq(ProcessEngine.class), any(ProcessEngine.class), any(Hashtable.class));
}
开发者ID:camunda,项目名称:camunda-bpm-platform-osgi,代码行数:10,代码来源:BundleClassloaderAwareProcessEngineControllerTest.java
示例11: stop
import org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void stop(){
BundleContext context = mock(BundleContext.class);
when(context.getBundle()).thenReturn(mock(Bundle.class));
TestBundleClassloaderAwareProcessEngineController controller = new TestBundleClassloaderAwareProcessEngineController(new StandaloneInMemProcessEngineConfiguration(), context);
ServiceRegistration<ProcessEngine> reg = mock(ServiceRegistration.class);
controller.setRegistration(reg);
controller.stop(null);
verify(reg, atLeastOnce()).unregister();
verify(controller.getFactory(), atLeastOnce()).destroy();
}
开发者ID:camunda,项目名称:camunda-bpm-platform-osgi,代码行数:13,代码来源:BundleClassloaderAwareProcessEngineControllerTest.java
示例12: createProcessEngineImpl
import org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration; //导入依赖的package包/类
protected static ProcessEngineImpl createProcessEngineImpl(boolean dmnEnabled) {
StandaloneInMemProcessEngineConfiguration config =
(StandaloneInMemProcessEngineConfiguration) new CustomStandaloneInMemProcessEngineConfiguration()
.setProcessEngineName("database-dmn-test-engine")
.setDatabaseSchemaUpdate("false")
.setHistory(ProcessEngineConfiguration.HISTORY_FULL)
.setJdbcUrl("jdbc:h2:mem:DatabaseDmnTest");
config.setDmnEnabled(dmnEnabled);
return (ProcessEngineImpl) config.buildProcessEngine();
}
示例13: testFallbackSerializerDoesNotOverrideRegularSerializer
import org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration; //导入依赖的package包/类
@Test
public void testFallbackSerializerDoesNotOverrideRegularSerializer() {
// given
// that the process engine is configured with a serializer for a certain format
// and a fallback serializer factory for the same format
ProcessEngineConfigurationImpl engineConfiguration = new StandaloneInMemProcessEngineConfiguration()
.setJdbcUrl("jdbc:h2:mem:camunda-forceclose")
.setProcessEngineName("engine-forceclose");
engineConfiguration.setCustomPreVariableSerializers(Arrays.<TypedValueSerializer>asList(new ExampleConstantSerializer()));
engineConfiguration.setFallbackSerializerFactory(new ExampleSerializerFactory());
processEngine = engineConfiguration.buildProcessEngine();
deployOneTaskProcess(processEngine);
// when setting a variable that no regular serializer can handle
ObjectValue objectValue = Variables.objectValue("foo").serializationDataFormat(ExampleSerializer.FORMAT).create();
ProcessInstance pi = processEngine.getRuntimeService().startProcessInstanceByKey("oneTaskProcess",
Variables.createVariables().putValueTyped("var", objectValue));
ObjectValue fetchedValue = processEngine.getRuntimeService().getVariableTyped(pi.getId(), "var", true);
// then the fallback serializer is used
Assert.assertNotNull(fetchedValue);
Assert.assertEquals(ExampleSerializer.FORMAT, fetchedValue.getSerializationDataFormat());
Assert.assertEquals(ExampleConstantSerializer.DESERIALIZED_VALUE, fetchedValue.getValue());
}
示例14: testCreateConfigurationWithMismatchtingSchemaAndPrefix
import org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration; //导入依赖的package包/类
public void testCreateConfigurationWithMismatchtingSchemaAndPrefix() {
try {
StandaloneInMemProcessEngineConfiguration configuration = new StandaloneInMemProcessEngineConfiguration();
configuration.setDatabaseSchema("foo");
configuration.setDatabaseTablePrefix("bar");
configuration.buildProcessEngine();
fail("Should throw exception");
} catch (ProcessEngineException e) {
// as expected
assertTrue(e.getMessage().contains("When setting a schema the prefix has to be schema + '.'"));
}
}
示例15: testCreateConfigurationWithMissingDotInSchemaAndPrefix
import org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration; //导入依赖的package包/类
public void testCreateConfigurationWithMissingDotInSchemaAndPrefix() {
try {
StandaloneInMemProcessEngineConfiguration configuration = new StandaloneInMemProcessEngineConfiguration();
configuration.setDatabaseSchema("foo");
configuration.setDatabaseTablePrefix("foo");
configuration.buildProcessEngine();
fail("Should throw exception");
} catch (ProcessEngineException e) {
// as expected
assertTrue(e.getMessage().contains("When setting a schema the prefix has to be schema + '.'"));
}
}