MetricAgeOffFilter extends Filter { @Override public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env) throws IOException { super.init(source, options, env); validateOptions(options); ageoffs = new PatriciaTrie<>(); options.forEach((k, v) -> { if (k.startsWith(AGE_OFF_PREFIX)) { String name = k.substring(AGE_OFF_PREFIX.length()); LOG.trace("Adding {} to Trie with value", name, Long.parseLong(v)); long ageoff = Long.parseLong(v); this.minAgeOff = Math.min(this.minAgeOff, ageoff); this.maxAgeOff = Math.max(this.maxAgeOff, ageoff); ageoffs.put(name, ageoff); } }); defaultAgeOff = ageoffs.get(DEFAULT_AGEOFF_KEY); currentTime = System.currentTimeMillis(); }  @Override boolean accept(Key k, Value v); @Override void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env); @Override SortedKeyValueIterator<Key, Value> deepCopy(IteratorEnvironment env); @Override IteratorOptions describeOptions(); @Override boolean validateOptions(Map<String, String> options); static final String AGE_OFF_PREFIX; static final String DEFAULT_AGEOFF_KEY; }
@Test(expected = IllegalArgumentException.class) public void testDefaultMissing() throws Exception { MetricAgeOffFilter filter = new MetricAgeOffFilter(); HashMap<String, String> options = new HashMap<>(); filter.init(null, options, null); }