org.jboss.msc.service.ServiceContainer Java Examples

The following examples show how to use org.jboss.msc.service.ServiceContainer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConsoleAvailabilityUnitTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Before
public void setupController() throws InterruptedException {
    container = ServiceContainer.Factory.create("test");
    ServiceTarget target = container.subTarget();

    this.controlledProcessState = new ControlledProcessState(true);

    ServiceBuilder<?> sb = target.addService(ServiceName.of("ModelController"));
    this.caSupplier = sb.requires(CONSOLE_AVAILABILITY_CAPABILITY.getCapabilityServiceName());

    ConsoleAvailabilityControllerTmp caService = new ConsoleAvailabilityControllerTmp(controlledProcessState);

    ControlledProcessStateService.addService(target, controlledProcessState);
    ConsoleAvailabilityService.addService(target, () -> {});

    sb.setInstance(caService)
            .install();

    caService.awaitStartup(30, TimeUnit.SECONDS);
}
 
Example #2
Source File: JBossSubsystemXMLTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
public void testInstallSubsystemXmlPlatformPlugins() throws Exception {
  String subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_PROCESS_ENGINES_ELEMENT_ONLY);

  KernelServices services = createKernelServicesBuilder(null)
      .setSubsystemXml(subsystemXml)
      .build();

  ServiceContainer container = services.getContainer();
  ServiceController<?> serviceController = container.getService(ServiceNames.forBpmPlatformPlugins());
  assertNotNull(serviceController);
  Object platformPlugins = serviceController.getValue();
  assertTrue(platformPlugins instanceof BpmPlatformPlugins);
  assertNotNull(platformPlugins);
  List<BpmPlatformPlugin> plugins = ((BpmPlatformPlugins) platformPlugins).getPlugins();
  assertEquals(1, plugins.size());
  assertTrue(plugins.get(0) instanceof ExampleBpmPlatformPlugin);
}
 
Example #3
Source File: JBossSubsystemXMLTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
public void testInstallSubsystemWithEnginesXml() throws Exception {
  String subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_ENGINES);

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

  assertNotNull("process engine controller for engine __default is installed ", container.getService(ServiceNames.forManagedProcessEngine("__default")));
  assertNotNull("process engine controller for engine __test is installed ", container.getService(ServiceNames.forManagedProcessEngine("__test")));
}
 
Example #4
Source File: UndertowHandlerTest.java    From wildfly-camel with Apache License 2.0 6 votes vote down vote up
@Test
public void testHttpEndpoint() throws Exception {

    ServiceContainer container = ServiceLocator.getServiceContainer();
    ServiceName hostServiceName = UndertowService.virtualHostName("default-server", "default-host");
    Host host = (Host) container.getRequiredService(hostServiceName).getValue();

    final StringBuilder result = new StringBuilder();
    host.registerHandler("/myapp/myservice", new HttpHandler() {
        @Override
        public void handleRequest(HttpServerExchange exchange) throws Exception {
            String name = exchange.getQueryParameters().get("name").getFirst();
            result.append("Hello " + name);
        }});

    HttpResponse response = HttpRequest.get("http://localhost:8080/myapp/myservice?name=Kermit").getResponse();
    Assert.assertEquals(HttpURLConnection.HTTP_OK, response.getStatusCode());
    Assert.assertEquals("Hello Kermit", result.toString());
}
 
Example #5
Source File: ContextCreateHandlerRegistryService.java    From wildfly-camel with Apache License 2.0 6 votes vote down vote up
ContextCreateHandlerRegistryImpl(final ServiceContainer serviceContainer, final ServiceTarget serviceTarget) {

            // Setup the default handlers
            addContextCreateHandler(null, new ModuleClassLoaderAssociationHandler());
            addContextCreateHandler(null, new ClassResolverAssociationHandler());
            addContextCreateHandler(null, new ComponentResolverAssociationHandler(subsystemState));

            subsystemState.processExtensions(new Consumer<CamelSubsytemExtension>() {
                @Override
                public void accept(CamelSubsytemExtension plugin) {
                    ContextCreateHandler handler = plugin.getContextCreateHandler(serviceContainer, serviceTarget, subsystemState);
                    if (handler != null) {
                        addContextCreateHandler(null, handler);
                    }
                }
            });
        }
 
