Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldInstantiatePartLazilyForSpecificValueGroupQuery() throws org.neo4j.internal.kernel.api.exceptions.schema.IndexNotApplicableKernelException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldInstantiatePartLazilyForSpecificValueGroupQuery()
        {
            // given
            Dictionary <IndexSlot, Value[]> values = FusionIndexTestHelp.ValuesByGroup();

            foreach (IndexSlot i in Enum.GetValues(typeof(IndexSlot)))
            {
                if (_readers[i] != IndexReader.EMPTY)
                {
                    // when
                    Value value = values[i][0];
                    _fusionIndexReader.query(IndexQuery.exact(0, value));
                    foreach (IndexSlot j in Enum.GetValues(typeof(IndexSlot)))
                    {
                        // then
                        if (_readers[j] != IndexReader.EMPTY)
                        {
                            if (i == j)
                            {
                                verify(_readers[i]).query(any(typeof(IndexQuery)));
                            }
                            else
                            {
                                verifyNoMoreInteractions(_readers[j]);
                            }
                        }
                    }
                }

                InitiateMocks();
            }
        }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustSelectCorrectTargetForAllGivenValueCombinations()
        public virtual void MustSelectCorrectTargetForAllGivenValueCombinations()
        {
            // given
            Dictionary <IndexSlot, Value[]> values = FusionIndexTestHelp.ValuesByGroup();

            Value[] allValues = FusionIndexTestHelp.AllValues();

            foreach (IndexSlot slot in Enum.GetValues(typeof(IndexSlot)))
            {
                Value[] group = values[slot];
                foreach (Value value in group)
                {
                    // when
                    IndexProvider selected = _instanceSelector.select(_slotSelector.selectSlot(array(value), GROUP_OF));

                    // then
                    assertSame(OrLucene(_providers[slot]), selected);
                }
            }

            // All composite values should go to lucene
            foreach (Value firstValue in allValues)
            {
                foreach (Value secondValue in allValues)
                {
                    // when
                    IndexProvider selected = _instanceSelector.select(_slotSelector.selectSlot(array(firstValue, secondValue), GROUP_OF));

                    // then
                    assertSame(_providers[LUCENE], selected);
                }
            }
        }
Example #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void processMustSelectCorrectForRemove() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ProcessMustSelectCorrectForRemove()
        {
            // given
            Dictionary <IndexSlot, Value[]> values = FusionIndexTestHelp.ValuesByGroup();

            Value[] allValues = FusionIndexTestHelp.AllValues();

            foreach (IndexSlot slot in Enum.GetValues(typeof(IndexSlot)))
            {
                foreach (Value value in values[slot])
                {
                    // then
                    VerifyRemoveWithCorrectUpdater(OrLucene(_updaters[slot]), value);
                }
            }

            // when value is composite
            foreach (Value firstValue in allValues)
            {
                foreach (Value secondValue in allValues)
                {
                    VerifyRemoveWithCorrectUpdater(_updaters[LUCENE], firstValue, secondValue);
                }
            }
        }
Example #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldInstantiatePartLazilyForSpecificValueGroupUpdates() throws java.io.IOException, org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldInstantiatePartLazilyForSpecificValueGroupUpdates()
        {
            // given
            Dictionary <IndexSlot, Value[]> values = FusionIndexTestHelp.ValuesByGroup();

            foreach (IndexSlot i in Enum.GetValues(typeof(IndexSlot)))
            {
                if (_updaters[i] != SwallowingIndexUpdater.INSTANCE)
                {
                    // when
                    Value value = values[i][0];
                    _fusionIndexUpdater.process(add(value));
                    foreach (IndexSlot j in Enum.GetValues(typeof(IndexSlot)))
                    {
                        // then
                        if (_updaters[j] != SwallowingIndexUpdater.INSTANCE)
                        {
                            if (i == j)
                            {
                                verify(_updaters[i]).process(any(typeof(IndexEntryUpdate)));
                            }
                            else
                            {
                                verifyNoMoreInteractions(_updaters[j]);
                            }
                        }
                    }
                }

                InitiateMocks();
            }
        }
Example #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void closeMustThrowIfAnyThrow() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CloseMustThrowIfAnyThrow()
        {
            foreach (IndexSlot indexSlot in FusionVersion.aliveSlots())
            {
                FusionIndexTestHelp.VerifyFusionCloseThrowOnSingleCloseThrow(_updaters[indexSlot], _fusionIndexUpdater);
                InitiateMocks();
            }
        }
