@Test public void delete_withResource() { when(service.delete(DOMAIN_ID, CLIENT_ID, USER_ID, RESOURCE_ID)).thenReturn(Completable.complete()); endpoint.delete(context); verify(response, times(1)).putHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); verify(response, times(1)).setStatusCode(intCaptor.capture()); Assert.assertEquals("Should be no content status",204, intCaptor.getValue().intValue()); }
public void delete(RoutingContext context) { JWT accessToken = context.get(OAuth2AuthHandler.TOKEN_CONTEXT_KEY); Client client = context.get(OAuth2AuthHandler.CLIENT_CONTEXT_KEY); String resource_id = context.request().getParam(RESOURCE_ID); this.resourceService.delete(domain.getId(), client.getId(), accessToken.getSub(), resource_id) .subscribe( () -> context.response() .putHeader(HttpHeaders.CACHE_CONTROL, "no-store") .putHeader(HttpHeaders.PRAGMA, "no-cache") .putHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .setStatusCode(HttpStatusCode.NO_CONTENT_204) .end() , error -> context.fail(error) ); }
ResourceRegistrationEndpoint implements Handler<RoutingContext> { public void delete(RoutingContext context) { JWT accessToken = context.get(OAuth2AuthHandler.TOKEN_CONTEXT_KEY); Client client = context.get(OAuth2AuthHandler.CLIENT_CONTEXT_KEY); String resource_id = context.request().getParam(RESOURCE_ID); this.resourceService.delete(domain.getId(), client.getId(), accessToken.getSub(), resource_id) .subscribe( () -> context.response() .putHeader(HttpHeaders.CACHE_CONTROL, "no-store") .putHeader(HttpHeaders.PRAGMA, "no-cache") .putHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .setStatusCode(HttpStatusCode.NO_CONTENT_204) .end() , error -> context.fail(error) ); } }
ResourceRegistrationEndpoint implements Handler<RoutingContext> { public void delete(RoutingContext context) { JWT accessToken = context.get(OAuth2AuthHandler.TOKEN_CONTEXT_KEY); Client client = context.get(OAuth2AuthHandler.CLIENT_CONTEXT_KEY); String resource_id = context.request().getParam(RESOURCE_ID); this.resourceService.delete(domain.getId(), client.getId(), accessToken.getSub(), resource_id) .subscribe( () -> context.response() .putHeader(HttpHeaders.CACHE_CONTROL, "no-store") .putHeader(HttpHeaders.PRAGMA, "no-cache") .putHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .setStatusCode(HttpStatusCode.NO_CONTENT_204) .end() , error -> context.fail(error) ); } ResourceRegistrationEndpoint(Domain domain, ResourceService resourceService); }
ResourceRegistrationEndpoint implements Handler<RoutingContext> { public void delete(RoutingContext context) { JWT accessToken = context.get(OAuth2AuthHandler.TOKEN_CONTEXT_KEY); Client client = context.get(OAuth2AuthHandler.CLIENT_CONTEXT_KEY); String resource_id = context.request().getParam(RESOURCE_ID); this.resourceService.delete(domain.getId(), client.getId(), accessToken.getSub(), resource_id) .subscribe( () -> context.response() .putHeader(HttpHeaders.CACHE_CONTROL, "no-store") .putHeader(HttpHeaders.PRAGMA, "no-cache") .putHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .setStatusCode(HttpStatusCode.NO_CONTENT_204) .end() , error -> context.fail(error) ); } ResourceRegistrationEndpoint(Domain domain, ResourceService resourceService); @Override void handle(RoutingContext context); void create(RoutingContext context); void get(RoutingContext context); void update(RoutingContext context); void delete(RoutingContext context); }
ResourceRegistrationEndpoint implements Handler<RoutingContext> { public void delete(RoutingContext context) { JWT accessToken = context.get(OAuth2AuthHandler.TOKEN_CONTEXT_KEY); Client client = context.get(OAuth2AuthHandler.CLIENT_CONTEXT_KEY); String resource_id = context.request().getParam(RESOURCE_ID); this.resourceService.delete(domain.getId(), client.getId(), accessToken.getSub(), resource_id) .subscribe( () -> context.response() .putHeader(HttpHeaders.CACHE_CONTROL, "no-store") .putHeader(HttpHeaders.PRAGMA, "no-cache") .putHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .setStatusCode(HttpStatusCode.NO_CONTENT_204) .end() , error -> context.fail(error) ); } ResourceRegistrationEndpoint(Domain domain, ResourceService resourceService); @Override void handle(RoutingContext context); void create(RoutingContext context); void get(RoutingContext context); void update(RoutingContext context); void delete(RoutingContext context);  }