Search in sources :

Example 6 with DoubleGauge

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

the class DoubleGaugeImplTest method whenNoProbeAvailable.

// ============ readDouble ===========================
@Test
public void whenNoProbeAvailable() {
    DoubleGauge gauge = metricsRegistry.newDoubleGauge("foo");
    double actual = gauge.read();
    assertEquals(0, actual, 0.1);
}
Also used : DoubleGauge(com.hazelcast.internal.metrics.DoubleGauge) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 7 with DoubleGauge

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

the class DoubleGaugeImplTest method whenLongProbe.

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

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

Example 8 with DoubleGauge

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

the class RegisterAnnotatedMethodsTest method register_primitiveDouble.

@Test
public void register_primitiveDouble() {
    PrimitiveDoubleMethod object = new PrimitiveDoubleMethod();
    metricsRegistry.scanAndRegister(object, "foo");
    DoubleGauge gauge = metricsRegistry.newDoubleGauge("foo.method");
    assertEquals(object.method(), gauge.read(), 0.1);
}
Also used : DoubleGauge(com.hazelcast.internal.metrics.DoubleGauge) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 9 with DoubleGauge

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

the class RegisterAnnotatedMethodsTest method register_primitiveFloat.

@Test
public void register_primitiveFloat() {
    PrimitiveFloatMethod object = new PrimitiveFloatMethod();
    metricsRegistry.scanAndRegister(object, "foo");
    DoubleGauge gauge = metricsRegistry.newDoubleGauge("foo.method");
    assertEquals(object.method(), gauge.read(), 0.1);
}
Also used : DoubleGauge(com.hazelcast.internal.metrics.DoubleGauge) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 10 with DoubleGauge

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

the class RegisterAnnotatedFieldsTest method register_primitiveDouble.

@Test
public void register_primitiveDouble() {
    PrimitiveDoubleField object = new PrimitiveDoubleField();
    metricsRegistry.scanAndRegister(object, "foo");
    DoubleGauge gauge = metricsRegistry.newDoubleGauge("foo.field");
    object.field = 10;
    assertEquals(object.field, gauge.read(), 0.1);
}
Also used : DoubleGauge(com.hazelcast.internal.metrics.DoubleGauge) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

DoubleGauge (com.hazelcast.internal.metrics.DoubleGauge)10 QuickTest (com.hazelcast.test.annotation.QuickTest)10 Test (org.junit.Test)10 DoubleProbeFunction (com.hazelcast.internal.metrics.DoubleProbeFunction)2 LongProbeFunction (com.hazelcast.internal.metrics.LongProbeFunction)1