Search in sources :

Example 41 with LongGauge

use of com.hazelcast.internal.metrics.LongGauge in project hazelcast by hazelcast.

the class LongGaugeImplTest method whenReregister.

@Test
public void whenReregister() {
    metricsRegistry.register(this, "foo", MANDATORY, new LongProbeFunction() {

        @Override
        public long get(Object o) throws Exception {
            return 10;
        }
    });
    LongGauge gauge = metricsRegistry.newLongGauge("foo");
    gauge.read();
    metricsRegistry.register(this, "foo", MANDATORY, new LongProbeFunction() {

        @Override
        public long get(Object o) throws Exception {
            return 11;
        }
    });
    assertEquals(11, gauge.read());
}
Also used : LongProbeFunction(com.hazelcast.internal.metrics.LongProbeFunction) LongGauge(com.hazelcast.internal.metrics.LongGauge) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 42 with LongGauge

use of com.hazelcast.internal.metrics.LongGauge in project hazelcast by hazelcast.

the class LongGaugeImplTest method whenLongProbe.

@Test
public void whenLongProbe() {
    metricsRegistry.register(this, "foo", MANDATORY, new LongProbeFunction() {

        @Override
        public long get(Object o) throws Exception {
            return 10;
        }
    });
    LongGauge gauge = metricsRegistry.newLongGauge("foo");
    assertEquals(10, gauge.read());
}
Also used : LongProbeFunction(com.hazelcast.internal.metrics.LongProbeFunction) LongGauge(com.hazelcast.internal.metrics.LongGauge) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 43 with LongGauge

use of com.hazelcast.internal.metrics.LongGauge in project hazelcast by hazelcast.

the class ClassLoadingMetricSetTest method loadedClassesCount.

@Test
public void loadedClassesCount() {
    final LongGauge gauge = metricsRegistry.newLongGauge("classloading.loadedClassesCount");
    assertTrueEventually(new AssertTask() {

        @Override
        public void run() throws Exception {
            assertEquals(BEAN.getLoadedClassCount(), gauge.read(), 100);
        }
    });
}
Also used : LongGauge(com.hazelcast.internal.metrics.LongGauge) AssertTask(com.hazelcast.test.AssertTask) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 44 with LongGauge

use of com.hazelcast.internal.metrics.LongGauge in project hazelcast by hazelcast.

the class ClassLoadingMetricSetTest method unloadedClassCount.

@Test
public void unloadedClassCount() {
    final LongGauge gauge = metricsRegistry.newLongGauge("classloading.unloadedClassCount");
    assertTrueEventually(new AssertTask() {

        @Override
        public void run() throws Exception {
            assertEquals(BEAN.getUnloadedClassCount(), gauge.read(), 100);
        }
    });
}
Also used : LongGauge(com.hazelcast.internal.metrics.LongGauge) AssertTask(com.hazelcast.test.AssertTask) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 45 with LongGauge

use of com.hazelcast.internal.metrics.LongGauge in project hazelcast by hazelcast.

the class GarbageCollectionMetricSetTest method majorTime.

@Test
public void majorTime() {
    final LongGauge gauge = metricsRegistry.newLongGauge("gc.majorTime");
    assertTrueEventually(new AssertTask() {

        @Override
        public void run() throws Exception {
            gcStats.run();
            assertEquals(gcStats.majorTime, gauge.read(), SECONDS.toMillis(1));
        }
    });
}
Also used : LongGauge(com.hazelcast.internal.metrics.LongGauge) AssertTask(com.hazelcast.test.AssertTask) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

LongGauge (com.hazelcast.internal.metrics.LongGauge)53 QuickTest (com.hazelcast.test.annotation.QuickTest)53 Test (org.junit.Test)53 AssertTask (com.hazelcast.test.AssertTask)18 LongProbeFunction (com.hazelcast.internal.metrics.LongProbeFunction)3 File (java.io.File)3 MetricsRegistryImpl (com.hazelcast.internal.metrics.impl.MetricsRegistryImpl)1 ParallelTest (com.hazelcast.test.annotation.ParallelTest)1