Package org.apache.geronimo.gbean.jmx

Examples of org.apache.geronimo.gbean.jmx.GBeanMBean


        kernel.boot();

        mbServer = kernel.getMBeanServer();

        gbeanName1 = new ObjectName("geronimo.test:name=MyMockGMBean1");
        GBeanMBean mockBean1 = new GBeanMBean(MockGBean.getGBeanInfo());
        mockBean1.setAttribute("value", "1234");
        mockBean1.setAttribute("name", "child");
        mockBean1.setAttribute("finalInt", new Integer(1));
        gbeanName2 = new ObjectName("geronimo.test:name=MyMockGMBean2");
        GBeanMBean mockBean2 = new GBeanMBean(MockGBean.getGBeanInfo());
        mockBean2.setAttribute("value", "5678");
        mockBean2.setAttribute("name", "Parent");
        mockBean2.setAttribute("finalInt", new Integer(3));
        mockBean2.setReferencePatterns("MockEndpoint", Collections.singleton(gbeanName1));
        mockBean2.setReferencePatterns("EndpointCollection", Collections.singleton(gbeanName1));

        Map gbeans = new HashMap();
        gbeans.put(gbeanName1, mockBean1);
        gbeans.put(gbeanName2, mockBean2);
        state = Configuration.storeGBeans(gbeans);
View Full Code Here


*/
public class StartupTest  extends TestCase {
    private Kernel kernel;

