예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void logConstraintJobProgress() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void LogConstraintJobProgress()
        {
            // Given
            CreateNode(map(_name, "irrelephant"), _first);
            AssertableLogProvider logProvider = new AssertableLogProvider();
            FlippableIndexProxy   index       = mock(typeof(FlippableIndexProxy));

            when(index.State).thenReturn(InternalIndexState.POPULATING);
            IndexPopulator populator = spy(IndexPopulator(false));

            try
            {
                IndexPopulationJob job = NewIndexPopulationJob(populator, index, _indexStoreView, logProvider, EntityType.NODE, IndexDescriptor(_first, _name, true));

                // When
                job.Run();

                // Then
                AssertableLogProvider.LogMatcherBuilder match = inLog(typeof(IndexPopulationJob));
                logProvider.AssertExactly(match.info("Index population started: [%s]", ":FIRST(name)"), match.info("Index created. Starting data checks. Index [%s] is %s.", ":FIRST(name)", "POPULATING"), match.info(containsString("TIME/PHASE Final: SCAN[")));
            }
            finally
            {
                populator.Close(true);
            }
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToCancelPopulationJob() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBeAbleToCancelPopulationJob()
        {
            // GIVEN
            CreateNode(map(_name, "Mattias"), _first);
            IndexPopulator      populator = mock(typeof(IndexPopulator));
            FlippableIndexProxy index     = mock(typeof(FlippableIndexProxy));
            IndexStoreView      storeView = mock(typeof(IndexStoreView));
            ControlledStoreScan storeScan = new ControlledStoreScan();

            when(storeView.VisitNodes(any(typeof(int[])), any(typeof(System.Func <int, bool>)), ArgumentMatchers.any(), ArgumentMatchers.any <Visitor <NodeLabelUpdate, Exception> >(), anyBoolean())).thenReturn(storeScan);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final IndexPopulationJob job = newIndexPopulationJob(populator, index, storeView, org.neo4j.logging.NullLogProvider.getInstance(), org.neo4j.storageengine.api.EntityType.NODE, indexDescriptor(FIRST, name, false));
            IndexPopulationJob job = NewIndexPopulationJob(populator, index, storeView, NullLogProvider.Instance, EntityType.NODE, IndexDescriptor(_first, _name, false));

            OtherThreadExecutor <Void> populationJobRunner = Cleanup.add(new OtherThreadExecutor <Void>("Population job test runner", null));
            Future <Void> runFuture = populationJobRunner.ExecuteDontWait(state =>
            {
                job.Run();
                return(null);
            });

            storeScan.Latch.waitForAllToStart();
            job.Cancel().get();
            storeScan.Latch.waitForAllToFinish();

            // WHEN
            runFuture.get();

            // THEN
            verify(populator, times(1)).close(false);
            verify(index, never()).flip(any(), any());
        }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void getPopulationFailureMustThrowEvenIfFailureOnOtherIndex()
        public virtual void getPopulationFailureMustThrowEvenIfFailureOnOtherIndex()
        {
            // given
            _provider = NewProvider();

            int            nonFailedIndexId   = NativeIndexProviderTests.INDEX_ID;
            IndexPopulator nonFailedPopulator = _provider.getPopulator(Descriptor(nonFailedIndexId), SamplingConfig(), heapBufferFactory(1024));

            nonFailedPopulator.Create();
            nonFailedPopulator.Close(true);

            int            failedIndexId   = 2;
            IndexPopulator failedPopulator = _provider.getPopulator(Descriptor(failedIndexId), SamplingConfig(), heapBufferFactory(1024));

            failedPopulator.Create();

            // when
            failedPopulator.MarkAsFailed("failure");
            failedPopulator.Close(false);

            // then
            try
            {
                _provider.getPopulationFailure(Descriptor(nonFailedIndexId));
                fail("Should have failed");
            }
            catch (System.InvalidOperationException e)
            {
                // good
                assertThat(e.Message, Matchers.containsString(Convert.ToString(nonFailedIndexId)));
            }
        }
예제 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPopulateIndexWithASmallDataset() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldPopulateIndexWithASmallDataset()
        {
            // GIVEN
            string value = "Mattias";
            long   node1 = CreateNode(map(_name, value), _first);

            CreateNode(map(_name, value), _second);
            CreateNode(map(_age, 31), _first);
            long                  node4      = CreateNode(map(_age, 35, _name, value), _first);
            IndexPopulator        populator  = spy(IndexPopulator(false));
            LabelSchemaDescriptor descriptor = SchemaDescriptorFactory.forLabel(0, 0);
            IndexPopulationJob    job        = NewIndexPopulationJob(populator, new FlippableIndexProxy(), EntityType.NODE, IndexDescriptorFactory.forSchema(descriptor));

            // WHEN
            job.Run();

            // THEN
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.neo4j.kernel.api.index.IndexEntryUpdate<?> update1 = add(node1, descriptor, org.neo4j.values.storable.Values.of(value));
            IndexEntryUpdate <object> update1 = add(node1, descriptor, Values.of(value));
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.neo4j.kernel.api.index.IndexEntryUpdate<?> update2 = add(node4, descriptor, org.neo4j.values.storable.Values.of(value));
            IndexEntryUpdate <object> update2 = add(node4, descriptor, Values.of(value));

            verify(populator).create();
            verify(populator).includeSample(update1);
            verify(populator).includeSample(update2);
            verify(populator, times(2)).add(anyCollection());
            verify(populator).sampleResult();
            verify(populator).close(true);
        }
예제 #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void populatorMarkedAsFailedAndUpdatesNotAdded() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void PopulatorMarkedAsFailedAndUpdatesNotAdded()
        {
            SetProperty(BATCH_SIZE_NAME, 2);

            EntityUpdates  update1   = NodeUpdates(1, PROPERTY_ID, "aaa", LABEL_ID);
            EntityUpdates  update2   = NodeUpdates(1, PROPERTY_ID, "bbb", LABEL_ID);
            EntityUpdates  update3   = NodeUpdates(1, PROPERTY_ID, "ccc", LABEL_ID);
            EntityUpdates  update4   = NodeUpdates(1, PROPERTY_ID, "ddd", LABEL_ID);
            EntityUpdates  update5   = NodeUpdates(1, PROPERTY_ID, "eee", LABEL_ID);
            IndexStoreView storeView = NewStoreView(update1, update2, update3, update4, update5);

            Exception batchFlushError = new Exception("Batch failed");

            BatchingMultipleIndexPopulator batchingPopulator = new BatchingMultipleIndexPopulator(storeView, SameThreadExecutor(), NullLogProvider.Instance, mock(typeof(SchemaState)));

            IndexPopulator populator = AddPopulator(batchingPopulator, _index1);

            doThrow(batchFlushError).when(populator).add(ForUpdates(_index1, update3, update4));

            batchingPopulator.IndexAllEntities().run();

            verify(populator).add(ForUpdates(_index1, update1, update2));
            verify(populator).add(ForUpdates(_index1, update3, update4));
            verify(populator).markAsFailed(failure(batchFlushError).asString());
            verify(populator, never()).add(ForUpdates(_index1, update5));
        }
예제 #6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void createEmptyIndex(org.neo4j.storageengine.api.schema.StoreIndexDescriptor schemaIndexDescriptor, SpatialIndexProvider provider) throws java.io.IOException
        private void CreateEmptyIndex(StoreIndexDescriptor schemaIndexDescriptor, SpatialIndexProvider provider)
        {
            IndexPopulator populator = provider.GetPopulator(schemaIndexDescriptor, SamplingConfig(), heapBufferFactory(1024));

            populator.Create();
            populator.Close(true);
        }
예제 #7
0
 internal FailedIndexProxy(CapableIndexDescriptor capableIndexDescriptor, string indexUserDescription, IndexPopulator populator, IndexPopulationFailure populationFailure, IndexCountsRemover indexCountsRemover, LogProvider logProvider) : base(capableIndexDescriptor, populationFailure)
 {
     this.Populator             = populator;
     this._indexUserDescription = indexUserDescription;
     this._indexCountsRemover   = indexCountsRemover;
     this._log = logProvider.getLog(this.GetType());
 }
예제 #8
0
        internal virtual IndexPopulation AddPopulator(IndexPopulator populator, CapableIndexDescriptor capableIndexDescriptor, FlippableIndexProxy flipper, FailedIndexProxyFactory failedIndexProxyFactory, string indexUserDescription)
        {
            IndexPopulation population = CreatePopulation(populator, capableIndexDescriptor, flipper, failedIndexProxyFactory, indexUserDescription);

            Populations.Add(population);
            return(population);
        }
예제 #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testMultiplePropertyUpdateFailures() throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException, org.neo4j.kernel.api.exceptions.index.FlipFailedKernelException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TestMultiplePropertyUpdateFailures()
        {
            NodePropertyAccessor nodePropertyAccessor = mock(typeof(NodePropertyAccessor));
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.neo4j.kernel.api.index.IndexEntryUpdate<?> update1 = add(1, index1, "foo");
            IndexEntryUpdate <object> update1 = add(1, _index1, "foo");
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.neo4j.kernel.api.index.IndexEntryUpdate<?> update2 = add(2, index1, "bar");
            IndexEntryUpdate <object> update2 = add(2, _index1, "bar");
            IndexUpdater   updater            = mock(typeof(IndexUpdater));
            IndexPopulator populator          = CreateIndexPopulator(updater);

            AddPopulator(populator, 1);

            doThrow(PopulatorException).when(updater).process(any(typeof(IndexEntryUpdate)));

            IndexUpdater multipleIndexUpdater = _multipleIndexPopulator.newPopulatingUpdater(nodePropertyAccessor);

            multipleIndexUpdater.Process(update1);
            multipleIndexUpdater.Process(update2);

            verify(updater).process(update1);
            verify(updater, never()).process(update2);
            verify(updater).close();
            CheckPopulatorFailure(populator);
        }
예제 #10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testIndexFlip()
        public virtual void TestIndexFlip()
        {
            IndexProxyFactory       indexProxyFactory       = mock(typeof(IndexProxyFactory));
            FailedIndexProxyFactory failedIndexProxyFactory = mock(typeof(FailedIndexProxyFactory));
            FlippableIndexProxy     flipper = new FlippableIndexProxy();

            flipper.FlipTarget = indexProxyFactory;

            IndexPopulator indexPopulator1 = CreateIndexPopulator();
            IndexPopulator indexPopulator2 = CreateIndexPopulator();

            AddPopulator(indexPopulator1, 1, flipper, failedIndexProxyFactory);
            AddPopulator(indexPopulator2, 2, flipper, failedIndexProxyFactory);

            when(indexPopulator1.SampleResult()).thenThrow(SampleError);

            _multipleIndexPopulator.indexAllEntities();
            _multipleIndexPopulator.flipAfterPopulation(false);

            verify(indexPopulator1).close(false);
            verify(failedIndexProxyFactory, times(1)).create(any(typeof(Exception)));

            verify(indexPopulator2).close(true);
            verify(indexPopulator2).sampleResult();
            verify(_indexStoreView).replaceIndexCounts(anyLong(), anyLong(), anyLong(), anyLong());
            verify(_schemaState).clear();
        }
예제 #11
0
        private static IndexPopulator CreateIndexPopulator()
        {
            IndexPopulator populator = mock(typeof(IndexPopulator));

            when(populator.SampleResult()).thenReturn(new IndexSample());
            return(populator);
        }
예제 #12
0
        private static IndexPopulator CreateIndexPopulator(IndexUpdater indexUpdater)
        {
            IndexPopulator indexPopulator = CreateIndexPopulator();

            when(indexPopulator.NewPopulatingUpdater(any(typeof(NodePropertyAccessor)))).thenReturn(indexUpdater);
            return(indexPopulator);
        }
예제 #13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldKeepFailedIndexesAsFailedAfterRestart() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldKeepFailedIndexesAsFailedAfterRestart()
        {
            // Given
            IndexPopulator indexPopulator = mock(typeof(IndexPopulator));

            when(_mockedIndexProvider.getPopulator(any(typeof(StoreIndexDescriptor)), any(typeof(IndexSamplingConfig)), any())).thenReturn(indexPopulator);
            IndexAccessor indexAccessor = mock(typeof(IndexAccessor));

            when(_mockedIndexProvider.getOnlineAccessor(any(typeof(StoreIndexDescriptor)), any(typeof(IndexSamplingConfig)))).thenReturn(indexAccessor);
            StartDb();
            CreateIndex(_myLabel);
            RotateLogsAndCheckPoint();

            // And Given
            KillDb();
            when(_mockedIndexProvider.getInitialState(any(typeof(StoreIndexDescriptor)))).thenReturn(InternalIndexState.FAILED);

            // When
            StartDb();

            // Then
            assertThat(getIndexes(_db, _myLabel), inTx(_db, hasSize(1)));
            assertThat(getIndexes(_db, _myLabel), inTx(_db, haveState(_db, Org.Neo4j.Graphdb.schema.Schema_IndexState.Failed)));
            verify(_mockedIndexProvider, times(2)).getPopulator(any(typeof(StoreIndexDescriptor)), any(typeof(IndexSamplingConfig)), any());
        }
예제 #14
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void populateFromQueueDoesNothingIfThresholdNotReached() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void PopulateFromQueueDoesNothingIfThresholdNotReached()
        {
            SetProperty(QUEUE_THRESHOLD_NAME, 5);

            BatchingMultipleIndexPopulator batchingPopulator = new BatchingMultipleIndexPopulator(mock(typeof(IndexStoreView)), ImmediateExecutor(), NullLogProvider.Instance, mock(typeof(SchemaState)));

            IndexPopulator populator = AddPopulator(batchingPopulator, _index1);
            IndexUpdater   updater   = mock(typeof(IndexUpdater));

            when(populator.NewPopulatingUpdater(any())).thenReturn(updater);

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.neo4j.kernel.api.index.IndexEntryUpdate<?> update1 = add(1, index1.schema(), "foo");
            IndexEntryUpdate <object> update1 = add(1, _index1.schema(), "foo");
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.neo4j.kernel.api.index.IndexEntryUpdate<?> update2 = add(2, index1.schema(), "bar");
            IndexEntryUpdate <object> update2 = add(2, _index1.schema(), "bar");

            batchingPopulator.QueueUpdate(update1);
            batchingPopulator.QueueUpdate(update2);

            batchingPopulator.PopulateFromQueueBatched(42);

            verify(updater, never()).process(any());
            verify(populator, never()).newPopulatingUpdater(any());
        }
예제 #15
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void buildReferencePopulatorSingleThreaded(Generator[] generators, java.util.Collection<org.neo4j.kernel.api.index.IndexEntryUpdate<?>> updates) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException
        private void BuildReferencePopulatorSingleThreaded <T1>(Generator[] generators, ICollection <T1> updates)
        {
            IndexPopulator referencePopulator = _indexProvider.getPopulator(_descriptor2, _samplingConfig, heapBufferFactory(1024));

            referencePopulator.Create();
            bool referenceSuccess = false;

            try
            {
                foreach (Generator generator in generators)
                {
                    generator.Reset();
                    for (int i = 0; i < BATCHES_PER_THREAD; i++)
                    {
                        referencePopulator.Add(generator.Batch());
                    }
                }
                using (IndexUpdater updater = referencePopulator.NewPopulatingUpdater(_nodePropertyAccessor))
                {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: for (org.neo4j.kernel.api.index.IndexEntryUpdate<?> update : updates)
                    foreach (IndexEntryUpdate <object> update in updates)
                    {
                        updater.Process(update);
                    }
                }
                referenceSuccess = true;
            }
            finally
            {
                referencePopulator.Close(referenceSuccess);
            }
        }
 internal FailedPopulatingIndexProxyFactory(CapableIndexDescriptor capableIndexDescriptor, IndexPopulator populator, string indexUserDescription, IndexCountsRemover indexCountsRemover, LogProvider logProvider)
 {
     this._capableIndexDescriptor = capableIndexDescriptor;
     this._populator            = populator;
     this._indexUserDescription = indexUserDescription;
     this._indexCountsRemover   = indexCountsRemover;
     this._logProvider          = logProvider;
 }
예제 #17
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup() throws java.io.IOException, org.neo4j.internal.kernel.api.exceptions.EntityNotFoundException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void Setup()
        {
            _indexProvider = ProviderCreator.apply(this);
            Rules.fileSystem().mkdirs(_indexProvider.directoryStructure().rootDirectory());
            _populator = _indexProvider.getPopulator(Descriptor, _samplingConfig, heapBufferFactory(1024));
            when(_nodePropertyAccessor.getNodePropertyValue(anyLong(), anyInt())).thenThrow(typeof(System.NotSupportedException));
            _prevAccessCheck = UnsafeUtil.exchangeNativeAccessCheckEnabled(false);
        }
예제 #18
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void before() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void Before()
        {
            IndexSamplingConfig indexSamplingConfig = new IndexSamplingConfig(Config.defaults());
            IndexPopulator      populator           = IndexProvider.getPopulator(Descriptor, indexSamplingConfig, heapBufferFactory(1024));

            populator.Create();
            populator.Close(true);
            Accessor = IndexProvider.getOnlineAccessor(Descriptor, indexSamplingConfig);
        }
예제 #19
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void cancelAndDropShouldCallDropOnPopulator() throws org.neo4j.kernel.api.exceptions.index.FlipFailedKernelException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CancelAndDropShouldCallDropOnPopulator()
        {
            IndexPopulator  populator       = CreateIndexPopulator();
            IndexPopulation indexPopulation = AddPopulator(populator, 1);

            indexPopulation.CancelAndDrop();

            verify(populator, never()).close(false);
            verify(populator).drop();
        }
예제 #20
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void canceledPopulationNotAbleToCreateNewIndex() throws org.neo4j.kernel.api.exceptions.index.FlipFailedKernelException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CanceledPopulationNotAbleToCreateNewIndex()
        {
            IndexPopulator  populator       = CreateIndexPopulator();
            IndexPopulation indexPopulation = AddPopulator(populator, 1);

            indexPopulation.Cancel();

            _multipleIndexPopulator.create();

            verify(populator, never()).create();
        }
예제 #21
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void canceledPopulationNotAbleToFlip() throws org.neo4j.kernel.api.exceptions.index.FlipFailedKernelException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CanceledPopulationNotAbleToFlip()
        {
            IndexPopulator  populator       = CreateIndexPopulator();
            IndexPopulation indexPopulation = AddPopulator(populator, 1);

            indexPopulation.Cancel();

            indexPopulation.Flip(false);

            verify(indexPopulation.Populator, never()).sampleResult();
        }
예제 #22
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void flippedPopulationAreNotCanceable() throws org.neo4j.kernel.api.exceptions.index.FlipFailedKernelException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void FlippedPopulationAreNotCanceable()
        {
            IndexPopulator  populator       = CreateIndexPopulator();
            IndexPopulation indexPopulation = AddPopulator(populator, 1);

            indexPopulation.Flip(false);

            indexPopulation.Cancel();

            verify(indexPopulation.Populator, never()).close(false);
        }
예제 #23
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testFailByNonExistingPopulation() throws org.neo4j.kernel.api.exceptions.index.FlipFailedKernelException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TestFailByNonExistingPopulation()
        {
            IndexPopulation nonExistingPopulation = mock(typeof(IndexPopulation));
            IndexPopulator  populator             = CreateIndexPopulator();

            AddPopulator(populator, 1);

            _multipleIndexPopulator.fail(nonExistingPopulation, PopulatorException);

            verify(populator, never()).markAsFailed(anyString());
        }
예제 #24
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static void updatePopulator(org.neo4j.kernel.api.index.IndexPopulator populator, Iterable<org.neo4j.kernel.api.index.IndexEntryUpdate<?>> updates, org.neo4j.storageengine.api.NodePropertyAccessor accessor) throws java.io.IOException, org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException
        private static void UpdatePopulator <T1>(IndexPopulator populator, IEnumerable <T1> updates, NodePropertyAccessor accessor)
        {
            using (IndexUpdater updater = populator.NewPopulatingUpdater(accessor))
            {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: for (org.neo4j.kernel.api.index.IndexEntryUpdate<?> update : updates)
                foreach (IndexEntryUpdate <object> update in updates)
                {
                    updater.Process(update);
                }
            }
        }
예제 #25
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.kernel.impl.api.index.MultipleIndexPopulator.IndexPopulation addPopulator(org.neo4j.kernel.api.index.IndexPopulator indexPopulator, int id) throws org.neo4j.kernel.api.exceptions.index.FlipFailedKernelException
        private IndexPopulation AddPopulator(IndexPopulator indexPopulator, int id)
        {
            FlippableIndexProxy indexProxy = mock(typeof(FlippableIndexProxy));

            when(indexProxy.State).thenReturn(InternalIndexState.ONLINE);
            doAnswer(invocation =>
            {
                Callable argument = invocation.getArgument(0);
                return(argument.call());
            }).when(indexProxy).flip(any(typeof(Callable)), any(typeof(FailedIndexProxyFactory)));
            return(AddPopulator(indexPopulator, id, indexProxy, mock(typeof(FailedIndexProxyFactory))));
        }
예제 #26
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testFailPopulator() throws org.neo4j.kernel.api.exceptions.index.FlipFailedKernelException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TestFailPopulator()
        {
            IndexPopulator indexPopulator1 = CreateIndexPopulator();
            IndexPopulator indexPopulator2 = CreateIndexPopulator();

            AddPopulator(indexPopulator1, 1);
            AddPopulator(indexPopulator2, 2);

            _multipleIndexPopulator.fail(PopulatorException);

            CheckPopulatorFailure(indexPopulator1);
            CheckPopulatorFailure(indexPopulator2);
        }
예제 #27
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testFlipAfterPopulation() throws org.neo4j.kernel.api.exceptions.index.FlipFailedKernelException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TestFlipAfterPopulation()
        {
            IndexPopulator indexPopulator1 = CreateIndexPopulator();
            IndexPopulator indexPopulator2 = CreateIndexPopulator();

            FlippableIndexProxy flipper1 = AddPopulator(indexPopulator1, 1).Flipper;
            FlippableIndexProxy flipper2 = AddPopulator(indexPopulator2, 2).Flipper;

            _multipleIndexPopulator.flipAfterPopulation(false);

            verify(flipper1).flip(any(typeof(Callable)), any(typeof(FailedIndexProxyFactory)));
            verify(flipper2).flip(any(typeof(Callable)), any(typeof(FailedIndexProxyFactory)));
        }
예제 #28
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testIndexAllNodes() throws org.neo4j.kernel.api.exceptions.index.FlipFailedKernelException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TestIndexAllNodes()
        {
            IndexPopulator indexPopulator1 = CreateIndexPopulator();
            IndexPopulator indexPopulator2 = CreateIndexPopulator();

            AddPopulator(indexPopulator1, 1);
            AddPopulator(indexPopulator2, 2);

            _multipleIndexPopulator.create();
            _multipleIndexPopulator.indexAllEntities();

            verify(_indexStoreView).visitNodes(any(typeof(int[])), any(typeof(System.Func <int, bool>)), any(typeof(Visitor)), Null, anyBoolean());
        }
예제 #29
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testMultiplePopulatorsCreation() throws org.neo4j.kernel.api.exceptions.index.FlipFailedKernelException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TestMultiplePopulatorsCreation()
        {
            IndexPopulator indexPopulator1 = CreateIndexPopulator();
            IndexPopulator indexPopulator2 = CreateIndexPopulator();

            AddPopulator(indexPopulator1, 1);
            AddPopulator(indexPopulator2, 2);

            _multipleIndexPopulator.create();

            verify(indexPopulator1).create();
            verify(indexPopulator2).create();
        }
예제 #30
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testFailByPopulation() throws org.neo4j.kernel.api.exceptions.index.FlipFailedKernelException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TestFailByPopulation()
        {
            IndexPopulator populator1 = CreateIndexPopulator();
            IndexPopulator populator2 = CreateIndexPopulator();

            AddPopulator(populator1, 1);
            IndexPopulation population2 = AddPopulator(populator2, 2);

            _multipleIndexPopulator.fail(population2, PopulatorException);

            verify(populator1, never()).markAsFailed(anyString());
            CheckPopulatorFailure(populator2);
        }