Example #6
Source File: JBossSubsystemXMLTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
public void testInstallSubsystemWithSingleEngineXml() throws Exception {
  String subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_SINGLE_ENGINE);

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

  assertNotNull("process engine controller for engine __default is installed ", container.getService(ServiceNames.forManagedProcessEngine("__default")));

  String persistedSubsystemXml = services.getPersistedSubsystemXml();
  compareXml(null, subsystemXml, persistedSubsystemXml);
}
 
Example #7
Source File: AbstractControllerTestBase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Before
public void setupController() throws InterruptedException {
    container = ServiceContainer.Factory.create("test");
    ServiceTarget target = container.subTarget();
    if (useDelegateRootResourceDefinition) {
        initializer = createInitializer();
        controllerService = new ModelControllerService(getAuditLogger(), rootResourceDefinition);
    } else {
        controllerService = new ModelControllerService(getAuditLogger());
    }
    ServiceBuilder<ModelController> builder = target.addService(ServiceName.of("ModelController"), controllerService);
    builder.install();
    controllerService.awaitStartup(30, TimeUnit.SECONDS);
    controller = controllerService.getValue();
    //ModelNode setup = Util.getEmptyOperation("setup", new ModelNode());
    //controller.execute(setup, null, null, null);
}
 
Example #8
Source File: JBossSubsystemXMLTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
  public void testInstallSubsystemXmlWithEnginesAndJobExecutor() throws Exception {
    String subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_PROCESS_ENGINES_AND_JOB_EXECUTOR);
//    System.out.println(normalizeXML(subsystemXml));
    KernelServices services = createKernelServicesBuilder(null)
        .setSubsystemXml(subsystemXml)
        .build();
    ServiceContainer container = services.getContainer();
//    container.dumpServices();

    assertNotNull("platform service should be installed", container.getService(PLATFORM_SERVICE_NAME));
    assertNotNull("platform jobexecutor service should be installed", container.getService(PLATFORM_JOBEXECUTOR_SERVICE_NAME));
    assertNotNull("process engine service should be bound in JNDI", container.getService(processEngineServiceBindingServiceName));

    assertNotNull("process engine controller for engine __default is installed ", container.getService(ServiceNames.forManagedProcessEngine("__default")));
    assertNotNull("process engine controller for engine __test is installed ", container.getService(ServiceNames.forManagedProcessEngine("__test")));


    String persistedSubsystemXml = services.getPersistedSubsystemXml();
//    System.out.println(persistedSubsystemXml);
    compareXml(null, subsystemXml, persistedSubsystemXml);
  }
 
Example #9
Source File: OperationCancellationUnitTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Before
public void setupController() throws InterruptedException {

    // restore default
    blockObject = new CountDownLatch(1);
    latch = new CountDownLatch(1);

    System.out.println("=========  New Test \n");
    container = ServiceContainer.Factory.create("test");
    ServiceTarget target = container.subTarget();
    ModelControllerService svc = new ModelControllerService();
    target.addService(ServiceName.of("ModelController")).setInstance(svc).install();
    svc.awaitStartup(30, TimeUnit.SECONDS);
    controller = svc.getValue();
    ModelNode setup = Util.getEmptyOperation("setup", new ModelNode());
    controller.execute(setup, null, null, null);

    client = controller.createClient(executor);

    managementControllerResource = svc.managementControllerResource;
}
 
Example #10
Source File: ModelControllerImplUnitTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Before
public void setupController() throws InterruptedException {

    container = ServiceContainer.Factory.create("test");
    ServiceTarget target = container.subTarget();
    ModelControllerService svc = new ModelControllerService();
    target.addService(ServiceName.of("ModelController")).setInstance(svc).install();
    sharedState = svc.getSharedState();
    svc.awaitStartup(30, TimeUnit.SECONDS);
    controller = svc.getValue();
    ModelNode setup = Util.getEmptyOperation("setup", new ModelNode());
    controller.execute(setup, null, null, null);
    notificationHandler = new ServiceNotificationHandler();
    controller.getNotificationRegistry().registerNotificationHandler(PathAddress.pathAddress(CORE_SERVICE, MANAGEMENT).append(SERVICE, MANAGEMENT_OPERATIONS), notificationHandler, notificationHandler);
    assertEquals(ControlledProcessState.State.RUNNING, svc.getCurrentProcessState());
}
 
