Package org.apache.cxf.management

Examples of org.apache.cxf.management.InstrumentationManager


    public void setBus(Bus bus) {
        if (this.bus == null) {
            readJMXProperties(bus);
        } else {
            // possibly this bus was reassigned from another im bean
            InstrumentationManager im = bus.getExtension(InstrumentationManager.class);
            if (this != im) {
                bus.setExtension(this, InstrumentationManager.class);
                try {
                    ManagedBus mbus = new ManagedBus(bus);
                    im.unregister(mbus);
                    if (LOG.isLoggable(Level.INFO)) {
                        LOG.info("unregistered " + mbus.getObjectName());
                    }
                } catch (JMException e) {
                    // ignore
View Full Code Here


        BusFactory.setDefaultBus(clientBus);
       
        RMManager clientManager = clientBus.getExtension(RMManager.class);
        RMManager serverManager = serverBus.getExtension(RMManager.class);
       
        InstrumentationManager serverIM = serverBus.getExtension(InstrumentationManager.class);
        MBeanServer mbs = serverIM.getMBeanServer();
        assertNotNull("MBeanServer must be available.", mbs);

        ObjectName clientManagerName = RMUtils.getManagedObjectName(clientManager);
        ObjectName serverManagerName = RMUtils.getManagedObjectName(serverManager);
View Full Code Here

       
        BusFactory.setDefaultBus(clientBus);
       
        RMManager clientManager = clientBus.getExtension(RMManager.class);
       
        InstrumentationManager serverIM = serverBus.getExtension(InstrumentationManager.class);
        MBeanServer mbs = serverIM.getMBeanServer();
        assertNotNull("MBeanServer must be available.", mbs);

        Object o;
        GreeterService gs = new GreeterService();
        final Greeter greeter = gs.getGreeterPort();
View Full Code Here

        // create Client with other bus
        Bus bus = BusFactory.getDefaultBus();
        bus.getExtension(WorkQueueManager.class);
                               
        CounterRepository cr = bus.getExtension(CounterRepository.class);
        InstrumentationManager im = bus.getExtension(InstrumentationManager.class);
        assertNotNull(im);
        InstrumentationManagerImpl impl = (InstrumentationManagerImpl)im;
        assertTrue(impl.isEnabled());
        assertNotNull(impl.getMBeanServer());
       
        MBeanServer mbs = im.getMBeanServer();
        ObjectName name = new ObjectName(ManagementConstants.DEFAULT_DOMAIN_NAME
            + ":" + ManagementConstants.BUS_ID_PROP + "=cxf" + bus.hashCode() + ",*");       
       
        SOAPService service = new SOAPService();
        assertNotNull(service);       
View Full Code Here

    }

    @Test
    public void testManagedEndpoint() throws Exception {
        Bus bus = SpringBusFactory.getDefaultBus();
        InstrumentationManager im = bus.getExtension(InstrumentationManager.class);
        assertNotNull(im);
        InstrumentationManagerImpl impl = (InstrumentationManagerImpl)im;
        assertTrue(impl.isEnabled());
        assertNotNull(impl.getMBeanServer());

        MBeanServer mbs = im.getMBeanServer();
        ObjectName name = new ObjectName(ManagementConstants.DEFAULT_DOMAIN_NAME
                                         + ":type=Bus.Service.Endpoint,*");
        Set<?> s = mbs.queryNames(name, null);
        assertEquals(1, s.size());
        name = (ObjectName)s.iterator().next();
View Full Code Here

    @Test
    public void testTwoSameNamedEndpoint() throws Exception {
        SpringBusFactory factory = new SpringBusFactory();
        Bus bus = factory.createBus();
        try {
            InstrumentationManager im = bus.getExtension(InstrumentationManager.class);
            assertNotNull(im);
            InstrumentationManagerImpl imi = (InstrumentationManagerImpl)im;
            imi.setServer(ManagementFactory.getPlatformMBeanServer());
            imi.setEnabled(true);
            imi.init();

           
            Greeter greeter1 = new GreeterImpl();
            JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
            svrFactory.setAddress("http://localhost:" + SERVICE_PORT + "/Hello");
            svrFactory.setServiceBean(greeter1);
            svrFactory.getProperties(true).put("managed.endpoint.name", "greeter1");
            svrFactory.create();

            Greeter greeter2 = new GreeterImpl();
            svrFactory = new JaxWsServerFactoryBean();
            svrFactory.setAddress("http://localhost:" + SERVICE_PORT + "/Hello2");
            svrFactory.setServiceBean(greeter2);
            svrFactory.getProperties(true).put("managed.endpoint.name", "greeter2");
            svrFactory.create();
           
            MBeanServer mbs = im.getMBeanServer();
           
            ObjectName name = new ObjectName(ManagementConstants.DEFAULT_DOMAIN_NAME
                                             + ":type=Bus.Service.Endpoint,*");
            Set<?> s = mbs.queryMBeans(name, null);
            assertEquals(2, s.size());
View Full Code Here

   
    @Test
    public void testManagedSpringBus() throws Exception {
        SpringBusFactory factory = new SpringBusFactory();
        Bus bus = factory.createBus();       
        InstrumentationManager im = bus.getExtension(InstrumentationManager.class);
        assertNotNull(im);
               
        InstrumentationManagerImpl imi = (InstrumentationManagerImpl)im;
        assertEquals("service:jmx:rmi:///jndi/rmi://localhost:9913/jmxrmi",
                     imi.getJMXServiceURL());
        assertTrue(!imi.isEnabled());
        assertNull(imi.getMBeanServer());
       
        //Test that registering without an MBeanServer is a no-op
        im.register(imi, new ObjectName("org.apache.cxf:foo=bar"));                       
       
        bus.shutdown(true);
    }
View Full Code Here

        Bus bus = factory.createBus("org/apache/cxf/systest/management/persistent-id.xml", true);
        doManagedBusTest(bus, "cxf_managed_bus_test", bus.getId(), Integer.parseInt(JMX_PORT2));
    }
   
    private void doManagedBusTest(Bus bus, String expect, String reject, int port) throws Exception {
        InstrumentationManager im = bus.getExtension(InstrumentationManager.class);
        assertNotNull(im);
        InstrumentationManagerImpl imi = (InstrumentationManagerImpl)im;
        assertEquals("service:jmx:rmi:///jndi/rmi://localhost:" + port + "/jmxrmi",
                     imi.getJMXServiceURL());
        assertTrue(imi.isEnabled());
        assertNotNull(imi.getMBeanServer());

        WorkQueueManager manager = bus.getExtension(WorkQueueManager.class);
               
        MBeanServer mbs = im.getMBeanServer();     
        ObjectName name = new ObjectName(ManagementConstants.DEFAULT_DOMAIN_NAME
                                         + ":type=WorkQueueManager,*");
        Set<?> s = mbs.queryNames(name, null);
        StringBuilder b = new StringBuilder();
        for (ObjectName o : CastUtils.cast(s, ObjectName.class)) {
View Full Code Here

    @Test
    public void testManagedSpringBus() throws Exception {
        SpringBusFactory factory = new SpringBusFactory();
        Bus bus = factory.createBus();       
        InstrumentationManager im = bus.getExtension(InstrumentationManager.class);
        assertNotNull(im);
               
        InstrumentationManagerImpl imi = (InstrumentationManagerImpl)im;
        assertEquals("service:jmx:rmi:///jndi/rmi://localhost:9913/jmxrmi",
                     imi.getJMXServiceURL());
        assertTrue(!imi.isEnabled());
        assertNull(imi.getMBeanServer());
       
        //Test that registering without an MBeanServer is a no-op
        im.register(imi, new ObjectName("org.apache.cxf:foo=bar"));                       
       
        bus.shutdown(true);
    }
View Full Code Here

        Bus bus = factory.createBus("org/apache/cxf/systest/management/persistent-id.xml", true);
        doManagedBusTest(bus, "cxf_managed_bus_test", bus.getId(), Integer.parseInt(JMX_PORT2));
    }
   
    private void doManagedBusTest(Bus bus, String expect, String reject, int port) throws Exception {
        InstrumentationManager im = bus.getExtension(InstrumentationManager.class);
        assertNotNull(im);
        InstrumentationManagerImpl imi = (InstrumentationManagerImpl)im;
        assertEquals("service:jmx:rmi:///jndi/rmi://localhost:" + port + "/jmxrmi",
                     imi.getJMXServiceURL());
        assertTrue(imi.isEnabled());
        assertNotNull(imi.getMBeanServer());

        WorkQueueManager manager = bus.getExtension(WorkQueueManager.class);
               
        MBeanServer mbs = im.getMBeanServer();     
        ObjectName name = new ObjectName(ManagementConstants.DEFAULT_DOMAIN_NAME
                                         + ":type=WorkQueueManager,*");
        Set s = mbs.queryNames(name, null);
        StringBuilder b = new StringBuilder();
        for (ObjectName o : CastUtils.cast(s, ObjectName.class)) {
View Full Code Here

TOP

Related Classes of org.apache.cxf.management.InstrumentationManager

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.