Examples of KernelServices


Examples of org.jboss.as.subsystem.test.KernelServices

        //Parse the subsystem xml and install into the controller
        String subsystemXml =
                "<subsystem xmlns=\"" + SimpleSubsystemExtension.NAMESPACE + "\">" +
                "</subsystem>";
        KernelServices services = super.installInController( new ExtraServicesInit(), subsystemXml);

        //Read the whole model and make sure it looks as expected
        ModelNode model = services.readWholeModel();
        Assert.assertTrue(model.get(SUBSYSTEM).hasDefined(OtherServicesSubsystemExtension.SUBSYSTEM_NAME));

        Assert.assertNotNull(services.getContainer().getService(OtherService.NAME));
        Assert.assertNotNull(services.getContainer().getService(MyService.NAME));
        MyService myService = (MyService)services.getContainer().getService(MyService.NAME).getValue();
        Assert.assertNotNull(myService.otherValue.getValue());
    }
View Full Code Here

Examples of org.jboss.as.subsystem.test.KernelServices

        //Parse the subsystem xml and install into the controller
        String subsystemXml =
                "<subsystem xmlns=\"" + SimpleSubsystemExtension.NAMESPACE + "\">" +
                "</subsystem>";
        KernelServices services = super.installInController( new SystemPropertiesInit(), subsystemXml);

        //Read the whole model and make sure it looks as expected
        ModelNode model = services.readWholeModel();
        Assert.assertTrue(model.get(SUBSYSTEM).hasDefined(OtherServicesSubsystemExtension.SUBSYSTEM_NAME));

        Assert.assertEquals("testing123", model.require(SYSTEM_PROPERTY).require("test123").require(VALUE).asString());
    }
View Full Code Here

Examples of org.jboss.as.subsystem.test.KernelServices

        //Parse the subsystem xml and install into the controller
        String subsystemXml =
                "<subsystem xmlns=\"" + SimpleSubsystemExtension.NAMESPACE + "\">" +
                "</subsystem>";
        KernelServices services = super.installInController( new SocketBindingInit(), subsystemXml);

        //Read the whole model and make sure it looks as expected
        ModelNode model = services.readWholeModel();
        Assert.assertTrue(model.get(SUBSYSTEM).hasDefined(OtherServicesSubsystemExtension.SUBSYSTEM_NAME));

        ModelNode iface = model.require(INTERFACE).require(ControllerInitializer.INTERFACE_NAME);
        Assert.assertEquals("127.0.0.1", iface.require(INET_ADDRESS).asString());

        ModelNode group = model.require(SOCKET_BINDING_GROUP).require(ControllerInitializer.SOCKET_BINDING_GROUP_NAME);
        Assert.assertEquals(ControllerInitializer.INTERFACE_NAME, group.require(DEFAULT_INTERFACE).asString());
        Assert.assertEquals(ControllerInitializer.SOCKET_BINDING_GROUP_NAME, group.require(NAME).asString());
        Assert.assertEquals(0, group.require(PORT_OFFSET).asInt());

        ModelNode bindings = group.require(SOCKET_BINDING);
        Assert.assertEquals(3, bindings.asList().size());
        Assert.assertEquals(123, group.require(SOCKET_BINDING).require("test1").require(PORT).asInt());
        Assert.assertEquals(234, group.require(SOCKET_BINDING).require("test2").require(PORT).asInt());
        Assert.assertEquals(345, group.require(SOCKET_BINDING).require("test3").require(PORT).asInt());

        ServiceController<?> controller = services.getContainer().getService(SocketBindingUserService.NAME);
        Assert.assertNotNull(controller);
        SocketBindingUserService service = (SocketBindingUserService)controller.getValue();
        SocketBinding socketBinding = service.socketBindingValue.getValue();
        Assert.assertEquals(234, socketBinding.getPort());
        Assert.assertEquals("127.0.0.1", socketBinding.getAddress().getHostAddress());
View Full Code Here

Examples of org.jboss.as.subsystem.test.KernelServices

        //Parse the subsystem xml and install into the controller
        String subsystemXml =
                "<subsystem xmlns=\"" + SimpleSubsystemExtension.NAMESPACE + "\">" +
                "</subsystem>";
        KernelServices services = super.installInController( new PathInit(), subsystemXml);

        //Read the whole model and make sure it looks as expected
        ModelNode model = services.readWholeModel();
        Assert.assertTrue(model.get(SUBSYSTEM).hasDefined(OtherServicesSubsystemExtension.SUBSYSTEM_NAME));

        ModelNode path = model.require(PATH);
        Assert.assertEquals(2, path.asList().size());
        Assert.assertEquals("p1", path.require("p1").require("name").asString());
        Assert.assertEquals(new File(".").getAbsolutePath(), path.require("p1").require("path").asString());
        Assert.assertFalse(path.get("p1", "relative-to").isDefined());
        Assert.assertEquals("p2", path.require("p2").require("name").asString());
        Assert.assertEquals("target", path.require("p2").require("path").asString());
        Assert.assertEquals("p1", path.require("p2").require("relative-to").asString());

        ServiceController<?> controller = services.getContainer().getService(PathUserService.NAME);
        Assert.assertNotNull(controller);
        PathUserService service = (PathUserService)controller.getValue();
        Assert.assertEquals(new File(".", "target").getAbsolutePath(), service.pathValue.getValue());
    }
View Full Code Here

