@Test(expected = GriffinException.BadRequestException.class) public void testAddMetricValuesFailureWithInvalidFormat() { List<MetricValue> values = Collections.singletonList(new MetricValue()); service.addMetricValues(values); }
@SuppressWarnings("rawtypes") @Override public ResponseEntity addMetricValues(List<MetricValue> values) { for (MetricValue value : values) { checkFormat(value); } try { return metricStore.addMetricValues(values); } catch (JsonProcessingException e) { LOGGER.warn("Failed to parse metric value.", e.getMessage()); throw new GriffinException.BadRequestException (INVALID_METRIC_VALUE_FORMAT); } catch (IOException e) { LOGGER.error("Failed to add metric values", e); throw new GriffinException.ServiceException( "Failed to add metric values", e); } }
MetricServiceImpl implements MetricService { @SuppressWarnings("rawtypes") @Override public ResponseEntity addMetricValues(List<MetricValue> values) { for (MetricValue value : values) { checkFormat(value); } try { return metricStore.addMetricValues(values); } catch (JsonProcessingException e) { LOGGER.warn("Failed to parse metric value.", e.getMessage()); throw new GriffinException.BadRequestException (INVALID_METRIC_VALUE_FORMAT); } catch (IOException e) { LOGGER.error("Failed to add metric values", e); throw new GriffinException.ServiceException( "Failed to add metric values", e); } } }
MetricServiceImpl implements MetricService { @SuppressWarnings("rawtypes") @Override public ResponseEntity addMetricValues(List<MetricValue> values) { for (MetricValue value : values) { checkFormat(value); } try { return metricStore.addMetricValues(values); } catch (JsonProcessingException e) { LOGGER.warn("Failed to parse metric value.", e.getMessage()); throw new GriffinException.BadRequestException (INVALID_METRIC_VALUE_FORMAT); } catch (IOException e) { LOGGER.error("Failed to add metric values", e); throw new GriffinException.ServiceException( "Failed to add metric values", e); } }  }
MetricServiceImpl implements MetricService { @SuppressWarnings("rawtypes") @Override public ResponseEntity addMetricValues(List<MetricValue> values) { for (MetricValue value : values) { checkFormat(value); } try { return metricStore.addMetricValues(values); } catch (JsonProcessingException e) { LOGGER.warn("Failed to parse metric value.", e.getMessage()); throw new GriffinException.BadRequestException (INVALID_METRIC_VALUE_FORMAT); } catch (IOException e) { LOGGER.error("Failed to add metric values", e); throw new GriffinException.ServiceException( "Failed to add metric values", e); } }  @Override Map<String, List<Metric>> getAllMetrics(); @Override List<MetricValue> getMetricValues(String metricName, int offset,
                                             int size, long tmst); @SuppressWarnings("rawtypes") @Override ResponseEntity addMetricValues(List<MetricValue> values); @SuppressWarnings("rawtypes") @Override ResponseEntity deleteMetricValues(String metricName); @Override MetricValue findMetric(Long id); }
MetricServiceImpl implements MetricService { @SuppressWarnings("rawtypes") @Override public ResponseEntity addMetricValues(List<MetricValue> values) { for (MetricValue value : values) { checkFormat(value); } try { return metricStore.addMetricValues(values); } catch (JsonProcessingException e) { LOGGER.warn("Failed to parse metric value.", e.getMessage()); throw new GriffinException.BadRequestException (INVALID_METRIC_VALUE_FORMAT); } catch (IOException e) { LOGGER.error("Failed to add metric values", e); throw new GriffinException.ServiceException( "Failed to add metric values", e); } }  @Override Map<String, List<Metric>> getAllMetrics(); @Override List<MetricValue> getMetricValues(String metricName, int offset,
                                             int size, long tmst); @SuppressWarnings("rawtypes") @Override ResponseEntity addMetricValues(List<MetricValue> values); @SuppressWarnings("rawtypes") @Override ResponseEntity deleteMetricValues(String metricName); @Override MetricValue findMetric(Long id);  }