Search in sources :

Example 11 with LongGauge

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

the class LongGaugeImplTest method whenLongProbeField.

@Test
public void whenLongProbeField() {
    SomeObject someObject = new SomeObject();
    metricsRegistry.scanAndRegister(someObject, "foo");
    LongGauge gauge = metricsRegistry.newLongGauge("foo.longField");
    assertEquals(10, gauge.read());
}
Also used : LongGauge(com.hazelcast.internal.metrics.LongGauge) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 12 with LongGauge

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

the class LongGaugeImplTest method whenDoubleProbe.

@Test
public void whenDoubleProbe() {
    metricsRegistry.register(this, "foo", MANDATORY, new DoubleProbeFunction<LongGaugeImplTest>() {

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

Example 13 with LongGauge

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

the class LongGaugeImplTest method getName.

@Test
public void getName() {
    LongGauge gauge = metricsRegistry.newLongGauge("foo");
    String actual = gauge.getName();
    assertEquals("foo", actual);
}
Also used : LongGauge(com.hazelcast.internal.metrics.LongGauge) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 14 with LongGauge

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

the class LongGaugeImplTest method whenProbeThrowsException.

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

        @Override
        public long get(Object o) {
            throw new RuntimeException();
        }
    });
    LongGauge gauge = metricsRegistry.newLongGauge("foo");
    long actual = gauge.read();
    assertEquals(0, actual);
}
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 15 with LongGauge

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

the class RegisterAnnotatedMethodsTest method register_counter.

@Test
public void register_counter() {
    CounterMethod object = new CounterMethod();
    metricsRegistry.scanAndRegister(object, "foo");
    LongGauge gauge = metricsRegistry.newLongGauge("foo.method");
    assertEquals(object.method().get(), gauge.read());
}
Also used : LongGauge(com.hazelcast.internal.metrics.LongGauge) 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