|
|
|
@ -129,6 +129,51 @@ public class MetricFilterAutoConfigurationTests {
|
|
|
|
|
context.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void recordsHttpInteractionsWithRegexTemplateVariable() throws Exception {
|
|
|
|
|
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
|
|
|
|
|
Config.class, MetricFilterAutoConfiguration.class);
|
|
|
|
|
Filter filter = context.getBean(Filter.class);
|
|
|
|
|
MockMvc mvc = MockMvcBuilders.standaloneSetup(new MetricFilterTestController())
|
|
|
|
|
.addFilter(filter).build();
|
|
|
|
|
mvc.perform(get("/templateVarRegexTest/foo")).andExpect(status().isOk());
|
|
|
|
|
verify(context.getBean(CounterService.class))
|
|
|
|
|
.increment("status.200.templateVarRegexTest.someVariable");
|
|
|
|
|
verify(context.getBean(GaugeService.class))
|
|
|
|
|
.submit(eq("response.templateVarRegexTest.someVariable"), anyDouble());
|
|
|
|
|
context.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void recordsHttpInteractionsWithWilcardMapping() throws Exception {
|
|
|
|
|
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
|
|
|
|
|
Config.class, MetricFilterAutoConfiguration.class);
|
|
|
|
|
Filter filter = context.getBean(Filter.class);
|
|
|
|
|
MockMvc mvc = MockMvcBuilders.standaloneSetup(new MetricFilterTestController())
|
|
|
|
|
.addFilter(filter).build();
|
|
|
|
|
mvc.perform(get("/wildcardMapping/foo")).andExpect(status().isOk());
|
|
|
|
|
verify(context.getBean(CounterService.class))
|
|
|
|
|
.increment("status.200.wildcardMapping.star");
|
|
|
|
|
verify(context.getBean(GaugeService.class))
|
|
|
|
|
.submit(eq("response.wildcardMapping.star"), anyDouble());
|
|
|
|
|
context.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void recordsHttpInteractionsWithDoubleWildcardMapping() throws Exception {
|
|
|
|
|
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
|
|
|
|
|
Config.class, MetricFilterAutoConfiguration.class);
|
|
|
|
|
Filter filter = context.getBean(Filter.class);
|
|
|
|
|
MockMvc mvc = MockMvcBuilders.standaloneSetup(new MetricFilterTestController())
|
|
|
|
|
.addFilter(filter).build();
|
|
|
|
|
mvc.perform(get("/doubleWildcardMapping/foo/bar/baz")).andExpect(status().isOk());
|
|
|
|
|
verify(context.getBean(CounterService.class))
|
|
|
|
|
.increment("status.200.doubleWildcardMapping.star-star.baz");
|
|
|
|
|
verify(context.getBean(GaugeService.class))
|
|
|
|
|
.submit(eq("response.doubleWildcardMapping.star-star.baz"), anyDouble());
|
|
|
|
|
context.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void recordsKnown404HttpInteractionsAsSingleMetricWithPathAndTemplateVariable()
|
|
|
|
|
throws Exception {
|
|
|
|
@ -429,6 +474,22 @@ public class MetricFilterAutoConfigurationTests {
|
|
|
|
|
return someVariable;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping("wildcardMapping/*")
|
|
|
|
|
public String testWildcardMapping() {
|
|
|
|
|
return "wildcard";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping("doubleWildcardMapping/**/baz")
|
|
|
|
|
public String testDoubleWildcardMapping() {
|
|
|
|
|
return "doubleWildcard";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping("templateVarRegexTest/{someVariable:[a-z]+}")
|
|
|
|
|
public String testTemplateVariableRegexResolution(
|
|
|
|
|
@PathVariable String someVariable) {
|
|
|
|
|
return someVariable;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping("knownPath/{someVariable}")
|
|
|
|
|
@ResponseStatus(HttpStatus.NOT_FOUND)
|
|
|
|
|
@ResponseBody
|
|
|
|
|