Package org.apache.sirona

Examples of org.apache.sirona.Role


    private static final String lineSeparator = System.getProperty("line.separator");

    @Before
    public void init() {
        Repository.INSTANCE.clearCounters();
        key = new Counter.Key(new Role("role", Unit.UNARY), "counter");
        Repository.INSTANCE.getCounter(key).add(55);
    }
View Full Code Here


            }
        }
    }

    private static SortedMap<Long, Double> gaugeValues(final String role) {
        return Repository.INSTANCE.getGaugeValues(0, System.currentTimeMillis(), new Role(role, Unit.UNARY));
    }
View Full Code Here

public abstract class HazelcastGaugeBase implements Gauge {
    private final Role role;
    protected final HazelcastInstance instance;

    public HazelcastGaugeBase(final String name, final HazelcastInstance instance) {
        this.role = new Role(name, Unit.UNARY);
        this.instance = instance;
    }
View Full Code Here

    private final Role role;
    private final String aggregate;

    public PoolGauge(final String name, final Object stats, final String target) {
        this.stats = stats;
        this.role = new Role("tomee-pool-stateless-" + Introspector.decapitalize(target.substring(3)) + "-" + name, Unit.UNARY);
        this.aggregate = target;
    }
View Full Code Here

        PeriodicNodeStatusDataStore.class.cast(IoCs.getInstance(NodeStatusDataStore.class)).shutdown();
    }

    @Test
    public void checkGauges() throws InterruptedException {
        final Role gaugeRole = Repository.INSTANCE.findGaugeRole("tomee-pool-stateless-instancesPooled-AStatelessBean");
        final Role gaugeActiveRole = Repository.INSTANCE.findGaugeRole("tomee-pool-stateless-instancesActive-AStatelessBean");
        assertNotNull("gauge role should be found", gaugeRole);
        assertNotNull("gauge active role should be found", gaugeActiveRole);
        assertEquals(0, sum(gaugeRole));
        assertEquals(0, sum(gaugeActiveRole));
        bean.work();
View Full Code Here

        return webClient.getPage(base.toExternalForm() + "sirona/" + path);
    }

    @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

public abstract class EhCacheManagerGaugeBase implements Gauge {
    private final Role role;
    protected final CacheManager manager;

    public EhCacheManagerGaugeBase(final String gauge, final CacheManager cacheManager) {
        this.role = new Role("ehcache-" + cacheManager.getName() + "-" + gauge, Unit.UNARY);
        this.manager = cacheManager;
    }
View Full Code Here

        assertEquals(1, hitCounter.getHits());
    }

    @Test
    public void knownStatusIsMonitored() throws IOException, InterruptedException {
        final Role role = new Role("/sirona-test-HTTP-200", Unit.UNARY);
        final int before = statusGaugeSum(role);
        final TextPage page = newClient().getPage(base.toExternalForm() + "hit");
        assertEquals(HttpURLConnection.HTTP_OK, page.getWebResponse().getStatusCode());
        Thread.sleep(1000);
        assertEquals("" + Repository.INSTANCE.getGaugeValues(0, System.currentTimeMillis() + 1000, role), 1, statusGaugeSum(role) - before);
View Full Code Here

    @Test
    public void unknownStatusIsIgnored() throws IOException, InterruptedException {
        final TextPage page = newClient().getPage(base.toExternalForm() + "hit?status=4567");
        assertEquals(4567, page.getWebResponse().getStatusCode());
        Thread.sleep(1000);
        assertEquals(0, statusGaugeSum(new Role("/sirona-test-HTTP-4567", Unit.UNARY)));
    }
View Full Code Here

    protected Map<Role, Measure> snapshot() {
        final long ts = System.currentTimeMillis();
        final Map<Role, Measure> snapshot = new HashMap<Role, Measure>();
        for (final Gauge gauge : gauges.values()) {
            final Role role = gauge.role();
            final double value = gauge.value();

            addToGauge(role, ts, value);
            snapshot.put(role, new Measure(ts, value));
        }
View Full Code Here

TOP

Related Classes of org.apache.sirona.Role

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.