congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
SharedMetricRegistries.names
Code IndexAdd Tabnine to your IDE (free)

How to use
names
method
in
com.codahale.metrics.SharedMetricRegistries

Best Java code snippets using com.codahale.metrics.SharedMetricRegistries.names (Showing top 20 results out of 315)

origin: astefanutti/metrics-aspectj

  @Test
  public void metricMethodsWithDefaultNamingConvention() {
    assertThat("Shared metric registry is not created", SharedMetricRegistries.names(), hasItem(REGISTRY_NAME));
    MetricRegistry registry = SharedMetricRegistries.getOrCreate(REGISTRY_NAME);
    assertThat("Metrics are not registered correctly", registry.getMetrics().keySet(), is(equalTo(metricNames())));
  }
}
origin: astefanutti/metrics-aspectj

  @Test
  public void callGaugeAfterSetterCall() {
    assertThat("Shared metric registry is not created", SharedMetricRegistries.names(), hasItem(REGISTRY_NAME));
    MetricRegistry registry = SharedMetricRegistries.getOrCreate(REGISTRY_NAME);
    assertThat("Gauge is not registered correctly", registry.getGauges(), hasKey(GAUGE_NAME));
    @SuppressWarnings("unchecked")
    Gauge<Long> gauge = registry.getGauges().get(GAUGE_NAME);

    // Call the setter method and assert the gauge is up-to-date
    long value = Math.round(Math.random() * Long.MAX_VALUE);
    instance.setSingleGauge(value);
    assertThat("Gauge value is incorrect", gauge.getValue(), is(equalTo(value)));
  }
}
origin: astefanutti/metrics-aspectj

  @Test
  public void callStaticGaugeAfterSetterCall() {
    long value = Math.round(Math.random() * Long.MAX_VALUE);
    // Call the setter static method and assert the gauge is up-to-date
    GaugeStaticMethodWithRegistryFromString.setSingleGauge(value);

    assertThat("Shared metric registry is not created", SharedMetricRegistries.names(), hasItem(REGISTRY_NAME));
    MetricRegistry registry = SharedMetricRegistries.getOrCreate(REGISTRY_NAME);
    assertThat("Gauge is not registered correctly", registry.getGauges(), hasKey(GAUGE_NAME));
    @SuppressWarnings("unchecked")
    Gauge<Long> gauge = registry.getGauges().get(GAUGE_NAME);
    assertThat("Gauge value is incorrect", gauge.getValue(), is(equalTo(value)));
  }
}
origin: astefanutti/metrics-aspectj

@Test
public void gaugeCalledWithDefaultValue() {
  assertThat("Shared metric registry is not created", SharedMetricRegistries.names(), hasItem(REGISTRY_NAME));
  MetricRegistry registry = SharedMetricRegistries.getOrCreate(REGISTRY_NAME);
  assertThat("Gauge is not registered correctly", registry.getGauges(), hasKey(GAUGE_NAME));
  @SuppressWarnings("unchecked")
  Gauge<Long> gauge = registry.getGauges().get(GAUGE_NAME);
  // Make sure that the gauge has the expected value
  assertThat("Gauge value is incorrect", gauge.getValue(), is(equalTo(0L)));
}
origin: astefanutti/metrics-aspectj

@Test
public void exceptionMeteredMethodsNotCalledYet() {
  assertThat("Shared metric registry is not created", SharedMetricRegistries.names(), hasItem(REGISTRY_NAME));
  MetricRegistry registry = SharedMetricRegistries.getOrCreate(REGISTRY_NAME);
  assertThat("Meters are not registered correctly", registry.getMeters().keySet(), is(equalTo(absoluteMetricNames())));
  // Make sure that all the meters haven't been called yet
  assertThat("Meter counts are incorrect", registry.getMeters().values(), everyItem(Matchers.<Meter>hasProperty("count", equalTo(0L))));
}
origin: astefanutti/metrics-aspectj

