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

The following examples show how to use org.eclipse.microprofile.metrics.MetricRegistry#getTimer() . 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
Source File: ConcreteTimedBeanTest.java    From microprofile-metrics with Apache License 2.0 5 votes vote down vote up
@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
Source File: ConcreteTimedBeanTest.java    From microprofile-metrics with Apache License 2.0 5 votes vote down vote up
@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
Source File: ConcreteTimedBeanTest.java    From microprofile-metrics with Apache License 2.0 5 votes vote down vote up
@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
Source File: ConcreteTimedBeanTest.java    From microprofile-metrics with Apache License 2.0 5 votes vote down vote up
@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
Source File: ConcreteExtendedTimedBeanTest.java    From microprofile-metrics with Apache License 2.0 5 votes vote down vote up
@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
Source File: ConcreteExtendedTimedBeanTest.java    From microprofile-metrics with Apache License 2.0 5 votes vote down vote up
@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
Source File: ConcreteExtendedTimedBeanTest.java    From microprofile-metrics with Apache License 2.0 5 votes vote down vote up
@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
Source File: ConcreteExtendedTimedBeanTest.java    From microprofile-metrics with Apache License 2.0 5 votes vote down vote up
@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)));
}