Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void releaseTryLocksOnClose()
        public virtual void ReleaseTryLocksOnClose()
        {
            assertTrue(ClientA.trySharedLock(ResourceTypes.Node, 1L));
            assertTrue(ClientB.tryExclusiveLock(ResourceTypes.Node, 2L));

            ClientA.close();
            ClientB.close();

            LockCountVisitor lockCountVisitor = new LockCountVisitor();

            Locks.accept(lockCountVisitor);
            assertEquals(0, lockCountVisitor.LockCount);
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void closeShouldWaitAllOperationToFinish()
        public virtual void CloseShouldWaitAllOperationToFinish()
        {
            // given
            ClientA.acquireShared(LockTracer.NONE, NODE, 1L);
            ClientA.acquireShared(LockTracer.NONE, NODE, 3L);
            ClientB.acquireShared(LockTracer.NONE, NODE, 1L);
            AcquireShared(ClientC, LockTracer.NONE, NODE, 2L);
            AcquireExclusive(ClientB, LockTracer.NONE, NODE, 1L).callAndAssertWaiting();
            AcquireExclusive(ClientC, LockTracer.NONE, NODE, 1L).callAndAssertWaiting();

            // when
            ClientB.close();
            ClientC.close();
            ClientA.close();

            // all locks should be closed at this point regardless of
            // reader/writer waiter in any threads
            // those should be gracefully finish and client should be closed

            LockCountVisitor lockCountVisitor = new LockCountVisitor();

            Locks.accept(lockCountVisitor);
            assertEquals(0, lockCountVisitor.LockCount);
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expected = LockClientStoppedException.class) public void shouldNotBeAbleToAcquireSharedLockFromClosedClient()
        public virtual void ShouldNotBeAbleToAcquireSharedLockFromClosedClient()
        {
            ClientA.close();
            ClientA.acquireShared(LockTracer.NONE, NODE, 1L);
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expected = LockClientStoppedException.class) public void shouldNotBeAbleToTryAcquireExclusiveLockFromClosedClient()
        public virtual void ShouldNotBeAbleToTryAcquireExclusiveLockFromClosedClient()
        {
            ClientA.close();
            ClientA.tryExclusiveLock(NODE, 1L);
        }
Ejemplo n.º 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expected = LockClientStoppedException.class) public void shouldNotBeAbleToTryAcquireSharedLockFromClosedClient()
        public virtual void ShouldNotBeAbleToTryAcquireSharedLockFromClosedClient()
        {
            ClientA.close();
            ClientA.trySharedLock(NODE, 1L);
        }