LowMetricTransform extends FeatureTransform { public LowMetricTransform(MacroBaseConf conf) throws ConfigurationException { toTransform = new ArrayList<>(); List<String> transformNames = conf.getStringList(MacroBaseConf.LOW_METRIC_TRANSFORM); List<String> metrics = conf.getStringList(MacroBaseConf.METRICS); for(String name : transformNames) { toTransform.add(metrics.indexOf(name)); } } LowMetricTransform(MacroBaseConf conf);  LowMetricTransform(List<Integer> indexesToTransform); @Override void initialize(); @Override void consume(List<Datum> records); @Override void shutdown(); @Override MBStream<Datum> getStream();  }
@Test public void testLowMetricTransform() throws Exception { List<Datum> data = new ArrayList<>(); data.add(new Datum(new ArrayList<>(), 1, 2)); data.add(new Datum(new ArrayList<>(), 1, .01)); List<Integer> targetAttrs = new ArrayList<>(); targetAttrs.add(1); LowMetricTransform lmt = new LowMetricTransform(targetAttrs); lmt.consume(data); data = lmt.getStream().drain(); assertEquals(2, data.size(), 0); assertEquals(1, data.get(0).metrics().getEntry(0), 0); assertEquals(.5, data.get(0).metrics().getEntry(1), 0); assertEquals(1, data.get(1).metrics().getEntry(0), 0); assertEquals(10, data.get(1).metrics().getEntry(1), 0); }