@Test
public void overloadedTimedMethodNotCalledYet() {
  assertThat("Shared metric registry is not created", SharedMetricRegistries.names(), hasItem(REGISTRY_NAME));
  MetricRegistry registry = SharedMetricRegistries.getOrCreate(REGISTRY_NAME);
  assertThat("Timers are not registered correctly", registry.getTimers().keySet(), is(equalTo(absoluteMetricNames())));
  // Make sure that all the timers haven't been called yet
  assertThat("Timer counts are incorrect", registry.getTimers().values(), everyItem(Matchers.<Timer>hasProperty("count", equalTo(0L))));
}
origin: astefanutti/metrics-aspectj

@Test
public void gaugesCalledWithDefaultValues() {
  assertThat("Shared metric registry is not created", SharedMetricRegistries.names(), hasItem(REGISTRY_NAME));
  MetricRegistry registry = SharedMetricRegistries.getOrCreate(REGISTRY_NAME);
  assertThat("Gauges are not registered correctly", registry.getGauges().keySet(), is(equalTo(absoluteMetricNames())));
  // Make sure that the gauges have the expected values
  assertThat("Gauge values are incorrect", registry.getGauges().values(), everyItem(Matchers.<Gauge>hasProperty("value", equalTo(0L))));
}
origin: astefanutti/metrics-aspectj

@Test
public void timedMethodsNotCalledYet() {
  assertThat("Shared metric registry is not created", SharedMetricRegistries.names(), hasItem(REGISTRY_NAME));
  MetricRegistry registry = SharedMetricRegistries.getOrCreate(REGISTRY_NAME);
  assertThat("Timers are not registered correctly", registry.getTimers().keySet(), is(equalTo(absoluteMetricNames())));
  // Make sure that all the timers haven't been called yet
  assertThat("Timer counts are incorrect", registry.getTimers().values(), everyItem(Matchers.<Timer>hasProperty("count", equalTo(0L))));
}
origin: astefanutti/metrics-aspectj

@Test
public void timedMethodsNotCalledYet() {
  assertThat("Shared metric registry is not created", SharedMetricRegistries.names(), hasItem(REGISTRY_NAME));
  MetricRegistry registry = SharedMetricRegistries.getOrCreate(REGISTRY_NAME);
  assertThat("Timers are not registered correctly", registry.getTimers().keySet(), is(equalTo(absoluteMetricNames())));
  // Make sure that all the timers haven't been called yet
  assertThat("Timer counts are incorrect", registry.getTimers().values(), everyItem(Matchers.<Timer>hasProperty("count", equalTo(0L))));
}
origin: astefanutti/metrics-aspectj

@Test
public void metricsMethodNotCalledYet() {
  assertThat("Shared metric registry is not created", SharedMetricRegistries.names(), hasItem(REGISTRY_NAME));
  MetricRegistry registry = SharedMetricRegistries.getOrCreate(REGISTRY_NAME);
  assertThat("Metrics are not registered correctly", registry.getMetrics().keySet(), is(equalTo(absoluteMetricNames())));
  // Make sure that the metrics haven't been called yet
  assertThat("Meter count is incorrect", registry.getMeters().get(absoluteMetricName("exception")).getCount(), is(equalTo(0L)));
  assertThat("Meter count is incorrect", registry.getMeters().get(absoluteMetricName("meter")).getCount(), is(equalTo(0L)));
  assertThat("Timer count is incorrect", registry.getTimers().get(absoluteMetricName("timer")).getCount(), is(equalTo(0L)));
}
origin: astefanutti/metrics-aspectj

