Java Code Examples for org.eclipse.microprofile.metrics.MetricRegistry#getTimer()

The following examples show how to use org.eclipse.microprofile.metrics.MetricRegistry#getTimer() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Test
@InSequence(1)
public void timedMethodNotCalledYet(MetricRegistry registry) {
    Timer timer = registry.getTimer(timerMID);
    assertThat("Timer is not registered correctly", timer, notNullValue());

    // Make sure that the timer hasn't been called yet
    assertThat("Timer count is incorrect", timer.getCount(), is(equalTo(0L)));
}
 
Example 2
@Test
@InSequence(2)
public void extendedTimedMethodNotCalledYet(MetricRegistry registry) {
    Timer timer = registry.getTimer(extendedTimedMID);
    assertThat("Timer is not registered correctly on the methods on the abstract class", timer, notNullValue());

    // Make sure that the timer hasn't been called yet
    assertThat("Timer count is incorrect", timer.getCount(), is(equalTo(0L)));
}
 
Example 3
@Test
@InSequence(3)
public void callTimedMethodOnce(MetricRegistry registry) {
    Timer timer = registry.getTimer(timerMID);
    assertThat("Timer is not registered correctly", timer, notNullValue());

    // Call the timed method and assert it's been timed
    bean.timedMethod();

    // Make sure that the timer has been called
    assertThat("Timer count is incorrect", timer.getCount(), is(equalTo(1L)));
}
 
Example 4
@Test
@InSequence(4)
public void callExtendedTimedMethodOnce(MetricRegistry registry) {
    Timer timer = registry.getTimer(extendedTimedMID);
    assertThat("Timer is not registered correctly", timer, notNullValue());

    // Call the timed method and assert it's been timed
    bean.normallyNotTimedMethod();

    // Make sure that the timer has been called
    assertThat("Timer count is incorrect", timer.getCount(), is(equalTo(1L)));
}
 
Example 5
@Test
@InSequence(1)
public void timedMethodNotCalledYet(MetricRegistry registry) {
    Timer timer = registry.getTimer(timedMID);
    assertThat("Timer is not registered correctly", timer, notNullValue());

    // Make sure that the timer hasn't been called yet
    assertThat("Timer count is incorrect", timer.getCount(), is(equalTo(0L)));
}
 
Example 6
@Test
@InSequence(2)
public void extendedTimedMethodNotCalledYet(MetricRegistry registry) {
    Timer timer = registry.getTimer(extendedTimedMID);
    assertThat("Timer is not registered correctly on the methods on the abstract class", timer, notNullValue());

    // Make sure that the timer hasn't been called yet
    assertThat("Timer count is incorrect", timer.getCount(), is(equalTo(0L)));
}
 
Example 7
@Test
@InSequence(3)
public void callTimedMethodOnce(MetricRegistry registry) {
    Timer timer = registry.getTimer(timedMID);
    assertThat("Timer is not registered correctly", timer, notNullValue());

    // Call the timed method and assert it's been timed
    bean.timedMethod();

    // Make sure that the timer has been called
    assertThat("Timer count is incorrect", timer.getCount(), is(equalTo(1L)));
}
 
Example 8
@Test
@InSequence(4)
public void callExtendedTimedMethodOnce(MetricRegistry registry) {
    Timer timer = registry.getTimer(extendedTimedMID);
    assertThat("Timer is not registered correctly", timer, notNullValue());

    // Call the timed method and assert it's been timed
    bean.anotherTimedMethod();

    // Make sure that the timer has been called
    assertThat("Timer count is incorrect", timer.getCount(), is(equalTo(1L)));
}