use of org.neo4j.kernel.api.index.IndexProvider in project neo4j by neo4j.
the class DefaultIndexProviderMapTest method shouldNotSupportMultipleProvidersWithSameDescriptor.
@Test
void shouldNotSupportMultipleProvidersWithSameDescriptor() {
// given
IndexProvider provider;
Dependencies dependencies = new Dependencies();
dependencies.satisfyDependency(provider = provider("provider", "1.2"));
dependencies.satisfyDependency(provider("provider", "1.2"));
dependencies.satisfyDependency(fulltext());
dependencies.satisfyDependency(tokenProvider());
// when
assertThrows(IllegalArgumentException.class, () -> createDefaultProviderMap(dependencies, provider.getProviderDescriptor()).init());
}
use of org.neo4j.kernel.api.index.IndexProvider in project neo4j by neo4j.
the class DefaultIndexProviderMapTest method provider.
private static IndexProvider provider(String name, String version) {
IndexProviderDescriptor descriptor = new IndexProviderDescriptor(name, version);
IndexProvider provider = mock(IndexProvider.class);
when(provider.getProviderDescriptor()).thenReturn(descriptor);
return provider;
}
use of org.neo4j.kernel.api.index.IndexProvider in project neo4j by neo4j.
the class DefaultIndexProviderMapTest method shouldInitializeTokenIndexProvider.
@Test
void shouldInitializeTokenIndexProvider() {
// given
IndexProvider tokenIndexProvider = tokenProvider();
IndexProvider provider;
Dependencies dependencies = new Dependencies();
dependencies.satisfyDependency(provider = provider("provider", "1.2"));
dependencies.satisfyDependency(tokenIndexProvider);
// when
DefaultIndexProviderMap defaultIndexProviderMap = new DefaultIndexProviderMap(dependencies, Config.newBuilder().set(GraphDatabaseSettings.default_schema_provider, provider.getProviderDescriptor().name()).build());
defaultIndexProviderMap.init();
Assertions.assertThat(defaultIndexProviderMap.getTokenIndexProvider()).isEqualTo(tokenIndexProvider);
}
use of org.neo4j.kernel.api.index.IndexProvider in project neo4j by neo4j.
the class IndexConfigMigrator method migrateIndexConfig.
public static SchemaRule migrateIndexConfig(SchemaRule rule, DatabaseLayout directoryLayout, FileSystemAbstraction fs, PageCache pageCache, IndexProviderMap indexProviderMap, Log log, CursorContext cursorContext) throws IOException {
if (rule instanceof IndexDescriptor) {
IndexDescriptor old = (IndexDescriptor) rule;
long indexId = old.getId();
IndexProviderDescriptor provider = old.getIndexProvider();
IndexMigration indexMigration = IndexMigration.migrationFromOldProvider(provider.getKey(), provider.getVersion());
IndexConfig indexConfig = indexMigration.extractIndexConfig(fs, pageCache, directoryLayout, indexId, cursorContext, log);
IndexDescriptor newIndexReference = old.withIndexConfig(indexConfig);
IndexProvider indexProvider = indexProviderMap.lookup(indexMigration.desiredAlternativeProvider);
return indexProvider.completeConfiguration(newIndexReference);
}
return rule;
}
use of org.neo4j.kernel.api.index.IndexProvider in project neo4j by neo4j.
the class IndexingService method validateIndexPrototype.
@Override
public void validateIndexPrototype(IndexPrototype prototype) {
IndexProvider provider = providerMap.lookup(prototype.getIndexProvider());
provider.validatePrototype(prototype);
}
Aggregations