use of com.hazelcast.internal.metrics.DoubleGauge in project hazelcast by hazelcast.
the class OperatingSystemMetricSetTest method registerMethod_whenDouble.
@Test
public void registerMethod_whenDouble() {
FakeOperatingSystemBean fakeOperatingSystemBean = new FakeOperatingSystemBean();
registerMethod(metricsRegistry, fakeOperatingSystemBean, "doubleMethod", "doubleMethod");
DoubleGauge gauge = metricsRegistry.newDoubleGauge("doubleMethod");
assertEquals(fakeOperatingSystemBean.doubleMethod(), gauge.read(), 0.1);
}
use of com.hazelcast.internal.metrics.DoubleGauge in project hazelcast by hazelcast.
the class DoubleGaugeImplTest method whenDoubleProbe.
@Test
public void whenDoubleProbe() {
metricsRegistry.register(this, "foo", MANDATORY, new DoubleProbeFunction() {
@Override
public double get(Object o) {
return 10;
}
});
DoubleGauge gauge = metricsRegistry.newDoubleGauge("foo");
double actual = gauge.read();
assertEquals(10, actual, 0.1);
}
use of com.hazelcast.internal.metrics.DoubleGauge in project hazelcast by hazelcast.
the class DoubleGaugeImplTest method whenLongGaugeField.
@Test
public void whenLongGaugeField() {
SomeObject someObject = new SomeObject();
metricsRegistry.scanAndRegister(someObject, "foo");
DoubleGauge gauge = metricsRegistry.newDoubleGauge("foo.longField");
assertEquals(someObject.longField, gauge.read(), 0.1);
}
use of com.hazelcast.internal.metrics.DoubleGauge in project hazelcast by hazelcast.
the class DoubleGaugeImplTest method whenProbeThrowsException.
@Test
public void whenProbeThrowsException() {
metricsRegistry.register(this, "foo", MANDATORY, new DoubleProbeFunction() {
@Override
public double get(Object o) {
throw new RuntimeException();
}
});
DoubleGauge gauge = metricsRegistry.newDoubleGauge("foo");
double actual = gauge.read();
assertEquals(0, actual, 0.1);
}
use of com.hazelcast.internal.metrics.DoubleGauge in project hazelcast by hazelcast.
the class DoubleGaugeImplTest method whenDoubleGaugeField.
@Test
public void whenDoubleGaugeField() {
SomeObject someObject = new SomeObject();
metricsRegistry.scanAndRegister(someObject, "foo");
DoubleGauge gauge = metricsRegistry.newDoubleGauge("foo.doubleField");
assertEquals(someObject.doubleField, gauge.read(), 0.1);
}
Aggregations