Search in sources :

Example 11 with Dependencies

use of org.neo4j.collection.Dependencies in project neo4j by neo4j.

the class LabelsAcceptanceTest method oversteppingMaxNumberOfLabelsShouldFailGracefully.

@Test
void oversteppingMaxNumberOfLabelsShouldFailGracefully() throws IOException {
    JobScheduler scheduler = JobSchedulerFactory.createScheduler();
    try (EphemeralFileSystemAbstraction fileSystem = new EphemeralFileSystemAbstraction();
        Lifespan lifespan = new Lifespan(scheduler);
        PageCache pageCache = new MuninnPageCache(swapper(fileSystem), scheduler, MuninnPageCache.config(1_000))) {
        // Given
        Dependencies dependencies = new Dependencies();
        dependencies.satisfyDependencies(createIdContextFactoryWithMaxedOutLabelTokenIds(fileSystem, scheduler));
        DatabaseManagementService managementService = new TestDatabaseManagementServiceBuilder().setFileSystem(fileSystem).noOpSystemGraphInitializer().setExternalDependencies(dependencies).impermanent().build();
        GraphDatabaseService graphDatabase = managementService.database(DEFAULT_DATABASE_NAME);
        // When
        try (Transaction tx = graphDatabase.beginTx()) {
            assertThrows(ConstraintViolationException.class, () -> tx.createNode().addLabel(Labels.MY_LABEL));
        }
        managementService.shutdown();
    }
}
Also used : JobScheduler(org.neo4j.scheduler.JobScheduler) TestDatabaseManagementServiceBuilder(org.neo4j.test.TestDatabaseManagementServiceBuilder) InternalTransaction(org.neo4j.kernel.impl.coreapi.InternalTransaction) KernelTransaction(org.neo4j.kernel.api.KernelTransaction) EphemeralFileSystemAbstraction(org.neo4j.io.fs.EphemeralFileSystemAbstraction) MuninnPageCache(org.neo4j.io.pagecache.impl.muninn.MuninnPageCache) Dependencies(org.neo4j.collection.Dependencies) Lifespan(org.neo4j.kernel.lifecycle.Lifespan) DatabaseManagementService(org.neo4j.dbms.api.DatabaseManagementService) PageCache(org.neo4j.io.pagecache.PageCache) MuninnPageCache(org.neo4j.io.pagecache.impl.muninn.MuninnPageCache) Test(org.junit.jupiter.api.Test)

Example 12 with Dependencies

use of org.neo4j.collection.Dependencies in project neo4j by neo4j.

the class DefaultIndexProviderMapTest method shouldThrowOnLookupOnUnknownProvider.

@Test
void shouldThrowOnLookupOnUnknownProvider() {
    // given
    IndexProvider provider;
    Dependencies dependencies = new Dependencies();
    dependencies.satisfyDependency(provider = provider("provider", "1.2"));
    dependencies.satisfyDependency(fulltext());
    dependencies.satisfyDependency(tokenProvider());
    // when
    DefaultIndexProviderMap defaultIndexProviderMap = createDefaultProviderMap(dependencies, provider.getProviderDescriptor());
    defaultIndexProviderMap.init();
    assertThrows(IndexProviderNotFoundException.class, () -> defaultIndexProviderMap.lookup(new IndexProviderDescriptor("provider2", "1.2")));
}
Also used : IndexProvider(org.neo4j.kernel.api.index.IndexProvider) IndexProviderDescriptor(org.neo4j.internal.schema.IndexProviderDescriptor) Dependencies(org.neo4j.collection.Dependencies) Test(org.junit.jupiter.api.Test)

Example 13 with Dependencies

use of org.neo4j.collection.Dependencies in project neo4j by neo4j.

the class SnapshotQueryExecutionIT method setUp.

@Before
public void setUp() throws Exception {
    testContextSupplier = new TestTransactionVersionContextSupplier();
    var dependencies = new Dependencies();
    dependencies.satisfyDependencies(testContextSupplier);
    testWebContainer = serverOnRandomPorts().withProperty(GraphDatabaseInternalSettings.snapshot_query.name(), TRUE).withDependencies(dependencies).build();
    prepareCursorContext();
    createData(testWebContainer.getDefaultDatabase());
}
Also used : TestTransactionVersionContextSupplier(org.neo4j.snapshot.TestTransactionVersionContextSupplier) Dependencies(org.neo4j.collection.Dependencies) Before(org.junit.Before)

