Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void failForceIndexesWhenOneOfTheIndexesIsBroken() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void FailForceIndexesWhenOneOfTheIndexesIsBroken()
        {
            string constraintLabelPrefix    = "ConstraintLabel";
            string constraintPropertyPrefix = "ConstraintProperty";
            string indexLabelPrefix         = "Label";
            string indexPropertyPrefix      = "Property";

            for (int i = 0; i < 10; i++)
            {
                using (Transaction transaction = _database.beginTx())
                {
                    _database.schema().constraintFor(Label.label(constraintLabelPrefix + i)).assertPropertyIsUnique(constraintPropertyPrefix + i).create();
                    _database.schema().indexFor(Label.label(indexLabelPrefix + i)).on(indexPropertyPrefix + i).create();
                    transaction.Success();
                }
            }

            using (Transaction ignored = _database.beginTx())
            {
                _database.schema().awaitIndexesOnline(1, TimeUnit.MINUTES);
            }

            IndexingService indexingService = GetIndexingService(_database);

            int indexLabel7    = GetLabelId(indexLabelPrefix + 7);
            int indexProperty7 = GetPropertyKeyId(indexPropertyPrefix + 7);

            IndexProxy index = indexingService.GetIndexProxy(TestIndexDescriptorFactory.forLabel(indexLabel7, indexProperty7).schema());

            index.Drop();

            ExpectedException.expect(typeof(UnderlyingStorageException));
            ExpectedException.expectMessage("Unable to force");
            indexingService.ForceAll(Org.Neo4j.Io.pagecache.IOLimiter_Fields.Unlimited);
        }