@Test @SuppressWarnings("unchecked") public void testExecute() { CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); assertEquals(CommandResult.Type.INFO, result.getType()); assertFalse(parent.getOutEdges().isEmpty()); assertFalse(candidate.getInEdges().isEmpty()); Edge edge = (Edge) parent.getOutEdges().get(0); assertTrue(edge.getContent() instanceof Child); assertEquals(parent, edge.getSourceNode()); assertEquals(candidate, edge.getTargetNode()); verify(graphIndex, times(1)).addEdge(eq(edge)); verify(graphIndex, times(0)).addNode(any(Node.class)); }
@Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { getCandidates(context).forEach(node -> execute(context, getParent(context), node)); } return results; }
SetChildrenCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { getCandidates(context).forEach(node -> execute(context, getParent(context), node)); } return results; } }
SetChildrenCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { getCandidates(context).forEach(node -> execute(context, getParent(context), node)); } return results; } SetChildrenCommand(final @MapsTo("parentUUID") String parentUUID,
                              final @MapsTo("candidateUUIDs") String[] candidateUUIDs);  SetChildrenCommand(final Node<?, Edge> parent,
                              final Node<?, Edge> candidate);  SetChildrenCommand(final Node<?, Edge> parent,
                              final Collection<Node<?, Edge>> candidates); }
SetChildrenCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { getCandidates(context).forEach(node -> execute(context, getParent(context), node)); } return results; } SetChildrenCommand(final @MapsTo("parentUUID") String parentUUID,
                              final @MapsTo("candidateUUIDs") String[] candidateUUIDs);  SetChildrenCommand(final Node<?, Edge> parent,
                              final Node<?, Edge> candidate);  SetChildrenCommand(final Node<?, Edge> parent,
                              final Collection<Node<?, Edge>> candidates); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getParent(); Collection<Node<?, Edge>> getCandidates(); @Override String toString(); }
SetChildrenCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { getCandidates(context).forEach(node -> execute(context, getParent(context), node)); } return results; } SetChildrenCommand(final @MapsTo("parentUUID") String parentUUID,
                              final @MapsTo("candidateUUIDs") String[] candidateUUIDs);  SetChildrenCommand(final Node<?, Edge> parent,
                              final Node<?, Edge> candidate);  SetChildrenCommand(final Node<?, Edge> parent,
                              final Collection<Node<?, Edge>> candidates); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getParent(); Collection<Node<?, Edge>> getCandidates(); @Override String toString();  }