@Test public void testOperationThatThrowsException(){ GraphVisitor repository = new TestGraphVisitor(); try{ OperationPipeline operationPipeline = new OperationPipeline(); OperationFeederImpl operationFeederImpl = new OperationFeederImpl(repository , operationPipeline); NewEntity newEntity = NewEntity.newInstance(Entity.ID.valueOf("entity-test")).build(); operationPipeline.add(new CreateEntity(newEntity)); VisitOperationResult result = operationFeederImpl.operationResult(); }catch(Exception e){ assertTrue(e instanceof RepositoryException); } }
public VisitOperationResult operationResult() { OperationIterator opIterator = operationsPipeline.iterator(); while (opIterator.hasNext()) { Operation operation = opIterator.next(); try { if (operation instanceof CreateEntity) { repository.visit((CreateEntity) operation); } else if (operation instanceof CreateRelationship) { repository.visit((CreateRelationship) operation); } else if (operation instanceof GetBatchEntityByID) { repository.visit((GetBatchEntityByID) operation); } else if (operation instanceof GetEntityByID) { repository.visit((GetEntityByID) operation); } else if (operation instanceof GetEntityByProperty) { repository.visit((GetEntityByProperty) operation); } else if (operation instanceof UpdateEntity) { repository.visit((UpdateEntity) operation); } else if (operation instanceof UpdateRelationship) { repository.visit((UpdateRelationship) operation); } else if (operation instanceof GraphTerminalOperation) { repository.visit((GraphTerminalOperation) operation); } else if (operation instanceof SelectEntities) { repository.visit((SelectEntities) operation); } else if (operation instanceof SelectRelationships) { repository.visit((SelectRelationships) operation); } else if (operation instanceof DeleteEntity) { repository.visit((DeleteEntity)operation); } else if(operation instanceof DeleteRelationship) { repository.visit((DeleteRelationship)operation); } LOG.info("SUCCESS " + operation.toString()); } catch (RepositoryException e) { LOG.error("FAIL " + operation.toString() + " with error message \" " + e.getMessage() + " \""); throw e; } } return repository.getResult(); }
OperationFeederImpl implements OperationFeeder { public VisitOperationResult operationResult() { OperationIterator opIterator = operationsPipeline.iterator(); while (opIterator.hasNext()) { Operation operation = opIterator.next(); try { if (operation instanceof CreateEntity) { repository.visit((CreateEntity) operation); } else if (operation instanceof CreateRelationship) { repository.visit((CreateRelationship) operation); } else if (operation instanceof GetBatchEntityByID) { repository.visit((GetBatchEntityByID) operation); } else if (operation instanceof GetEntityByID) { repository.visit((GetEntityByID) operation); } else if (operation instanceof GetEntityByProperty) { repository.visit((GetEntityByProperty) operation); } else if (operation instanceof UpdateEntity) { repository.visit((UpdateEntity) operation); } else if (operation instanceof UpdateRelationship) { repository.visit((UpdateRelationship) operation); } else if (operation instanceof GraphTerminalOperation) { repository.visit((GraphTerminalOperation) operation); } else if (operation instanceof SelectEntities) { repository.visit((SelectEntities) operation); } else if (operation instanceof SelectRelationships) { repository.visit((SelectRelationships) operation); } else if (operation instanceof DeleteEntity) { repository.visit((DeleteEntity)operation); } else if(operation instanceof DeleteRelationship) { repository.visit((DeleteRelationship)operation); } LOG.info("SUCCESS " + operation.toString()); } catch (RepositoryException e) { LOG.error("FAIL " + operation.toString() + " with error message \" " + e.getMessage() + " \""); throw e; } } return repository.getResult(); } }
OperationFeederImpl implements OperationFeeder { public VisitOperationResult operationResult() { OperationIterator opIterator = operationsPipeline.iterator(); while (opIterator.hasNext()) { Operation operation = opIterator.next(); try { if (operation instanceof CreateEntity) { repository.visit((CreateEntity) operation); } else if (operation instanceof CreateRelationship) { repository.visit((CreateRelationship) operation); } else if (operation instanceof GetBatchEntityByID) { repository.visit((GetBatchEntityByID) operation); } else if (operation instanceof GetEntityByID) { repository.visit((GetEntityByID) operation); } else if (operation instanceof GetEntityByProperty) { repository.visit((GetEntityByProperty) operation); } else if (operation instanceof UpdateEntity) { repository.visit((UpdateEntity) operation); } else if (operation instanceof UpdateRelationship) { repository.visit((UpdateRelationship) operation); } else if (operation instanceof GraphTerminalOperation) { repository.visit((GraphTerminalOperation) operation); } else if (operation instanceof SelectEntities) { repository.visit((SelectEntities) operation); } else if (operation instanceof SelectRelationships) { repository.visit((SelectRelationships) operation); } else if (operation instanceof DeleteEntity) { repository.visit((DeleteEntity)operation); } else if(operation instanceof DeleteRelationship) { repository.visit((DeleteRelationship)operation); } LOG.info("SUCCESS " + operation.toString()); } catch (RepositoryException e) { LOG.error("FAIL " + operation.toString() + " with error message \" " + e.getMessage() + " \""); throw e; } } return repository.getResult(); } @Inject  OperationFeederImpl(GraphVisitor repository,
            @Assisted OperationPipeline operationsPipeline); }
