use of org.camunda.bpm.container.impl.metadata.spi.ProcessEnginePluginXml in project camunda-bpm-platform by camunda.
the class StartProcessEngineStep method configurePlugins.
/**
* <p>Instantiates and applies all {@link ProcessEnginePlugin}s defined in the processEngineXml
*/
protected void configurePlugins(ProcessEngineConfigurationImpl configuration, ProcessEngineXml processEngineXml, ClassLoader classLoader) {
for (ProcessEnginePluginXml pluginXml : processEngineXml.getPlugins()) {
// create plugin instance
Class<? extends ProcessEnginePlugin> pluginClass = loadClass(pluginXml.getPluginClass(), classLoader, ProcessEnginePlugin.class);
ProcessEnginePlugin plugin = createInstance(pluginClass);
// apply configured properties
Map<String, String> properties = pluginXml.getProperties();
PropertyHelper.applyProperties(plugin, properties);
// add to configuration
configuration.getProcessEnginePlugins().add(plugin);
}
}
use of org.camunda.bpm.container.impl.metadata.spi.ProcessEnginePluginXml in project camunda-bpm-platform by camunda.
the class BpmPlatformXmlParserTest method testParseBpmPlatformXmlOneEngine.
public void testParseBpmPlatformXmlOneEngine() {
BpmPlatformXml bpmPlatformXml = parser.createParse().sourceUrl(getStreamUrl("bpmplatform_xml_one_engine.xml")).execute().getBpmPlatformXml();
assertNotNull(bpmPlatformXml);
assertNotNull(bpmPlatformXml.getJobExecutor());
assertEquals(1, bpmPlatformXml.getProcessEngines().size());
JobExecutorXml jobExecutorXml = bpmPlatformXml.getJobExecutor();
assertEquals(1, jobExecutorXml.getJobAcquisitions().size());
assertThat(jobExecutorXml.getProperties().size(), is(2));
JobAcquisitionXml jobAcquisitionXml = jobExecutorXml.getJobAcquisitions().get(0);
assertEquals("default", jobAcquisitionXml.getName());
assertEquals("org.camunda.bpm.engine.impl.jobexecutor.DefaultJobExecutor", jobAcquisitionXml.getJobExecutorClassName());
assertEquals(2, jobAcquisitionXml.getProperties().size());
ProcessEngineXml engineXml = bpmPlatformXml.getProcessEngines().get(0);
assertEquals("engine1", engineXml.getName());
assertEquals("default", engineXml.getJobAcquisitionName());
Map<String, String> properties = engineXml.getProperties();
assertNotNull(properties);
assertEquals(0, properties.size());
List<ProcessEnginePluginXml> plugins = engineXml.getPlugins();
assertNotNull(plugins);
assertEquals(0, plugins.size());
}
use of org.camunda.bpm.container.impl.metadata.spi.ProcessEnginePluginXml in project camunda-bpm-platform by camunda.
the class BpmPlatformXmlParserTest method testParseBpmPlatformXmlMultipleEnginePlugins.
public void testParseBpmPlatformXmlMultipleEnginePlugins() {
BpmPlatformXml bpmPlatformXml = parser.createParse().sourceUrl(getStreamUrl("bpmplatform_xml_multiple_engine_plugins.xml")).execute().getBpmPlatformXml();
assertNotNull(bpmPlatformXml);
assertEquals(1, bpmPlatformXml.getProcessEngines().size());
ProcessEngineXml engineXml = bpmPlatformXml.getProcessEngines().get(0);
assertEquals("engine1", engineXml.getName());
assertEquals("default", engineXml.getJobAcquisitionName());
List<ProcessEnginePluginXml> plugins = engineXml.getPlugins();
assertEquals(2, plugins.size());
}
use of org.camunda.bpm.container.impl.metadata.spi.ProcessEnginePluginXml in project camunda-bpm-platform by camunda.
the class BpmPlatformXmlParserTest method testParseProcessesXmlAntStyleProperties.
public void testParseProcessesXmlAntStyleProperties() {
BpmPlatformXml platformXml = parser.createParse().sourceUrl(getStreamUrl("bpmplatform_xml_ant_style_properties.xml")).execute().getBpmPlatformXml();
assertNotNull(platformXml);
ProcessEngineXml engineXml = platformXml.getProcessEngines().get(0);
assertEquals(1, engineXml.getPlugins().size());
ProcessEnginePluginXml pluginXml = engineXml.getPlugins().get(0);
Map<String, String> properties = pluginXml.getProperties();
assertEquals(2, properties.size());
// these two system properties are guaranteed to be set
assertEquals(System.getProperty("java.version"), properties.get("prop1"));
assertEquals("prefix-" + System.getProperty("os.name"), properties.get("prop2"));
}
use of org.camunda.bpm.container.impl.metadata.spi.ProcessEnginePluginXml in project camunda-bpm-platform by camunda.
the class BpmPlatformXmlParserTest method testParseBpmPlatformXmlEnginePlugin.
public void testParseBpmPlatformXmlEnginePlugin() {
BpmPlatformXml bpmPlatformXml = parser.createParse().sourceUrl(getStreamUrl("bpmplatform_xml_engine_plugin.xml")).execute().getBpmPlatformXml();
assertNotNull(bpmPlatformXml);
assertEquals(1, bpmPlatformXml.getProcessEngines().size());
ProcessEngineXml engineXml = bpmPlatformXml.getProcessEngines().get(0);
assertEquals("engine1", engineXml.getName());
assertEquals("default", engineXml.getJobAcquisitionName());
List<ProcessEnginePluginXml> plugins = engineXml.getPlugins();
assertEquals(1, plugins.size());
ProcessEnginePluginXml plugin1 = plugins.get(0);
assertNotNull(plugin1);
assertEquals("org.camunda.bpm.MyAwesomePlugin", plugin1.getPluginClass());
Map<String, String> properties = plugin1.getProperties();
assertNotNull(properties);
assertEquals(2, properties.size());
String val1 = properties.get("prop1");
assertNotNull(val1);
assertEquals("val1", val1);
String val2 = properties.get("prop2");
assertNotNull(val2);
assertEquals("val2", val2);
}
Aggregations