protected ManagementHost startHost(ManagementHost host, URI sandboxUri, List<String> peers) throws Throwable { String hostname = host.getUri().toString() + ":" + host.getSecurePort(); System.out.println("Starting host '" + hostname + "'..."); host = setUpHost(host.getSecurePort(), sandboxUri, peers); TestContext ctx = new TestContext(1, Duration.ofSeconds(DEFAULT_WAIT_SECONDS_FOR_AUTH_SERVICES)); AuthUtil.getPreferredAuthConfigProvider().waitForInitBootConfig(host, host.localUsers, ctx::completeIteration, ctx::failIteration); ctx.await(); System.out.println("Sleep for a while, until the host starts..."); Thread.sleep(4000); System.out.println("Host '" + hostname + "' started."); return host; }
protected void stopHost(ManagementHost host) { if (host == null) { return; } String hostname = host.getUri().toString(); System.out.println("Stopping host '" + hostname + "'..."); try { ServiceRequestListener secureListener = host.getSecureListener(); host.stop(); secureListener.stop(); waitWhilePortIsListening(secureListener.getPort()); System.out.println("Host '" + hostname + "' stopped."); } catch (Exception e) { throw new RuntimeException("Exception stopping host!", e); } }
@Override public boolean isReady() { try { SimpleEntry<Integer, String> response = doGet(uri, headers); assertEquals(HttpURLConnection.HTTP_OK, (int) response.getKey()); String body = switchToUnixLineEnds(response.getValue()); for (ManagementHost host2 : hosts) { assertTrue("Host " + host2.getUri() + " should be present!", body.contains("\"groupReference\": \"" + host2.getUri() + "/core/node-groups/default\",\n \"status\": \"AVAILABLE\"")); } } catch (Throwable e) { host.log(Level.WARNING, "Request to [%s] failed with: [%s].", NODE_GROUPS, e.getMessage()); return false; } return true; }
public static void startServices(ManagementHost host) { startServices(host, TestAuthServiceDocumentHelper.class, DummyFactoryService.class, DummySubscriber.class); // start initialization of test documents host.sendRequest(Operation.createPost( UriUtils.buildUri(host, TestAuthServiceDocumentHelper.class)) .setReferer(host.getUri()) .setBody(new ServiceDocument())); } }
op.setReferer(host.getUri()); op.setCompletion((o, e) -> { if (e != null) {
this.getUri(), ServiceUriPaths.SWAGGER);