Example #11
Source File: MetricsUndefinedValueUnitTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private ManagementResourceRegistration setupController(TestResourceDefinition resourceDefinition) throws InterruptedException {

        // restore default
        blockObject = new CountDownLatch(1);
        latch = new CountDownLatch(1);

        System.out.println("=========  New Test \n");
        container = ServiceContainer.Factory.create(TEST_METRIC);
        ServiceTarget target = container.subTarget();
        ModelControllerService svc = new ModelControllerService(resourceDefinition);
        target.addService(ServiceName.of("ModelController")).setInstance(svc).install();
        svc.awaitStartup(30, TimeUnit.SECONDS);
        controller = svc.getValue();
        ModelNode setup = Util.getEmptyOperation("setup", new ModelNode());
        controller.execute(setup, null, null, null);

        client = controller.createClient(executor);

        return svc.managementControllerResource;
    }
 
Example #12
Source File: RemoveNotEsistingResourceTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testRemoveNonExistingResource() throws Exception {
    container = ServiceContainer.Factory.create("test");
    ServiceTarget target = container.subTarget();
    TestModelControllerService svc = new InterleavedSubsystemModelControllerService();
    target.addService(ServiceName.of("ModelController")).setInstance(svc).install();
    svc.awaitStartup(30, TimeUnit.SECONDS);
    ModelController controller = svc.getValue();

    final PathAddress attributePath = PathAddress.pathAddress(PathElement.pathElement("subsystem", "a"))
            .append(PathElement.pathElement(SUBMODEL_NAME, "nonExisting"));
    final ModelNode op = Util.createEmptyOperation(REMOVE, attributePath);
    ModelNode result = controller.execute(op, null, null, null);

    Assert.assertEquals("failed", result.get("outcome").asString());
}
 
Example #13
Source File: RemoveNotEsistingResourceTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testRemoveExistingResource() throws Exception {
    container = ServiceContainer.Factory.create("test");
    ServiceTarget target = container.subTarget();
    TestModelControllerService svc = new InterleavedSubsystemModelControllerService();
    target.addService(ServiceName.of("ModelController")).setInstance(svc).install();
    svc.awaitStartup(30, TimeUnit.SECONDS);
    ModelController controller = svc.getValue();

    // create child node
    final PathAddress attributePath = PathAddress.pathAddress(PathElement.pathElement("subsystem", "a"))
            .append(PathElement.pathElement(SUBMODEL_NAME, "existing"));
    final ModelNode addChild = Util.createEmptyOperation(ADD, attributePath);
    controller.execute(addChild, null, null, null);

    // should be able to remove it
    final ModelNode op = Util.createEmptyOperation(REMOVE, attributePath);
    ModelNode result = controller.execute(op, null, null, null);

    Assert.assertEquals("success", result.get("outcome").asString());
}
 
Example #14
Source File: CompositeOperationHandlerUnitTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Before
public void setupController() throws InterruptedException {
    System.out.println("=========  New Test \n");

    container = ServiceContainer.Factory.create("test");
    ServiceTarget target = container.subTarget();
    TestModelControllerService svc = new ModelControllerImplUnitTestCase.ModelControllerService();
    target.addService(ServiceName.of("ModelController")).setInstance(svc).install();
    sharedState = svc.getSharedState();
    svc.awaitStartup(30, TimeUnit.SECONDS);
    controller = svc.getValue();
    ModelNode setup = Util.getEmptyOperation("setup", new ModelNode());
    controller.execute(setup, null, null, null);

    assertEquals(ControlledProcessState.State.RUNNING, svc.getCurrentProcessState());
}
 
Example #15
Source File: JBossSubsystemXMLTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
public void testInstallSubsystemXmlPlatformPlugins() throws Exception {
  String subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_PROCESS_ENGINES_ELEMENT_ONLY);

  KernelServices services = createKernelServicesBuilder(null)
      .setSubsystemXml(subsystemXml)
      .build();

  ServiceContainer container = services.getContainer();
  ServiceController<?> serviceController = container.getService(PLATFORM_BPM_PLATFORM_PLUGINS_SERVICE_NAME);
  assertNotNull(serviceController);
  Object platformPlugins = serviceController.getValue();
  assertNotNull(platformPlugins);
  assertTrue(platformPlugins instanceof BpmPlatformPlugins);
  List<BpmPlatformPlugin> plugins = ((BpmPlatformPlugins) platformPlugins).getPlugins();
  assertEquals(1, plugins.size());
  assertTrue(plugins.get(0) instanceof ExampleBpmPlatformPlugin);
}
 
Example #16
Source File: JBossSubsystemXMLTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
  public void testInstallSubsystemWithJobExecutorXml() throws Exception {
    String subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_JOB_EXECUTOR);