Example #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void closeMustCloseOthersIfAnyThrow() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CloseMustCloseOthersIfAnyThrow()
        {
            foreach (IndexSlot indexSlot in FusionVersion.aliveSlots())
            {
                IndexUpdater failingUpdater = _updaters[indexSlot];
                FusionIndexTestHelp.VerifyOtherIsClosedOnSingleThrow(failingUpdater, _fusionIndexUpdater, without(_aliveUpdaters, failingUpdater));
                InitiateMocks();
            }
        }
Example #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldIncludeSampleOnCorrectPopulator()
        public virtual void ShouldIncludeSampleOnCorrectPopulator()
        {
            // given
            Dictionary <IndexSlot, Value[]> values = FusionIndexTestHelp.ValuesByGroup();

            foreach (IndexSlot activeSlot in FusionVersion.aliveSlots())
            {
                VerifySampleToCorrectPopulator(values[activeSlot], _populators[activeSlot]);
            }
        }
Example #8
0
        internal static Dictionary <IndexSlot, Value[]> ValuesByGroup()
        {
            Dictionary <IndexSlot, Value[]> values = new Dictionary <IndexSlot, Value[]>(typeof(IndexSlot));

            values[STRING]   = FusionIndexTestHelp.ValuesSupportedByString();
            values[NUMBER]   = FusionIndexTestHelp.ValuesSupportedByNumber();
            values[SPATIAL]  = FusionIndexTestHelp.ValuesSupportedBySpatial();
            values[TEMPORAL] = FusionIndexTestHelp.ValuesSupportedByTemporal();
            values[LUCENE]   = FusionIndexTestHelp.ValuesNotSupportedBySpecificIndex();
            return(values);
        }
Example #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustSelectLuceneForExactPredicateWithOtherValue() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MustSelectLuceneForExactPredicateWithOtherValue()
        {
            // given
            foreach (object value in FusionIndexTestHelp.ValuesNotSupportedBySpecificIndex())
            {
                IndexQuery indexQuery = IndexQuery.exact(PROP_KEY, value);

                // then
                VerifyQueryWithCorrectReader(_readers[LUCENE], indexQuery);
            }
        }
Example #10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustSelectNumberForExactPredicateWithNumberValue() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MustSelectNumberForExactPredicateWithNumberValue()
        {
            // given
            foreach (object value in FusionIndexTestHelp.ValuesSupportedByNumber())
            {
                IndexQuery indexQuery = IndexQuery.exact(PROP_KEY, value);

                // then
                VerifyQueryWithCorrectReader(ExpectedForNumbers(), indexQuery);
            }
        }
Example #11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustSelectTemporalForExactPredicateWithTemporalValue() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MustSelectTemporalForExactPredicateWithTemporalValue()
        {
            // given
            assumeTrue(HasTemporalSupport());
            foreach (object temporalValue in FusionIndexTestHelp.ValuesSupportedByTemporal())
            {
                IndexQuery indexQuery = IndexQuery.exact(PROP_KEY, temporalValue);

                // then
                VerifyQueryWithCorrectReader(_readers[TEMPORAL], indexQuery);
            }
        }
Example #12
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustSelectSpatialForExactPredicateWithSpatialValue() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MustSelectSpatialForExactPredicateWithSpatialValue()
        {
            // given
            assumeTrue(HasSpatialSupport());
            foreach (object value in FusionIndexTestHelp.ValuesSupportedBySpatial())
            {
                IndexQuery indexQuery = IndexQuery.exact(PROP_KEY, value);

                // then
                VerifyQueryWithCorrectReader(_readers[SPATIAL], indexQuery);
            }
        }
Example #13
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void verifyRemoveWithCorrectUpdater(org.neo4j.kernel.api.index.IndexUpdater correctPopulator, org.neo4j.values.storable.Value... numberValues) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException, java.io.IOException
        private void VerifyRemoveWithCorrectUpdater(IndexUpdater correctPopulator, params Value[] numberValues)
        {
            IndexEntryUpdate <LabelSchemaDescriptor> update = FusionIndexTestHelp.Remove(numberValues);

            _fusionIndexUpdater.process(update);
            verify(correctPopulator, times(1)).process(update);
            foreach (IndexUpdater populator in _aliveUpdaters)
            {
                if (populator != correctPopulator)
                {
                    verify(populator, never()).process(update);
                }
            }
        }
Example #14
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void verifyChangeWithCorrectUpdaterNotMixed(org.neo4j.kernel.api.index.IndexUpdater correctPopulator, org.neo4j.values.storable.Value before, org.neo4j.values.storable.Value after) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException, java.io.IOException
        private void VerifyChangeWithCorrectUpdaterNotMixed(IndexUpdater correctPopulator, Value before, Value after)
        {
            IndexEntryUpdate <LabelSchemaDescriptor> update = FusionIndexTestHelp.Change(before, after);

            _fusionIndexUpdater.process(update);
            verify(correctPopulator, times(1)).process(update);
            foreach (IndexUpdater populator in _aliveUpdaters)
            {
                if (populator != correctPopulator)
                {
                    verify(populator, never()).process(update);
                }
            }
        }
