@Test @SuppressWarnings("unchecked") public void testEvaluateSuccess() { when(context.getCandidates()).thenReturn(candidates); final RuleViolations violations = tested.evaluate(RULE, context); assertNotNull(violations); assertFalse(violations.violations(RuleViolation.Type.ERROR).iterator().hasNext()); }
@Override @SuppressWarnings("unchecked") public RuleViolations evaluate(final CanContain rule, final NodeContainmentContext context) { final Element<? extends Definition<?>> parent = context.getParent(); final Set<String> parentLabels = evalUtils.getLabels(parent); final DefaultRuleViolations result = new DefaultRuleViolations(); final Collection<Node<? extends Definition<?>, ? extends Edge>> candidates = context.getCandidates(); candidates.forEach(candidate -> result.addViolations(evaluate(rule, candidate.getUUID(), evalUtils.getLabels(candidate), parentLabels))); return result; }
NodeContainmentEvaluationHandler implements RuleEvaluationHandler<CanContain, NodeContainmentContext> { @Override @SuppressWarnings("unchecked") public RuleViolations evaluate(final CanContain rule, final NodeContainmentContext context) { final Element<? extends Definition<?>> parent = context.getParent(); final Set<String> parentLabels = evalUtils.getLabels(parent); final DefaultRuleViolations result = new DefaultRuleViolations(); final Collection<Node<? extends Definition<?>, ? extends Edge>> candidates = context.getCandidates(); candidates.forEach(candidate -> result.addViolations(evaluate(rule, candidate.getUUID(), evalUtils.getLabels(candidate), parentLabels))); return result; } }
NodeContainmentEvaluationHandler implements RuleEvaluationHandler<CanContain, NodeContainmentContext> { @Override @SuppressWarnings("unchecked") public RuleViolations evaluate(final CanContain rule, final NodeContainmentContext context) { final Element<? extends Definition<?>> parent = context.getParent(); final Set<String> parentLabels = evalUtils.getLabels(parent); final DefaultRuleViolations result = new DefaultRuleViolations(); final Collection<Node<? extends Definition<?>, ? extends Edge>> candidates = context.getCandidates(); candidates.forEach(candidate -> result.addViolations(evaluate(rule, candidate.getUUID(), evalUtils.getLabels(candidate), parentLabels))); return result; } protected  NodeContainmentEvaluationHandler(); @Inject  NodeContainmentEvaluationHandler(final DefinitionManager definitionManager,
                                            final ContainmentEvaluationHandler containmentHandler); }
NodeContainmentEvaluationHandler implements RuleEvaluationHandler<CanContain, NodeContainmentContext> { @Override @SuppressWarnings("unchecked") public RuleViolations evaluate(final CanContain rule, final NodeContainmentContext context) { final Element<? extends Definition<?>> parent = context.getParent(); final Set<String> parentLabels = evalUtils.getLabels(parent); final DefaultRuleViolations result = new DefaultRuleViolations(); final Collection<Node<? extends Definition<?>, ? extends Edge>> candidates = context.getCandidates(); candidates.forEach(candidate -> result.addViolations(evaluate(rule, candidate.getUUID(), evalUtils.getLabels(candidate), parentLabels))); return result; } protected  NodeContainmentEvaluationHandler(); @Inject  NodeContainmentEvaluationHandler(final DefinitionManager definitionManager,
                                            final ContainmentEvaluationHandler containmentHandler); @Override Class<CanContain> getRuleType(); @Override Class<NodeContainmentContext> getContextType(); @Override boolean accepts(final CanContain rule,
                           final NodeContainmentContext context); @Override @SuppressWarnings("unchecked") RuleViolations evaluate(final CanContain rule,
                                   final NodeContainmentContext context); }
NodeContainmentEvaluationHandler implements RuleEvaluationHandler<CanContain, NodeContainmentContext> { @Override @SuppressWarnings("unchecked") public RuleViolations evaluate(final CanContain rule, final NodeContainmentContext context) { final Element<? extends Definition<?>> parent = context.getParent(); final Set<String> parentLabels = evalUtils.getLabels(parent); final DefaultRuleViolations result = new DefaultRuleViolations(); final Collection<Node<? extends Definition<?>, ? extends Edge>> candidates = context.getCandidates(); candidates.forEach(candidate -> result.addViolations(evaluate(rule, candidate.getUUID(), evalUtils.getLabels(candidate), parentLabels))); return result; } protected  NodeContainmentEvaluationHandler(); @Inject  NodeContainmentEvaluationHandler(final DefinitionManager definitionManager,
                                            final ContainmentEvaluationHandler containmentHandler); @Override Class<CanContain> getRuleType(); @Override Class<NodeContainmentContext> getContextType(); @Override boolean accepts(final CanContain rule,
                           final NodeContainmentContext context); @Override @SuppressWarnings("unchecked") RuleViolations evaluate(final CanContain rule,
                                   final NodeContainmentContext context);  }