Ejemplo n.º 1
0
  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());
  }
Ejemplo n.º 2
0
  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());
  }
Ejemplo n.º 3
0
  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());
  }