Package org.apache.sirona.gauges

Examples of org.apache.sirona.gauges.Gauge


        assertEquals(6, new EhCacheGaugeFactory().gauges().length);
    }

    @Test
    public void ehCacheCachesCountManagerGauge() {
        final Gauge gauge = new EhCacheCachesCountManagerGauge(mgr);
        assertEquals(0., gauge.value(), 0.);
        mgr.addCacheIfAbsent("cache1");
        assertEquals(1., gauge.value(), 0.);
        mgr.addCacheIfAbsent("cache2");
        assertEquals(2., gauge.value(), 0.);
        mgr.removeCache("cache1");
        assertEquals(1., gauge.value(), 0.);
    }
View Full Code Here


        assertEquals(0, gauges.size());
    }

    @Test
    public void ehCacheTransactionCommittedCountManagerGauge() {
        final Gauge gauge = new EhCacheTransactionCommittedCountManagerGauge(mgr);
        assertEquals(0., gauge.value(), 0.);
        mgr.getTransactionController().begin();
        mgr.getTransactionController().commit();
        assertEquals(1., gauge.value(), 0.);
    }
View Full Code Here

        assertEquals(1., gauge.value(), 0.);
    }

    @Test
    public void ehCacheTransactionRollbackedCountManagerGauge() {
        final Gauge gauge = new EhCacheTransactionRollbackedCountManagerGauge(mgr);
        assertEquals(0., gauge.value(), 0.);
        mgr.getTransactionController().begin();
        mgr.getTransactionController().rollback();
        assertEquals(1., gauge.value(), 0.);
    }
View Full Code Here

    @BeforeClass
    public static void feedSomeHazelcastDate() throws InterruptedException {
        final Role role1 = new Role("hazelcast-members-cluster", Unit.UNARY);
        final CountDownLatch latch1 = new CountDownLatch(1);
        gauge1 = new Gauge() {
            @Override
            public Role role() {
                return role1;
            }

            @Override
            public double value() {
                try {
                    return 2;
                } finally {
                    latch1.countDown();
                }
            }
        };

        final Role role2 = new Role("hazelcast-partitions-cluster", Unit.UNARY);
        final CountDownLatch latch2 = new CountDownLatch(1);
        gauge2 = new Gauge() {
            @Override
            public Role role() {
                return role2;
            }
View Full Code Here

    private static PullRepository createRepo() {
        final PullRepository repo = new PullRepository();
        for (int i = 0; i < 3; i++) {
            repo.getCounter(new Counter.Key(Role.PERFORMANCES, "counter#" + i)).add(i);
        }
        repo.addGauge(new Gauge() {
            public int value = 0;

            @Override
            public Role role() {
                return new Role("gaugerole", Unit.UNARY);
View Full Code Here

            }
        });

        assertEquals(0, store.gauges().size());

        final Gauge gauge = new Gauge() {
            @Override
            public Role role() {
                return Role.FAILURES;
            }

            @Override
            public double value() {
                return 5;
            }
        };
        store.createOrNoopGauge(gauge.role());
        store.addGauge(gauge);

        Thread.sleep(250);
        store.shutdown();

        final Collection<Role> gauges = store.gauges();
        assertEquals(1, gauges.size());

        assertEquals(gauge.role(), gauges.iterator().next());
        final SortedMap<Long,Double> gaugeValues = store.getGaugeValues(new GaugeValuesRequest(0, System.currentTimeMillis(), Role.FAILURES));
        assertTrue(gaugeValues.size() > 0);
        assertEquals(5., gaugeValues.values().iterator().next(), 0.);

        store.gaugeStopped(gauge.role());
    }
View Full Code Here

TOP

Related Classes of org.apache.sirona.gauges.Gauge

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.