//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldRecoverTransactionWhereNodeIsDeletedInTheFuture() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldRecoverTransactionWhereNodeIsDeletedInTheFuture() { // GIVEN Node node = CreateNodeWithProperty("key", "value", _label); CheckPoint(); SetProperty(node, "other-key", 1); DeleteNode(node); _flush.flush(_db); // WHEN CrashAndRestart(); // THEN // -- really the problem was that recovery threw exception, so mostly assert that. try { using (Transaction tx = _db.beginTx()) { node = _db.getNodeById(node.Id); tx.Success(); fail("Should not exist"); } } catch (NotFoundException e) { assertEquals("Node " + node.Id + " not found", e.Message); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testForceOpenIfChanged() public virtual void TestForceOpenIfChanged() { // do some actions to force the indexreader to be reopened using (Transaction tx = _graphDb.beginTx()) { Node node1 = _graphDb.getNodeById(_id1); Node node2 = _graphDb.getNodeById(_id2); Node node3 = _graphDb.getNodeById(_id3); node1.SetProperty("np2", "test property"); node1.GetRelationships(RelationshipType.withName("FOO")).forEach(Relationship.delete); // check first node Relationship rel; using (IndexHits <Relationship> hits = RelationShipAutoIndex().get("type", "FOO", node1, node3)) { assertEquals(0, hits.Size()); } // create second relation ship rel = node1.CreateRelationshipTo(node3, RelationshipType.withName("FOO")); rel.SetProperty("type", "FOO"); // check second node -> crashs with old FullTxData using (IndexHits <Relationship> indexHits = RelationShipAutoIndex().get("type", "FOO", node1, node2)) { assertEquals(0, indexHits.Size()); } // create second relation ship rel = node1.CreateRelationshipTo(node2, RelationshipType.withName("FOO")); rel.SetProperty("type", "FOO"); using (IndexHits <Relationship> relationships = RelationShipAutoIndex().get("type", "FOO", node1, node2)) { assertEquals(1, relationships.Size()); } tx.Success(); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private org.neo4j.graphdb.Node node(long id) throws NodeNotFoundException private Node Node(long id) { try { using (Transaction tx = _graphDb.beginTx()) { Node node = _graphDb.getNodeById(id); tx.Success(); return(node); } } catch (NotFoundException e) { throw new NodeNotFoundException(e); } }
public override Node GetNodeById(long id) { return(GraphDatabaseAPI.getNodeById(id)); }