//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))); } }
//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); } }
//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); }
//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); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReportInitialStateAsOnlineIfPopulationCompletedSuccessfully() public virtual void ShouldReportInitialStateAsOnlineIfPopulationCompletedSuccessfully() { // given _provider = NewProvider(); IndexPopulator populator = _provider.getPopulator(Descriptor(), SamplingConfig(), heapBufferFactory(1024)); populator.Create(); populator.Close(true); // when InternalIndexState state = _provider.getInitialState(Descriptor()); // then assertEquals(InternalIndexState.ONLINE, state); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReportInitialStateAsPopulatingIfPopulationStartedButIncomplete() public virtual void ShouldReportInitialStateAsPopulatingIfPopulationStartedButIncomplete() { // given _provider = NewProvider(); IndexPopulator populator = _provider.getPopulator(Descriptor(), SamplingConfig(), heapBufferFactory(1024)); populator.Create(); // when InternalIndexState state = _provider.getInitialState(Descriptor()); // then assertEquals(InternalIndexState.POPULATING, state); populator.Close(true); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReportInitialStateAsFailedIfMarkedAsFailed() public virtual void ShouldReportInitialStateAsFailedIfMarkedAsFailed() { // given _provider = NewProvider(); IndexPopulator populator = _provider.getPopulator(Descriptor(), SamplingConfig(), heapBufferFactory(1024)); populator.Create(); populator.MarkAsFailed("Just some failure"); populator.Close(false); // when InternalIndexState state = _provider.getInitialState(Descriptor()); // then assertEquals(InternalIndexState.FAILED, state); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: void withPopulator(IndexPopulator populator, org.neo4j.function.ThrowingConsumer<IndexPopulator,Exception> runWithPopulator, boolean closeSuccessfully) throws Exception internal virtual void WithPopulator(IndexPopulator populator, ThrowingConsumer <IndexPopulator, Exception> runWithPopulator, bool closeSuccessfully) { try { populator.Create(); runWithPopulator.Accept(populator); if (closeSuccessfully) { populator.ScanCompleted(Org.Neo4j.Kernel.Impl.Api.index.PhaseTracker_Fields.NullInstance); TestSuite.consistencyCheck(populator); } } finally { populator.Close(closeSuccessfully); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void getPopulationFailureMustReturnReportedFailure() public virtual void getPopulationFailureMustReturnReportedFailure() { // given _provider = NewProvider(); IndexPopulator populator = _provider.getPopulator(Descriptor(), SamplingConfig(), heapBufferFactory(1024)); populator.Create(); // when string failureMessage = "fail"; populator.MarkAsFailed(failureMessage); populator.Close(false); // then string populationFailure = _provider.getPopulationFailure(Descriptor()); assertThat(populationFailure, @is(failureMessage)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void getPopulationFailureMustReturnReportedFailuresForDifferentIndexIds() public virtual void getPopulationFailureMustReturnReportedFailuresForDifferentIndexIds() { // given _provider = NewProvider(); int first = 1; int second = 2; int third = 3; IndexPopulator firstPopulator = _provider.getPopulator(Descriptor(first), SamplingConfig(), heapBufferFactory(1024)); firstPopulator.Create(); IndexPopulator secondPopulator = _provider.getPopulator(Descriptor(second), SamplingConfig(), heapBufferFactory(1024)); secondPopulator.Create(); IndexPopulator thirdPopulator = _provider.getPopulator(Descriptor(third), SamplingConfig(), heapBufferFactory(1024)); thirdPopulator.Create(); // when string firstFailure = "first failure"; firstPopulator.MarkAsFailed(firstFailure); firstPopulator.Close(false); secondPopulator.Close(true); string thirdFailure = "third failure"; thirdPopulator.MarkAsFailed(thirdFailure); thirdPopulator.Close(false); // then assertThat(_provider.getPopulationFailure(Descriptor(first)), @is(firstFailure)); assertThat(_provider.getPopulationFailure(Descriptor(third)), @is(thirdFailure)); try { _provider.getPopulationFailure(Descriptor(second)); fail("Should have failed"); } catch (System.InvalidOperationException) { // good } }
/* getPopulationFailure */ //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void getPopulationFailureMustThrowIfNoFailure() public virtual void getPopulationFailureMustThrowIfNoFailure() { // given _provider = NewProvider(); IndexPopulator populator = _provider.getPopulator(Descriptor(), SamplingConfig(), heapBufferFactory(1024)); populator.Create(); populator.Close(true); // when // ... no failure on populator // then try { _provider.getPopulationFailure(Descriptor()); fail("Should have failed"); } catch (System.InvalidOperationException e) { // good assertThat(e.Message, Matchers.containsString(Convert.ToString(INDEX_ID))); } }