//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCheckAllCollisionsFromPopulatorAdd() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldCheckAllCollisionsFromPopulatorAdd() { // given _populator = NewPopulator(); int iterations = 228; // This value has to be high enough to stress the EntrySet implementation IndexUpdater updater = _populator.newPopulatingUpdater(_nodePropertyAccessor); for (int nodeId = 0; nodeId < iterations; nodeId++) { updater.Process(add(nodeId, _schemaDescriptor, 1)); when(_nodePropertyAccessor.getNodePropertyValue(nodeId, PROPERTY_KEY_ID)).thenReturn(Values.of(nodeId)); } // ... and the actual conflicting property: updater.Process(add(iterations, _schemaDescriptor, 1)); when(_nodePropertyAccessor.getNodePropertyValue(iterations, PROPERTY_KEY_ID)).thenReturn(Values.of(1)); // This collision is real!!! // when try { updater.Close(); fail("should have thrown exception"); } // then catch (IndexEntryConflictException conflict) { assertEquals(1, conflict.ExistingNodeId); assertEquals(Values.of(1), conflict.SinglePropertyValue); assertEquals(iterations, conflict.AddedNodeId); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldRejectDuplicateEntryAfterUsingPopulatingUpdater() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldRejectDuplicateEntryAfterUsingPopulatingUpdater() { // given _populator = NewPopulator(); string valueString = "value1"; IndexUpdater updater = _populator.newPopulatingUpdater(_nodePropertyAccessor); updater.Process(add(1, _schemaDescriptor, valueString)); AddUpdate(_populator, 2, valueString); Value value = Values.of(valueString); when(_nodePropertyAccessor.getNodePropertyValue(1, PROPERTY_KEY_ID)).thenReturn(value); when(_nodePropertyAccessor.getNodePropertyValue(2, PROPERTY_KEY_ID)).thenReturn(value); // when try { _populator.verifyDeferredConstraints(_nodePropertyAccessor); fail("should have thrown exception"); } // then catch (IndexEntryConflictException conflict) { assertEquals(1, conflict.ExistingNodeId); assertEquals(value, conflict.SinglePropertyValue); assertEquals(2, conflict.AddedNodeId); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldRejectDuplicateEntryWhenUsingPopulatingUpdater() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldRejectDuplicateEntryWhenUsingPopulatingUpdater() { // given _populator = NewPopulator(); AddUpdate(_populator, 1, "value1"); AddUpdate(_populator, 2, "value2"); Value value = Values.of("value1"); when(_nodePropertyAccessor.getNodePropertyValue(1, PROPERTY_KEY_ID)).thenReturn(value); when(_nodePropertyAccessor.getNodePropertyValue(3, PROPERTY_KEY_ID)).thenReturn(value); // when try { IndexUpdater updater = _populator.newPopulatingUpdater(_nodePropertyAccessor); updater.Process(add(3, _schemaDescriptor, "value1")); updater.Close(); fail("should have thrown exception"); } // then catch (IndexEntryConflictException conflict) { assertEquals(1, conflict.ExistingNodeId); assertEquals(value, conflict.SinglePropertyValue); assertEquals(3, conflict.AddedNodeId); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private int interleaveLargeAmountOfUpdates(java.util.Random updaterRandom, java.util.Iterator<org.neo4j.kernel.api.index.IndexEntryUpdate<org.neo4j.storageengine.api.schema.IndexDescriptor>> updates) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException private int InterleaveLargeAmountOfUpdates(Random updaterRandom, IEnumerator <IndexEntryUpdate <IndexDescriptor> > updates) { int count = 0; for (int i = 0; i < LARGE_AMOUNT_OF_UPDATES; i++) { if (updaterRandom.nextFloat() < 0.1) { using (IndexUpdater indexUpdater = Populator.newPopulatingUpdater(NullPropertyAccessor)) { int numberOfUpdaterUpdates = updaterRandom.Next(100); for (int j = 0; j < numberOfUpdaterUpdates; j++) { //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: indexUpdater.Process(updates.next()); count++; } } } //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: Populator.add(Collections.singletonList(updates.next())); count++; } return(count); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void mustDiscoverRelationshipInStoreMissingFromIndex() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void MustDiscoverRelationshipInStoreMissingFromIndex() { GraphDatabaseService db = CreateDatabase(); using (Transaction tx = Db.beginTx()) { Db.execute(format(RELATIONSHIP_CREATE, "rels", array("REL"), array("prop"))).close(); tx.Success(); } StoreIndexDescriptor indexDescriptor; long relId; using (Transaction tx = Db.beginTx()) { Db.schema().awaitIndexesOnline(1, TimeUnit.MINUTES); indexDescriptor = GetIndexDescriptor(first(Db.schema().Indexes)); Node node = Db.createNode(); Relationship rel = node.CreateRelationshipTo(node, RelationshipType.withName("REL")); rel.SetProperty("prop", "value"); relId = rel.Id; tx.Success(); } IndexingService indexes = GetIndexingService(db); IndexProxy indexProxy = indexes.GetIndexProxy(indexDescriptor.Schema()); using (IndexUpdater updater = indexProxy.NewUpdater(IndexUpdateMode.ONLINE)) { updater.Process(IndexEntryUpdate.remove(relId, indexDescriptor, Values.stringValue("value"))); } Db.shutdown(); ConsistencyCheckService.Result result = CheckConsistency(); assertFalse(result.Successful); }
public override void Process <T1>(IndexEntryUpdate <T1> update) { Pair <IndexPopulation, IndexUpdater> pair = PopulationsWithUpdaters[update.IndexKey().schema()]; if (pair != null) { IndexPopulation population = pair.First(); IndexUpdater updater = pair.Other(); try { population.Populator.includeSample(update); updater.Process(update); } catch (Exception t) { try { updater.Close(); } catch (Exception ce) { Log.error(format("Failed to close index updater: [%s]", updater), ce); } PopulationsWithUpdaters.Remove(update.IndexKey().schema()); MultipleIndexPopulator.fail(population, t); } } }
//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()); }
//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); } }
public virtual void EnqueueUpdate <T1, T2>(DatabaseIndex <T1> index, IndexUpdater indexUpdater, IndexEntryUpdate <T2> update) where T1 : Org.Neo4j.Storageengine.Api.schema.IndexReader { _updateQueueLimit.acquireUninterruptibly(); ThreadStart eventualUpdate = () => { try { indexUpdater.Process(update); } catch (IndexEntryConflictException e) { MarkAsFailed(index, e); } finally { _updateQueueLimit.release(); } }; try { _scheduler.schedule(Group.INDEX_UPDATING, eventualUpdate); } catch (Exception e) { _updateQueueLimit.release(); // Avoid leaking permits if job scheduling fails. throw e; } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldPopulateAndUpdate() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldPopulateAndUpdate() { // GIVEN WithPopulator(IndexProvider.getPopulator(Descriptor, IndexSamplingConfig, heapBufferFactory(1024)), p => p.add(Updates(ValueSet1))); using (IndexAccessor accessor = IndexProvider.getOnlineAccessor(Descriptor, IndexSamplingConfig)) { // WHEN using (IndexUpdater updater = accessor.NewUpdater(IndexUpdateMode.ONLINE)) { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.List<IndexEntryUpdate<?>> updates = updates(valueSet2); IList <IndexEntryUpdate <object> > updates = updates(ValueSet2); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: for (IndexEntryUpdate<?> update : updates) foreach (IndexEntryUpdate <object> update in updates) { updater.Process(update); } } // THEN using (IndexReader reader = new QueryResultComparingIndexReader(accessor.NewReader())) { int propertyKeyId = Descriptor.schema().PropertyId; foreach (NodeAndValue entry in Iterables.concat(ValueSet1, ValueSet2)) { NodeValueIterator nodes = new NodeValueIterator(); reader.Query(nodes, IndexOrder.NONE, false, IndexQuery.exact(propertyKeyId, entry.Value)); assertEquals(entry.NodeId, nodes.Next()); assertFalse(nodes.HasNext()); } } } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void updaterShouldThrowOnDuplicateValues() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void UpdaterShouldThrowOnDuplicateValues() { // given outerInstance.populator.create(); IndexEntryUpdate <IndexDescriptor>[] updates = valueCreatorUtil.someUpdatesWithDuplicateValues(random); IndexUpdater updater = outerInstance.populator.newPopulatingUpdater(NullPropertyAccessor); // when foreach (IndexEntryUpdate <IndexDescriptor> update in updates) { updater.Process(update); } try { updater.Close(); outerInstance.populator.scanCompleted(nullInstance); fail("Updates should have conflicted"); } catch (Exception e) { // then assertTrue(e.Message, Exceptions.contains(e, typeof(IndexEntryConflictException))); } finally { outerInstance.populator.close(true); } }
//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); }
/// <summary> /// Commit these updates to the index. Also store the values, which currently are stored for all types except geometry, /// so therefore it's done explicitly here so that we can filter on them later. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: void updateAndCommit(java.util.Collection<IndexEntryUpdate<?>> updates) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException internal virtual void UpdateAndCommit <T1>(ICollection <T1> updates) { using (IndexUpdater updater = Accessor.newUpdater(IndexUpdateMode.ONLINE)) { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: for (IndexEntryUpdate<?> update : updates) foreach (IndexEntryUpdate <object> update in updates) { updater.Process(update); switch (update.UpdateMode()) { case ADDED: case CHANGED: _committedValues[update.EntityId] = update.Values(); break; case REMOVED: _committedValues.Remove(update.EntityId); break; default: throw new System.ArgumentException("Unknown update mode of " + update); } } } }
private static IndexPopulator CreateIndexPopulator(IndexUpdater indexUpdater) { IndexPopulator indexPopulator = CreateIndexPopulator(); when(indexPopulator.NewPopulatingUpdater(any(typeof(NodePropertyAccessor)))).thenReturn(indexUpdater); return(indexPopulator); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldApplyUpdatesIdempotently() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldApplyUpdatesIdempotently() { // GIVEN IndexSamplingConfig indexSamplingConfig = new IndexSamplingConfig(Config.defaults()); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.values.storable.Value propertyValue = org.neo4j.values.storable.Values.of("value1"); Value propertyValue = Values.of("value1"); WithPopulator(IndexProvider.getPopulator(Descriptor, indexSamplingConfig, heapBufferFactory(1024)), p => { long nodeId = 1; // update using populator... IndexEntryUpdate <SchemaDescriptor> update = add(nodeId, Descriptor.schema(), propertyValue); p.add(singletonList(update)); // ...is the same as update using updater using (IndexUpdater updater = p.newPopulatingUpdater((node, propertyId) => propertyValue)) { updater.Process(update); } }); // THEN using (IndexAccessor accessor = IndexProvider.getOnlineAccessor(Descriptor, indexSamplingConfig)) { using (IndexReader reader = new QueryResultComparingIndexReader(accessor.NewReader())) { int propertyKeyId = Descriptor.schema().PropertyId; LongIterator nodes = reader.Query(IndexQuery.exact(propertyKeyId, propertyValue)); assertEquals(asSet(1L), PrimitiveLongCollections.toSet(nodes)); } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void externalUpdate(BlockBasedIndexPopulator<GenericKey,NativeIndexValue> populator, org.neo4j.values.storable.TextValue matata, int matataId) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException private void ExternalUpdate(BlockBasedIndexPopulator <GenericKey, NativeIndexValue> populator, TextValue matata, int matataId) { using (IndexUpdater indexUpdater = populator.NewPopulatingUpdater()) { // After scanCompleted indexUpdater.Process(add(matataId, _indexDescriptor, matata)); } }
//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(); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void generateUpdates(LuceneIndexAccessor indexAccessor, int nodesToUpdate) throws java.io.IOException, org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException private void GenerateUpdates(LuceneIndexAccessor indexAccessor, int nodesToUpdate) { using (IndexUpdater updater = indexAccessor.NewUpdater(IndexUpdateMode.ONLINE)) { for (int nodeId = 0; nodeId < nodesToUpdate; nodeId++) { updater.Process(Add(nodeId, nodeId)); } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void verifyChangeWithCorrectUpdaterNotMixed(org.neo4j.kernel.api.index.IndexUpdater updater, org.neo4j.values.storable.Value[] supportedValues) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException, java.io.IOException private void VerifyChangeWithCorrectUpdaterNotMixed(IndexUpdater updater, Value[] supportedValues) { foreach (Value before in supportedValues) { foreach (Value after in supportedValues) { VerifyChangeWithCorrectUpdaterNotMixed(updater, before, after); } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void externalUpdates(BlockBasedIndexPopulator<GenericKey,NativeIndexValue> populator, int firstId, int lastId) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException private void ExternalUpdates(BlockBasedIndexPopulator <GenericKey, NativeIndexValue> populator, int firstId, int lastId) { using (IndexUpdater updater = populator.NewPopulatingUpdater()) { for (int i = firstId; i < lastId; i++) { updater.Process(Add(i)); } } }
public override MultipleIndexUpdater NewPopulatingUpdater(NodePropertyAccessor accessor) { IDictionary <SchemaDescriptor, Pair <IndexPopulation, IndexUpdater> > updaters = new Dictionary <SchemaDescriptor, Pair <IndexPopulation, IndexUpdater> >(); ForEachPopulation(population => { IndexUpdater updater = population.populator.newPopulatingUpdater(accessor); updaters[population.schema()] = Pair.of(population, updater); }); return(new MultipleIndexUpdater(this, updaters, _logProvider)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldInstantiateUpdatersLazily() public virtual void ShouldInstantiateUpdatersLazily() { // when getting a new reader, no part-reader should be instantiated IndexUpdater updater = _fusionIndexAccessor.newUpdater(IndexUpdateMode.ONLINE); for (int j = 0; j < _aliveAccessors.Length; j++) { // then verifyNoMoreInteractions(_aliveAccessors[j]); } }
//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); } } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(expected = IllegalStateException.class) public void shouldNotUpdateBeforeCreate() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotUpdateBeforeCreate() { // GIVEN IndexProxy inner = mockIndexProxy(); IndexProxy outer = NewContractCheckingIndexProxy(inner); // WHEN using (IndexUpdater updater = outer.NewUpdater(IndexUpdateMode.Online)) { updater.Process(null); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void updateAndCommit(org.neo4j.kernel.api.index.IndexAccessor accessor, Iterable<org.neo4j.kernel.api.index.IndexEntryUpdate<?>> updates) throws java.io.IOException, org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException private void UpdateAndCommit <T1>(IndexAccessor accessor, IEnumerable <T1> updates) { using (IndexUpdater updater = accessor.NewUpdater(IndexUpdateMode.ONLINE)) { //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); } } }
//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); } } }
//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); } } }
public virtual void CloseUpdater <T1>(DatabaseIndex <T1> index, IndexUpdater indexUpdater) where T1 : Org.Neo4j.Storageengine.Api.schema.IndexReader { _scheduler.schedule(Group.INDEX_UPDATING, () => { try { indexUpdater.Close(); } catch (IndexEntryConflictException e) { MarkAsFailed(index, e); } }); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(expected = IllegalStateException.class) public void shouldNotUpdateAfterClose() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotUpdateAfterClose() { // GIVEN IndexProxy inner = mockIndexProxy(); IndexProxy outer = NewContractCheckingIndexProxy(inner); // WHEN outer.Start(); outer.Close(); using (IndexUpdater updater = outer.NewUpdater(IndexUpdateMode.Online)) { updater.Process(null); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void addUpdates(SpatialIndexProvider provider, org.neo4j.storageengine.api.schema.StoreIndexDescriptor schemaIndexDescriptor, ValueCreatorUtil<SpatialIndexKey,NativeIndexValue> layoutUtil) throws java.io.IOException, org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException private void AddUpdates(SpatialIndexProvider provider, StoreIndexDescriptor schemaIndexDescriptor, ValueCreatorUtil <SpatialIndexKey, NativeIndexValue> layoutUtil) { IndexAccessor accessor = provider.GetOnlineAccessor(schemaIndexDescriptor, SamplingConfig()); using (IndexUpdater updater = accessor.NewUpdater(ONLINE)) { // when foreach (IndexEntryUpdate <IndexDescriptor> update in layoutUtil.SomeUpdates(_randomRule)) { updater.Process(update); } } accessor.Force(Org.Neo4j.Io.pagecache.IOLimiter_Fields.Unlimited); accessor.Dispose(); }
private static void Main(string[] args) { _logger = LogManager.GetCurrentClassLogger(); _logger.Log(LogLevel.Info, "Версия: {0}", Assembly.GetEntryAssembly().GetName().Version); try { IndexUpdater indexUpdater = new IndexUpdater(); indexUpdater.DeleteIndexForDroppingColumns(typeof(BloggingContext)); using (BloggingContext context = new BloggingContext()) { if (context.Database.CompatibleWithModel(false)) _logger.Log(LogLevel.Info, "База данных успешно обновлена"); else _logger.Log(LogLevel.Error, "Ошибка обновления базы данных: модель данных не соответствует базе данных"); indexUpdater.UpdateIndexes(context); } var dbMigrator = new DbMigrator(new MigrationsConfiguration()); var databaseMigrations = dbMigrator.GetDatabaseMigrations().Reverse().ToList(); if (databaseMigrations.Any()) { _logger.Log(LogLevel.Info, "Миграции в базе данных:"); foreach (var databaseMigration in databaseMigrations) { _logger.Log(LogLevel.Info, databaseMigration); } } } catch (Exception ex) { _logger.Log(LogLevel.Fatal, ex); } Console.ReadLine(); }