Example 14 with Dependencies

use of org.neo4j.collection.Dependencies in project neo4j by neo4j.

the class SchemaIndexExtensionLoader method instantiateExtensions.

@SuppressWarnings("unchecked")
public static DatabaseExtensions instantiateExtensions(DatabaseLayout databaseLayout, FileSystemAbstraction fileSystem, Config config, LogService logService, PageCache pageCache, JobScheduler jobScheduler, RecoveryCleanupWorkCollector recoveryCollector, DbmsInfo dbmsInfo, Monitors monitors, TokenHolders tokenHolders, PageCacheTracer pageCacheTracer, DatabaseReadOnlyChecker readOnlyChecker) {
    Dependencies deps = new Dependencies();
    deps.satisfyDependencies(fileSystem, config, logService, pageCache, recoveryCollector, monitors, jobScheduler, tokenHolders, pageCacheTracer, databaseLayout, readOnlyChecker);
    @SuppressWarnings("rawtypes") Iterable extensions = Services.loadAll(ExtensionFactory.class);
    DatabaseExtensionContext extensionContext = new DatabaseExtensionContext(databaseLayout, dbmsInfo, deps);
    return new DatabaseExtensions(extensionContext, extensions, deps, ExtensionFailureStrategies.ignore());
}
Also used : DatabaseExtensionContext(org.neo4j.kernel.extension.context.DatabaseExtensionContext) DatabaseExtensions(org.neo4j.kernel.extension.DatabaseExtensions) Dependencies(org.neo4j.collection.Dependencies)

Example 15 with Dependencies

use of org.neo4j.collection.Dependencies in project neo4j by neo4j.

the class EagerResultIT method startRestartableDatabase.

private GraphDatabaseService startRestartableDatabase() {
    Dependencies dependencies = new Dependencies();
    dependencies.satisfyDependencies(testContextSupplier);
    managementService = new TestDatabaseManagementServiceBuilder(storeDir).setExternalDependencies(dependencies).setConfig(GraphDatabaseInternalSettings.snapshot_query, true).build();
    return managementService.database(DEFAULT_DATABASE_NAME);
}
Also used : TestDatabaseManagementServiceBuilder(org.neo4j.test.TestDatabaseManagementServiceBuilder) Dependencies(org.neo4j.collection.Dependencies)

Aggregations

Dependencies (org.neo4j.collection.Dependencies)40 Test (org.junit.jupiter.api.Test)13 TestDatabaseManagementServiceBuilder (org.neo4j.test.TestDatabaseManagementServiceBuilder)7 Config (org.neo4j.configuration.Config)6 Monitors (org.neo4j.monitoring.Monitors)6 PageCache (org.neo4j.io.pagecache.PageCache)5 LifeSupport (org.neo4j.kernel.lifecycle.LifeSupport)5 DatabaseHealth (org.neo4j.monitoring.DatabaseHealth)5 StorageEngine (org.neo4j.storageengine.api.StorageEngine)5 BeforeEach (org.junit.jupiter.api.BeforeEach)4 DatabaseReadOnlyChecker (org.neo4j.configuration.helpers.DatabaseReadOnlyChecker)4 DatabaseManagementService (org.neo4j.dbms.api.DatabaseManagementService)4 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)4 Database (org.neo4j.kernel.database.Database)4 IndexingService (org.neo4j.kernel.impl.api.index.IndexingService)4 StorageEngineFactory (org.neo4j.storageengine.api.StorageEngineFactory)4 IOException (java.io.IOException)3 RecoveryCleanupWorkCollector (org.neo4j.index.internal.gbptree.RecoveryCleanupWorkCollector)3 GlobalExtensionContext (org.neo4j.kernel.extension.context.GlobalExtensionContext)3 IndexStatisticsStore (org.neo4j.kernel.impl.api.index.stats.IndexStatisticsStore)3