Package com.sun.sgs.profile

Examples of com.sun.sgs.profile.ProfileConsumer


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


    }
   
    @Test
    public void testCounterName() throws Exception {
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        ProfileConsumer cons2 = collector.getConsumer("c2");
        String name = "taskcounter";
        {
            ProfileCounter counter1 =
                    cons1.createCounter(name,
                                        ProfileDataType.TASK, ProfileLevel.MAX);
            ProfileCounter counter2 =
                    cons2.createCounter(name,
                                        ProfileDataType.TASK, ProfileLevel.MAX);
            assertFalse(counter1.getName().equals(counter2.getName()));
            assertTrue(counter1.getName().contains(name));
            assertTrue(counter2.getName().contains(name));
        }
       
        name = "aggregateCounter";
        {
            ProfileCounter counter1 =
                    cons1.createCounter(name, ProfileDataType.AGGREGATE,
                                        ProfileLevel.MAX);
            ProfileCounter counter2 =
                    cons2.createCounter(name, ProfileDataType.AGGREGATE,
                                        ProfileLevel.MAX);
            assertFalse(counter1.getName().equals(counter2.getName()));
            assertTrue(counter1.getName().contains(name));
            assertTrue(counter2.getName().contains(name));
        }
       
        name = "bothCounter";
        {
            ProfileCounter counter1 =
                cons1.createCounter(name, ProfileDataType.TASK_AND_AGGREGATE,
                                    ProfileLevel.MAX);
            ProfileCounter counter2 =
                cons2.createCounter(name, ProfileDataType.TASK_AND_AGGREGATE,
                                    ProfileLevel.MAX);
            assertFalse(counter1.getName().equals(counter2.getName()));
            assertTrue(counter1.getName().contains(name));
            assertTrue(counter2.getName().contains(name));
        }
View Full Code Here

   
    @Test
    public void testCounterTwice() throws Exception {
        final String name = "counter";
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        ProfileCounter counter1 =
                cons1.createCounter(name,
                                    ProfileDataType.TASK, ProfileLevel.MAX);

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

    }
   
    @Test
    public void testCounterType() throws Exception {
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        ProfileCounter counter =
                cons1.createCounter("counter",
                                    ProfileDataType.TASK, ProfileLevel.MIN);
        assertTrue(counter instanceof TaskProfileCounter);
        assertFalse(counter instanceof AggregateProfileCounter);
       
        ProfileCounter counter1 =
                cons1.createCounter("counter1",
                                    ProfileDataType.AGGREGATE,
                                    ProfileLevel.MIN);
        assertFalse(counter1 instanceof TaskProfileCounter);
        assertTrue(counter1 instanceof AggregateProfileCounter);
       
        ProfileCounter counter2 =
                cons1.createCounter("counter2",
                                    ProfileDataType.TASK_AND_AGGREGATE,
                                    ProfileLevel.MIN);
        assertTrue(counter2 instanceof TaskProfileCounter);
        assertTrue(counter2 instanceof AggregateProfileCounter);
       
View Full Code Here

    }

    @Test(expected=IllegalStateException.class)
    public void testTaskCounterIncrementNoTransaction() throws Exception {
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        final ProfileCounter counter =
                cons1.createCounter("my counter",
                                    ProfileDataType.TASK, ProfileLevel.MIN);
       
        counter.incrementCount();
    }
View Full Code Here

    }
   
    @Test(expected=IllegalStateException.class)
    public void testTaskCounterIncrementValueNoTransaction() throws Exception {
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        final ProfileCounter counter =
                cons1.createCounter("my counter",
                                    ProfileDataType.TASK, ProfileLevel.MIN);
       
        counter.incrementCount(55);
    }
View Full Code Here

   
    @Test
    public void testAggregateProfileCounterNotInTaskReport() throws Exception {
        final String name = "counter";
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        // Register a counter to be noted at all profiling levels
        final AggregateProfileCounter counter =
                (AggregateProfileCounter)
                    cons1.createCounter(name,
                                        ProfileDataType.AGGREGATE,
                                        ProfileLevel.MIN);
       
        // Because the listener is running in a different thread, JUnit
        // is not able to report the assertions and failures.
View Full Code Here

   
    @Test
    public void testTaskAggregateProfileCounter() throws Exception {
        final String name = "counter";
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        // Register a counter to be noted at all profiling levels
        final AggregateProfileCounter counter =
                (AggregateProfileCounter)
                    cons1.createCounter(name,
                                        ProfileDataType.TASK_AND_AGGREGATE,
                                        ProfileLevel.MIN);
       
        // Because the listener is running in a different thread, JUnit
        // is not able to report the assertions and failures.
View Full Code Here

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

    final ProfileOperation getIdentitiesOp;
    final ProfileOperation getNodeOp;
    final ProfileOperation setStatusOp;
   
    NodeMappingServiceStats(ProfileCollector collector) {
        ProfileConsumer consumer =
            collector.getConsumer(ProfileCollectorImpl.CORE_CONSUMER_PREFIX +
                                  "NodeMappingService");

        ProfileLevel level = ProfileLevel.MAX;
        ProfileDataType type = ProfileDataType.TASK_AND_AGGREGATE;

        addNodeMappingListenerOp = (AggregateProfileOperation)
            consumer.createOperation("addNodeMappingListener", type, level);
        addIdentityRelocationListenerOp = (AggregateProfileOperation)
            consumer.createOperation("addIdentityRelocationListener",
                                     type, level);
        assignNodeOp =
            consumer.createOperation("assignNode", type, level);
        getIdentitiesOp =
            consumer.createOperation("getIdentities", type, level);
        getNodeOp =
            consumer.createOperation("getNode", type, level);
        setStatusOp =
            consumer.createOperation("setStatus", type, level);
    }
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.