@Test
public void timedMethodNotCalledYet() {
  assertThat("Shared metric registry is not created", SharedMetricRegistries.names(), hasItem(REGISTRY_NAME));
  MetricRegistry registry = SharedMetricRegistries.getOrCreate(REGISTRY_NAME);
  assertThat("Timer is not registered correctly", registry.getTimers(), hasKey(TIMER_NAME));
  Timer timer = registry.getTimers().get(TIMER_NAME);
  // Make sure that the timer hasn't been called yet
  assertThat("Timer count is incorrect", timer.getCount(), is(equalTo(0L)));
}
origin: astefanutti/metrics-aspectj

@Test
public void meteredMethodNotCalledYet() {
  assertThat("Shared metric registry is not created", SharedMetricRegistries.names(), hasItem(REGISTRY_NAME));
  MetricRegistry registry = SharedMetricRegistries.getOrCreate(REGISTRY_NAME);
  assertThat("Meter is not registered correctly", registry.getMeters(), hasKey(METER_NAME));
  Meter meter = registry.getMeters().get(METER_NAME);
  // Make sure that the meter hasn't been called yet
  assertThat("Meter count is incorrect", meter.getCount(), is(equalTo(0L)));
}
origin: astefanutti/metrics-aspectj

@Test
public void timedMethodNotCalledYet() {
  assertThat("Shared metric registry is not created", SharedMetricRegistries.names(), hasItem(REGISTRY_NAME));
  MetricRegistry registry = SharedMetricRegistries.getOrCreate(REGISTRY_NAME);
  assertThat("Timer is not registered correctly", registry.getTimers(), hasKey(TIMER_NAME));
  Timer timer = registry.getTimers().get(TIMER_NAME);
  // Make sure that the timer hasn't been called yet
  assertThat("Timer count is incorrect", timer.getCount(), is(equalTo(0L)));
}
origin: astefanutti/metrics-aspectj

  @Test
  public void callOverloadedTimedMethodOnce() {
    assertThat("Shared metric registry is not created", SharedMetricRegistries.names(), hasItem(REGISTRY_NAME));
    MetricRegistry registry = SharedMetricRegistries.getOrCreate(REGISTRY_NAME);
    assertThat("Timers are not registered correctly", registry.getTimers().keySet(), is(equalTo(absoluteMetricNames())));

    // Call the timed methods and assert they've all been timed once
    instance.overloadedTimedMethod();
    instance.overloadedTimedMethod("string");
    instance.overloadedTimedMethod(new Object());
    instance.overloadedTimedMethod(Arrays.asList("string1", "string2"));
    assertThat("Timer counts are incorrect", registry.getTimers().values(), everyItem(Matchers.<Timer>hasProperty("count", equalTo(1L))));
  }
}
origin: astefanutti/metrics-aspectj

  @Test
  public void callMeteredMethodOnce() {
    assertThat("Shared metric registry is not created", SharedMetricRegistries.names(), hasItem(REGISTRY_NAME));
    MetricRegistry registry = SharedMetricRegistries.getOrCreate(REGISTRY_NAME);
    assertThat("Meter is not registered correctly", registry.getMeters(), hasKey(METER_NAME));
    Meter meter = registry.getMeters().get(METER_NAME);

    // Call the metered method and assert it's been marked
    instance.singleMeteredMethod();
    assertThat("Meter count is incorrect", meter.getCount(), is(equalTo(1L)));
  }
}
origin: astefanutti/metrics-aspectj

  @Test
  public void callTimedMethodOnce() {
    assertThat("Shared metric registry is not created", SharedMetricRegistries.names(), hasItem(REGISTRY_NAME));
    MetricRegistry registry = SharedMetricRegistries.getOrCreate(REGISTRY_NAME);
    assertThat("Timer is not registered correctly", registry.getTimers(), hasKey(TIMER_NAME));
    Timer timer = registry.getTimers().get(TIMER_NAME);

    // Call the timed method and assert it's been timed
    instance.singleTimedMethod();
    assertThat("Timer count is incorrect", timer.getCount(), is(equalTo(1L)));
  }
}
origin: astefanutti/metrics-aspectj

  @Test
  public void callTimedMethodOnce() {
    assertThat("Shared metric registry is not created", SharedMetricRegistries.names(), hasItem(REGISTRY_NAME));
    MetricRegistry registry = SharedMetricRegistries.getOrCreate(REGISTRY_NAME);
    assertThat("Timer is not registered correctly", registry.getTimers(), hasKey(TIMER_NAME));
    Timer timer = registry.getTimers().get(TIMER_NAME);

    // Call the timed method and assert it's been timed
    instance.absoluteTimedMethod();
    assertThat("Timer count is incorrect", timer.getCount(), is(equalTo(1L)));
  }
}
origin: astefanutti/metrics-aspectj

  @Test
  public void callMeteredStaticMethodOnce() {
    // Call the metered method and assert it's been marked
    MeteredStaticMethodWithRegistryFromString.singleMeteredStaticMethod();

    assertThat("Shared metric registry is not created", SharedMetricRegistries.names(), hasItem(REGISTRY_NAME));
    MetricRegistry registry = SharedMetricRegistries.getOrCreate(REGISTRY_NAME);
    assertThat("Timer is not registered correctly", registry.getMeters(), hasKey(METER_NAME));
    Meter meter = registry.getMeters().get(METER_NAME);
    assertThat("Meter count is incorrect", meter.getCount(), is(equalTo(1L)));
  }
}
origin: astefanutti/metrics-aspectj

  @Test
  public void callTimedStaticMethodsOnce() {
    // Call the timed methods and assert they've all been timed once
    TimedStaticMethodWithVisibilityModifiers.publicTimedStaticMethod();
    TimedStaticMethodWithVisibilityModifiers.protectedTimedStaticMethod();
    TimedStaticMethodWithVisibilityModifiers.packagePrivateTimedStaticMethod();
    staticMethod("privateTimedStaticMethod").in(TimedStaticMethodWithVisibilityModifiers.class).invoke();

    assertThat("Shared metric registry is not created", SharedMetricRegistries.names(), hasItem(REGISTRY_NAME));
    MetricRegistry registry = SharedMetricRegistries.getOrCreate(REGISTRY_NAME);

    assertThat("Timers are not registered correctly", registry.getTimers().keySet(), is(equalTo(absoluteMetricNames())));

    assertThat("Timer counts are incorrect", registry.getTimers().values(), everyItem(Matchers.<Timer>hasProperty("count", equalTo(1L))));
  }
}
origin: astefanutti/metrics-aspectj

  @Test
  public void callTimedMethodsOnce() {
    assertThat("Shared metric registry is not created", SharedMetricRegistries.names(), hasItem(REGISTRY_NAME));
    MetricRegistry registry = SharedMetricRegistries.getOrCreate(REGISTRY_NAME);
    assertThat("Timers are not registered correctly", registry.getTimers().keySet(), is(equalTo(absoluteMetricNames())));

    // Call the timed methods and assert they've all been timed once
    instance.publicTimedMethod();
    instance.protectedTimedMethod();
    instance.packagePrivateTimedMethod();
    method("privateTimedMethod").in(instance).invoke();
    assertThat("Timer counts are incorrect", registry.getTimers().values(), everyItem(Matchers.<Timer>hasProperty("count", equalTo(1L))));
  }
}
com.codahale.metricsSharedMetricRegistriesnames

Popular methods of SharedMetricRegistries

  • getOrCreate
  • add
  • clear
  • setDefault
    Sets the provided registry as the default one under the provided name
  • tryGetDefault
    Same as #getDefault() except returns null when the default registry has not been set.
  • getDefault
    Gets the name of the default registry, if it has been set
  • remove

Popular in Java

  • Making http requests using okhttp
  • requestLocationUpdates (LocationManager)
  • setRequestProperty (URLConnection)
  • onCreateOptionsMenu (Activity)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Socket (java.net)
    Provides a client-side TCP socket.
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now