public void testInitialCount() { Meter meter = MetricManager.meter(Level.INFO, MetricManager.name(this.getClass(), "test-initial-count")); assertEquals("Initial count should be zero", 0, meter.getCount()); Meter meter2 = MetricManager.meter(Level.INFO, MetricManager.name(this.getClass(), "test-initial-count")); assertEquals("Initial count should be zero", 0, meter2.getCount()); }
public void testSameMetric() { String name = MetricManager.name(this.getClass(), "test-same-meter"); Meter meter = MetricManager.meter(Level.INFO, name); meter.mark(); assertEquals("Count should be one", 1, meter.getCount()); Meter meter2 = MetricManager.meter(Level.INFO, name); assertEquals("Count should be one", 1, meter2.getCount()); }
public void testMarkEvent() { Meter meter = MetricManager.meter(Level.INFO, MetricManager.name(this.getClass(), "test-meter-mark")); meter.mark(); assertEquals("Count should be one", 1, meter.getCount()); metricService.setRootLevel(Level.OFF); meter.mark(); assertEquals("Count should be one", 1, meter.getCount()); }
public void testMarkEventByRandomNumber() { Meter meter = MetricManager.meter( Level.INFO, MetricManager.name(this.getClass(), "test-meter-mark-rand")); int n = randomGenerator.nextInt(); meter.mark(n); assertEquals("Count should be " + n, n, meter.getCount()); metricService.setRootLevel(Level.OFF); meter.mark(n); assertEquals("Count should be " + n, n, meter.getCount()); }