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

            TestRelationshipChain chain = (new TestRelationshipChain(_nodeId)).outgoing(21L, 43L, _type).incoming(22L, 40, _type).outgoing(23L, 41L, _type);

            ReturnRelationships(_transaction, true, chain);

            InOrder inOrder = inOrder(_locks);

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

            // then
            inOrder.verify(_locks).acquireExclusive(NONE, NODE, 40L, 41L, _nodeId);

            inOrder.verify(_locks).releaseExclusive(NODE, 40L, 41L, _nodeId);

            inOrder.verify(_locks).acquireExclusive(NONE, NODE, 40L, 41L, _nodeId, 43L);
            assertEquals(set(21L, 22L, 23L), collector.Set);
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: static void returnRelationships(org.neo4j.internal.kernel.api.Transaction transaction, final boolean skipFirst, final org.neo4j.internal.kernel.api.helpers.TestRelationshipChain relIds) throws org.neo4j.internal.kernel.api.exceptions.EntityNotFoundException
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
        internal static void ReturnRelationships(Transaction transaction, bool skipFirst, TestRelationshipChain relIds)
        {
            StubRead read = new StubRead();

            when(transaction.DataRead()).thenReturn(read);
            StubCursorFactory cursorFactory = new StubCursorFactory(true);

            if (skipFirst)
            {
                cursorFactory.WithRelationshipTraversalCursors(new StubRelationshipCursor(relIds.Tail()), new StubRelationshipCursor(relIds));
            }
            else
            {
                cursorFactory.WithRelationshipTraversalCursors(new StubRelationshipCursor(relIds));
            }

            when(transaction.Cursors()).thenReturn(cursorFactory);
        }