We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SE examples have unit tests starting the server with a blocking loop:
webServer = Main.startServer(); long timeout = 2000; // 2 seconds should be enough to start the server long now = System.currentTimeMillis(); while (!webServer.isRunning()) { //noinspection BusyWait Thread.sleep(100); if ((System.currentTimeMillis() - now) > timeout) { Assertions.fail("Failed to start webserver"); } }
Instead, the startServer method should be written more or less that way:
startServer
static Single<WebServer> startServer(Config config) { // load logging configuration LogConfig.configureRuntime(); // Build server using three ports: // default public port, admin port, private port WebServer server = WebServer.builder(createRouting()) .config(config.get("server")) // ... .build(); Single<WebServer> webserver = server.start(); webserver.thenAccept(ws -> { System.out.println( "WEB server is up! http://localhost:" + ws.port()); ws.whenShutdown().thenRun(() -> System.out.println("WEB server is DOWN. Good bye!")); }) .exceptionally(t -> { System.err.println("Startup failed: " + t.getMessage()); t.printStackTrace(System.err); return null; }); return webserver; }
Then the test can do something like this:
WebServer webServer = Main.startServer(config).await();
The text was updated successfully, but these errors were encountered:
This needs to be fixed for examples/media/multipart and the SE quickstart.
examples/media/multipart
Sorry, something went wrong.
CC @tomas-langer @barchetta
romain-grecourt
barchetta
No branches or pull requests
SE examples have unit tests starting the server with a blocking loop:
Instead, the
startServer
method should be written more or less that way:Then the test can do something like this:
The text was updated successfully, but these errors were encountered: