use of org.jdbi.v3.core.extension.ExtensionMethod in project metrics by dropwizard.
the class SmartNameStrategyTest method updatesTimerForContextClass.
@Test
public void updatesTimerForContextClass() throws Exception {
when(ctx.getExtensionMethod()).thenReturn(new ExtensionMethod(getClass(), getClass().getMethod("updatesTimerForContextClass")));
collector.collect(TimeUnit.SECONDS.toNanos(3), ctx);
String name = smartNameStrategy.getStatementName(ctx);
assertThat(name).isEqualTo(name(getClass(), "updatesTimerForContextClass"));
assertThat(getTimerMaxValue(name)).isEqualTo(3000000000L);
}
use of org.jdbi.v3.core.extension.ExtensionMethod in project metrics by dropwizard.
the class SmartNameStrategyTest method updatesTimerForSqlObjects.
@Test
public void updatesTimerForSqlObjects() throws Exception {
when(ctx.getExtensionMethod()).thenReturn(new ExtensionMethod(getClass(), getClass().getMethod("updatesTimerForSqlObjects")));
collector.collect(TimeUnit.SECONDS.toNanos(1), ctx);
String name = smartNameStrategy.getStatementName(ctx);
assertThat(name).isEqualTo(name(getClass(), "updatesTimerForSqlObjects"));
assertThat(getTimerMaxValue(name)).isEqualTo(1000000000);
}
use of org.jdbi.v3.core.extension.ExtensionMethod in project metrics by dropwizard.
the class TimedAnnotationNameStrategyTest method testAnnotationOnMethod.
@Test
public void testAnnotationOnMethod() throws Exception {
when(ctx.getExtensionMethod()).thenReturn(new ExtensionMethod(Foo.class, Foo.class.getMethod("update")));
assertThat(timedAnnotationNameStrategy.getStatementName(ctx)).isEqualTo("com.codahale.metrics.jdbi3.strategies.TimedAnnotationNameStrategyTest$Foo.update");
}
use of org.jdbi.v3.core.extension.ExtensionMethod in project metrics by dropwizard.
the class TimedAnnotationNameStrategyTest method testAnnotationOnMethodWithCustomAbsoluteName.
@Test
public void testAnnotationOnMethodWithCustomAbsoluteName() throws Exception {
when(ctx.getExtensionMethod()).thenReturn(new ExtensionMethod(Foo.class, Foo.class.getMethod("absoluteUpdate")));
assertThat(timedAnnotationNameStrategy.getStatementName(ctx)).isEqualTo("absolute-update");
}
use of org.jdbi.v3.core.extension.ExtensionMethod in project metrics by dropwizard.
the class TimedAnnotationNameStrategyTest method testAnnotationOnMethodWithCustomName.
@Test
public void testAnnotationOnMethodWithCustomName() throws Exception {
when(ctx.getExtensionMethod()).thenReturn(new ExtensionMethod(Foo.class, Foo.class.getMethod("customUpdate")));
assertThat(timedAnnotationNameStrategy.getStatementName(ctx)).isEqualTo("com.codahale.metrics.jdbi3.strategies.TimedAnnotationNameStrategyTest$Foo.custom-update");
}
Aggregations