예제 #1
0
        private void SeekQuery(IndexDescriptor descriptor, IndexQuery[] query)
        {
            IndexQuery.ExactPredicate[] exactPreds = AssertOnlyExactPredicates(query);
            TransactionState            txState    = _read.txState();

            AddedAndRemoved changes = indexUpdatesForSeek(txState, descriptor, IndexQuery.asValueTuple(exactPreds));

            _added   = changes.Added.longIterator();
            _removed = _removed(txState, changes.Removed);
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldSeekWhenThereAreNewNumberNodes()
            internal virtual void ShouldSeekWhenThereAreNewNumberNodes()
            {
                // GIVEN
                ReadableTransactionState state = (new TxStateBuilder()).WithAdded(42L, 42001.0, 42002.0).withAdded(43L, 43001.0, 43002.0).build();

                // WHEN
                AddedAndRemoved changes = indexUpdatesForSeek(state, CompositeIndexConflict, ValueTuple.of(43001.0, 43002.0));

                // THEN
                outerInstance.AssertContains(changes.Added, 43L);
            }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldSeekWhenThereAreManyEntriesWithTheSameValues()
            internal virtual void ShouldSeekWhenThereAreManyEntriesWithTheSameValues()
            {
                // GIVEN (note that 44 has the same properties as 43)
                ReadableTransactionState state = (new TxStateBuilder()).WithAdded(42L, "42value1", "42value2").withAdded(43L, "43value1", "43value2").withAdded(44L, "43value1", "43value2").build();

                // WHEN
                AddedAndRemoved changes = indexUpdatesForSeek(state, CompositeIndexConflict, ValueTuple.of("43value1", "43value2"));

                // THEN
                outerInstance.AssertContains(changes.Added, 43L, 44L);
            }
예제 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldComputeIndexUpdatesForRangeSeekByPrefixWhenThereAreNoMatchingNodes()
            internal virtual void ShouldComputeIndexUpdatesForRangeSeekByPrefixWhenThereAreNoMatchingNodes()
            {
                // GIVEN
                ReadableTransactionState state = (new TxStateBuilder()).WithAdded(42L, "value42").withAdded(43L, "value43").build();

                // WHEN
                AddedAndRemoved           changes           = indexUpdatesForRangeSeekByPrefix(state, outerInstance.index, stringValue("eulav"), IndexOrder.NONE);
                AddedWithValuesAndRemoved changesWithValues = indexUpdatesWithValuesForRangeSeekByPrefix(state, outerInstance.index, stringValue("eulav"), IndexOrder.NONE);

                // THEN
                assertTrue(changes.Added.Empty);
                assertFalse(changesWithValues.Added.GetEnumerator().hasNext());
            }
예제 #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldSeekOnAnEmptyTxState()
            internal virtual void ShouldSeekOnAnEmptyTxState()
            {
                // GIVEN
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.storageengine.api.txstate.ReadableTransactionState state = org.mockito.Mockito.mock(org.neo4j.storageengine.api.txstate.ReadableTransactionState.class);
                ReadableTransactionState state = Mockito.mock(typeof(ReadableTransactionState));

                // WHEN
                AddedAndRemoved changes = indexUpdatesForSeek(state, CompositeIndexConflict, ValueTuple.of("43value1", "43value2"));

                // THEN
                assertTrue(changes.Empty);
            }
예제 #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldScanWhenThereAreNewNodes()
            internal virtual void ShouldScanWhenThereAreNewNodes()
            {
                // GIVEN
                ReadableTransactionState state = (new TxStateBuilder()).WithAdded(42L, "42value1", "42value2").withAdded(43L, "43value1", "43value2").build();

                // WHEN
                AddedAndRemoved           changes           = indexUpdatesForScan(state, CompositeIndexConflict, IndexOrder.NONE);
                AddedWithValuesAndRemoved changesWithValues = indexUpdatesWithValuesForScan(state, CompositeIndexConflict, IndexOrder.NONE);

                // THEN
                outerInstance.AssertContains(changes.Added, 42L, 43L);
                outerInstance.AssertContains(changesWithValues.Added, NodeWithPropertyValues(42L, "42value1", "42value2"), NodeWithPropertyValues(43L, "43value1", "43value2"));
            }
예제 #7
0
        private DynamicTest RangeTest(ReadableTransactionState state, IndexOrder indexOrder, Value lo, bool includeLo, Value hi, bool includeHi, params NodeWithPropertyValues[] expected)
        {
            return(DynamicTest.dynamicTest(string.Format("range seek: lo={0} (incl: {1}), hi={2} (incl: {3})", lo, includeLo, hi, includeHi), () =>
            {
                // Internal production code relies on null for unbounded, and cannot cope with NO_VALUE in this case
                Debug.Assert(lo != NO_VALUE);
                Debug.Assert(hi != NO_VALUE);
                AddedAndRemoved changes = indexUpdatesForRangeSeek(state, _index, IndexQuery.range(-1, lo, includeLo, hi, includeHi), indexOrder);
                AddedWithValuesAndRemoved changesWithValues = indexUpdatesWithValuesForRangeSeek(state, _index, IndexQuery.range(-1, lo, includeLo, hi, includeHi), indexOrder);

                AssertContains(indexOrder, changes, changesWithValues, expected);
            }));
        }
예제 #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldComputeIndexUpdatesForSeekWhenThereAreNewNodes()
        internal virtual void ShouldComputeIndexUpdatesForSeekWhenThereAreNewNodes()
        {
            // GIVEN
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.storageengine.api.txstate.ReadableTransactionState state = new TxStateBuilder().withAdded(42L, "foo").withAdded(43L, "bar").build();
            ReadableTransactionState state = (new TxStateBuilder()).WithAdded(42L, "foo").withAdded(43L, "bar").build();

            // WHEN
            AddedAndRemoved changes = indexUpdatesForSeek(state, _index, ValueTuple.of("bar"));

            // THEN
            AssertContains(changes.Added, 43L);
        }
예제 #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldComputeIndexUpdatesForRangeSeekByPrefixWhenThereAreNonStringNodes()
            internal virtual void ShouldComputeIndexUpdatesForRangeSeekByPrefixWhenThereAreNonStringNodes()
            {
                // GIVEN
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.storageengine.api.txstate.ReadableTransactionState state = new TxStateBuilder().withAdded(42L, "barry").withAdded(44L, 101L).withAdded(43L, "bar").build();
                ReadableTransactionState state = (new TxStateBuilder()).WithAdded(42L, "barry").withAdded(44L, 101L).withAdded(43L, "bar").build();

                // WHEN
                AddedAndRemoved changes = TxStateIndexChanges.IndexUpdatesForRangeSeekByPrefix(state, outerInstance.index, stringValue("bar"), IndexOrder.NONE);

                // THEN
                outerInstance.AssertContainsInOrder(changes.Added, 43L, 42L);
            }
예제 #10
0
            internal virtual void AssertRangeSeekByPrefixForOrder(IndexOrder indexOrder)
            {
                // GIVEN
                ReadableTransactionState state = (new TxStateBuilder()).WithAdded(40L, "Aaron").withAdded(41L, "Agatha").withAdded(42L, "Andreas").withAdded(43L, "Barbarella").withAdded(44L, "Andrea").withAdded(45L, "Aristotle").withAdded(46L, "Barbara").withAdded(47L, "Andy").withAdded(48L, "Cinderella").withAdded(49L, "Andromeda").build();

                // WHEN
                AddedAndRemoved           changes           = indexUpdatesForRangeSeekByPrefix(state, outerInstance.index, stringValue("And"), indexOrder);
                AddedWithValuesAndRemoved changesWithValues = indexUpdatesWithValuesForRangeSeekByPrefix(state, outerInstance.index, stringValue("And"), indexOrder);

                NodeWithPropertyValues[] expected = new NodeWithPropertyValues[] { NodeWithPropertyValues(44L, "Andrea"), NodeWithPropertyValues(42L, "Andreas"), NodeWithPropertyValues(49L, "Andromeda"), NodeWithPropertyValues(47L, "Andy") };

                // THEN
                outerInstance.AssertContains(indexOrder, changes, changesWithValues, expected);
            }
예제 #11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldComputeIndexUpdatesForRangeSeekByContainsWhenThereArePartiallyMatchingNewNodes()
            internal virtual void ShouldComputeIndexUpdatesForRangeSeekByContainsWhenThereArePartiallyMatchingNewNodes()
            {
                // GIVEN
                ReadableTransactionState state = (new TxStateBuilder()).WithAdded(40L, "Aaron").withAdded(41L, "Agatha").withAdded(42L, "Andreas").withAdded(43L, "Andrea").withAdded(44L, "Aristotle").withAdded(45L, "Barbara").withAdded(46L, "Barbarella").withAdded(47L, "Cinderella").build();

                // WHEN
                IndexQuery.StringContainsPredicate indexQuery = IndexQuery.stringContains(outerInstance.index.Schema().PropertyId, stringValue("arbar"));
                AddedAndRemoved           changes             = indexUpdatesForSuffixOrContains(state, outerInstance.index, indexQuery, IndexOrder.NONE);
                AddedWithValuesAndRemoved changesWithValues   = indexUpdatesWithValuesForSuffixOrContains(state, outerInstance.index, indexQuery, IndexOrder.NONE);

                // THEN
                outerInstance.AssertContains(changes.Added, 45L, 46L);
                outerInstance.AssertContains(changesWithValues.Added, NodeWithPropertyValues(45L, "Barbara"), NodeWithPropertyValues(46L, "Barbarella"));
            }
예제 #12
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldComputeIndexUpdatesForScanOnAnEmptyTxState()
        internal virtual void ShouldComputeIndexUpdatesForScanOnAnEmptyTxState()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.storageengine.api.txstate.ReadableTransactionState state = org.mockito.Mockito.mock(org.neo4j.storageengine.api.txstate.ReadableTransactionState.class);
            ReadableTransactionState state = Mockito.mock(typeof(ReadableTransactionState));

            // WHEN
            AddedAndRemoved           changes           = indexUpdatesForScan(state, _index, IndexOrder.NONE);
            AddedWithValuesAndRemoved changesWithValues = indexUpdatesWithValuesForScan(state, _index, IndexOrder.NONE);

            // THEN
            assertTrue(changes.Empty);
            assertTrue(changesWithValues.Empty);
        }
