use of org.neo4j.kernel.GraphDatabaseDependencies in project neo4j by neo4j.
the class EmbeddedGraphDatabase method create.
protected void create(File storeDir, Map<String, String> params, GraphDatabaseFacadeFactory.Dependencies dependencies) {
GraphDatabaseDependencies newDependencies = newDependencies(dependencies).settingsClasses(asList(append(GraphDatabaseSettings.class, dependencies.settingsClasses())));
new GraphDatabaseFacadeFactory(DatabaseInfo.COMMUNITY, CommunityEditionModule::new).initFacade(storeDir, params, newDependencies, this);
}
use of org.neo4j.kernel.GraphDatabaseDependencies in project neo4j by neo4j.
the class ServerBootstrapperTest method shouldNotThrowNullPointerExceptionIfConfigurationValidationFails.
@Test
public void shouldNotThrowNullPointerExceptionIfConfigurationValidationFails() throws Exception {
// given
ServerBootstrapper serverBootstrapper = new ServerBootstrapper() {
@Override
protected NeoServer createNeoServer(Config config, GraphDatabaseDependencies dependencies, LogProvider userLogProvider) {
return mock(NeoServer.class);
}
@Nonnull
@Override
protected Collection<ConfigurationValidator> configurationValidators() {
return Collections.emptyList();
}
};
File dir = Files.createTempDirectory("test-server-bootstrapper").toFile();
dir.deleteOnExit();
// when
serverBootstrapper.start(dir, Optional.empty());
// then no exceptions are thrown and
assertThat(suppress.getOutputVoice().lines(), not(empty()));
}
use of org.neo4j.kernel.GraphDatabaseDependencies in project neo4j by neo4j.
the class DatabaseActions method start.
public void start() throws UnableToStartServerException {
if (isRunning()) {
throw new UnableToStartServerException("Already started");
}
Config config = model.getConfig();
Monitors monitors = new Monitors();
LogProvider userLogProvider = FormattedLogProvider.toOutputStream(System.out);
GraphDatabaseDependencies dependencies = GraphDatabaseDependencies.newDependencies().userLogProvider(userLogProvider).monitors(monitors);
server = new CommunityNeoServer(config, dependencies, userLogProvider);
try {
server.start();
} catch (ServerStartupException e) {
server = null;
Set<Class> causes = extractCauseTypes(e);
if (causes.contains(StoreLockException.class)) {
throw new UnableToStartServerException("Unable to lock store. Are you running another Neo4j process against this database?");
}
if (causes.contains(BindException.class)) {
throw new UnableToStartServerException("Unable to bind to port. Are you running another Neo4j process on this computer?");
}
throw new UnableToStartServerException(e.getMessage());
}
}
use of org.neo4j.kernel.GraphDatabaseDependencies 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);
}
use of org.neo4j.kernel.GraphDatabaseDependencies in project neo4j by neo4j.
the class AbstractInProcessServerBuilder method newServer.
@Override
public ServerControls newServer() {
try (FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction()) {
final OutputStream logOutputStream;
try {
logOutputStream = createOrOpenAsOuputStream(fileSystem, new File(serverFolder, "neo4j.log"), true);
} catch (IOException e) {
throw new RuntimeException("Unable to create log file", e);
}
config.put(ServerSettings.third_party_packages.name(), toStringForThirdPartyPackageProperty(extensions.toList()));
final FormattedLogProvider userLogProvider = FormattedLogProvider.toOutputStream(logOutputStream);
GraphDatabaseDependencies dependencies = GraphDatabaseDependencies.newDependencies();
Iterable<KernelExtensionFactory<?>> kernelExtensions = append(new Neo4jHarnessExtensions(procedures), dependencies.kernelExtensions());
dependencies = dependencies.kernelExtensions(kernelExtensions).userLogProvider(userLogProvider);
AbstractNeoServer neoServer = createNeoServer(config, dependencies, userLogProvider);
InProcessServerControls controls = new InProcessServerControls(serverFolder, neoServer, logOutputStream);
controls.start();
try {
fixtures.applyTo(controls);
} catch (Exception e) {
controls.close();
throw Exceptions.launderedException(e);
}
return controls;
} catch (IOException e) {
throw Exceptions.launderedException(e);
}
}
Aggregations