@Test @SuppressWarnings("unchecked") public void testExecute() { CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); assertEquals(CommandResult.Type.INFO, result.getType()); assertTrue(parentOutEdges.isEmpty()); assertTrue(candidateInEdges.isEmpty()); verify(graphIndex, times(1)).removeEdge(any(Edge.class)); verify(graphIndex, times(0)).removeNode(any(Node.class)); verify(graph, times(0)).addNode(any(Node.class)); verify(graphIndex, times(0)).addNode(any(Node.class)); verify(graphIndex, times(0)).addEdge(any(Edge.class)); }
@Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); getCandidates(context).forEach(candidate -> removeChild(context, parent, candidate)); } return results; }
RemoveChildrenCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); getCandidates(context).forEach(candidate -> removeChild(context, parent, candidate)); } return results; } }
RemoveChildrenCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); getCandidates(context).forEach(candidate -> removeChild(context, parent, candidate)); } return results; } RemoveChildrenCommand(final @MapsTo("parentUUID") String parentUUID,
                                 final @MapsTo("candidateUUIDs") String[] candidateUUIDs);  RemoveChildrenCommand(final Node<?, Edge> parent,
                                 final Node<?, Edge> candidate);  RemoveChildrenCommand(final Node<?, Edge> parent,
                                 final Collection<Node<?, Edge>> candidates); }
RemoveChildrenCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); getCandidates(context).forEach(candidate -> removeChild(context, parent, candidate)); } return results; } RemoveChildrenCommand(final @MapsTo("parentUUID") String parentUUID,
                                 final @MapsTo("candidateUUIDs") String[] candidateUUIDs);  RemoveChildrenCommand(final Node<?, Edge> parent,
                                 final Node<?, Edge> candidate);  RemoveChildrenCommand(final Node<?, Edge> parent,
                                 final Collection<Node<?, Edge>> candidates); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getParent(); Collection<Node<?, Edge>> getCandidates(); @Override String toString(); }
RemoveChildrenCommand extends AbstractGraphCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> results = allow(context); if (!results.getType().equals(CommandResult.Type.ERROR)) { final Node<?, Edge> parent = getParent(context); getCandidates(context).forEach(candidate -> removeChild(context, parent, candidate)); } return results; } RemoveChildrenCommand(final @MapsTo("parentUUID") String parentUUID,
                                 final @MapsTo("candidateUUIDs") String[] candidateUUIDs);  RemoveChildrenCommand(final Node<?, Edge> parent,
                                 final Node<?, Edge> candidate);  RemoveChildrenCommand(final Node<?, Edge> parent,
                                 final Collection<Node<?, Edge>> candidates); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Node<?, Edge> getParent(); Collection<Node<?, Edge>> getCandidates(); @Override String toString();  }