//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void pageCacheMetrics() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void PageCacheMetrics() { Label testLabel = Label.label("testLabel"); using (Transaction transaction = _database.beginTx()) { Node node = _database.createNode(testLabel); node.SetProperty("property", "value"); transaction.Success(); } using (Transaction ignored = _database.beginTx()) { ResourceIterator <Node> nodes = _database.findNodes(testLabel); assertEquals(1, nodes.Count()); } AssertMetrics("Metrics report should include page cache pins", PC_PINS, greaterThan(0L)); AssertMetrics("Metrics report should include page cache unpins", PC_UNPINS, greaterThan(0L)); AssertMetrics("Metrics report should include page cache evictions", PC_EVICTIONS, greaterThanOrEqualTo(0L)); AssertMetrics("Metrics report should include page cache page faults", PC_PAGE_FAULTS, greaterThan(0L)); AssertMetrics("Metrics report should include page cache hits", PC_HITS, greaterThan(0L)); AssertMetrics("Metrics report should include page cache flushes", PC_FLUSHES, greaterThanOrEqualTo(0L)); AssertMetrics("Metrics report should include page cache exceptions", PC_EVICTION_EXCEPTIONS, equalTo(0L)); assertEventually("Metrics report should include page cache hit ratio", () => readDoubleValue(metricsCsv(_metricsDirectory, PC_HIT_RATIO)), lessThanOrEqualTo(1.0), 5, SECONDS); assertEventually("Metrics report should include page cache usage ratio", () => readDoubleValue(metricsCsv(_metricsDirectory, PC_USAGE_RATIO)), lessThanOrEqualTo(1.0), 5, SECONDS); }
private void AssertNodeWith(Label label, string key, object value) { using (ResourceIterator <Node> nodes = _db.findNodes(label, key, value)) { //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertTrue(nodes.hasNext()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: Node foundNode = nodes.next(); assertTrue(foundNode.HasLabel(label)); assertEquals(value, foundNode.GetProperty(key)); } }
private void AssertBothNodesArePresent(Pair <long, long> nodeIds) { using (Transaction tx = _db.beginTx()) { ResourceIterator <Node> origin = _db.findNodes(LABEL, KEY, _point1); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertTrue(origin.hasNext()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertEquals(nodeIds.First(), origin.next().Id); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertFalse(origin.hasNext()); ResourceIterator <Node> center = _db.findNodes(LABEL, KEY, _point2); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertTrue(center.hasNext()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertEquals(nodeIds.Other(), center.next().Id); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertFalse(center.hasNext()); tx.Success(); } }
private void DeleteHumans() { using (Transaction tx = _db.beginTx()) { using (ResourceIterator <Node> humans = _db.findNodes(_human)) { while (humans.MoveNext()) { humans.Current.delete(); } } tx.Success(); } }