//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldTryUpgradeSharedToExclusive() public virtual void ShouldTryUpgradeSharedToExclusive() { // Given I've grabbed an exclusive lock assertTrue(ClientA.trySharedLock(NODE, 1L)); // Then I can upgrade it to exclusive assertTrue(ClientA.tryExclusiveLock(NODE, 1L)); // And other clients are denied it assertFalse(ClientB.trySharedLock(NODE, 1L)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldTrySharedLock() public virtual void ShouldTrySharedLock() { // Given I've grabbed a share lock assertTrue(ClientA.trySharedLock(NODE, 1L)); // Then other clients can't have exclusive locks assertFalse(ClientB.tryExclusiveLock(NODE, 1L)); // But they are allowed share locks assertTrue(ClientB.trySharedLock(NODE, 1L)); }
//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); }
//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); }