private Node GetNodeByIdInTx(int nodeId) { using (Transaction ignored = _db.beginTx()) { return(_db.getNodeById(nodeId)); } }
/// <summary> /// Reading a node command might leave a node record which referred to /// labels in one or more dynamic records as marked as heavy even if that /// node already had references to dynamic records, changed in a transaction, /// but had no labels on that node changed within that same transaction. /// Now defensively only marks as heavy if there were one or more dynamic /// records provided when providing the record object with the label field /// value. This would give the opportunity to load the dynamic records the /// next time that record would be ensured heavy. /// </summary> //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldRecoverNodeWithDynamicLabelRecords() public virtual void ShouldRecoverNodeWithDynamicLabelRecords() { // GIVEN _database = (new TestGraphDatabaseFactory()).setFileSystem(Fs).newImpermanentDatabase(); Node node; Label[] labels = new Label[] { label("a"), label("b"), label("c"), label("d"), label("e"), label("f"), label("g"), label("h"), label("i"), label("j"), label("k") }; using (Transaction tx = _database.beginTx()) { node = _database.createNode(labels); tx.Success(); } // WHEN using (Transaction tx = _database.beginTx()) { node.SetProperty("prop", "value"); tx.Success(); } EphemeralFileSystemAbstraction snapshot = Fs.snapshot(); _database.shutdown(); _database = (new TestGraphDatabaseFactory()).setFileSystem(snapshot).newImpermanentDatabase(); // THEN using (Transaction ignored = _database.beginTx()) { node = _database.getNodeById(node.Id); foreach (Label label in labels) { assertTrue(node.HasLabel(label)); } } }
public override void Perform(long nodeId, string value) { Node node = _db.getNodeById(nodeId); if (node.HasProperty(value)) { node.RemoveProperty(value); } else { node.SetProperty(value, 10); } }
public override void Perform(long nodeId, string value) { Node node = _db.getNodeById(nodeId); Label label = Label.label(value); if (node.HasLabel(label)) { node.RemoveLabel(label); } else { node.AddLabel(label); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotInitializeTxOnReadOnlyOpsOnNeoXaDS() public virtual void ShouldNotInitializeTxOnReadOnlyOpsOnNeoXaDS() { long nodeId = 0L; using (Transaction transaction = _slave.beginTx()) { // When Node node = _slave.getNodeById(nodeId); // Then AssertDidntStartMasterTx(); // When count(node.Labels); // Then AssertDidntStartMasterTx(); // When ReadAllRels(node); // Then AssertDidntStartMasterTx(); // When ReadEachProperty(node); // Then AssertDidntStartMasterTx(); transaction.Success(); } // Finally AssertDidntStartMasterTx(); }