//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldTimeoutWaitingForAllIndexesToComeOnline()
        public void shouldTimeoutWaitingForAllIndexesToComeOnline()
        {
            // given
            GraphDatabaseService db    = rule.GraphDatabaseAPI;
            DoubleLatch          latch = _provider.installPopulationJobCompletionLatch();

            using (Transaction tx = Db.beginTx())
            {
                Db.schema().indexFor(Label.label("Person")).on("name").create();
                tx.Success();
            }

            latch.WaitForAllToStart();

            // when
            try
            {
                using (Transaction tx = Db.beginTx())
                {
                    // then
                    Db.schema().awaitIndexesOnline(1, TimeUnit.MILLISECONDS);

                    fail("Expected IllegalStateException to be thrown");
                }
            }
            catch (System.InvalidOperationException e)
            {
                // good
                assertThat(e.Message, containsString("come online"));
            }
            finally
            {
                latch.Finish();
            }
        }
Esempio n. 2
0
        public virtual DoubleLatch InstallPopulationJobCompletionLatch()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.test.DoubleLatch populationCompletionLatch = new org.neo4j.test.DoubleLatch();
            DoubleLatch populationCompletionLatch = new DoubleLatch();

            _mockedPopulator = new IndexPopulator_AdapterAnonymousInnerClass(this, populationCompletionLatch);
            return(populationCompletionLatch);
        }
Esempio n. 3
0
 private void DropIndex(IndexDefinition index, DoubleLatch populationCompletionLatch)
 {
     using (Transaction tx = _db.beginTx())
     {
         index.Drop();
         populationCompletionLatch.Finish();
         tx.Success();
     }
 }
Esempio n. 4
0
        /* This is somewhat difficult to test since dropping an index while it's populating forces it to be cancelled
         * first (and also awaiting cancellation to complete). So this is a best-effort to have the timing as close
         * as possible. If this proves to be flaky, remove it right away.
         */
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToDropIndexWhileItIsPopulating()
        public virtual void ShouldBeAbleToDropIndexWhileItIsPopulating()
        {
            // GIVEN
            StartDb();
            DoubleLatch     populationCompletionLatch = _provider.installPopulationJobCompletionLatch();
            IndexDefinition index = CreateIndex();

            populationCompletionLatch.WaitForAllToStart();               // await population job to start

            // WHEN
            DropIndex(index, populationCompletionLatch);

            // THEN
            assertThat(getIndexes(_db, _myLabel), inTx(_db, hasSize(0)));
            try
            {
                getIndexState(_db, index);
                fail("This index should have been deleted");
            }
            catch (NotFoundException e)
            {
                assertThat(e.Message, CoreMatchers.containsString(_myLabel.name()));
            }
        }
Esempio n. 5
0
 public IndexPopulator_AdapterAnonymousInnerClass(ControlledPopulationIndexProvider outerInstance, DoubleLatch populationCompletionLatch)
 {
     this.outerInstance = outerInstance;
     this._populationCompletionLatch = populationCompletionLatch;
 }