@Test public void extractNoValues(){ MRecord record2 = UntypedValues.builder().source("source").timestamp(123L).values(Collections.emptyMap()).build(); EvaluationContext<MRecord> context2 = new SimpleEvaluationContext<>(record2); Map<String, Value> extract = extractor.extract(context2); assertEquals(0, extract.size()); }
@Override public Map<String, Value> extract(EvaluationContext context) { try { return context.get().getChannels().stream().collect(Collectors.toMap( channel -> channel, channel -> context.get().getValue(channel) )); } catch (Exception e) { logger.warn("could not extract all channel values", e); return Collections.emptyMap(); } }
AllChannelMapExtractor implements MapExtractor { @Override public Map<String, Value> extract(EvaluationContext context) { try { return context.get().getChannels().stream().collect(Collectors.toMap( channel -> channel, channel -> context.get().getValue(channel) )); } catch (Exception e) { logger.warn("could not extract all channel values", e); return Collections.emptyMap(); } } }
AllChannelMapExtractor implements MapExtractor { @Override public Map<String, Value> extract(EvaluationContext context) { try { return context.get().getChannels().stream().collect(Collectors.toMap( channel -> channel, channel -> context.get().getValue(channel) )); } catch (Exception e) { logger.warn("could not extract all channel values", e); return Collections.emptyMap(); } } AllChannelMapExtractor(Set<String> channels); }
AllChannelMapExtractor implements MapExtractor { @Override public Map<String, Value> extract(EvaluationContext context) { try { return context.get().getChannels().stream().collect(Collectors.toMap( channel -> channel, channel -> context.get().getValue(channel) )); } catch (Exception e) { logger.warn("could not extract all channel values", e); return Collections.emptyMap(); } } AllChannelMapExtractor(Set<String> channels); @Override Map<String, Value> extract(EvaluationContext context); @Override Set<String> getChannelIdentifiers(); }
AllChannelMapExtractor implements MapExtractor { @Override public Map<String, Value> extract(EvaluationContext context) { try { return context.get().getChannels().stream().collect(Collectors.toMap( channel -> channel, channel -> context.get().getValue(channel) )); } catch (Exception e) { logger.warn("could not extract all channel values", e); return Collections.emptyMap(); } } AllChannelMapExtractor(Set<String> channels); @Override Map<String, Value> extract(EvaluationContext context); @Override Set<String> getChannelIdentifiers();  }