ReportConfigUtil { public List<LookoutMeasurement> filter(List<LookoutMeasurement> measures) { List<String> mnps = metricNamePrefixWhitelist; Map<String, String> tagFilters = tagWhitelist; if (mnps == null && tagFilters == null) { return measures; } Iterator<LookoutMeasurement> it = measures.iterator(); while (it.hasNext()) { boolean included = false; LookoutMeasurement measurement = it.next(); if (mnps != null) { for (String prefix : mnps) { if (measurement.metricId().name().startsWith(prefix)) { included = true; break; } } } if (!included && tagFilters != null) { for (Map.Entry<String, String> e : tagFilters.entrySet()) { if (measurement.containsTag(e.getKey()) && e.getValue().equals(measurement.getTags().get(e.getKey()))) { included = true; break; } } } if (!included) { it.remove(); } } return measures; }  List<LookoutMeasurement> filter(List<LookoutMeasurement> measures); ReportConfig getReportConfig(); static final String METRIC_NAME_PREFIX_WHITELIST; static final String TAG_WHITELIST; }
@Test public void testFilterMeasures() { AddressService addressService = new DefaultAddressService(); DefaultHttpRequestProcessor p = new DefaultHttpRequestProcessor(addressService, new LookoutConfig()); List<LookoutMeasurement> measurementList = p.filter(measurements); Assert.assertEquals(measurements.size(), measurementList.size()); }