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 transactionShouldReleaseLocksWhenGraphDbIsBeingShutdown()
        public virtual void TransactionShouldReleaseLocksWhenGraphDbIsBeingShutdown()
        {
            // GIVEN
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.kernel.impl.locking.Locks locks = db.getDependencyResolver().resolveDependency(org.neo4j.kernel.impl.locking.Locks.class);
            Locks locks = _db.DependencyResolver.resolveDependency(typeof(Locks));

            assertEquals(0, LockCount(locks));
            Exception exceptionThrownByTxClose = null;

            // WHEN
            try
            {
                using (Transaction tx = _db.beginTx())
                {
                    Node node = _db.createNode();
                    tx.AcquireWriteLock(node);
                    assertThat(LockCount(locks), greaterThanOrEqualTo(1));

                    _db.shutdown();

                    _db.createNode();
                    tx.Success();
                }
            }
            catch (Exception e)
            {
                exceptionThrownByTxClose = e;
            }

            // THEN
            assertThat(exceptionThrownByTxClose, instanceOf(typeof(DatabaseShutdownException)));
            assertFalse(_db.isAvailable(1));
            assertEquals(0, LockCount(locks));
        }
Esempio n. 2
0
 public override bool IsAvailable(long timeout)
 {
     return(_database.isAvailable(timeout));
 }