コード例 #1
0
ファイル: Read.cs プロジェクト: Neo4Net/Neo4Net
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public long lockingNodeUniqueIndexSeek(org.neo4j.internal.kernel.api.IndexReference index, org.neo4j.internal.kernel.api.IndexQuery.ExactPredicate... predicates) throws org.neo4j.internal.kernel.api.exceptions.schema.IndexNotApplicableKernelException, org.neo4j.internal.kernel.api.exceptions.schema.IndexNotFoundKernelException, org.neo4j.kernel.api.exceptions.schema.IndexBrokenKernelException
        public override long LockingNodeUniqueIndexSeek(IndexReference index, params IndexQuery.ExactPredicate[] predicates)
        {
            AssertIndexOnline(index);
            AssertPredicatesMatchSchema(index, predicates);

            Org.Neo4j.Kernel.impl.locking.Locks_Client locks = Ktx.statementLocks().optimistic();
            LockTracer lockTracer = Ktx.lockTracer();

            return(LockingNodeUniqueIndexSeek.Apply(locks, lockTracer, _cursors.allocateNodeValueIndexCursor, this, this, index, predicates));
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHoldSharedIndexLockIfNodeIsExists() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldHoldSharedIndexLockIfNodeIsExists()
        {
            // given
            NodeValueIndexCursor cursor = mock(typeof(NodeValueIndexCursor));

            when(cursor.Next()).thenReturn(true);
            when(cursor.NodeReference()).thenReturn(42L);

            // when
            long nodeId = LockingNodeUniqueIndexSeek.Apply(_locks, LockTracer.NONE, () => cursor, _uniqueNodeIndexSeeker, _read, _index, _predicate);

            // then
            assertEquals(42L, nodeId);
            verify(_locks).acquireShared(LockTracer.NONE, INDEX_ENTRY, _resourceId);
            verifyNoMoreInteractions(_locks);

            verify(cursor).close();
        }