Examples of ZorkaStatsCollector


Examples of com.jitlogic.zorka.core.spy.plugins.ZorkaStatsCollector

public class ZorkaStatsCollectionUnitTest extends ZorkaFixture {

    @Test
    public void testCollectToStatsMbeanWithoutPlaceholders() throws Exception {
        ZorkaStatsCollector collector = new ZorkaStatsCollector(mBeanServerRegistry, "test", "test:name=Test", "stats",
                "test", "T", null, ZorkaStatsCollector.ACTION_STATS);

        SpyContext ctx = new SpyContext(spy.instance("x"), "TClass", "testMethod", "()V", 1);

        Map<String, Object> record = ZorkaUtil.map(".CTX", ctx, ".STAGE", ON_SUBMIT, ".STAGES", (1 << ON_RETURN), "T", 10L);

        collector.process(record);

        MethodCallStatistics stats = (MethodCallStatistics) getAttr(testMbs, "test:name=Test", "stats");

        assertNotNull(stats.getStatistic("test"));
    }
View Full Code Here

Examples of com.jitlogic.zorka.core.spy.plugins.ZorkaStatsCollector

    }


    @Test
    public void testCollectorToStatsMbeanWithMethodNamePlaceholder() throws Exception {
        ZorkaStatsCollector collector = new ZorkaStatsCollector(mBeanServerRegistry, "test", "test:name=Test", "stats",
                "${methodName}", "T", null, ZorkaStatsCollector.ACTION_STATS);

        SpyContext ctx = new SpyContext(spy.instance("x"), "TClass", "testMethod", "()V", 1);

        Map<String, Object> record = ZorkaUtil.map(".CTX", ctx, ".STAGE", ON_SUBMIT, ".STAGES", (1 << ON_RETURN), "T", 10L);

        collector.process(record);

        MethodCallStatistics stats = (MethodCallStatistics) getAttr(testMbs, "test:name=Test", "stats");

        assertNotNull(stats.getStatistic("testMethod"));
    }
View Full Code Here

Examples of com.jitlogic.zorka.core.spy.plugins.ZorkaStatsCollector

    }


    @Test
    public void testCollectoToStatsMbeanWithClassAndMethodNamePlaceholder() throws Exception {
        ZorkaStatsCollector collector = new ZorkaStatsCollector(mBeanServerRegistry, "test", "test:name=${shortClassName}",
                "stats", "${methodName}", "T", null, ZorkaStatsCollector.ACTION_STATS);

        SpyContext ctx = new SpyContext(spy.instance("x"), "some.TClass", "testMethod", "()V", 1);

        Map<String, Object> record = ZorkaUtil.map(".CTX", ctx, ".STAGE", ON_SUBMIT, ".STAGES", (1 << ON_RETURN), "T", 10L);

        collector.process(record);

        MethodCallStatistics stats = (MethodCallStatistics) getAttr(testMbs, "test:name=TClass", "stats");

        assertNotNull(stats.getStatistic("testMethod"));
    }
View Full Code Here

Examples of com.jitlogic.zorka.core.spy.plugins.ZorkaStatsCollector

    }


    @Test
    public void testCollectToStatsWithKeyExpression() throws Exception {
        ZorkaStatsCollector collector = new ZorkaStatsCollector(mBeanServerRegistry, "test", "test:name=${shortClassName}",
                "stats", "${C1}", "T", null, ZorkaStatsCollector.ACTION_STATS);

        SpyContext ctx = new SpyContext(spy.instance("x"), "some.TClass", "testMethod", "()V", 1);

        Map<String, Object> record = ZorkaUtil.map(".CTX", ctx, ".STAGE", ON_SUBMIT, ".STAGES", (1 << ON_RETURN), "T", 10L, "C1", "oja");

        collector.process(record);

        MethodCallStatistics stats = (MethodCallStatistics) getAttr(testMbs, "test:name=TClass", "stats");

        assertNotNull(stats.getStatistic("oja"));
    }
View Full Code Here

Examples of com.jitlogic.zorka.core.spy.plugins.ZorkaStatsCollector

    }


    @Test
    public void testTwoCollectorsReportingToIndependentItemsInSingleZorkaStatsObject() throws Exception {
        new ZorkaStatsCollector(mBeanServerRegistry, "test", "test:name=SomeBean", "stats", "AAA", "T",
                null, ZorkaStatsCollector.ACTION_STATS);

        new ZorkaStatsCollector(mBeanServerRegistry, "test", "test:name=SomeBean", "stats", "BBB", "T",
                null, ZorkaStatsCollector.ACTION_STATS);

        MethodCallStatistics stats = (MethodCallStatistics) getAttr(testMbs, "test:name=SomeBean", "stats");
        assertEquals(2, stats.getStatisticNames().length);
    }
View Full Code Here

Examples of com.jitlogic.zorka.core.spy.plugins.ZorkaStatsCollector

    }


    @Test
    public void testTwoCollectorsReportingToSingleZorkaStat() throws Exception {
        ZorkaStatsCollector c1 = new ZorkaStatsCollector(mBeanServerRegistry, "test", "test:name=SomeBean", "stats", "AAA", "T",
                null, ZorkaStatsCollector.ACTION_STATS);

        ZorkaStatsCollector c2 = new ZorkaStatsCollector(mBeanServerRegistry, "test", "test:name=SomeBean", "stats", "AAA", "T",
                null, ZorkaStatsCollector.ACTION_STATS);

        SpyContext ctx = new SpyContext(spy.instance("x"), "some.TClass", "testMethod", "()V", 1);
        Map<String, Object> rec = ZorkaUtil.map(".CTX", ctx, ".STAGE", ON_SUBMIT, ".STAGES", (1 << ON_RETURN), "T", 1L);

        c1.process(rec);
        c2.process(rec);

        MethodCallStatistics stats = (MethodCallStatistics) getAttr(testMbs, "test:name=SomeBean", "stats");
        assertEquals(2L, ((MethodCallStatistic) stats.getStatistic("AAA")).getCalls());
    }
View Full Code Here

Examples of com.jitlogic.zorka.core.spy.plugins.ZorkaStatsCollector

    }


    @Test
    public void testThroughputCounting() throws Exception {
        ZorkaStatsCollector c1 = new ZorkaStatsCollector(mBeanServerRegistry, "test", "test:name=SomeBean",
                "stats", "AAA", "T", "LEN", ZorkaStatsCollector.ACTION_STATS);

        SpyContext ctx = new SpyContext(spy.instance("x"), "some.TClass", "testMethod", "()V", 1);
        c1.process(ZorkaUtil.<String, Object>map(".CTX", ctx, ".STAGE", ON_SUBMIT, ".STAGES", (1 << ON_RETURN), "T", 1L, "LEN", 100));
        c1.process(ZorkaUtil.<String, Object>map(".CTX", ctx, ".STAGE", ON_SUBMIT, ".STAGES", (1 << ON_RETURN), "T", 1L, "LEN", 300));
        c1.process(ZorkaUtil.<String, Object>map(".CTX", ctx, ".STAGE", ON_SUBMIT, ".STAGES", (1 << ON_RETURN), "T", 1L, "LEN", 200));

        MethodCallStatistics stats = (MethodCallStatistics) getAttr(testMbs, "test:name=SomeBean", "stats");
        assertEquals(600L, ((MethodCallStatistic) stats.getStatistic("AAA")).getThroughput());
        assertEquals(300L, ((MethodCallStatistic) stats.getStatistic("AAA")).getMaxThroughput());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.