OperationFeederImpl implements OperationFeeder { public VisitOperationResult operationResult() { OperationIterator opIterator = operationsPipeline.iterator(); while (opIterator.hasNext()) { Operation operation = opIterator.next(); try { if (operation instanceof CreateEntity) { repository.visit((CreateEntity) operation); } else if (operation instanceof CreateRelationship) { repository.visit((CreateRelationship) operation); } else if (operation instanceof GetBatchEntityByID) { repository.visit((GetBatchEntityByID) operation); } else if (operation instanceof GetEntityByID) { repository.visit((GetEntityByID) operation); } else if (operation instanceof GetEntityByProperty) { repository.visit((GetEntityByProperty) operation); } else if (operation instanceof UpdateEntity) { repository.visit((UpdateEntity) operation); } else if (operation instanceof UpdateRelationship) { repository.visit((UpdateRelationship) operation); } else if (operation instanceof GraphTerminalOperation) { repository.visit((GraphTerminalOperation) operation); } else if (operation instanceof SelectEntities) { repository.visit((SelectEntities) operation); } else if (operation instanceof SelectRelationships) { repository.visit((SelectRelationships) operation); } else if (operation instanceof DeleteEntity) { repository.visit((DeleteEntity)operation); } else if(operation instanceof DeleteRelationship) { repository.visit((DeleteRelationship)operation); } LOG.info("SUCCESS " + operation.toString()); } catch (RepositoryException e) { LOG.error("FAIL " + operation.toString() + " with error message \" " + e.getMessage() + " \""); throw e; } } return repository.getResult(); } @Inject  OperationFeederImpl(GraphVisitor repository,
            @Assisted OperationPipeline operationsPipeline); VisitOperationResult operationResult(); }
OperationFeederImpl implements OperationFeeder { public VisitOperationResult operationResult() { OperationIterator opIterator = operationsPipeline.iterator(); while (opIterator.hasNext()) { Operation operation = opIterator.next(); try { if (operation instanceof CreateEntity) { repository.visit((CreateEntity) operation); } else if (operation instanceof CreateRelationship) { repository.visit((CreateRelationship) operation); } else if (operation instanceof GetBatchEntityByID) { repository.visit((GetBatchEntityByID) operation); } else if (operation instanceof GetEntityByID) { repository.visit((GetEntityByID) operation); } else if (operation instanceof GetEntityByProperty) { repository.visit((GetEntityByProperty) operation); } else if (operation instanceof UpdateEntity) { repository.visit((UpdateEntity) operation); } else if (operation instanceof UpdateRelationship) { repository.visit((UpdateRelationship) operation); } else if (operation instanceof GraphTerminalOperation) { repository.visit((GraphTerminalOperation) operation); } else if (operation instanceof SelectEntities) { repository.visit((SelectEntities) operation); } else if (operation instanceof SelectRelationships) { repository.visit((SelectRelationships) operation); } else if (operation instanceof DeleteEntity) { repository.visit((DeleteEntity)operation); } else if(operation instanceof DeleteRelationship) { repository.visit((DeleteRelationship)operation); } LOG.info("SUCCESS " + operation.toString()); } catch (RepositoryException e) { LOG.error("FAIL " + operation.toString() + " with error message \" " + e.getMessage() + " \""); throw e; } } return repository.getResult(); } @Inject  OperationFeederImpl(GraphVisitor repository,
            @Assisted OperationPipeline operationsPipeline); VisitOperationResult operationResult();  }