public static void main( String[] args ) { int status = ServerBootstrapper.start( new CommunityBootstrapper(), args ); if ( status != 0 ) { System.exit( status ); } }
/** * Used by the windows service wrapper */ @SuppressWarnings( "unused" ) public static void start( String[] args ) { bootstrapper = new BlockingBootstrapper( new CommunityBootstrapper() ); System.exit( ServerBootstrapper.start( bootstrapper, args ) ); }
@Test public void shouldStartStopNeoServerWithoutAnyConfigFiles() throws Throwable { // When int resultCode = ServerBootstrapper.start( bootstrapper, withConnectorsOnRandomPortsConfig( "--home-dir", tempDir.newFolder( "home-dir" ).getAbsolutePath(), "-c", configOption( data_directory, tempDir.getRoot().getAbsolutePath() ), "-c", configOption( logs_directory, tempDir.getRoot().getAbsolutePath() ), "-c", "dbms.backup.enabled=false" ) ); // Then assertEquals( ServerBootstrapper.OK, resultCode ); assertEventually( "Server was not started", bootstrapper::isRunning, is( true ), 1, TimeUnit.MINUTES ); }
@Test public void shouldNotThrowNullPointerExceptionIfConfigurationValidationFails() throws Exception { // given ServerBootstrapper serverBootstrapper = new ServerBootstrapper() { @Override protected GraphFactory createGraphFactory( Config config ) { return new CommunityGraphFactory(); } @Override protected NeoServer createNeoServer( GraphFactory graphFactory, Config config, GraphDatabaseDependencies dependencies ) { return mock( NeoServer.class ); } }; File dir = Files.createTempDirectory( "test-server-bootstrapper" ).toFile(); dir.deleteOnExit(); // when serverBootstrapper.start( dir, Optional.empty(), MapUtil.stringMap( database_path.name(), homeDir.absolutePath().getAbsolutePath() ) ); // then no exceptions are thrown and assertThat( suppress.getOutputVoice().lines(), not( empty() ) ); } }
@Test public void canSpecifyConfigFile() throws Throwable { // Given File configFile = tempDir.newFile( Config.DEFAULT_CONFIG_FILE_NAME ); Map<String,String> properties = stringMap( forced_kernel_id.name(), "ourcustomvalue" ); properties.putAll( ServerTestUtils.getDefaultRelativeProperties() ); properties.putAll( connectorsOnRandomPortsConfig() ); store( properties, configFile ); // When ServerBootstrapper.start( bootstrapper, "--home-dir", tempDir.newFolder( "home-dir" ).getAbsolutePath(), "--config-dir", configFile.getParentFile().getAbsolutePath() ); // Then assertThat( bootstrapper.getServer().getConfig().get( forced_kernel_id ), equalTo( "ourcustomvalue" ) ); }
@Test public void shouldLogToStdOutByDefault() throws Exception { // given ServerBootstrapper serverBootstrapper = getServerBootstrapper(); File dir = homeDir.directory(); // when serverBootstrapper.start( dir, Optional.empty(), MapUtil.stringMap( database_path.name(), homeDir.absolutePath().getAbsolutePath() ) ); // then no exceptions are thrown and assertThat( getStdOut(), not( empty() ) ); assertTrue( !Files.exists( getUserLogFileLocation( dir ) ) ); // stop the server so that resources are released and test teardown isn't flaky serverBootstrapper.stop(); }
@Test public void canOverrideConfigValues() throws Throwable { // Given File configFile = tempDir.newFile( Config.DEFAULT_CONFIG_FILE_NAME ); Map<String,String> properties = stringMap( forced_kernel_id.name(), "thisshouldnotshowup" ); properties.putAll( ServerTestUtils.getDefaultRelativeProperties() ); properties.putAll( connectorsOnRandomPortsConfig() ); store( properties, configFile ); // When ServerBootstrapper.start( bootstrapper, "--home-dir", tempDir.newFolder( "home-dir" ).getAbsolutePath(), "--config-dir", configFile.getParentFile().getAbsolutePath(), "-c", configOption( forced_kernel_id, "mycustomvalue" ) ); // Then assertThat( bootstrapper.getServer().getConfig().get( forced_kernel_id ), equalTo( "mycustomvalue" ) ); }
@Test public void shouldLogToFileWhenConfigured() throws Exception { // given ServerBootstrapper serverBootstrapper = getServerBootstrapper(); File dir = homeDir.directory(); // when serverBootstrapper.start( dir, Optional.empty(), MapUtil.stringMap( database_path.name(), homeDir.absolutePath().getAbsolutePath(), store_user_log_to_stdout.name(), "false" ) ); // then no exceptions are thrown and assertThat( getStdOut(), empty() ); assertTrue( Files.exists( getUserLogFileLocation( dir ) ) ); assertThat( readUserLogFile( dir ), not( empty() ) ); // stop the server so that resources are released and test teardown isn't flaky serverBootstrapper.stop(); }
private void testStartupWithConnectors( boolean httpEnabled, boolean httpsEnabled, boolean boltEnabled ) throws Exception { int resultCode = ServerBootstrapper.start( bootstrapper, "--home-dir", tempDir.newFolder( "home-dir" ).getAbsolutePath(), "-c", configOption( data_directory, tempDir.getRoot().getAbsolutePath() ), "-c", configOption( logs_directory, tempDir.getRoot().getAbsolutePath() ), "-c", "dbms.connector.http.enabled=" + httpEnabled, "-c", "dbms.connector.http.listen_address=:0", "-c", "dbms.connector.https.enabled=" + httpsEnabled, "-c", "dbms.connector.https.listen_address=:0", "-c", "dbms.connector.bolt.enabled=" + boltEnabled, "-c", "dbms.connector.bolt.listen_address=:0" ); assertEquals( ServerBootstrapper.OK, resultCode ); assertEventually( "Server was not started", bootstrapper::isRunning, is( true ), 1, TimeUnit.MINUTES ); assertDbAccessibleAsEmbedded(); verifyConnector( db(), "http", httpEnabled ); verifyConnector( db(), "https", httpsEnabled ); verifyConnector( db(), "bolt", boltEnabled ); }
public static void main( String[] args ) { int status = ServerBootstrapper.start( new CommunityBootstrapper(), args ); if ( status != 0 ) { System.exit( status ); } }
public static void main( String[] args ) { int status = ServerBootstrapper.start( new CommercialBootstrapper(), args ); if ( status != 0 ) { System.exit( status ); } }
/** * Used by the windows service wrapper */ @SuppressWarnings( "unused" ) public static void start( String[] args ) { bootstrapper = new BlockingBootstrapper( new CommunityBootstrapper() ); System.exit( ServerBootstrapper.start( bootstrapper, args ) ); }
public static void start( String[] args ) { bootstrapper = new BlockingBootstrapper( new CommercialBootstrapper() ); System.exit( ServerBootstrapper.start( bootstrapper, args ) ); }
/** * Used by the windows service wrapper */ @SuppressWarnings( "unused" ) public static void start( String[] args ) { bootstrapper = new BlockingBootstrapper( new ArbiterBootstrapper() ); System.exit( ServerBootstrapper.start( bootstrapper, args ) ); }