public override void AwaitIndexOnline(IndexDefinition index, long duration, TimeUnit unit) { _actions.assertInOpenTransaction(); long timeout = DateTimeHelper.CurrentUnixTimeMillis() + unit.toMillis(duration); do { Org.Neo4j.Graphdb.schema.Schema_IndexState state = GetIndexState(index); switch (state) { case Org.Neo4j.Graphdb.schema.Schema_IndexState.Online: return; case Org.Neo4j.Graphdb.schema.Schema_IndexState.Failed: string cause = GetIndexFailure(index); string message = IndexPopulationFailure.appendCauseOfFailure(string.Format("Index {0} entered a {1} state. Please see database logs.", index, state), cause); throw new System.InvalidOperationException(message); default: try { Thread.Sleep(100); } catch (InterruptedException) { // Ignore interrupted exceptions here. } break; } } while (DateTimeHelper.CurrentUnixTimeMillis() < timeout); throw new System.InvalidOperationException("Expected index to come online within a reasonable time."); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldThrowWhenPopulatingWithNonUniquePoints() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldThrowWhenPopulatingWithNonUniquePoints() { Config config = Config.defaults(stringMap(default_schema_provider.name(), _schemaIndex.providerName())); BatchInserter inserter = NewBatchInserter(config); PointValue point = Values.pointValue(CoordinateReferenceSystem.WGS84, 0.0, 0.0); inserter.createNode(MapUtil.map("prop", point), TestLabels.LABEL_ONE); inserter.createNode(MapUtil.map("prop", point), TestLabels.LABEL_ONE); inserter.CreateDeferredConstraint(TestLabels.LABEL_ONE).assertPropertyIsUnique("prop").create(); inserter.Shutdown(); GraphDatabaseService db = GraphDatabaseService(config); try { using (Transaction tx = Db.beginTx()) { IEnumerator <IndexDefinition> indexes = Db.schema().Indexes.GetEnumerator(); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertTrue(indexes.hasNext()); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: IndexDefinition index = indexes.next(); Org.Neo4j.Graphdb.schema.Schema_IndexState indexState = Db.schema().getIndexState(index); assertEquals(Org.Neo4j.Graphdb.schema.Schema_IndexState.Failed, indexState); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertFalse(indexes.hasNext()); tx.Success(); } } finally { Db.shutdown(); } }
public IndexDefinitionRepresentation(IndexDefinition indexDefinition, Org.Neo4j.Graphdb.schema.Schema_IndexState indexState, IndexPopulationProgress indexPopulationProgress) : base(RepresentationType.IndexDefinition) { this._indexDefinition = indexDefinition; this._indexPopulationProgress = indexPopulationProgress; this._indexState = indexState; }