    public void testLoad() throws Exception {
        GBeanMBean gbean;

        // Create all the parts
        gbean = new GBeanMBean("org.apache.geronimo.remoting.router.SubsystemRouter");
        ObjectName subsystemRouter = new ObjectName("geronimo.remoting:router=SubsystemRouter");
        kernel.loadGBean(subsystemRouter, gbean);

        gbean = new GBeanMBean("org.apache.geronimo.remoting.transport.TransportLoader");
        gbean.setAttribute("BindURI", new URI("async://0.0.0.0:3434"));
        gbean.setReferencePatterns("Router", Collections.singleton(subsystemRouter));
        ObjectName asyncTransport = new ObjectName("geronimo.remoting:transport=async");
        kernel.loadGBean(asyncTransport, gbean);

        gbean = new GBeanMBean("org.apache.geronimo.remoting.router.JMXRouter");
        gbean.setReferencePatterns("SubsystemRouter", Collections.singleton(subsystemRouter));
        ObjectName jmxRouter = new ObjectName("geronimo.remoting:router=JMXRouter");
        kernel.loadGBean(jmxRouter, gbean);

        gbean = new GBeanMBean("org.apache.geronimo.remoting.router.InterceptorRegistryRouter");
        gbean.setReferencePatterns("SubsystemRouter", Collections.singleton(subsystemRouter));
        ObjectName registeryRouter = new ObjectName("geronimo.remoting:router=InterceptorRegistryRouter");
        kernel.loadGBean(registeryRouter, gbean);

        gbean = new GBeanMBean("org.apache.geronimo.remoting.jmx.MBeanServerStub");
        gbean.setReferencePatterns("Router", Collections.singleton(jmxRouter));
        ObjectName serverStub = new ObjectName("geronimo.remoting:target=MBeanServerStub");
        kernel.loadGBean(serverStub, gbean);

        // Start all the parts
        kernel.startGBean(subsystemRouter);
View Full Code Here

    public void doStart() throws WaitingException, Exception {
        kernel.boot();

        ObjectName localStoreName = JMXUtil.getObjectName("geronimo.localserver:role=ConfigurationStore,type=Local");
        GBeanMBean localStore = new GBeanMBean(LocalConfigStore.GBEAN_INFO);
        localStore.setAttribute("root", storeDir);
        kernel.startGBean(localStoreName);
        store = (ConfigurationStore) localStore.getTarget();

        configName = kernel.getConfigurationManager().load(rootConfigID);
        kernel.startRecursiveGBean(configName);
        parent = (ConfigurationParent) MBeanProxyFactory.getProxy(ConfigurationParent.class, kernel.getMBeanServer(), configName);
    }
View Full Code Here

        // Set-up the first ServerNode.
        kernel1 = new Kernel("test.kernel1", "test");
        kernel1.boot();

        node1Name = new ObjectName("geronimo.test:role=node1");
        GBeanMBean node1GB = new GBeanMBean(NodeImpl.GBEAN_INFO);
        node1GB.setAttribute("NodeInfo", primaryNode);
        repNode1Name = new ObjectName("geronimo.test:role=replication");
        GBeanMBean repNode1GB = new GBeanMBean(ReplicationMemberImpl.GBEAN_INFO);
        repNode1GB.setReferencePatterns("Node",
            Collections.singleton(node1Name));
        repNode1GB.setAttribute("Name", "Replication");
        repNode1GB.setAttribute("TargetNodes", new NodeInfo[] {secondaryNode});
        loadAndStart(kernel1, repNode1Name, repNode1GB);
        loadAndStart(kernel1, node1Name, node1GB);
        repNode1 = (ReplicationMember) repNode1GB.getTarget();
       
        // Set-up the second ServerNode.
        kernel2 = new Kernel("test.kernel2", "test");
        kernel2.boot();
       
        node2Name = new ObjectName("geronimo.test:role=node2");
        GBeanMBean node2GB = new GBeanMBean(NodeImpl.GBEAN_INFO);
        node2GB.setAttribute("NodeInfo", secondaryNode);
        repNode2Name = new ObjectName("geronimo.test:role=replication");
        GBeanMBean repNode2GB = new GBeanMBean(ReplicationMemberImpl.GBEAN_INFO);
        repNode2GB.setReferencePatterns("Node",
            Collections.singleton(node2Name));
        repNode2GB.setAttribute("Name", "Replication");
        repNode2GB.setAttribute("TargetNodes", new NodeInfo[] {primaryNode});
        loadAndStart(kernel2, repNode2Name, repNode2GB);
        loadAndStart(kernel2, node2Name, node2GB);
        repNode2 = (ReplicationMember) repNode2GB.getTarget();
       
        Node node = (Node) node2GB.getTarget();
        // The second ServerNode joins the first one.
        node.join(primaryNode);
       
View Full Code Here

    private GBeanMBean tm;
    private GBeanMBean ctc;

    public void testApplication() throws Exception {
        URL url = Thread.currentThread().getContextClassLoader().getResource("deployables/war1");
        GBeanMBean app = new GBeanMBean(JettyWebApplicationContext.GBEAN_INFO);
        app.setAttribute("URI", URI.create(url.toString()));
        app.setAttribute("ContextPath", "/test");
        app.setAttribute("ComponentContext", null);
        app.setAttribute("PolicyContextID", null);
        UserTransactionImpl userTransaction = new UserTransactionImpl();
        app.setAttribute("UserTransaction", userTransaction);
        app.setReferencePatterns("Configuration", Collections.EMPTY_SET);
        app.setReferencePatterns("JettyContainer", containerPatterns);
        app.setReferencePatterns("TransactionManager", Collections.singleton(tmName));
        app.setReferencePatterns("TrackedConnectionAssociator", Collections.singleton(tcaName));
        start(appName, app);


        HttpURLConnection connection = (HttpURLConnection) new URL("http://localhost:5678/test/hello.txt").openConnection();
        BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
View Full Code Here

        tcaName = new ObjectName("geronimo.test:role=ConnectionTrackingCoordinator");

        kernel = new Kernel("test.kernel", "test");
        kernel.boot();
        mbServer = kernel.getMBeanServer();
        container = new GBeanMBean(JettyContainerImpl.GBEAN_INFO);

        connector = new GBeanMBean(HTTPConnector.GBEAN_INFO);
        connector.setAttribute("Port", new Integer(5678));
        connector.setReferencePatterns("JettyContainer", containerPatterns);

        start(containerName, container);
        start(connectorName, connector);

        tm = new GBeanMBean(TransactionManagerProxy.GBEAN_INFO);
        start(tmName, tm);
        ctc = new GBeanMBean(ConnectionTrackingCoordinator.GBEAN_INFO);
        start(tcaName, ctc);
    }
View Full Code Here

    public void testServer() throws Exception {
        assertEquals(new Integer(State.RUNNING_INDEX), kernel.getMBeanServer().getAttribute(containerName, "state"));
    }

    public void testHTTPConnector() throws Exception {
        GBeanMBean connector = new GBeanMBean(HTTPConnector.GBEAN_INFO);
        connector.setAttribute("Port", new Integer(5678));
        connector.setReferencePatterns("JettyContainer", containerPatterns);
        start(connectorName, connector);

        assertEquals(new Integer(State.RUNNING_INDEX), kernel.getMBeanServer().getAttribute(connectorName, "state"));

        HttpURLConnection connection = (HttpURLConnection) new URL("http://localhost:5678").openConnection();
View Full Code Here

        containerPatterns.add(containerName);
        connectorName = new ObjectName("geronimo.jetty:role=Connector");
        kernel = new Kernel("test.kernel", "test");
        kernel.boot();
        mbServer = kernel.getMBeanServer();
        container = new GBeanMBean(JettyContainerImpl.GBEAN_INFO);
        start(containerName, container);
    }
View Full Code Here

        if (!handlesURI(uri)) {
            return null;
        }

        try {
            GBeanMBean server = new GBeanMBean(DisconnectedServer.GBEAN_INFO);
            return createManager(server);
        } catch (InvalidConfigurationException e) {
            throw (IllegalStateException) new IllegalStateException("Unable to create disconnected server").initCause(e);
        }
    }
View Full Code Here

        if (!handlesURI(uri)) {
            return null;
        }

        try {
            GBeanMBean server = new GBeanMBean(LocalServer.GBEAN_INFO);
            return createManager(server);
        } catch (InvalidConfigurationException e) {
            throw (IllegalStateException) new IllegalStateException("Unable to create disconnected server").initCause(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.gbean.jmx.GBeanMBean

Copyright © 2018 www.massapicom. 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.