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());
}
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);
}
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);
}
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);
}
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());
}
Aggregations