@Test @SuppressWarnings("unchecked") public void testAllow() { CommandResult<RuleViolation> result = tested.allow(graphCommandExecutionContext); assertEquals(CommandResult.Type.INFO, result.getType()); final ArgumentCaptor<RuleEvaluationContext> contextCaptor = ArgumentCaptor.forClass(RuleEvaluationContext.class); verify(ruleManager, times(2)).evaluate(eq(ruleSet), contextCaptor.capture()); final List<RuleEvaluationContext> contexts = contextCaptor.getAllValues(); assertEquals(2, contexts.size()); verifyConnection((GraphConnectionContext) contexts.get(0), edge, node, null); verifyConnectorCardinality((ConnectorCardinalityContext) contexts.get(1), graph, node, edge, EdgeCardinalityContext.Direction.OUTGOING, Optional.of(CardinalityContext.Operation.ADD)); }
@Override public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { getMutableIndex(context).addEdge(edge); final CommandResult<RuleViolation> results = super.allow(context); if (CommandUtils.isError(results)) { getMutableIndex(context).removeEdge(edge); } return results; }
AddConnectorCommand extends AbstractGraphCompositeCommand { @Override public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { getMutableIndex(context).addEdge(edge); final CommandResult<RuleViolation> results = super.allow(context); if (CommandUtils.isError(results)) { getMutableIndex(context).removeEdge(edge); } return results; } }
AddConnectorCommand extends AbstractGraphCompositeCommand { @Override public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { getMutableIndex(context).addEdge(edge); final CommandResult<RuleViolation> results = super.allow(context); if (CommandUtils.isError(results)) { getMutableIndex(context).removeEdge(edge); } return results; } AddConnectorCommand(final @MapsTo("nodeUUID") String nodeUUID,
                               final @MapsTo("edge") Edge edge,
                               final @MapsTo("magnet") Connection connection);  AddConnectorCommand(final Node<?, Edge> sourceNode,
                               final Edge edge,
                               final Connection connection); }
AddConnectorCommand extends AbstractGraphCompositeCommand { @Override public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { getMutableIndex(context).addEdge(edge); final CommandResult<RuleViolation> results = super.allow(context); if (CommandUtils.isError(results)) { getMutableIndex(context).removeEdge(edge); } return results; } AddConnectorCommand(final @MapsTo("nodeUUID") String nodeUUID,
                               final @MapsTo("edge") Edge edge,
                               final @MapsTo("magnet") Connection connection);  AddConnectorCommand(final Node<?, Edge> sourceNode,
                               final Edge edge,
                               final Connection connection); @Override CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Edge getEdge(); Connection getConnection(); Node<?, Edge> getSourceNode(); @Override String toString(); }
AddConnectorCommand extends AbstractGraphCompositeCommand { @Override public CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context) { getMutableIndex(context).addEdge(edge); final CommandResult<RuleViolation> results = super.allow(context); if (CommandUtils.isError(results)) { getMutableIndex(context).removeEdge(edge); } return results; } AddConnectorCommand(final @MapsTo("nodeUUID") String nodeUUID,
                               final @MapsTo("edge") Edge edge,
                               final @MapsTo("magnet") Connection connection);  AddConnectorCommand(final Node<?, Edge> sourceNode,
                               final Edge edge,
                               final Connection connection); @Override CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Edge getEdge(); Connection getConnection(); Node<?, Edge> getSourceNode(); @Override String toString();  }