Examples of org.jboss.as.subsystem.test.KernelServices

    public void testInstallIntoController() throws Exception {
        //Parse the subsystem xml and install into the controller
        String subsystemXml =
                "<subsystem xmlns=\"" + SimpleSubsystemExtension.NAMESPACE + "\">" +
                "</subsystem>";
        KernelServices services = super.installInController(subsystemXml);

        //Read the whole model and make sure it looks as expected
        ModelNode model = services.readWholeModel();
        Assert.assertTrue(model.get(SUBSYSTEM).hasDefined(SimpleSubsystemExtension.SUBSYSTEM_NAME));

        //Test that the service was installed
        services.getContainer().getRequiredService(SimpleService.NAME);

        //Check that all the resources were removed
        super.assertRemoveSubsystemResources(services);
        try {
            services.getContainer().getRequiredService(SimpleService.NAME);
            Assert.fail("Should not have found simple service");
        } catch (Exception expected) {
        }
    }
View Full Code Here

Examples of org.jboss.as.subsystem.test.KernelServices

    public void testInstallIntoControllerModelOnly() throws Exception {
        //Parse the subsystem xml and install into the controller
        String subsystemXml =
                "<subsystem xmlns=\"" + SimpleSubsystemExtension.NAMESPACE + "\">" +
                "</subsystem>";
        KernelServices services = super.installInController(AdditionalInitialization.MANAGEMENT, subsystemXml);

        //Read the whole model and make sure it looks as expected
        ModelNode model = services.readWholeModel();
        Assert.assertTrue(model.get(SUBSYSTEM).hasDefined(SimpleSubsystemExtension.SUBSYSTEM_NAME));

        //Test that the service was not installed
        Assert.assertNull(services.getContainer().getService(SimpleService.NAME));

        //Check that all the resources were removed
        super.assertRemoveSubsystemResources(services);
        try {
            services.getContainer().getRequiredService(SimpleService.NAME);
            Assert.fail("Should not have found simple service");
        } catch (Exception expected) {
        }
    }
View Full Code Here

Examples of org.jboss.as.subsystem.test.KernelServices

    public void testParseAndMarshalModel() throws Exception {
        //Parse the subsystem xml and install into the first controller
        String subsystemXml =
                "<subsystem xmlns=\"" + SimpleSubsystemExtension.NAMESPACE + "\">" +
                "</subsystem>";
        KernelServices servicesA = super.installInController(subsystemXml);
        //Get the model and the persisted xml from the first controller
        ModelNode modelA = servicesA.readWholeModel();
        String marshalled = servicesA.getPersistedSubsystemXml();

        //Install the persisted xml from the first controller into a second controller
        KernelServices servicesB = super.installInController(marshalled);
        ModelNode modelB = servicesB.readWholeModel();

        //Make sure the models from the two controllers are identical
        super.compare(modelA, modelB);
    }
View Full Code Here

Examples of org.jboss.as.subsystem.test.KernelServices

    public void testDescribeHandler() throws Exception {
        //Parse the subsystem xml and install into the first controller
        String subsystemXml =
                "<subsystem xmlns=\"" + SimpleSubsystemExtension.NAMESPACE + "\">" +
                "</subsystem>";
        KernelServices servicesA = super.installInController(subsystemXml);
        //Get the model and the describe operations from the first controller
        ModelNode modelA = servicesA.readWholeModel();
        ModelNode describeOp = new ModelNode();
        describeOp.get(OP).set(DESCRIBE);
        describeOp.get(OP_ADDR).set(
                PathAddress.pathAddress(
                        PathElement.pathElement(SUBSYSTEM, SimpleSubsystemExtension.SUBSYSTEM_NAME)).toModelNode());
        List<ModelNode> operations = super.checkResultAndGetContents(servicesA.executeOperation(describeOp)).asList();


        //Install the describe options from the first controller into a second controller
        KernelServices servicesB = super.installInController(operations);
        ModelNode modelB = servicesB.readWholeModel();

        //Make sure the models from the two controllers are identical
        super.compare(modelA, modelB);
    }
View Full Code Here

Examples of org.jboss.as.subsystem.test.KernelServices

        ModelNode testModel = new ModelNode();
        testModel.get(SUBSYSTEM).get(SimpleSubsystemExtension.SUBSYSTEM_NAME).setEmptyObject();
        String triggered = outputModel(testModel);

        KernelServices services = super.installInController(AdditionalInitialization.MANAGEMENT, subsystemXml);
        //Get the model and the persisted xml from the controller
        services.readWholeModel();
        String marshalled = services.getPersistedSubsystemXml();

        Assert.assertEquals(marshalled, triggered);
        Assert.assertEquals(normalizeXML(marshalled), normalizeXML(triggered));
    }
View Full Code Here

Examples of org.jboss.as.subsystem.test.KernelServices

        String subsystemXml =
                "<subsystem xmlns=\"" + DependencySubsystemExtension.NAMESPACE + "\">" +
                "</subsystem>" +
                "<subsystem xmlns=\"" + MainSubsystemExtension.NAMESPACE + "\">" +
                "</subsystem>";
        KernelServices services = super.installInController(new DependencyAdditionalInitialization(), subsystemXml);

        //Read the whole model and make sure it looks as expected
        ModelNode model = services.readWholeModel();
        Assert.assertTrue(model.get(SUBSYSTEM).hasDefined(DependencySubsystemExtension.SUBSYSTEM_NAME));
        Assert.assertTrue(model.get(SUBSYSTEM).hasDefined(MainSubsystemExtension.SUBSYSTEM_NAME));

        Assert.assertNotNull(services.getContainer().getService(Dependency.NAME));
        Assert.assertNotNull(services.getContainer().getService(MainService.NAME));
        MainService mainService = (MainService)services.getContainer().getService(MainService.NAME).getValue();
        Assert.assertNotNull(mainService.dependencyValue.getValue());

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.