Package com.sun.sgs.profile

Examples of com.sun.sgs.profile.ProfileConsumer


    }
   
    @Test
    public void testNodeMapServiceMXBean() throws Exception {
        // Turn on profiling for the service
        ProfileConsumer cons =
            getCollector(serverNode).getConsumer(
                ProfileCollectorImpl.CORE_CONSUMER_PREFIX +
                "NodeMappingService");
        cons.setProfileLevel(ProfileLevel.MAX);
       
        ObjectName name = new ObjectName(NodeMappingServiceMXBean.MXBEAN_NAME);
       
        // Ensure the object was registered at startup
        NodeMappingServiceMXBean bean = (NodeMappingServiceMXBean)
View Full Code Here


    }
   
    @Test
    public void testTaskServiceMXBean() throws Exception {
        // Turn on profiling for the service
        ProfileConsumer cons =
            getCollector(serverNode).getConsumer(
                ProfileCollectorImpl.CORE_CONSUMER_PREFIX +
                "TaskService");
        cons.setProfileLevel(ProfileLevel.MAX);
       
        ObjectName name = new ObjectName(TaskServiceMXBean.MXBEAN_NAME);
       
        // Ensure the object was registered at startup
        TaskServiceMXBean bean = (TaskServiceMXBean)
View Full Code Here

    }
    @Test
    public void testSessionServiceMXBean() throws Exception {
        // Turn on profiling for the service
        ProfileConsumer cons =
            getCollector(serverNode).getConsumer(
                ProfileCollectorImpl.CORE_CONSUMER_PREFIX +
                "ClientSessionService");
        cons.setProfileLevel(ProfileLevel.MAX);
       
        ObjectName name =
                new ObjectName(ClientSessionServiceMXBean.MXBEAN_NAME);
       
        // Ensure the object was registered at startup
View Full Code Here

    }
    
    @Test
    public void testChannelServiceMXBean() throws Exception {
        // Turn on profiling for the service
        ProfileConsumer cons =
            getCollector(serverNode).getConsumer(
                ProfileCollectorImpl.CORE_CONSUMER_PREFIX +
                "ChannelService");
        cons.setProfileLevel(ProfileLevel.MAX);
       
        ObjectName name = new ObjectName(ChannelServiceMXBean.MXBEAN_NAME);
       
        // Ensure the object was registered at startup
        ChannelServiceMXBean bean = (ChannelServiceMXBean)
View Full Code Here

    final ProfileOperation scheduleTaskOp;
    final ProfileOperation scheduleTaskDelayedOp;
    final ProfileOperation scheduleTaskPeriodicOp;
   
    TaskServiceStats(ProfileCollector collector) {
        ProfileConsumer consumer =
            collector.getConsumer(ProfileCollectorImpl.CORE_CONSUMER_PREFIX +
                                  "TaskService");
        ProfileLevel level = ProfileLevel.MAX;
        ProfileDataType type = ProfileDataType.TASK_AND_AGGREGATE;
       
        scheduleNDTaskOp =
            consumer.createOperation("scheduleNonDurableTask", type, level);
        scheduleNDTaskDelayedOp =
            consumer.createOperation("scheduleNonDurableTaskDelayed",
                                       type, level);
        scheduleTaskOp =
            consumer.createOperation("scheduleTask", type, level);
        scheduleTaskDelayedOp =
            consumer.createOperation("scheduleDelayedTask", type, level);
        scheduleTaskPeriodicOp =
            consumer.createOperation("schedulePeriodicTask", type, level);
    }
View Full Code Here

            cons1.createOperation(null, ProfileDataType.TASK, ProfileLevel.MIN);
    }
    @Test(expected=NullPointerException.class)
    public void testOperationAggregateBadName() throws Exception {
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        ProfileOperation o1 =
            cons1.createOperation(null,
                                  ProfileDataType.AGGREGATE, ProfileLevel.MIN);
    }
View Full Code Here

                                  ProfileDataType.AGGREGATE, ProfileLevel.MIN);
    }
    @Test(expected=NullPointerException.class)
    public void testOperationTaskAggregateBadName() throws Exception {
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        ProfileOperation o1 =
            cons1.createOperation(null,
                                  ProfileDataType.TASK_AND_AGGREGATE,
                                  ProfileLevel.MIN);
    }
