Search in sources :

Example 1 with CommunityEditionModule

use of org.neo4j.graphdb.factory.module.edition.CommunityEditionModule in project neo4j by neo4j.

the class CommitContentionTest method createDb.

private GraphDatabaseService createDb() {
    Config cfg = Config.newBuilder().set(neo4j_home, testDirectory.absolutePath()).build();
    managementService = new DatabaseManagementServiceFactory(DbmsInfo.COMMUNITY, globalModule -> new CommunityEditionModule(globalModule) {

        @Override
        public DatabaseTransactionStats createTransactionMonitor() {
            return new SkipTransactionDatabaseStats();
        }
    }).build(cfg, GraphDatabaseDependencies.newDependencies().dependencies(noOpSystemGraphInitializer(cfg)));
    return managementService.database(cfg.get(GraphDatabaseSettings.default_database));
}
Also used : DatabaseManagementServiceFactory(org.neo4j.graphdb.facade.DatabaseManagementServiceFactory) CommunityEditionModule(org.neo4j.graphdb.factory.module.edition.CommunityEditionModule) Config(org.neo4j.configuration.Config) DatabaseTransactionStats(org.neo4j.kernel.impl.transaction.stats.DatabaseTransactionStats)

Example 2 with CommunityEditionModule

use of org.neo4j.graphdb.factory.module.edition.CommunityEditionModule in project neo4j by neo4j.

the class DatabaseManagementServiceFactoryTest method newFaultyGraphDatabaseFacadeFactory.

private static DatabaseManagementServiceFactory newFaultyGraphDatabaseFacadeFactory(final RuntimeException startupError, RuntimeException shutdownError) {
    return new DatabaseManagementServiceFactory(DbmsInfo.UNKNOWN, CommunityEditionModule::new) {

        @Override
        protected GlobalModule createGlobalModule(Config config, ExternalDependencies dependencies) {
            final LifeSupport lifeMock = mock(LifeSupport.class);
            doThrow(startupError).when(lifeMock).start();
            if (shutdownError != null) {
                doThrow(shutdownError).when(lifeMock).shutdown();
            }
            doAnswer(invocation -> invocation.getArgument(0)).when(lifeMock).add(any(Lifecycle.class));
            return new GlobalModule(config, dbmsInfo, dependencies) {

                @Override
                public LifeSupport createLife() {
                    return lifeMock;
                }
            };
        }
    };
}
Also used : CommunityEditionModule(org.neo4j.graphdb.factory.module.edition.CommunityEditionModule) GlobalModule(org.neo4j.graphdb.factory.module.GlobalModule) Config(org.neo4j.configuration.Config) Lifecycle(org.neo4j.kernel.lifecycle.Lifecycle) LifeSupport(org.neo4j.kernel.lifecycle.LifeSupport)

Aggregations

Config (org.neo4j.configuration.Config)2 CommunityEditionModule (org.neo4j.graphdb.factory.module.edition.CommunityEditionModule)2 DatabaseManagementServiceFactory (org.neo4j.graphdb.facade.DatabaseManagementServiceFactory)1 GlobalModule (org.neo4j.graphdb.factory.module.GlobalModule)1 DatabaseTransactionStats (org.neo4j.kernel.impl.transaction.stats.DatabaseTransactionStats)1 LifeSupport (org.neo4j.kernel.lifecycle.LifeSupport)1 Lifecycle (org.neo4j.kernel.lifecycle.Lifecycle)1