//    System.out.println(normalizeXML(subsystemXml));
    KernelServices services = createKernelServicesBuilder(null)
        .setSubsystemXml(subsystemXml)
        .build();
    ServiceContainer container = services.getContainer();
//    container.dumpServices();

    assertNotNull("platform service should be installed", container.getService(PLATFORM_SERVICE_NAME));
    assertNotNull("process engine service should be bound in JNDI", container.getService(processEngineServiceBindingServiceName));

    assertNotNull("platform jobexecutor service should be installed", container.getService(PLATFORM_JOBEXECUTOR_SERVICE_NAME));

  }
 
Example #17
Source File: PlatformMBeanResourceUnitTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@BeforeClass
public static void setupController() throws InterruptedException {
    container = ServiceContainer.Factory.create("test");
    ServiceTarget target = container.subTarget();
    PlatformMBeanTestModelControllerService svc = new PlatformMBeanTestModelControllerService();
    ServiceBuilder<ModelController> builder = target.addService(ServiceName.of("ModelController"), svc);
    builder.install();
    svc.latch.await(30, TimeUnit.SECONDS);
    controller = svc.getValue();
    ModelNode setup = Util.getEmptyOperation("setup", new ModelNode());
    controller.execute(setup, null, null, null);

    client = controller.createClient(Executors.newSingleThreadExecutor());
}
 
Example #18
Source File: BootstrapImpl.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static SuspendController getSuspendController(ServiceContainer sc) {
    SuspendController result = null;
    if (sc != null && !sc.isShutdownComplete()) {
        final ServiceController serviceController = sc.getService(JBOSS_SUSPEND_CONTROLLER);
        if (serviceController != null && serviceController.getState() == ServiceController.State.UP) {
            result = (SuspendController) serviceController.getValue();
        }
    }
    return result;
}
 
Example #19
Source File: JBossSubsystemXMLTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Test
public void testInstallSubsystemXml() throws Exception {
  String subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_PROCESS_ENGINES_ELEMENT_ONLY);

  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));
  assertNull(container.getService(PLATFORM_JOBEXECUTOR_SERVICE_NAME));
}
 
Example #20
Source File: LegacyKernelServicesImpl.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public LegacyKernelServicesImpl(ServiceContainer container, ModelTestModelControllerService controllerService,
        StringConfigurationPersister persister, ManagementResourceRegistration rootRegistration,
        OperationValidator operationValidator, String mainSubsystemName, ExtensionRegistry extensionRegistry,
        ModelVersion legacyModelVersion, boolean successfulBoot, Throwable bootError, boolean registerTransformers) {
    // FIXME LegacyKernelServicesImpl constructor
    super(container, controllerService, persister, rootRegistration, operationValidator, mainSubsystemName,
            extensionRegistry, legacyModelVersion, successfulBoot, bootError, registerTransformers);
}
 
Example #21
Source File: LegacyKernelServicesImpl.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public LegacyKernelServicesImpl(ServiceContainer container, ModelTestModelControllerService controllerService,
        StringConfigurationPersister persister, ManagementResourceRegistration rootRegistration,
        OperationValidator operationValidator, ModelVersion legacyModelVersion, boolean successfulBoot, Throwable bootError,
        ExtensionRegistry extensionRegistry, ContentRepository contentRepository) {
    // FIXME MainKernelServicesImpl constructor
    super(container, controllerService, persister, rootRegistration, operationValidator, legacyModelVersion, successfulBoot,
            bootError, extensionRegistry);
    this.contentRepository = contentRepository;
}
 
Example #22
Source File: ModelTestKernelServicesImpl.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected ModelTestKernelServicesImpl(ServiceContainer container, ModelTestModelControllerService controllerService, StringConfigurationPersister persister, ManagementResourceRegistration rootRegistration,
        OperationValidator operationValidator, ModelVersion legacyModelVersion, boolean successfulBoot, Throwable bootError) {
    this.container = container;
    this.controllerService = controllerService;
    this.controller = controllerService.getValue();
    this.persister = persister;
    this.operationValidator = operationValidator;
    this.rootRegistration = rootRegistration;
    this.legacyServices = legacyModelVersion != null ? null : new HashMap<ModelVersion, T>();
    this.successfulBoot = successfulBoot;
    this.bootError = bootError;
}
 
