use of org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController in project camunda-bpm-platform by camunda.
the class ProcessEngineStartProcessor method startProcessEngine.
protected void startProcessEngine(ProcessEngineXml processEngineXml, DeploymentPhaseContext phaseContext) {
final ServiceTarget serviceTarget = phaseContext.getServiceTarget();
// transform configuration
ManagedProcessEngineMetadata configuration = transformConfiguration(processEngineXml);
// validate the configuration
configuration.validate();
// create service instance
MscManagedProcessEngineController service = new MscManagedProcessEngineController(configuration);
// get the service name for the process engine
ServiceName serviceName = ServiceNames.forManagedProcessEngine(processEngineXml.getName());
// get service builder
ServiceBuilder<ProcessEngine> serviceBuilder = serviceTarget.addService(serviceName, service);
// make this service depend on the current phase -> makes sure it is removed with the phase service at undeployment
serviceBuilder.addDependency(phaseContext.getPhaseServiceName());
// add Service dependencies
MscManagedProcessEngineController.initializeServiceBuilder(configuration, service, serviceBuilder, processEngineXml.getJobAcquisitionName());
// make this start on demand
serviceBuilder.setInitialMode(Mode.ACTIVE);
// install the service
serviceBuilder.install();
}
use of org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController in project camunda-bpm-platform by camunda.
the class JBossSubsystemXMLTest method testInstallSubsystemWithEnginesAndPropertiesXml.
@Test
public void testInstallSubsystemWithEnginesAndPropertiesXml() throws Exception {
String subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_ENGINES_AND_PROPERTIES);
KernelServices services = createKernelServicesBuilder(null).setSubsystemXml(subsystemXml).build();
ServiceContainer container = services.getContainer();
assertNotNull("platform service should be installed", container.getService(PLATFORM_SERVICE_NAME));
assertNotNull("process engine service should be bound in JNDI", container.getService(PROCESS_ENGINE_SERVICE_BINDING_SERVICE_NAME));
ServiceController<?> defaultEngineService = container.getService(ServiceNames.forManagedProcessEngine("__default"));
assertNotNull("process engine controller for engine __default is installed ", defaultEngineService);
ManagedProcessEngineMetadata metadata = ((MscManagedProcessEngineController) defaultEngineService.getService()).getProcessEngineMetadata();
Map<String, String> configurationProperties = metadata.getConfigurationProperties();
assertEquals("default", configurationProperties.get("job-name"));
assertEquals("default", configurationProperties.get("job-acquisition"));
assertEquals("default", configurationProperties.get("job-acquisition-name"));
Map<String, String> foxLegacyProperties = metadata.getFoxLegacyProperties();
assertTrue(foxLegacyProperties.isEmpty());
assertNotNull("process engine controller for engine __test is installed ", container.getService(ServiceNames.forManagedProcessEngine("__test")));
assertNotNull("process engine controller for engine __emptyPropertiesTag is installed ", container.getService(ServiceNames.forManagedProcessEngine("__emptyPropertiesTag")));
assertNotNull("process engine controller for engine __noPropertiesTag is installed ", container.getService(ServiceNames.forManagedProcessEngine("__noPropertiesTag")));
}
use of org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController in project camunda-bpm-platform by camunda.
the class JBossSubsystemXMLTest method testInstallSubsystemWithEnginesPropertiesPlugins.
@Test
public void testInstallSubsystemWithEnginesPropertiesPlugins() throws Exception {
String subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_ENGINES_PROPERTIES_PLUGINS);
KernelServices services = createKernelServicesBuilder(null).setSubsystemXml(subsystemXml).build();
ServiceContainer container = services.getContainer();
assertNotNull("platform service should be installed", container.getRequiredService(PLATFORM_SERVICE_NAME));
assertNotNull("process engine service should be bound in JNDI", container.getRequiredService(PROCESS_ENGINE_SERVICE_BINDING_SERVICE_NAME));
ServiceController<?> defaultEngineService = container.getService(ServiceNames.forManagedProcessEngine("__default"));
assertNotNull("process engine controller for engine __default is installed ", defaultEngineService);
ManagedProcessEngineMetadata metadata = ((MscManagedProcessEngineController) defaultEngineService.getService()).getProcessEngineMetadata();
Map<String, String> configurationProperties = metadata.getConfigurationProperties();
assertEquals("default", configurationProperties.get("job-name"));
assertEquals("default", configurationProperties.get("job-acquisition"));
assertEquals("default", configurationProperties.get("job-acquisition-name"));
Map<String, String> foxLegacyProperties = metadata.getFoxLegacyProperties();
assertTrue(foxLegacyProperties.isEmpty());
assertNotNull("process engine controller for engine __default is installed ", container.getRequiredService(ServiceNames.forManagedProcessEngine("__default")));
assertNotNull("process engine controller for engine __test is installed ", container.getRequiredService(ServiceNames.forManagedProcessEngine("__test")));
// check we have parsed the plugin configurations
metadata = ((MscManagedProcessEngineController) container.getRequiredService(ServiceNames.forManagedProcessEngine("__test")).getService()).getProcessEngineMetadata();
List<ProcessEnginePluginXml> pluginConfigurations = metadata.getPluginConfigurations();
ProcessEnginePluginXml processEnginePluginXml = pluginConfigurations.get(0);
assertEquals("org.camunda.bpm.identity.impl.ldap.plugin.LdapIdentityProviderPlugin", processEnginePluginXml.getPluginClass());
Map<String, String> processEnginePluginXmlProperties = processEnginePluginXml.getProperties();
assertEquals("abc", processEnginePluginXmlProperties.get("test"));
assertEquals("123", processEnginePluginXmlProperties.get("number"));
assertEquals("true", processEnginePluginXmlProperties.get("bool"));
processEnginePluginXml = pluginConfigurations.get(1);
assertEquals("org.camunda.bpm.identity.impl.ldap.plugin.LdapIdentityProviderPlugin", processEnginePluginXml.getPluginClass());
processEnginePluginXmlProperties = processEnginePluginXml.getProperties();
assertEquals("cba", processEnginePluginXmlProperties.get("test"));
assertEquals("321", processEnginePluginXmlProperties.get("number"));
assertEquals("false", processEnginePluginXmlProperties.get("bool"));
// test correct subsystem removal
assertRemoveSubsystemResources(services);
try {
ServiceController<?> service = container.getRequiredService(ServiceNames.forManagedProcessEngine("__default"));
fail("Service '" + service.getName() + "' should have been removed.");
} catch (Exception expected) {
// nop
}
try {
ServiceController<?> service = container.getRequiredService(ServiceNames.forManagedProcessEngine("__test"));
fail("Service '" + service.getName() + "' should have been removed.");
} catch (Exception expected) {
// nop
}
}
use of org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController in project camunda-bpm-platform by camunda.
the class ProcessEngineAdd method installService.
protected ServiceController<ProcessEngine> installService(OperationContext context, ServiceVerificationHandler verificationHandler, ManagedProcessEngineMetadata processEngineConfiguration) {
MscManagedProcessEngineController service = new MscManagedProcessEngineController(processEngineConfiguration);
ServiceName name = ServiceNames.forManagedProcessEngine(processEngineConfiguration.getEngineName());
ServiceBuilder<ProcessEngine> serviceBuilder = context.getServiceTarget().addService(name, service);
MscManagedProcessEngineController.initializeServiceBuilder(processEngineConfiguration, service, serviceBuilder, processEngineConfiguration.getJobExecutorAcquisitionName());
serviceBuilder.addListener(verificationHandler);
return serviceBuilder.install();
}
Aggregations