Search in sources :

Example 6 with GraphDatabaseFacadeFactory

use of org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory in project neo4j by neo4j.

the class NonUniqueIndexTests method newEmbeddedGraphDatabaseWithSlowJobScheduler.

private GraphDatabaseService newEmbeddedGraphDatabaseWithSlowJobScheduler() {
    GraphDatabaseFactoryState graphDatabaseFactoryState = new GraphDatabaseFactoryState();
    graphDatabaseFactoryState.setUserLogProvider(NullLogService.getInstance().getUserLogProvider());
    return new GraphDatabaseFacadeFactory(DatabaseInfo.COMMUNITY, CommunityEditionModule::new) {

        @Override
        protected PlatformModule createPlatform(File storeDir, Config config, Dependencies dependencies, GraphDatabaseFacade graphDatabaseFacade) {
            return new PlatformModule(storeDir, config, databaseInfo, dependencies, graphDatabaseFacade) {

                @Override
                protected Neo4jJobScheduler createJobScheduler() {
                    return newSlowJobScheduler();
                }

                @Override
                protected LogService createLogService(LogProvider userLogProvider) {
                    return NullLogService.getInstance();
                }
            };
        }
    }.newFacade(directory.graphDbDir(), Config.embeddedDefaults(), graphDatabaseFactoryState.databaseDependencies());
}
Also used : Neo4jJobScheduler(org.neo4j.kernel.impl.util.Neo4jJobScheduler) LogProvider(org.neo4j.logging.LogProvider) NullLogProvider(org.neo4j.logging.NullLogProvider) Config(org.neo4j.kernel.configuration.Config) IndexSamplingConfig(org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig) GraphDatabaseFactoryState(org.neo4j.graphdb.factory.GraphDatabaseFactoryState) GraphDatabaseFacadeFactory(org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory) GraphDatabaseFacade(org.neo4j.kernel.impl.factory.GraphDatabaseFacade) PlatformModule(org.neo4j.kernel.impl.factory.PlatformModule) File(java.io.File) LogService(org.neo4j.kernel.impl.logging.LogService) NullLogService(org.neo4j.kernel.impl.logging.NullLogService)

Example 7 with GraphDatabaseFacadeFactory

use of org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory in project neo4j by neo4j.

the class EmbeddedGraphDatabase method create.

protected void create(File storeDir, Config config, GraphDatabaseFacadeFactory.Dependencies dependencies) {
    GraphDatabaseDependencies newDependencies = newDependencies(dependencies).settingsClasses(asList(append(GraphDatabaseSettings.class, dependencies.settingsClasses())));
    new GraphDatabaseFacadeFactory(DatabaseInfo.COMMUNITY, CommunityEditionModule::new).initFacade(storeDir, config, newDependencies, this);
}
Also used : GraphDatabaseFacadeFactory(org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory) GraphDatabaseDependencies(org.neo4j.kernel.GraphDatabaseDependencies)

Example 8 with GraphDatabaseFacadeFactory

use of org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory in project neo4j by neo4j.

the class GraphDatabaseFacadeFactoryTest method shouldThrowAppropriateExceptionIfStartFails.

@Test
public void shouldThrowAppropriateExceptionIfStartFails() {
    // Given
    RuntimeException startupError = new RuntimeException();
    GraphDatabaseFacadeFactory db = newFaultyGraphDatabaseFacadeFactory(startupError);
    try {
        // When
        db.initFacade(dir.graphDbDir(), Collections.emptyMap(), deps, mockFacade);
        fail("Should have thrown " + RuntimeException.class);
    } catch (RuntimeException exception) {
        // Then
        assertEquals(startupError, Exceptions.rootCause(exception));
    }
}
Also used : GraphDatabaseFacadeFactory(org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory) Test(org.junit.Test)

Aggregations

GraphDatabaseFacadeFactory (org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory)8 File (java.io.File)4 Test (org.junit.Test)4 Config (org.neo4j.kernel.configuration.Config)4 GraphDatabaseFacade (org.neo4j.kernel.impl.factory.GraphDatabaseFacade)4 PlatformModule (org.neo4j.kernel.impl.factory.PlatformModule)4 GraphDatabaseDependencies (org.neo4j.kernel.GraphDatabaseDependencies)3 Map (java.util.Map)2 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)2 EditionModule (org.neo4j.kernel.impl.factory.EditionModule)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Set (java.util.Set)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 Function (java.util.function.Function)1 Supplier (java.util.function.Supplier)1 Collectors.toSet (java.util.stream.Collectors.toSet)1 Stream (java.util.stream.Stream)1