Пример #1
0
 private Node node(long id) throws NodeNotFoundException {
   try {
     return graphDb.getNodeById(id);
   } catch (NotFoundException e) {
     throw new NodeNotFoundException(e);
   }
 }
Пример #2
0
 protected void assertNodeExists(long id) {
   try (Transaction ignore = db.beginTx()) {
     db.getNodeById(id);
   } catch (NotFoundException e) {
     fail("Node " + id + " should exist");
   }
 }
Пример #3
0
 protected void assertNodeDoesntExist(long id) {
   try (Transaction ignore = db.beginTx()) {
     db.getNodeById(id);
     fail("Relationship " + id + " shouldn't exist");
   } catch (NotFoundException e) {
     // Good
   }
 }
Пример #4
0
 @Override
 public void run(GraphDatabaseAPI graphdb) {
   try (Transaction ignored = graphdb.beginTx()) {
     // TODO: Pass a node reference around of assuming the id will be deterministically assigned,
     // artifact of removing the reference node, upon which this test used to depend.
     assertTrue((Boolean) graphdb.getNodeById(3).getProperty("success"));
   }
 }
Пример #5
0
 protected Node getCurrentNode() throws RemoteException, ShellException {
   Serializable current =
       shellServer.interpretVariable(shellClient.getId(), Variables.CURRENT_KEY);
   int nodeId = parseInt(current.toString().substring(1));
   try (Transaction tx = db.beginTx()) {
     Node nodeById = db.getNodeById(nodeId);
     tx.success();
     return nodeById;
   }
 }
Пример #6
0
 private void updateNode(long nodeId, int value) {
   Transaction tx = db.beginTx();
   try {
     Node node = db.getNodeById(nodeId);
     node.setProperty(NUM_BANANAS_KEY, value);
     tx.success();
   } finally {
     tx.finish();
   }
 }