Search in sources :

Example 26 with LongGauge

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

the class RegisterAnnotatedFieldsTest method register_superclassRegistration.

@Test
public void register_superclassRegistration() {
    Subclass object = new Subclass();
    metricsRegistry.scanAndRegister(object, "foo");
    LongGauge gauge = metricsRegistry.newLongGauge("foo.field");
    assertEquals(0, gauge.read());
    object.field = 10;
    assertEquals(10, gauge.read());
}
Also used : LongGauge(com.hazelcast.internal.metrics.LongGauge) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 27 with LongGauge

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

the class RegisterAnnotatedFieldsTest method register_concurrentHashMap.

@Test
public void register_concurrentHashMap() {
    ConcurrentMapField object = new ConcurrentMapField();
    object.field.put("foo", "foo");
    object.field.put("bar", "bar");
    metricsRegistry.scanAndRegister(object, "foo");
    LongGauge gauge = metricsRegistry.newLongGauge("foo.field");
    assertEquals(object.field.size(), gauge.read());
    object.field = null;
    assertEquals(0, gauge.read());
}
Also used : LongGauge(com.hazelcast.internal.metrics.LongGauge) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 28 with LongGauge

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

the class RegisterAnnotatedFieldsTest method register_counterFields.

@Test
public void register_counterFields() {
    CounterField object = new CounterField();
    object.field.inc(10);
    metricsRegistry.scanAndRegister(object, "foo");
    LongGauge gauge = metricsRegistry.newLongGauge("foo.field");
    assertEquals(10, gauge.read());
    object.field = null;
    assertEquals(0, gauge.read());
}
Also used : LongGauge(com.hazelcast.internal.metrics.LongGauge) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 29 with LongGauge

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

the class RegisterAnnotatedFieldsTest method register_primitiveLong.

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

Example 30 with LongGauge

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

the class RegisterAnnotatedFieldsTest method register_staticField.

@Test
public void register_staticField() {
    StaticField object = new StaticField();
    StaticField.field.set(10);
    metricsRegistry.scanAndRegister(object, "foo");
    LongGauge gauge = metricsRegistry.newLongGauge("foo.field");
    assertEquals(10, gauge.read());
    StaticField.field = null;
    assertEquals(0, 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