@Test public void testAddMetricValuesSuccess() throws Exception { List<MetricValue> values = Collections.singletonList(new MetricValue()); given(service.addMetricValues(Matchers.any())) .willReturn( new ResponseEntity<>( "{\"errors\": false, \"items\": []}", HttpStatus.OK)); mvc.perform( post(URLHelper.API_VERSION_PATH + "/metrics/values") .contentType(MediaType.APPLICATION_JSON) .content(JsonUtil.toJson(values))) .andExpect(status().isOk()) .andExpect(jsonPath("$.errors", is(false))); }
@RequestMapping(value = "/metrics/values", method = RequestMethod.POST) public ResponseEntity<?> addMetricValues(@RequestBody List<MetricValue> values) { return metricService.addMetricValues(values); }
MetricController { @RequestMapping(value = "/metrics/values", method = RequestMethod.POST) public ResponseEntity<?> addMetricValues(@RequestBody List<MetricValue> values) { return metricService.addMetricValues(values); } }
MetricController { @RequestMapping(value = "/metrics/values", method = RequestMethod.POST) public ResponseEntity<?> addMetricValues(@RequestBody List<MetricValue> values) { return metricService.addMetricValues(values); }  }
MetricController { @RequestMapping(value = "/metrics/values", method = RequestMethod.POST) public ResponseEntity<?> addMetricValues(@RequestBody List<MetricValue> values) { return metricService.addMetricValues(values); }  @RequestMapping(value = "/metrics", method = RequestMethod.GET) Map<String, List<Metric>> getAllMetrics(); @RequestMapping(value = "/metrics/values", method = RequestMethod.GET) List<MetricValue> getMetricValues(@RequestParam("metricName")
                                                 String metricName,
                                             @RequestParam("size") int size,
                                             @RequestParam(value = "offset",
                                                 defaultValue = "0")
                                                 int offset,
                                             @RequestParam(value = "tmst",
                                                 defaultValue = "0")
                                                 long tmst); @RequestMapping(value = "/metrics/values", method = RequestMethod.POST) ResponseEntity<?> addMetricValues(@RequestBody List<MetricValue>
                                                 values); @RequestMapping(value = "/metrics/values", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.NO_CONTENT) ResponseEntity<?> deleteMetricValues(@RequestParam("metricName")
                                                    String metricName); @RequestMapping(value = "/metrics/values/{instanceId}", method = RequestMethod.GET) MetricValue getMetric(@PathVariable("instanceId") Long id); }
MetricController { @RequestMapping(value = "/metrics/values", method = RequestMethod.POST) public ResponseEntity<?> addMetricValues(@RequestBody List<MetricValue> values) { return metricService.addMetricValues(values); }  @RequestMapping(value = "/metrics", method = RequestMethod.GET) Map<String, List<Metric>> getAllMetrics(); @RequestMapping(value = "/metrics/values", method = RequestMethod.GET) List<MetricValue> getMetricValues(@RequestParam("metricName")
                                                 String metricName,
                                             @RequestParam("size") int size,
                                             @RequestParam(value = "offset",
                                                 defaultValue = "0")
                                                 int offset,
                                             @RequestParam(value = "tmst",
                                                 defaultValue = "0")
                                                 long tmst); @RequestMapping(value = "/metrics/values", method = RequestMethod.POST) ResponseEntity<?> addMetricValues(@RequestBody List<MetricValue>
                                                 values); @RequestMapping(value = "/metrics/values", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.NO_CONTENT) ResponseEntity<?> deleteMetricValues(@RequestParam("metricName")
                                                    String metricName); @RequestMapping(value = "/metrics/values/{instanceId}", method = RequestMethod.GET) MetricValue getMetric(@PathVariable("instanceId") Long id);  }