private void doShutdown() { if ( server != null ) { server.stop(); } if ( userLogFileStream != null ) { closeUserLogFileStream(); } }
private static synchronized void shutdown() { allocation = null; try { if ( server != null ) { server.stop(); } } finally { builder = null; server = null; } }
@Override public void close() { server.stop(); this.connectorPortRegister = null; try { additionalClosable.close(); } catch ( IOException e ) { throw new RuntimeException( e ); } try { if ( looksLikeMd5Hash( serverFolder.getName() ) ) { FileUtils.deleteRecursively( serverFolder ); } } catch ( IOException e ) { throw new RuntimeException( "Failed to clean up test server directory.", e ); } }
private Runnable stopServerAfterStartingHasStarted( NeoServer server, AtomicBoolean failure ) { return () -> { try { // Make sure that we have started the startup procedure before calling stop. semaphore.acquire(); server.stop(); } catch ( Exception e ) { failure.set( true ); } }; }
@After public void teardown() { if ( readOnlyServer != null ) { readOnlyServer.stop(); } }
@After public void shutdownTheServer() { if ( server != null ) { server.stop(); } }
@AfterClass public static void stopServer() { server.stop(); }
@After public void stopServer() { if ( server != null ) { server.stop(); } }
@After public void stopTheServer() { server.stop(); }
@AfterClass public static void stopServer() { if ( server != null ) { server.stop(); } }
@After public void stopServer() { if ( server != null ) { server.stop(); } }
@AfterClass public static void shutdownServer() { try { if ( server != null ) { server.stop(); } } finally { server = null; } }
@Test public void shouldLogShutdown() { server.stop(); logProvider.assertContainsMessageContaining( "Stopped." ); } }
@AfterClass public static void stopServer() throws Exception { suppressAll().call( (Callable<Void>) () -> { server.stop(); return null; } ); }
server.stop();
@Test public void givenExplicitlyDisabledServerLoggingConfigurationShouldNotLogAccesses() throws Exception { // given String directoryPrefix = testName.getMethodName(); File logDirectory = testDirectory.directory( directoryPrefix + "-logdir" ); NeoServer server = serverOnRandomPorts().withDefaultDatabaseTuning().persistent() .withProperty( ServerSettings.http_logging_enabled.name(), Settings.FALSE ) .withProperty( GraphDatabaseSettings.logs_directory.name(), logDirectory.toString() ) .withProperty( new BoltConnector( "bolt" ).listen_address.name(), ":0" ) .usingDataDir( testDirectory.directory( directoryPrefix + "-dbdir" ).getAbsolutePath() ) .build(); try { server.start(); FunctionalTestHelper functionalTestHelper = new FunctionalTestHelper( server ); // when String query = "?implicitlyDisabled" + randomString(); JaxRsResponse response = new RestRequest().get( functionalTestHelper.managementUri() + query ); assertThat( response.getStatus(), is( HttpStatus.SC_OK ) ); response.close(); // then File httpLog = new File( logDirectory, "http.log" ); assertThat( httpLog.exists(), is( false ) ); } finally { server.stop(); } }
@Test public void givenExplicitlyEnabledServerLoggingConfigurationShouldLogAccess() throws Exception { // given String directoryPrefix = testName.getMethodName(); File logDirectory = testDirectory.directory( directoryPrefix + "-logdir" ); final String query = "?explicitlyEnabled=" + randomString(); NeoServer server = serverOnRandomPorts().withDefaultDatabaseTuning().persistent() .withProperty( ServerSettings.http_logging_enabled.name(), Settings.TRUE ) .withProperty( GraphDatabaseSettings.logs_directory.name(), logDirectory.getAbsolutePath() ) .withProperty( new BoltConnector( "bolt" ).listen_address.name(), ":0" ) .usingDataDir( testDirectory.directory( directoryPrefix + "-dbdir" ).getAbsolutePath() ) .build(); try { server.start(); FunctionalTestHelper functionalTestHelper = new FunctionalTestHelper( server ); // when JaxRsResponse response = new RestRequest().get( functionalTestHelper.managementUri() + query ); assertThat( response.getStatus(), is( HttpStatus.SC_OK ) ); response.close(); // then File httpLog = new File( logDirectory, "http.log" ); assertEventually( "request appears in log", fileContentSupplier( httpLog ), containsString( query ), 5, TimeUnit.SECONDS ); } finally { server.stop(); } }
/** * Stop the server. */ protected final void stopServer() { if (server != null) { server.stop(); server = null; } }
@Override public Void call() throws Exception { server.stop(); return null; } } );
@Override public void run() { log.info( "Restarting server" ); server.stop(); server.start(); } };