@Test public void shouldGet_technicalManagementException() { final String certificatePluginId = "certificate-plugin-id"; doReturn(Maybe.error(new TechnicalManagementException("Error occurs"))).when(certificatePluginService).findById(certificatePluginId); final Response response = target("platform") .path("plugins") .path("certificates") .path(certificatePluginId) .request().get(); assertEquals(HttpStatusCode.INTERNAL_SERVER_ERROR_500, response.getStatus()); }
@GET @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Get an certificate plugin", notes = "There is no particular permission needed. User must be authenticated.") public void get( @PathParam("certificate") String certificateId, @Suspended final AsyncResponse response) { certificatePluginService.findById(certificateId) .map(extensionGrantPlugin -> Response.ok(certificateId).build()) .switchIfEmpty(Maybe.error(new CertificatePluginNotFoundException(certificateId))) .subscribe(response::resume, response::resume); }
CertificatePluginResource { @GET @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Get an certificate plugin", notes = "There is no particular permission needed. User must be authenticated.") public void get( @PathParam("certificate") String certificateId, @Suspended final AsyncResponse response) { certificatePluginService.findById(certificateId) .map(extensionGrantPlugin -> Response.ok(certificateId).build()) .switchIfEmpty(Maybe.error(new CertificatePluginNotFoundException(certificateId))) .subscribe(response::resume, response::resume); } }
CertificatePluginResource { @GET @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Get an certificate plugin", notes = "There is no particular permission needed. User must be authenticated.") public void get( @PathParam("certificate") String certificateId, @Suspended final AsyncResponse response) { certificatePluginService.findById(certificateId) .map(extensionGrantPlugin -> Response.ok(certificateId).build()) .switchIfEmpty(Maybe.error(new CertificatePluginNotFoundException(certificateId))) .subscribe(response::resume, response::resume); }  }
CertificatePluginResource { @GET @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Get an certificate plugin", notes = "There is no particular permission needed. User must be authenticated.") public void get( @PathParam("certificate") String certificateId, @Suspended final AsyncResponse response) { certificatePluginService.findById(certificateId) .map(extensionGrantPlugin -> Response.ok(certificateId).build()) .switchIfEmpty(Maybe.error(new CertificatePluginNotFoundException(certificateId))) .subscribe(response::resume, response::resume); }  @GET @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Get an certificate plugin", notes = "There is no particular permission needed. User must be authenticated.") void get(
            @PathParam("certificate") String certificateId,
            @Suspended final AsyncResponse response); @GET @Path("schema") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Get an certificate's schema", notes = "There is no particular permission needed. User must be authenticated.") void getSchema(
            @PathParam("certificate") String certificateId,
            @Suspended final AsyncResponse response); }
CertificatePluginResource { @GET @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Get an certificate plugin", notes = "There is no particular permission needed. User must be authenticated.") public void get( @PathParam("certificate") String certificateId, @Suspended final AsyncResponse response) { certificatePluginService.findById(certificateId) .map(extensionGrantPlugin -> Response.ok(certificateId).build()) .switchIfEmpty(Maybe.error(new CertificatePluginNotFoundException(certificateId))) .subscribe(response::resume, response::resume); }  @GET @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Get an certificate plugin", notes = "There is no particular permission needed. User must be authenticated.") void get(
            @PathParam("certificate") String certificateId,
            @Suspended final AsyncResponse response); @GET @Path("schema") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Get an certificate's schema", notes = "There is no particular permission needed. User must be authenticated.") void getSchema(
            @PathParam("certificate") String certificateId,
            @Suspended final AsyncResponse response);  }