View Full Code Here

    }
   
    @Test
    public void testOperationName() throws Exception {
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        ProfileConsumer cons2 = collector.getConsumer("c2");
        String name = "myOperation";
        {
            ProfileOperation op1 =
                cons1.createOperation(name,
                                      ProfileDataType.TASK, ProfileLevel.MAX);
            ProfileOperation op2 =
                cons2.createOperation(name,
                                      ProfileDataType.TASK, ProfileLevel.MAX);
            assertFalse(op1.getName().equals(op2.getName()));
            assertTrue(op1.getName().contains(name));
            assertTrue(op2.getName().contains(name));
        }
       
        name = "aggOp";
        {
            ProfileOperation op1 =
                cons1.createOperation(name, ProfileDataType.AGGREGATE,
                                      ProfileLevel.MAX);
            ProfileOperation op2 =
                cons2.createOperation(name, ProfileDataType.AGGREGATE,
                                      ProfileLevel.MAX);
            assertFalse(op1.getName().equals(op2.getName()));
            assertTrue(op1.getName().contains(name));
            assertTrue(op2.getName().contains(name));
        }
       
        name = "bothOp";
        {
            ProfileOperation op1 =
                cons1.createOperation(name, ProfileDataType.TASK_AND_AGGREGATE,
                                      ProfileLevel.MAX);
            ProfileOperation op2 =
                cons2.createOperation(name, ProfileDataType.TASK_AND_AGGREGATE,
                                      ProfileLevel.MAX);
            assertFalse(op1.getName().equals(op2.getName()));
            assertTrue(op1.getName().contains(name));
            assertTrue(op2.getName().contains(name));
        }
View Full Code Here

   
    @Test
    public void testOperationTwice() throws Exception {
        final String name = "myOperation";
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        ProfileOperation op1 =
                cons1.createOperation(name,
                                      ProfileDataType.TASK, ProfileLevel.MAX);

        // Try creating with same name and parameters
        ProfileOperation op2 =
                cons1.createOperation(name,
                                      ProfileDataType.TASK, ProfileLevel.MAX);
        assertSame(op1, op2);
       
        // Try creating with same name and different parameters
        try {
            ProfileOperation op3 =
                cons1.createOperation(name,
                                      ProfileDataType.AGGREGATE,
                                      ProfileLevel.MAX);
            fail("Expected IllegalArgumentException");
        } catch (IllegalArgumentException expected) {
            System.err.println(expected);
        }
        try {
            ProfileOperation op3 =
                cons1.createOperation(name,
                                      ProfileDataType.TASK_AND_AGGREGATE,
                                      ProfileLevel.MAX);
            fail("Expected IllegalArgumentException");
        } catch (IllegalArgumentException expected) {
            System.err.println(expected);
        }
        try {
            ProfileOperation op3 =
                cons1.createOperation(name, ProfileDataType.TASK,
                                      ProfileLevel.MIN);
            fail("Expected IllegalArgumentException");
        } catch (IllegalArgumentException expected) {
            System.err.println(expected);
        }
        try {
            ProfileOperation op3 =
                cons1.createOperation(name, ProfileDataType.TASK,
                                      ProfileLevel.MEDIUM);
            fail("Expected IllegalArgumentException");
        } catch (IllegalArgumentException expected) {
            System.err.println(expected);
        }
       
        // Try creating with a different name
        ProfileOperation op4 =
                cons1.createOperation("somethingelse",
                                      ProfileDataType.TASK, ProfileLevel.MAX);
        assertNotSame(op1, op4);
    }
View Full Code Here

   

    @Test
    public void testOperationType() throws Exception {
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        ProfileOperation op1 =
            cons1.createOperation("op1", ProfileDataType.TASK,
                                  ProfileLevel.MAX);
        assertTrue(op1 instanceof TaskProfileOperation);
        assertFalse(op1 instanceof AggregateProfileOperation);
        ProfileOperation op2 =
            cons1.createOperation("op2", ProfileDataType.AGGREGATE,
                                  ProfileLevel.MAX);
        assertFalse(op2 instanceof TaskProfileOperation);
        assertTrue(op2 instanceof AggregateProfileOperation);
       
        ProfileOperation op3 =
            cons1.createOperation("op3", ProfileDataType.TASK_AND_AGGREGATE,
                                  ProfileLevel.MAX);
        assertTrue(op3 instanceof TaskProfileOperation);
        assertTrue(op3 instanceof AggregateProfileOperation);
    }
View Full Code Here

TOP

Related Classes of com.sun.sgs.profile.ProfileConsumer

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.