예제 #13
0
            internal virtual void AssertRangeSeekByContainsForOrder(IndexOrder indexOrder)
            {
                // GIVEN
                ReadableTransactionState state = (new TxStateBuilder()).WithAdded(40L, "Smashing").withAdded(41L, "Bashley").withAdded(42L, "Crasch").withAdded(43L, "Mayonnaise").withAdded(44L, "Seashell").withAdded(45L, "Ton").withAdded(46L, "The Flash").withAdded(47L, "Strayhound").withAdded(48L, "Trashy").withAdded(49L, "Andromeda").build();

                // WHEN
                IndexQuery                indexQuery        = IndexQuery.stringContains(outerInstance.index.Schema().PropertyId, stringValue("ash"));
                AddedAndRemoved           changes           = indexUpdatesForSuffixOrContains(state, outerInstance.index, indexQuery, indexOrder);
                AddedWithValuesAndRemoved changesWithValues = indexUpdatesWithValuesForSuffixOrContains(state, outerInstance.index, indexQuery, indexOrder);

                NodeWithPropertyValues[] expected = new NodeWithPropertyValues[] { NodeWithPropertyValues(41L, "Bashley"), NodeWithPropertyValues(44L, "Seashell"), NodeWithPropertyValues(40L, "Smashing"), NodeWithPropertyValues(46L, "The Flash"), NodeWithPropertyValues(48L, "Trashy") };

                // THEN
                outerInstance.AssertContains(indexOrder, changes, changesWithValues, expected);
            }
