Codota Logo
SharedMetricRegistries.names
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
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 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 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.absoluteTimedMethod();
    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.singleTimedMethod();
    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
  • compareTo (BigDecimal)
  • requestLocationUpdates (LocationManager)
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Properties (java.util)
    The Properties class represents a persistent set of properties. The Properties can be saved to a st
  • ResourceBundle (java.util)
    Resource bundles contain locale-specific objects. When your program needs a locale-specific resource
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • JFrame (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now