@Test public void match_statement_once_each_using_metric_matcher() { final MatchTransformerImpl matchStmt = new MatchTransformerImpl( EMPTY_MAP, singletonMap(new MatchStatement.IdentifierPair(IDENT, METRIC_IDENT), new MetricMatcher(wildcard_matcher, wildcard_matcher)), Optional.empty(), Stream.of(metric_ident_rule)); matchStmt.transform(ctx); Mockito.verify(group1, Mockito.atLeastOnce()).getGroup(); Mockito.verify(group2, Mockito.atLeastOnce()).getGroup(); Mockito.verify(group3, Mockito.atLeastOnce()).getGroup(); Mockito.verify(group1, Mockito.atLeastOnce()).findMetric(METRIC); Mockito.verify(group2, Mockito.atLeastOnce()).findMetric(METRIC); Mockito.verify(group3, Mockito.atLeastOnce()).findMetric(METRIC); assertEquals(3, metric_ident_rule.getInvocations()); }
@Override public void transform(Context parent) { decorator_ .map(Stream.of( (MutableContext mctx) -> { }), parent) .map(application -> { final MutableContext ctx = new MutableContext(parent); application.accept(ctx); return ctx; }) .filter(where_clause_.orElse(CONTEXT_TAUTOLOGY)) .forEach(this::play_rules_); }
MatchTransformerImpl implements TimeSeriesTransformer { @Override public void transform(Context parent) { decorator_ .map(Stream.of( (MutableContext mctx) -> { }), parent) .map(application -> { final MutableContext ctx = new MutableContext(parent); application.accept(ctx); return ctx; }) .filter(where_clause_.orElse(CONTEXT_TAUTOLOGY)) .forEach(this::play_rules_); } }
MatchTransformerImpl implements TimeSeriesTransformer { @Override public void transform(Context parent) { decorator_ .map(Stream.of( (MutableContext mctx) -> { }), parent) .map(application -> { final MutableContext ctx = new MutableContext(parent); application.accept(ctx); return ctx; }) .filter(where_clause_.orElse(CONTEXT_TAUTOLOGY)) .forEach(this::play_rules_); } MatchTransformerImpl(Map<String, PathMatcher> groupNameMatchers,
                                Map<IdentifierPair, MetricMatcher> metricNameMatchers,
                                Optional<MatchStatement.LookBackExposingPredicate> where_clause,
                                Stream<TimeSeriesTransformer> rules); }
MatchTransformerImpl implements TimeSeriesTransformer { @Override public void transform(Context parent) { decorator_ .map(Stream.of( (MutableContext mctx) -> { }), parent) .map(application -> { final MutableContext ctx = new MutableContext(parent); application.accept(ctx); return ctx; }) .filter(where_clause_.orElse(CONTEXT_TAUTOLOGY)) .forEach(this::play_rules_); } MatchTransformerImpl(Map<String, PathMatcher> groupNameMatchers,
                                Map<IdentifierPair, MetricMatcher> metricNameMatchers,
                                Optional<MatchStatement.LookBackExposingPredicate> where_clause,
                                Stream<TimeSeriesTransformer> rules); @Override void transform(Context parent); @Override ExpressionLookBack getLookBack(); }
MatchTransformerImpl implements TimeSeriesTransformer { @Override public void transform(Context parent) { decorator_ .map(Stream.of( (MutableContext mctx) -> { }), parent) .map(application -> { final MutableContext ctx = new MutableContext(parent); application.accept(ctx); return ctx; }) .filter(where_clause_.orElse(CONTEXT_TAUTOLOGY)) .forEach(this::play_rules_); } MatchTransformerImpl(Map<String, PathMatcher> groupNameMatchers,
                                Map<IdentifierPair, MetricMatcher> metricNameMatchers,
                                Optional<MatchStatement.LookBackExposingPredicate> where_clause,
                                Stream<TimeSeriesTransformer> rules); @Override void transform(Context parent); @Override ExpressionLookBack getLookBack();  }