Exemplo n.º 1
0
 private void CreateNonUniqueNodes()
 {
     using (Transaction tx = _db.beginTx())
     {
         Node originNode = _db.createNode(LABEL);
         originNode.SetProperty(KEY, _point1);
         Node centerNode = _db.createNode(LABEL);
         centerNode.SetProperty(KEY, _point1);
         tx.Success();
     }
 }
Exemplo n.º 2
0
 private void CreateAliensAndHumans()
 {
     using (Transaction tx = _db.beginTx())
     {
         for (int i = 0; i < ALIENS; i++)
         {
             _db.createNode(_alien);
         }
         for (int i = 0; i < HUMANS; i++)
         {
             _db.createNode(_human);
         }
         tx.Success();
     }
 }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(timeout = TEST_TIMEOUT) public void shouldNotFreakOutIfTwoTransactionsDecideToEachAddTheSameProperty() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotFreakOutIfTwoTransactionsDecideToEachAddTheSameProperty()
        {
            // GIVEN
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.test.Barrier_Control barrier = new org.neo4j.test.Barrier_Control();
            Org.Neo4j.Test.Barrier_Control barrier = new Org.Neo4j.Test.Barrier_Control();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.graphdb.Node node;
            Node node;

            using (Transaction tx = _db.beginTx())
            {
                node = _db.createNode();
                tx.Success();
            }

            // WHEN
            T2.execute((WorkerCommand <Void, Void>)state =>
            {
                using (Transaction tx = _db.beginTx())
                {
                    node.SetProperty(PROPERTY_KEY, VALUE_1);
                    tx.Success();
                    barrier.Reached();
                }
                return(null);
            });
            using (Transaction tx = _db.beginTx())
            {
                barrier.Await();
                node.SetProperty(PROPERTY_KEY, VALUE_2);
                tx.Success();
                barrier.Release();
            }

            using (Transaction tx = _db.beginTx())
            {
                assertEquals(1, count(node.PropertyKeys));
                tx.Success();
            }
        }