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 prepareMustAllowAcquiringNewLocksAfterStop()
        public virtual void PrepareMustAllowAcquiringNewLocksAfterStop()
        {
            // Given
            ClientA.prepare();
            ClientA.stop();

            // When
            ClientA.acquireShared(_tracer, NODE, 1);
            ClientA.acquireExclusive(_tracer, NODE, 2);

            // Stopped essentially has no effect when it comes after the client has entered the prepare phase
            LockCountVisitor lockCountVisitor = new LockCountVisitor();

            Locks.accept(lockCountVisitor);
            assertEquals(2, 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 mustNotReleaseLocksAfterPrepareOnStop()
        public virtual void MustNotReleaseLocksAfterPrepareOnStop()
        {
            // Given
            ClientA.acquireShared(_tracer, NODE, 1L);
            ClientA.acquireExclusive(_tracer, NODE, 2L);
            ClientA.prepare();

            // When
            ClientA.stop();

            // The client entered the prepare phase, so it gets to keep its locks
            LockCountVisitor lockCountVisitor = new LockCountVisitor();

            Locks.accept(lockCountVisitor);
            assertEquals(2, lockCountVisitor.LockCount);
        }