@Test public void testLookup() throws Exception { Closure closure = mock(Closure.class); Value myValue = new Value(); myValue.add(1.0); when(closure.getValueByShortcut("name")).thenReturn(myValue); DefaultResultProcessor victim = new DefaultResultProcessor(null, null, Buckets.DEFAULT_BUCKET_SIZE); double foundValue = victim.lookup("name", closure); assertEquals("lookup should return correct value for series.", myValue.getValue(), foundValue, EPSILON); }
@Override public double lookup(String name, Closure closure) throws UnknownReferenceException { if (null == closure) { throw new NullPointerException("null closure passed to lookup() method."); } if ("time".equalsIgnoreCase(name)) { return closure.getTimeStamp(); } Value v = closure.getValueByShortcut(name); if (v == null) { throw new UnknownReferenceException(name); } return v.getValue(); }
DefaultResultProcessor implements ResultProcessor,
        ReferenceProvider { @Override public double lookup(String name, Closure closure) throws UnknownReferenceException { if (null == closure) { throw new NullPointerException("null closure passed to lookup() method."); } if ("time".equalsIgnoreCase(name)) { return closure.getTimeStamp(); } Value v = closure.getValueByShortcut(name); if (v == null) { throw new UnknownReferenceException(name); } return v.getValue(); } }
DefaultResultProcessor implements ResultProcessor,
        ReferenceProvider { @Override public double lookup(String name, Closure closure) throws UnknownReferenceException { if (null == closure) { throw new NullPointerException("null closure passed to lookup() method."); } if ("time".equalsIgnoreCase(name)) { return closure.getTimeStamp(); } Value v = closure.getValueByShortcut(name); if (v == null) { throw new UnknownReferenceException(name); } return v.getValue(); } DefaultResultProcessor(Iterable<OpenTSDBQueryResult> results, List<MetricSpecification> queries, long bucketSize); }
DefaultResultProcessor implements ResultProcessor,
        ReferenceProvider { @Override public double lookup(String name, Closure closure) throws UnknownReferenceException { if (null == closure) { throw new NullPointerException("null closure passed to lookup() method."); } if ("time".equalsIgnoreCase(name)) { return closure.getTimeStamp(); } Value v = closure.getValueByShortcut(name); if (v == null) { throw new UnknownReferenceException(name); } return v.getValue(); } DefaultResultProcessor(Iterable<OpenTSDBQueryResult> results, List<MetricSpecification> queries, long bucketSize); @Override double lookup(String name, Closure closure); @Override Buckets<IHasShortcut> processResults(); }
DefaultResultProcessor implements ResultProcessor,
        ReferenceProvider { @Override public double lookup(String name, Closure closure) throws UnknownReferenceException { if (null == closure) { throw new NullPointerException("null closure passed to lookup() method."); } if ("time".equalsIgnoreCase(name)) { return closure.getTimeStamp(); } Value v = closure.getValueByShortcut(name); if (v == null) { throw new UnknownReferenceException(name); } return v.getValue(); } DefaultResultProcessor(Iterable<OpenTSDBQueryResult> results, List<MetricSpecification> queries, long bucketSize); @Override double lookup(String name, Closure closure); @Override Buckets<IHasShortcut> processResults();  }