/// <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)); } } }
private int LabelId(Label alien) { using (Transaction ignore = _db.beginTx()) { return(Ktx().tokenRead().nodeLabel(alien.Name())); } }
private IndexDefinition CreateIndex() { using (Transaction tx = _db.beginTx()) { IndexDefinition index = _db.schema().indexFor(_myLabel).on("number_of_bananas_owned").create(); tx.Success(); return(index); } }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected: //ORIGINAL LINE: private org.neo4j.test.OtherThreadExecutor.WorkerCommand<Void, org.neo4j.graphdb.Lock> acquireWriteLock(final org.neo4j.graphdb.Node resource) private OtherThreadExecutor.WorkerCommand <Void, Lock> AcquireWriteLock(Node resource) { return(state => { using (Transaction tx = _db.beginTx()) { return tx.acquireWriteLock(resource); } }); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldHandleSingleNodePath() public virtual void ShouldHandleSingleNodePath() { // Given Node node; using (Transaction tx = Db.beginTx()) { node = Db.createNode(); tx.Success(); } // When Path mapped = _mapper.mapPath(path(AsNodeValues(node), AsRelationshipsValues())); // Then using (Transaction ignore = Db.beginTx()) { assertThat(mapped.Length(), equalTo(0)); assertThat(mapped.StartNode(), equalTo(node)); assertThat(mapped.EndNode(), equalTo(node)); assertThat(Iterables.asList(mapped.Relationships()), hasSize(0)); assertThat(Iterables.asList(mapped.ReverseRelationships()), hasSize(0)); assertThat(Iterables.asList(mapped.Nodes()), equalTo(singletonList(node))); assertThat(Iterables.asList(mapped.ReverseNodes()), equalTo(singletonList(node))); assertThat(mapped.LastRelationship(), nullValue()); assertThat(Iterators.asList(mapped.GetEnumerator()), equalTo(singletonList(node))); } }
public virtual void BeginTx() { if (_tx == null) { _tx = _graphDb.beginTx(); } }
private Node GetNodeByIdInTx(int nodeId) { using (Transaction ignored = _db.beginTx()) { return(_db.getNodeById(nodeId)); } }
private void DoTransaction() { using (Transaction transaction = _database.beginTx()) { _database.createNode(); transaction.Success(); } }
private void NewTransaction() { if (_tx != null) { _tx.success(); _tx.close(); } _tx = _graph.beginTx(); }
private void CreateNode(string label) { using (Transaction tx = _db.beginTx()) { _db.createNode(label(label)); tx.Success(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setUp() public virtual void SetUp() { GraphDatabaseAPI api = DbRule.GraphDatabaseAPI; _graph = api; DependencyResolver dependencyResolver = api.DependencyResolver; this._bridge = dependencyResolver.ResolveDependency(typeof(ThreadToStatementContextBridge)); this._tx = _graph.beginTx(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void should_remove_all_data() public virtual void ShouldRemoveAllData() { using (Transaction tx = _db.beginTx()) { RelationshipType relationshipType = RelationshipType.withName("R"); Node n1 = _db.createNode(); Node n2 = _db.createNode(); Node n3 = _db.createNode(); n1.CreateRelationshipTo(n2, relationshipType); n2.CreateRelationshipTo(n1, relationshipType); n3.CreateRelationshipTo(n1, relationshipType); tx.Success(); } CleanDatabaseContent(_db); assertThat(NodeCount(), @is(0L)); }
public override void ClearGraph() { GraphDatabaseServiceCleaner.cleanDatabaseContent(_db); using (Transaction tx = _db.beginTx()) { PropertyContainer graphProperties = graphProperties(); foreach (string key in graphProperties.PropertyKeys) { graphProperties.RemoveProperty(key); } tx.Success(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testUpdateDoubleArrayProperty() public virtual void TestUpdateDoubleArrayProperty() { Node node; using (Transaction tx = _db.beginTx()) { node = _db.createNode(); node.SetProperty("foo", new double[] { 0, 0, 0, 0 }); tx.Success(); } using (Transaction ignore = _db.beginTx()) { for (int i = 0; i < 100; i++) { double[] data = ( double[] )node.GetProperty("foo"); data[2] = i; data[3] = i; node.SetProperty("foo", data); assertArrayEquals(new double[] { 0, 0, i, i }, ( double[] )node.GetProperty("foo"), 0.1D); } } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setUp() public virtual void SetUp() { _cluster = ClusterRule.startCluster(); _slave = _cluster.AnySlave; // Create some basic data using (Transaction tx = _slave.beginTx()) { Node node = _slave.createNode(Label.label("Person")); node.SetProperty("name", "Bob"); node.CreateRelationshipTo(_slave.createNode(), RelationshipType.withName("KNOWS")); tx.Success(); } // And now monitor the master for incoming calls _cluster.Master.DependencyResolver.resolveDependency(typeof(Monitors)).addMonitorListener(_masterMonitor); }
//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(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void validateIndexedNodePropertiesInLucene() internal virtual void ValidateIndexedNodePropertiesInLucene() { setUp(default_schema_provider.name(), GraphDatabaseSettings.SchemaIndex.NATIVE10.providerName()); Label label = Label.label("indexedNodePropertiesTestLabel"); string propertyName = "indexedNodePropertyName"; CreateIndex(label, propertyName); using (Transaction ignored = _database.beginTx()) { _database.schema().awaitIndexesOnline(5, TimeUnit.MINUTES); } System.ArgumentException argumentException = assertThrows(typeof(System.ArgumentException), () => { using (Transaction transaction = _database.beginTx()) { Node node = _database.createNode(label); node.setProperty(propertyName, StringUtils.repeat("a", IndexWriter.MAX_TERM_LENGTH + 1)); transaction.success(); } }); assertThat(argumentException.Message, equalTo("Property value size is too large for index. Please see index documentation for limitations.")); }
private void BeginTx() { this._tx = _db.beginTx(); }
public virtual void CommitAndReOpen() { Commit(); _tx = _graph.beginTx(); }
public override Response AddToNodeIndex(string indexName, string unique, string uniqueness, string postBody) { using (Transaction transaction = _graph.beginTx()) { Response response = _restfulGraphDatabase.addToNodeIndex(indexName, unique, uniqueness, postBody); if (response.Status < 300) { transaction.Success(); } return(response); } }