Package com.sun.sgs.management

Examples of com.sun.sgs.management.ProfileControllerMXBean


    }
   
    @Test
    public void testProfileControllerMXBean() throws Exception {
        // Ensure the object was registered at startup
        ProfileControllerMXBean bean =
            (ProfileControllerMXBean) profileCollector.getRegisteredMBean(
                                ProfileControllerMXBean.MXBEAN_NAME);
        assertNotNull(bean);
       
        // Create a proxy
        ProfileControllerMXBean proxy = (ProfileControllerMXBean)
            JMX.newMXBeanProxy(mbsc,
                new ObjectName(ProfileControllerMXBean.MXBEAN_NAME),
                ProfileControllerMXBean.class);
        String[] consumers = proxy.getProfileConsumers();
        for (String con : consumers) {
            System.out.println("Found consumer " + con);
        }
       
        // Default profile level is min
        assertEquals(ProfileLevel.MIN, proxy.getDefaultProfileLevel());
        // Can set the default profile level
        proxy.setDefaultProfileLevel(ProfileLevel.MEDIUM);
        assertEquals(ProfileLevel.MEDIUM, proxy.getDefaultProfileLevel());
       
        String consName =
                ProfileCollectorImpl.CORE_CONSUMER_PREFIX + "DataService";
        ProfileLevel level = proxy.getConsumerLevel(consName);
        assertEquals(ProfileLevel.MIN, level);
       
        DataServiceMXBean dataProxy =
            JMX.newMXBeanProxy(mbsc,
                new ObjectName(DataServiceMXBean.MXBEAN_NAME),
                DataServiceMXBean.class);
       
        // Test that consumer level can be changed
        txnScheduler.runTask(new TestAbstractKernelRunnable() {
    public void run() {
                    ManagedObject dummy = new DummyManagedObject();
                    serverNode.getDataService().setBinding("dummy", dummy);
    }}, taskOwner);
        assertEquals(0, dataProxy.getSetBindingCalls());
       
        proxy.setConsumerLevel(consName, ProfileLevel.MAX);
        assertEquals(ProfileLevel.MAX, proxy.getConsumerLevel(consName));
       
        txnScheduler.runTask(new TestAbstractKernelRunnable() {
    public void run() {
                    ManagedObject dummy = new DummyManagedObject();
                    serverNode.getDataService().setBinding("dummy", dummy);
View Full Code Here


   
    @Test(expected=IllegalArgumentException.class)
    public void testProfileControllerMXBeanBadGetLevel() throws Exception {

        // Create a proxy
        ProfileControllerMXBean proxy = (ProfileControllerMXBean)
            JMX.newMXBeanProxy(mbsc,
                new ObjectName(ProfileControllerMXBean.MXBEAN_NAME),
                ProfileControllerMXBean.class);
       
        ProfileLevel level = proxy.getConsumerLevel("noSuchConsumer");
    }
View Full Code Here

   
    @Test(expected=IllegalArgumentException.class)
    public void testProfileControllerMXBeanBadSetLevel() throws Exception {

        // Create a proxy
        ProfileControllerMXBean proxy = (ProfileControllerMXBean)
            JMX.newMXBeanProxy(mbsc,
                new ObjectName(ProfileControllerMXBean.MXBEAN_NAME),
                ProfileControllerMXBean.class);
       
        proxy.setConsumerLevel("notFound", ProfileLevel.MIN);
    }
View Full Code Here

TOP

Related Classes of com.sun.sgs.management.ProfileControllerMXBean

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.