예제 #14
0
        private void AssertScanWithOrder(IndexOrder indexOrder)
        {
            // GIVEN
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.storageengine.api.txstate.ReadableTransactionState state = new TxStateBuilder().withAdded(40L, "Aaron").withAdded(41L, "Agatha").withAdded(42L, "Andreas").withAdded(43L, "Barbarella").withAdded(44L, "Andrea").withAdded(45L, "Aristotle").withAdded(46L, "Barbara").withAdded(47L, "Cinderella").build();
            ReadableTransactionState state = (new TxStateBuilder()).WithAdded(40L, "Aaron").withAdded(41L, "Agatha").withAdded(42L, "Andreas").withAdded(43L, "Barbarella").withAdded(44L, "Andrea").withAdded(45L, "Aristotle").withAdded(46L, "Barbara").withAdded(47L, "Cinderella").build();

            // WHEN
            AddedAndRemoved           changes           = indexUpdatesForScan(state, _index, indexOrder);
            AddedWithValuesAndRemoved changesWithValues = indexUpdatesWithValuesForScan(state, _index, indexOrder);

            NodeWithPropertyValues[] expectedNodesWithValues = new NodeWithPropertyValues[] { NodeWithPropertyValues(40L, "Aaron"), NodeWithPropertyValues(41L, "Agatha"), NodeWithPropertyValues(44L, "Andrea"), NodeWithPropertyValues(42L, "Andreas"), NodeWithPropertyValues(45L, "Aristotle"), NodeWithPropertyValues(46L, "Barbara"), NodeWithPropertyValues(43L, "Barbarella"), NodeWithPropertyValues(47L, "Cinderella") };

            // THEN
            AssertContains(indexOrder, changes, changesWithValues, expectedNodesWithValues);
        }
