Ejemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void testCreateIndexWithGivenProvider(String label, String... properties) throws org.neo4j.internal.kernel.api.exceptions.KernelException
        private void TestCreateIndexWithGivenProvider(string label, params string[] properties)
        {
            // given
            Transaction transaction = NewTransaction(AnonymousContext.writeToken());
            int         labelId     = transaction.TokenWrite().labelGetOrCreateForName(label);

            int[]     propertyKeyIds = CreateProperties(transaction, properties);
            TextValue value          = stringValue("some value");
            long      node           = CreateNodeWithPropertiesAndLabel(transaction, labelId, propertyKeyIds, value);

            Commit();

            // when
            NewTransaction(AnonymousContext.full());
            string pattern           = IndexPattern(label, properties);
            string specifiedProvider = NATIVE10.providerName();
            RawIterator <object[], ProcedureException> result = CallIndexProcedure(pattern, specifiedProvider);

            // then
            assertThat(Arrays.asList(result.Next()), contains(pattern, specifiedProvider, ExpectedSuccessfulCreationStatus));
            Commit();
            AwaitIndexOnline();

            // and then
            transaction = NewTransaction(AnonymousContext.read());
            SchemaRead     schemaRead = transaction.SchemaRead();
            IndexReference index      = schemaRead.Index(labelId, propertyKeyIds);

            AssertCorrectIndex(labelId, propertyKeyIds, UniquenessConstraint, index);
            AssertIndexData(transaction, propertyKeyIds, value, node, index);
            Commit();
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void createConstraint(String label, String... properties) throws org.neo4j.internal.kernel.api.exceptions.TransactionFailureException, org.neo4j.internal.kernel.api.exceptions.ProcedureException
        private void CreateConstraint(string label, params string[] properties)
        {
            NewTransaction(AnonymousContext.full());
            string pattern           = IndexPattern(label, properties);
            string specifiedProvider = NATIVE10.providerName();

            CallIndexProcedure(pattern, specifiedProvider);
            Commit();
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void skipMigrationOfEnableNativeSchemaIndexIfNotPresent()
        public virtual void SkipMigrationOfEnableNativeSchemaIndexIfNotPresent()
        {
            IDictionary <string, string> migratedProperties = _migrator.apply(stringMap("dbms.index.default_schema_provider", NATIVE10.providerName()), Log);

            assertEquals("Nothing to migrate", migratedProperties, stringMap("dbms.index.default_schema_provider", NATIVE10.providerName()));
            LogProvider.assertNoLoggingOccurred();
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void skipMigrationOfEnableNativeSchemaIndexIfDefaultSchemaIndexConfigured()
        public virtual void SkipMigrationOfEnableNativeSchemaIndexIfDefaultSchemaIndexConfigured()
        {
            IDictionary <string, string> migratedProperties = _migrator.apply(stringMap("dbms.index.default_schema_provider", NATIVE10.providerName(), "unsupported.dbms.enable_native_schema_index", "false"), Log);

            assertEquals("Should keep pre configured default schema index.", migratedProperties, stringMap("dbms.index.default_schema_provider", NATIVE10.providerName()));
            AssertContainsWarningMessage();
        }
        protected internal override IndexProvider CreateIndexProvider(PageCache pageCache, FileSystemAbstraction fs, File graphDbDir)
        {
            IndexProvider.Monitor monitor = IndexProvider.Monitor_Fields.EMPTY;
            Config          config        = Config.defaults(stringMap(default_schema_provider.name(), NATIVE10.providerName()));
            OperationalMode mode          = OperationalMode.single;
            RecoveryCleanupWorkCollector recoveryCleanupWorkCollector = RecoveryCleanupWorkCollector.immediate();

            return(NativeLuceneFusionIndexProviderFactory10.Create(pageCache, graphDbDir, fs, monitor, config, mode, recoveryCleanupWorkCollector));
        }