Example #23
Source File: AbstractKernelServicesImpl.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected AbstractKernelServicesImpl(ServiceContainer container, ModelTestModelControllerService controllerService,
                StringConfigurationPersister persister, ManagementResourceRegistration rootRegistration,
                OperationValidator operationValidator, String mainSubsystemName,
                ExtensionRegistry extensionRegistry, ModelVersion legacyModelVersion, boolean successfulBoot,
                Throwable bootError, boolean registerTransformers) {
    super(container, controllerService, persister, rootRegistration, operationValidator, legacyModelVersion, successfulBoot, bootError);

    this.mainSubsystemName = mainSubsystemName;
    this.extensionRegistry = extensionRegistry;
    this.registerTransformers = registerTransformers;
}
 
Example #24
Source File: JBossSubsystemXMLTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@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(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 __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")));
}
 
Example #25
Source File: BootstrapImpl.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void asyncCancel(final boolean interruptionDesired) {
    container.shutdown();
    container.addTerminateListener(new ServiceContainer.TerminateListener() {
        @Override
        public void handleTermination(final Info info) {
            setCancelled();
        }
    });
}
 
Example #26
Source File: BootstrapImpl.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public AsyncFuture<ServiceContainer> startup(Configuration configuration, List<ServiceActivator> extraServices) {
    try {
        ServiceContainer container = bootstrap(configuration, extraServices).get();
        ServiceController<?> controller = container.getRequiredService(Services.JBOSS_AS);
        return (AsyncFuture<ServiceContainer>) controller.getValue();
    } catch (Exception ex) {
        shutdownHook.shutdown(true);
        throw ServerLogger.ROOT_LOGGER.cannotStartServer(ex);
    }
}
 
Example #27
Source File: JBossSubsystemXMLTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Test
  public void testJobAcquisitionStrategyOptional() throws Exception {
    String subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_JOB_EXECUTOR_WITHOUT_ACQUISITION_STRATEGY);
//    System.out.println(normalizeXML(subsystemXml));
    KernelServices services = createKernelServicesBuilder(null)
        .setSubsystemXml(subsystemXml)
        .build();
    ServiceContainer container = services.getContainer();
//    container.dumpServices();

    assertNotNull("platform service should be installed", container.getService(PLATFORM_SERVICE_NAME));
    assertNotNull("process engine service should be bound in JNDI", container.getService(processEngineServiceBindingServiceName));

    assertNotNull("platform jobexecutor service should be installed", container.getService(PLATFORM_JOBEXECUTOR_SERVICE_NAME));
  }
 
Example #28
Source File: RuntimeServer.java    From thorntail with Apache License 2.0 5 votes vote down vote up
public void stop() throws Exception {
    this.container.stop();
    awaitContainerTermination();
    this.containerStarted = false;

    //Clear the container ShutdownHook so it doesn't try to execute after container is stopped
    Field field = this.container.getClass().getDeclaredField("serviceContainer");
    field.setAccessible(true);
    ServiceContainer serviceContainer = (ServiceContainer) field.get(this.container);

    Class<?> shutdownHookHolder = null;
    Class<?>[] declaredClasses = serviceContainer.getClass().getDeclaredClasses();
    for (Class<?> clazz : declaredClasses) {
        if (clazz.getName().contains("ShutdownHookHolder")) {
            shutdownHookHolder = clazz;
        }
    }

    if (shutdownHookHolder != null) {
        Field containersSetField = shutdownHookHolder.getDeclaredField("containers");
        containersSetField.setAccessible(true);
        Set<?> set = (Set<?>) containersSetField.get(null);
        set.clear();
    }

    this.container = null;

    this.client = null;
    this.deployer.get().removeAllContent();
    this.deployer = null;
    cleanup();
}
 
Example #29
Source File: BootstrapListener.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public BootstrapListener(final ServiceContainer serviceContainer, final long startTime, final ServiceTarget serviceTarget, final FutureServiceContainer futureContainer, final String prettyVersion, final File tempDir) {
    this.serviceContainer = serviceContainer;
    this.startTime = startTime;
    this.serviceTarget = serviceTarget;
    this.prettyVersion = prettyVersion;
    this.futureContainer = futureContainer;
    this.tempDir = tempDir;
    serviceTarget.addMonitor(monitor);
}
 
Example #30
Source File: JBossSubsystemXMLTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Test
public void testInstallSubsystemWithJobExecutorXml() throws Exception {
  String subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_JOB_EXECUTOR);
  KernelServices services = createKernelServicesBuilder(null)
      .setSubsystemXml(subsystemXml)
      .build();
  ServiceContainer container = services.getContainer();

  commonSubsystemServicesAreInstalled(container);
}