@Test public void testDenyWithRedirect() throws InterruptedException, IOException, KeyStoreException, CertificateException, NoSuchAlgorithmException, KeyManagementException, UnrecoverableKeyException { FakeConfiguration s1 = new FakeConfiguration(ImmutableMap.<String, Object>builder() .put("port", 0) .put("ssl", false) .put("authentication", false) .put("deny", ImmutableList.of("/bar*")) .put("onDenied", "/foo") .build()); when(application.getConfiguration("vertx.servers")).thenReturn( new FakeConfiguration( ImmutableMap.<String, Object>of( "s1", s1 ) )); Controller controller = new DefaultController() { @SuppressWarnings("unused") public Result index() { return ok("Alright"); } @SuppressWarnings("unused") public Result bar() { return ok("bar"); } }; final Route route1 = new RouteBuilder().route(HttpMethod.GET) .on("/foo") .to(controller, "index"); final Route route2 = new RouteBuilder().route(HttpMethod.GET) .on("/bar") .to(controller, "bar"); doAnswer(new Answer<Route>() { @Override public Route answer(InvocationOnMock mock) throws Throwable { String url = (String) mock.getArguments()[1]; if (url.equals("/foo")) { return route1; } if (url.equals("/bar")) { return route2; } return null; } }).when(router).getRouteFor(anyString(), anyString(), any(Request.class)); wisdom.start(); waitForStart(wisdom); assertThat(wisdom.servers).hasSize(1); for (Server server : wisdom.servers) { HttpResponse r = org.apache.http.client.fluent.Request.Get( "http: assertThat(r.getStatusLine().getStatusCode()).isEqualTo(Status.OK); r = org.apache.http.client.fluent.Request.Get( "http: assertThat(r.getStatusLine().getStatusCode()).isEqualTo(Status.OK); assertThat(EntityUtils.toString(r.getEntity())).contains("Alright"); } }
public int port() { return port; }
Server { public int port() { return port; } }
Server { public int port() { return port; } Server(ServiceAccessor accessor,
                  Vertx vertx,
                  String name, int port,
                  boolean ssl, boolean authentication,
                  String host,
                  List<String> allow, List<String> deny, String onDenied); }
Server { public int port() { return port; } Server(ServiceAccessor accessor,
                  Vertx vertx,
                  String name, int port,
                  boolean ssl, boolean authentication,
                  String host,
                  List<String> allow, List<String> deny, String onDenied); static Server defaultHttp(ServiceAccessor accessor, Vertx vertx); static Server defaultHttps(ServiceAccessor accessor, Vertx vertx); static Server from(ServiceAccessor accessor,
                              Vertx vertx,
                              String name,
                              Configuration configuration); void bind(Handler<AsyncResult<Void>> completion); boolean accept(String path); Result getOnDeniedResult(); String name(); void close(Handler<AsyncResult<Void>> completion); boolean ssl(); int port(); String host(); boolean hasCompressionEnabled(); long getEncodingMinBound(); long getEncodingMaxBound(); }
Server { public int port() { return port; } Server(ServiceAccessor accessor,
                  Vertx vertx,
                  String name, int port,
                  boolean ssl, boolean authentication,
                  String host,
                  List<String> allow, List<String> deny, String onDenied); static Server defaultHttp(ServiceAccessor accessor, Vertx vertx); static Server defaultHttps(ServiceAccessor accessor, Vertx vertx); static Server from(ServiceAccessor accessor,
                              Vertx vertx,
                              String name,
                              Configuration configuration); void bind(Handler<AsyncResult<Void>> completion); boolean accept(String path); Result getOnDeniedResult(); String name(); void close(Handler<AsyncResult<Void>> completion); boolean ssl(); int port(); String host(); boolean hasCompressionEnabled(); long getEncodingMinBound(); long getEncodingMaxBound();  }