@Test public void wait_as_long_queue_is_not_empty() throws Exception { webServer.enqueue(new MockResponse().setBody("false")); webServer.enqueue(new MockResponse().setBody("false")); webServer.enqueue(new MockResponse().setBody("true")); Server server = new Server(null, null, Edition.COMMUNITY, Version.create("7.3.0.1000"), webServer.url(""), 9001, null); new SynchronousAnalyzer(server, 1L, 2).waitForDone(); assertThat(webServer.getRequestCount()).isEqualTo(3); for (int i = 0; i < 3; i++) { RecordedRequest recordedRequest = webServer.takeRequest(); assertThat(recordedRequest.getPath()).isEqualTo(SynchronousAnalyzer.RELATIVE_PATH); assertThat(recordedRequest.getHeader("Authorization")).isEqualTo(Credentials.basic("admin", "admin")); } }
public void waitForDone() { boolean empty = false; int count = 0; while (!empty) { if (count % logFrequency == 0) { LOGGER.info("Waiting for analysis reports to be integrated"); } try { String response = server.newHttpCall(RELATIVE_PATH) .setAdminCredentials() .execute() .getBodyAsString(); empty = "true".equals(response); Thread.sleep(delayMs); count++; } catch (InterruptedException e) { Thread.currentThread().interrupt(); return; } } }
SynchronousAnalyzer { public void waitForDone() { boolean empty = false; int count = 0; while (!empty) { if (count % logFrequency == 0) { LOGGER.info("Waiting for analysis reports to be integrated"); } try { String response = server.newHttpCall(RELATIVE_PATH) .setAdminCredentials() .execute() .getBodyAsString(); empty = "true".equals(response); Thread.sleep(delayMs); count++; } catch (InterruptedException e) { Thread.currentThread().interrupt(); return; } } } }
SynchronousAnalyzer { public void waitForDone() { boolean empty = false; int count = 0; while (!empty) { if (count % logFrequency == 0) { LOGGER.info("Waiting for analysis reports to be integrated"); } try { String response = server.newHttpCall(RELATIVE_PATH) .setAdminCredentials() .execute() .getBodyAsString(); empty = "true".equals(response); Thread.sleep(delayMs); count++; } catch (InterruptedException e) { Thread.currentThread().interrupt(); return; } } } SynchronousAnalyzer(Server server);   SynchronousAnalyzer(Server server, long delayMs, int logFrequency); }
SynchronousAnalyzer { public void waitForDone() { boolean empty = false; int count = 0; while (!empty) { if (count % logFrequency == 0) { LOGGER.info("Waiting for analysis reports to be integrated"); } try { String response = server.newHttpCall(RELATIVE_PATH) .setAdminCredentials() .execute() .getBodyAsString(); empty = "true".equals(response); Thread.sleep(delayMs); count++; } catch (InterruptedException e) { Thread.currentThread().interrupt(); return; } } } SynchronousAnalyzer(Server server);   SynchronousAnalyzer(Server server, long delayMs, int logFrequency); void waitForDone(); }
SynchronousAnalyzer { public void waitForDone() { boolean empty = false; int count = 0; while (!empty) { if (count % logFrequency == 0) { LOGGER.info("Waiting for analysis reports to be integrated"); } try { String response = server.newHttpCall(RELATIVE_PATH) .setAdminCredentials() .execute() .getBodyAsString(); empty = "true".equals(response); Thread.sleep(delayMs); count++; } catch (InterruptedException e) { Thread.currentThread().interrupt(); return; } } } SynchronousAnalyzer(Server server);   SynchronousAnalyzer(Server server, long delayMs, int logFrequency); void waitForDone();  }