//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup()
        public virtual void Setup()
        {
            _db = DbRule.GraphDatabaseAPI;
            if (WithIndex)
            {
                using (Org.Neo4j.Graphdb.Transaction tx = _db.beginTx())
                {
                    _db.schema().indexFor(_label).on(Keys[0]).create();

                    IndexCreator indexCreator = _db.schema().indexFor(_label);
                    foreach (string key in Keys)
                    {
                        indexCreator = indexCreator.On(key);
                    }
                    indexCreator.Create();
                    tx.Success();
                }

                using (Org.Neo4j.Graphdb.Transaction tx = _db.beginTx())
                {
                    _db.schema().awaitIndexesOnline(5, TimeUnit.MINUTES);
                    tx.Success();
                }
            }
        }
Example #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: void shouldFailWithNonExistentProviderName(IndexCreator creator) throws org.neo4j.internal.kernel.api.exceptions.KernelException
        internal virtual void ShouldFailWithNonExistentProviderName(IndexCreator creator)
        {
            // given
            SchemaWrite schemaWrite = SchemaWriteInNewTransaction();

            // when
            try
            {
                creator.Create(schemaWrite, forLabel(0, 0), "something-completely-different");
                fail("Should have failed");
            }
            catch (IndexProviderNotFoundException)
            {
                // then good
            }
        }
Example #3
0
 private void CreateIndex(params string[] propKeys)
 {
     using (Transaction tx = Db.beginTx())
     {
         IndexCreator indexCreator = Db.schema().indexFor(LABEL_ONE);
         foreach (string propKey in propKeys)
         {
             indexCreator = indexCreator.On(propKey);
         }
         indexCreator.Create();
         tx.Success();
     }
     using (Transaction tx = Db.beginTx())
     {
         Db.schema().awaitIndexesOnline(1, TimeUnit.MINUTES);
         tx.Success();
     }
 }
 private void CreateIndex(params string[] keys)
 {
     using (Transaction tx = Db.beginTx())
     {
         IndexCreator indexCreator = Db.schema().indexFor(LABEL);
         foreach (string key in keys)
         {
             indexCreator = indexCreator.On(key);
         }
         indexCreator.Create();
         tx.Success();
     }
     using (Transaction tx = Db.beginTx())
     {
         Db.schema().awaitIndexesOnline(10, SECONDS);
         tx.Success();
     }
 }
Example #5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: void shouldCreateWithSpecificExistingProviderName(IndexCreator creator) throws org.neo4j.internal.kernel.api.exceptions.KernelException
        internal virtual void ShouldCreateWithSpecificExistingProviderName(IndexCreator creator)
        {
            int labelId = 0;

            foreach (GraphDatabaseSettings.SchemaIndex indexSetting in GraphDatabaseSettings.SchemaIndex.values())
            {
                // given
                SchemaWrite           schemaWrite = SchemaWriteInNewTransaction();
                string                provider    = indexSetting.providerName();
                LabelSchemaDescriptor descriptor  = forLabel(labelId++, 0);
                creator.Create(schemaWrite, descriptor, provider);

                // when
                Commit();

                // then
                assertEquals(provider, IndexingService.getIndexProxy(descriptor).Descriptor.providerDescriptor().name());
            }
        }