@Test public void success() { ArgumentCaptor<String> strCaptor = ArgumentCaptor.forClass(String.class); ArgumentCaptor<Integer> intCaptor = ArgumentCaptor.forClass(Integer.class); when(context.response()).thenReturn(response); when(response.putHeader(anyString(),anyString())).thenReturn(response); when(response.setStatusCode(anyInt())).thenReturn(response); when(context.request()).thenReturn(request); when(request.getHeader(anyString())).thenReturn(null); when(discoveryService.getConfiguration(anyString())).thenReturn(new UMAProviderMetadata().setResourceRegistrationEndpoint("RRE")); endpoint.handle(context); verify(response, times(1)).end(strCaptor.capture()); verify(response, times(1)).setStatusCode(intCaptor.capture()); verify(response, times(1)).putHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); Assert.assertEquals("Should be ok", 200, intCaptor.getValue().intValue()); Assert.assertTrue(strCaptor.getValue().contains("\"resource_registration_endpoint\" : \"RRE\"")); }
@Override public void handle(RoutingContext context) { String basePath = UriBuilderRequest.resolveProxyRequest(context); context.response() .putHeader(HttpHeaders.CACHE_CONTROL, "no-store") .putHeader(HttpHeaders.PRAGMA, "no-cache") .putHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .setStatusCode(HttpStatusCode.OK_200) .end(Json.encodePrettily(discoveryService.getConfiguration(basePath))); }
ProviderConfigurationEndpoint implements Handler<RoutingContext> { @Override public void handle(RoutingContext context) { String basePath = UriBuilderRequest.resolveProxyRequest(context); context.response() .putHeader(HttpHeaders.CACHE_CONTROL, "no-store") .putHeader(HttpHeaders.PRAGMA, "no-cache") .putHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .setStatusCode(HttpStatusCode.OK_200) .end(Json.encodePrettily(discoveryService.getConfiguration(basePath))); } }
ProviderConfigurationEndpoint implements Handler<RoutingContext> { @Override public void handle(RoutingContext context) { String basePath = UriBuilderRequest.resolveProxyRequest(context); context.response() .putHeader(HttpHeaders.CACHE_CONTROL, "no-store") .putHeader(HttpHeaders.PRAGMA, "no-cache") .putHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .setStatusCode(HttpStatusCode.OK_200) .end(Json.encodePrettily(discoveryService.getConfiguration(basePath))); } ProviderConfigurationEndpoint(UMADiscoveryService umaDiscoveryService); }
ProviderConfigurationEndpoint implements Handler<RoutingContext> { @Override public void handle(RoutingContext context) { String basePath = UriBuilderRequest.resolveProxyRequest(context); context.response() .putHeader(HttpHeaders.CACHE_CONTROL, "no-store") .putHeader(HttpHeaders.PRAGMA, "no-cache") .putHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .setStatusCode(HttpStatusCode.OK_200) .end(Json.encodePrettily(discoveryService.getConfiguration(basePath))); } ProviderConfigurationEndpoint(UMADiscoveryService umaDiscoveryService); @Override void handle(RoutingContext context); }
ProviderConfigurationEndpoint implements Handler<RoutingContext> { @Override public void handle(RoutingContext context) { String basePath = UriBuilderRequest.resolveProxyRequest(context); context.response() .putHeader(HttpHeaders.CACHE_CONTROL, "no-store") .putHeader(HttpHeaders.PRAGMA, "no-cache") .putHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .setStatusCode(HttpStatusCode.OK_200) .end(Json.encodePrettily(discoveryService.getConfiguration(basePath))); } ProviderConfigurationEndpoint(UMADiscoveryService umaDiscoveryService); @Override void handle(RoutingContext context);  }