Example #15
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void processMustSelectCorrectForChange() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ProcessMustSelectCorrectForChange()
        {
            // given
            Dictionary <IndexSlot, Value[]> values = FusionIndexTestHelp.ValuesByGroup();

            // when
            foreach (IndexSlot slot in Enum.GetValues(typeof(IndexSlot)))
            {
                foreach (Value before in values[slot])
                {
                    foreach (Value after in values[slot])
                    {
                        VerifyChangeWithCorrectUpdaterNotMixed(OrLucene(_updaters[slot]), before, after);
                    }
                }
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void allEntriesReaderMustThrowIfOneThrow() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void AllEntriesReaderMustThrowIfOneThrow()
        {
            foreach (IndexAccessor failingAccessor in _aliveAccessors)
            {
                BoundedIterable <long> failingReader = null;
                foreach (IndexAccessor aliveAccessor in _aliveAccessors)
                {
                    BoundedIterable <long> reader = MockSingleAllEntriesReader(aliveAccessor, Collections.emptyList());
                    if (aliveAccessor == failingAccessor)
                    {
                        failingReader = reader;
                    }
                }

                // then
                BoundedIterable <long> fusionAllEntriesReader = _fusionIndexAccessor.newAllEntriesReader();
                FusionIndexTestHelp.VerifyFusionCloseThrowOnSingleCloseThrow(failingReader, fusionAllEntriesReader);
            }
        }
Example #17
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void processMustSelectCorrectForChangeFromOneGroupToAnother() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ProcessMustSelectCorrectForChangeFromOneGroupToAnother()
        {
            Dictionary <IndexSlot, Value[]> values = FusionIndexTestHelp.ValuesByGroup();

            foreach (IndexSlot from in Enum.GetValues(typeof(IndexSlot)))
            {
                // given
                foreach (IndexSlot to in Enum.GetValues(typeof(IndexSlot)))
                {
                    if (from != to)
                    {
                        // when
                        VerifyChangeWithCorrectUpdaterMixed(OrLucene(_updaters[from]), OrLucene(_updaters[to]), values[from], values[to]);
                    }
                    else
                    {
                        VerifyChangeWithCorrectUpdaterNotMixed(OrLucene(_updaters[from]), values[from]);
                    }
                    ResetMocks();
                }
            }
        }
Example #18
0
        /* add */

//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void addMustSelectCorrectPopulator() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void AddMustSelectCorrectPopulator()
        {
            // given
            Dictionary <IndexSlot, Value[]> values = FusionIndexTestHelp.ValuesByGroup();

            Value[] allValues = FusionIndexTestHelp.AllValues();

            foreach (IndexSlot slot in Enum.GetValues(typeof(IndexSlot)))
            {
                foreach (Value value in values[slot])
                {
                    VerifyAddWithCorrectPopulator(OrLucene(_populators[slot]), value);
                }
            }

            // All composite values should go to lucene
            foreach (Value firstValue in allValues)
            {
                foreach (Value secondValue in allValues)
                {
                    VerifyAddWithCorrectPopulator(_populators[LUCENE], firstValue, secondValue);
                }
            }
        }
Example #19
0
        /* countIndexedNodes */

//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void countIndexedNodesMustSelectCorrectReader()
        public virtual void CountIndexedNodesMustSelectCorrectReader()
        {
            // given
            Dictionary <IndexSlot, Value[]> values = FusionIndexTestHelp.ValuesByGroup();

            Value[] allValues = FusionIndexTestHelp.AllValues();

            foreach (IndexSlot slot in Enum.GetValues(typeof(IndexSlot)))
            {
                foreach (Value value in values[slot])
                {
                    VerifyCountIndexedNodesWithCorrectReader(OrLucene(_readers[slot]), value);
                }
            }

            // When passing composite keys, they are only handled by lucene
            foreach (Value firstValue in allValues)
            {
                foreach (Value secondValue in allValues)
                {
                    VerifyCountIndexedNodesWithCorrectReader(_readers[LUCENE], firstValue, secondValue);
                }
            }
        }
Example #20
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void closeMustThrowIfAllThrow() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CloseMustThrowIfAllThrow()
        {
            FusionIndexTestHelp.VerifyFusionCloseThrowIfAllThrow(_fusionIndexUpdater, _aliveUpdaters);
        }