@Test @SuppressWarnings("unchecked") public void testExecuteCheckFailed() { final RuleViolations FAILED_VIOLATIONS = new DefaultRuleViolations() .addViolation(new ContainmentRuleViolation(graph.getUUID(), UUID)); when(ruleManager.evaluate(any(RuleSet.class), any(RuleEvaluationContext.class))).thenReturn(FAILED_VIOLATIONS); final List sourceOutEdges = spy(new ArrayList()); final List targetInEdges = spy(new ArrayList()); when(source.getOutEdges()).thenReturn(sourceOutEdges); when(target.getInEdges()).thenReturn(targetInEdges); CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); assertEquals(CommandResult.Type.ERROR, result.getType()); verify(sourceOutEdges, times(0)).remove(any(Edge.class)); verify(targetInEdges, times(0)).remove(any(Edge.class)); verify(graphIndex, times(0)).removeNode(any(Node.class)); verify(graphIndex, times(0)).removeEdge(any(Edge.class)); verify(graphIndex, times(0)).addEdge(any(Edge.class)); verify(graphIndex, times(0)).addNode(any(Node.class)); }
@Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> result = super.execute(context); if (!CommandUtils.isError(result)) { final Edge<? extends ViewConnector, Node> edge = getCandidateEdge(context); getMutableIndex(context).removeEdge(edge); } return result; }
DeleteConnectorCommand extends AbstractGraphCompositeCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> result = super.execute(context); if (!CommandUtils.isError(result)) { final Edge<? extends ViewConnector, Node> edge = getCandidateEdge(context); getMutableIndex(context).removeEdge(edge); } return result; } }
DeleteConnectorCommand extends AbstractGraphCompositeCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> result = super.execute(context); if (!CommandUtils.isError(result)) { final Edge<? extends ViewConnector, Node> edge = getCandidateEdge(context); getMutableIndex(context).removeEdge(edge); } return result; } DeleteConnectorCommand(final @MapsTo("edge") String edgeUUID);  DeleteConnectorCommand(final Edge<? extends View, Node> edge); }
DeleteConnectorCommand extends AbstractGraphCompositeCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> result = super.execute(context); if (!CommandUtils.isError(result)) { final Edge<? extends ViewConnector, Node> edge = getCandidateEdge(context); getMutableIndex(context).removeEdge(edge); } return result; } DeleteConnectorCommand(final @MapsTo("edge") String edgeUUID);  DeleteConnectorCommand(final Edge<? extends View, Node> edge); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Edge<? extends View, Node> getEdge(); @Override String toString(); }
DeleteConnectorCommand extends AbstractGraphCompositeCommand { @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final CommandResult<RuleViolation> result = super.execute(context); if (!CommandUtils.isError(result)) { final Edge<? extends ViewConnector, Node> edge = getCandidateEdge(context); getMutableIndex(context).removeEdge(edge); } return result; } DeleteConnectorCommand(final @MapsTo("edge") String edgeUUID);  DeleteConnectorCommand(final Edge<? extends View, Node> edge); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Edge<? extends View, Node> getEdge(); @Override String toString();  }