Пример #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);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(timeout = TEST_TIMEOUT) public void timeoutOnAcquiringSharedLock() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TimeoutOnAcquiringSharedLock()
        {
            ExpectedException.expect(new RootCauseMatcher <>(typeof(LockAcquisitionTimeoutException), "The transaction has been terminated. " + "Retry your operation in a new transaction, and you should see a successful result. " + "Unable to acquire lock within configured timeout (dbms.lock.acquisition.timeout). " + "Unable to acquire lock for resource: LABEL with id: 1 within 2000 millis."));

            using (Transaction ignored = _database.beginTx())
            {
                Locks lockManger = LockManager;
                lockManger.NewClient().acquireExclusive(LockTracer.NONE, ResourceTypes.LABEL, 1);

                Future <Void> propertySetFuture = _secondTransactionExecutor.executeDontWait(state =>
                {
                    using (Transaction nestedTransaction = _database.beginTx())
                    {
                        ResourceIterator <Node> nodes = _database.findNodes(_marker);
                        Node node = nodes.next();
                        node.addLabel(Label.label("anotherLabel"));
                        nestedTransaction.success();
                    }
                    return(null);
                });

                _secondTransactionExecutor.waitUntilWaiting(SharedLockWaitingPredicate());
                _clockExecutor.execute((OtherThreadExecutor.WorkerCommand <Void, Void>)state =>
                {
                    _fakeClock.forward(3, TimeUnit.SECONDS);
                    return(null);
                });
                propertySetFuture.get();

                fail("Should throw termination exception.");
            }
        }
Пример #3
0
//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()
        {
            _label = Label.label("LABEL");
            char[] chars = new char[1 << 15];
            Arrays.fill(chars, 'c');
            _longString  = new string( chars );
            _propertyKey = "name";
        }
Пример #4
0
 internal override void RemoveOffendingDataInRunningTx(GraphDatabaseService db)
 {
     using (ResourceIterator <Node> nodes = Db.findNodes(Label.label(KEY)))
     {
         while (nodes.MoveNext())
         {
             nodes.Current.delete();
         }
     }
 }
Пример #5
0
 internal override void CreateOffendingDataInRunningTx(GraphDatabaseService db)
 {
     Db.createNode(Label.label(KEY));
 }