Esempio n. 1
0
//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);
        }