Esempio n. 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void nodeIndexDistinctValues(org.neo4j.internal.kernel.api.IndexReference index, org.neo4j.internal.kernel.api.NodeValueIndexCursor cursor, boolean needsValues) throws org.neo4j.internal.kernel.api.exceptions.schema.IndexNotFoundKernelException
        public override void NodeIndexDistinctValues(IndexReference index, NodeValueIndexCursor cursor, bool needsValues)
        {
            Ktx.assertOpen();
            DefaultNodeValueIndexCursor cursorImpl = ( DefaultNodeValueIndexCursor )cursor;
            IndexReader reader = IndexReader(index, true);

            cursorImpl.Read = this;
            using (CursorPropertyAccessor accessor = new CursorPropertyAccessor(_cursors.allocateNodeCursor(), _cursors.allocatePropertyCursor(), this))
            {
                reader.DistinctValues(cursorImpl, accessor, needsValues);
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturnNoValueOnMissingProperty() throws org.neo4j.internal.kernel.api.exceptions.EntityNotFoundException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldReturnNoValueOnMissingProperty()
        {
            // given
            long                   nodeId     = 10;
            StubNodeCursor         nodeCursor = (new StubNodeCursor()).withNode(nodeId, new long[] {}, genericMap(999, Values.of(12345)));
            CursorPropertyAccessor accessor   = new CursorPropertyAccessor(nodeCursor, new StubPropertyCursor(), new StubRead());

            // when
            Value readValue = accessor.GetNodePropertyValue(nodeId, 0);

            // then
            assertEquals(NO_VALUE, readValue);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLookupProperty() throws org.neo4j.internal.kernel.api.exceptions.EntityNotFoundException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldLookupProperty()
        {
            // given
            long                   nodeId        = 10;
            Value                  value         = Values.of("abc");
            int                    propertyKeyId = 0;
            StubNodeCursor         nodeCursor    = (new StubNodeCursor()).withNode(nodeId, new long[] {}, genericMap(999, Values.of(12345), propertyKeyId, value));
            CursorPropertyAccessor accessor      = new CursorPropertyAccessor(nodeCursor, new StubPropertyCursor(), new StubRead());

            // when
            Value readValue = accessor.GetNodePropertyValue(nodeId, propertyKeyId);

            // then
            assertEquals(value, readValue);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldThrowOnEntityNotFound()
        public virtual void ShouldThrowOnEntityNotFound()
        {
            // given
            long                   nodeId        = 10;
            Value                  value         = Values.of("abc");
            int                    propertyKeyId = 0;
            StubNodeCursor         nodeCursor    = (new StubNodeCursor()).withNode(nodeId, new long[] {}, genericMap(999, Values.of(12345), propertyKeyId, value));
            CursorPropertyAccessor accessor      = new CursorPropertyAccessor(nodeCursor, new StubPropertyCursor(), new StubRead());

            // when
            try
            {
                accessor.GetNodePropertyValue(nodeId + 1, propertyKeyId);
                fail();
            }
            catch (EntityNotFoundException)
            {
                // then good
            }
        }