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(processEngineServiceBindingServiceName));
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
}
}