Search in sources :

Example 6 with ProcessEnginePluginXml

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);
    }
}
Also used : ProcessEnginePluginXml(org.camunda.bpm.container.impl.metadata.spi.ProcessEnginePluginXml) ProcessEnginePlugin(org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin)

Example 7 with ProcessEnginePluginXml

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());
}
Also used : ProcessEnginePluginXml(org.camunda.bpm.container.impl.metadata.spi.ProcessEnginePluginXml) ProcessEngineXml(org.camunda.bpm.container.impl.metadata.spi.ProcessEngineXml) BpmPlatformXml(org.camunda.bpm.container.impl.metadata.spi.BpmPlatformXml) JobExecutorXml(org.camunda.bpm.container.impl.metadata.spi.JobExecutorXml) JobAcquisitionXml(org.camunda.bpm.container.impl.metadata.spi.JobAcquisitionXml)

Example 8 with ProcessEnginePluginXml

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());
}
Also used : ProcessEnginePluginXml(org.camunda.bpm.container.impl.metadata.spi.ProcessEnginePluginXml) ProcessEngineXml(org.camunda.bpm.container.impl.metadata.spi.ProcessEngineXml) BpmPlatformXml(org.camunda.bpm.container.impl.metadata.spi.BpmPlatformXml)

Example 9 with ProcessEnginePluginXml

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"));
}
Also used : ProcessEnginePluginXml(org.camunda.bpm.container.impl.metadata.spi.ProcessEnginePluginXml) ProcessEngineXml(org.camunda.bpm.container.impl.metadata.spi.ProcessEngineXml) BpmPlatformXml(org.camunda.bpm.container.impl.metadata.spi.BpmPlatformXml)

Example 10 with ProcessEnginePluginXml

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);
}
Also used : ProcessEnginePluginXml(org.camunda.bpm.container.impl.metadata.spi.ProcessEnginePluginXml) ProcessEngineXml(org.camunda.bpm.container.impl.metadata.spi.ProcessEngineXml) BpmPlatformXml(org.camunda.bpm.container.impl.metadata.spi.BpmPlatformXml)

Aggregations

ProcessEnginePluginXml (org.camunda.bpm.container.impl.metadata.spi.ProcessEnginePluginXml)11 BpmPlatformXml (org.camunda.bpm.container.impl.metadata.spi.BpmPlatformXml)4 ProcessEngineXml (org.camunda.bpm.container.impl.metadata.spi.ProcessEngineXml)4 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)2 ProcessEnginePlugin (org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin)2 XMLStreamException (javax.xml.stream.XMLStreamException)1 ManagedProcessEngineMetadata (org.camunda.bpm.container.impl.jboss.config.ManagedProcessEngineMetadata)1 MscManagedProcessEngineController (org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController)1 ProcessEngineXmlImpl (org.camunda.bpm.container.impl.metadata.ProcessEngineXmlImpl)1 JobAcquisitionXml (org.camunda.bpm.container.impl.metadata.spi.JobAcquisitionXml)1 JobExecutorXml (org.camunda.bpm.container.impl.metadata.spi.JobExecutorXml)1 StandaloneInMemProcessEngineConfiguration (org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration)1 Element (org.camunda.bpm.engine.impl.util.xml.Element)1 AbstractSubsystemTest (org.jboss.as.subsystem.test.AbstractSubsystemTest)1 KernelServices (org.jboss.as.subsystem.test.KernelServices)1 ModelNode (org.jboss.dmr.ModelNode)1 ServiceContainer (org.jboss.msc.service.ServiceContainer)1 Test (org.junit.Test)1