예제 #15
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldComputeIndexUpdatesForRangeSeekByContainsWhenThereAreNoMatchingNodes()
            internal virtual void ShouldComputeIndexUpdatesForRangeSeekByContainsWhenThereAreNoMatchingNodes()
            {
                // GIVEN
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.storageengine.api.txstate.ReadableTransactionState state = new TxStateBuilder().withAdded(42L, "foo").withAdded(43L, "bar").build();
                ReadableTransactionState state = (new TxStateBuilder()).WithAdded(42L, "foo").withAdded(43L, "bar").build();

                // WHEN
                IndexQuery.StringContainsPredicate indexQuery = IndexQuery.stringContains(outerInstance.index.Schema().PropertyId, stringValue("eulav"));
                AddedAndRemoved           changes             = indexUpdatesForSuffixOrContains(state, outerInstance.index, indexQuery, IndexOrder.NONE);
                AddedWithValuesAndRemoved changesWithValues   = indexUpdatesWithValuesForSuffixOrContains(state, outerInstance.index, indexQuery, IndexOrder.NONE);

                // THEN
                assertTrue(changes.Added.Empty);
                assertFalse(changesWithValues.Added.GetEnumerator().hasNext());
            }
예제 #16
0
        private void PrefixQuery(IndexDescriptor descriptor, IndexQuery.StringPrefixPredicate predicate)
        {
            TransactionState txState = _read.txState();

            if (_needsValues)
            {
                AddedWithValuesAndRemoved changes = indexUpdatesWithValuesForRangeSeekByPrefix(txState, descriptor, predicate.Prefix(), _indexOrder);
                _addedWithValues = changes.Added.GetEnumerator();
                _removed         = _removed(txState, changes.Removed);
            }
            else
            {
                AddedAndRemoved changes = indexUpdatesForRangeSeekByPrefix(txState, descriptor, predicate.Prefix(), _indexOrder);
                _added   = changes.Added.longIterator();
                _removed = _removed(txState, changes.Removed);
            }
        }
예제 #17
0
        private void SuffixOrContainsQuery(IndexDescriptor descriptor, IndexQuery query)
        {
            TransactionState txState = _read.txState();

            if (_needsValues)
            {
                AddedWithValuesAndRemoved changes = indexUpdatesWithValuesForSuffixOrContains(txState, descriptor, query, _indexOrder);
                _addedWithValues = changes.Added.GetEnumerator();
                _removed         = _removed(txState, changes.Removed);
            }
            else
            {
                AddedAndRemoved changes = indexUpdatesForSuffixOrContains(txState, descriptor, query, _indexOrder);
                _added   = changes.Added.longIterator();
                _removed = _removed(txState, changes.Removed);
            }
        }
예제 #18
0
        private void RangeQuery <T1>(IndexDescriptor descriptor, IndexQuery.RangePredicate <T1> predicate)
        {
            TransactionState txState = _read.txState();

            if (_needsValues)
            {
                AddedWithValuesAndRemoved changes = indexUpdatesWithValuesForRangeSeek(txState, descriptor, predicate, _indexOrder);
                _addedWithValues = changes.Added.GetEnumerator();
                _removed         = _removed(txState, changes.Removed);
            }
            else
            {
                AddedAndRemoved changes = indexUpdatesForRangeSeek(txState, descriptor, predicate, _indexOrder);
                _added   = changes.Added.longIterator();
                _removed = _removed(txState, changes.Removed);
            }
        }
예제 #19
0
        private void AssertContains(IndexOrder indexOrder, AddedAndRemoved changes, AddedWithValuesAndRemoved changesWithValues, NodeWithPropertyValues[] expected)
        {
            if (indexOrder == IndexOrder.DESCENDING)
            {
                ArrayUtils.reverse(expected);
            }

//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            long[] expectedNodeIds = java.util.expected.Select(NodeWithPropertyValues::getNodeId).ToArray();

            if (indexOrder == IndexOrder.NONE)
            {
                AssertContains(changes.Added, expectedNodeIds);
                AssertContains(changesWithValues.Added, expected);
            }
            else
            {
                AssertContainsInOrder(changes.Added, expectedNodeIds);
                AssertContainsInOrder(changesWithValues.Added, expected);
            }
        }