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 lockNodeWithoutRelationships() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void LockNodeWithoutRelationships()
        {
            Collector collector = new Collector();
            TwoPhaseNodeForRelationshipLocking locking = new TwoPhaseNodeForRelationshipLocking(collector, _locks, NONE);

            ReturnRelationships(_transaction, false, new TestRelationshipChain(42));

            locking.LockAllNodesAndConsumeRelationships(_nodeId, _transaction, (new StubNodeCursor(false)).withNode(_nodeId));

            verify(_locks).acquireExclusive(NONE, NODE, _nodeId);
            verifyNoMoreInteractions(_locks);
        }
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 shouldLockNodesInOrderAndConsumeTheRelationships() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldLockNodesInOrderAndConsumeTheRelationships()
        {
            // given
            Collector collector = new Collector();
            TwoPhaseNodeForRelationshipLocking locking = new TwoPhaseNodeForRelationshipLocking(collector, _locks, NONE);

            ReturnRelationships(_transaction, false, (new TestRelationshipChain(_nodeId)).outgoing(21L, 43L, 0).incoming(22L, 40L, _type).outgoing(23L, 41L, _type).outgoing(2L, 3L, _type).incoming(3L, 49L, _type).outgoing(50L, 41L, _type));
            InOrder inOrder = inOrder(_locks);

            // when
            locking.LockAllNodesAndConsumeRelationships(_nodeId, _transaction, (new StubNodeCursor(false)).withNode(_nodeId));

            // then
            inOrder.verify(_locks).acquireExclusive(NONE, NODE, 3L, 40L, 41L, _nodeId, 43L, 49L);
            assertEquals(set(21L, 22L, 23L, 2L, 3L, 50L), collector.Set);
        }