@Test public void shouldListAllAndroidVariationsForPushAppSuccessfully() { final WebPushVariant webPushVariant = new WebPushVariant(); final Variant iOSVariant = new iOSVariant(); final PushApplication pushApp = new PushApplication(); pushApp.setVariants(Lists.newArrayList(webPushVariant, iOSVariant)); when(searchService.findByPushApplicationIDForDeveloper("push-app-id")).thenReturn(pushApp); final Response response = this.endpoint.listAllWebPushVariationsForPushApp("push-app-id"); assertEquals(response.getStatus(), 200); assertTrue(((Collection) response.getEntity()).iterator().next() == webPushVariant); }
@GET @Produces(MediaType.APPLICATION_JSON) public Response listAllWebPushVariationsForPushApp(@PathParam("pushAppID") String pushApplicationID) { final PushApplication application = getSearch().findByPushApplicationIDForDeveloper(pushApplicationID); if (application == null) { return Response.status(Response.Status.NOT_FOUND).entity(ErrorBuilder.forPushApplications().notFound().build()).build(); } return Response.ok(getVariants(application)).build(); }
WebPushVariantEndpoint extends AbstractVariantEndpoint<WebPushVariant> { @GET @Produces(MediaType.APPLICATION_JSON) public Response listAllWebPushVariationsForPushApp(@PathParam("pushAppID") String pushApplicationID) { final PushApplication application = getSearch().findByPushApplicationIDForDeveloper(pushApplicationID); if (application == null) { return Response.status(Response.Status.NOT_FOUND).entity(ErrorBuilder.forPushApplications().notFound().build()).build(); } return Response.ok(getVariants(application)).build(); } }
WebPushVariantEndpoint extends AbstractVariantEndpoint<WebPushVariant> { @GET @Produces(MediaType.APPLICATION_JSON) public Response listAllWebPushVariationsForPushApp(@PathParam("pushAppID") String pushApplicationID) { final PushApplication application = getSearch().findByPushApplicationIDForDeveloper(pushApplicationID); if (application == null) { return Response.status(Response.Status.NOT_FOUND).entity(ErrorBuilder.forPushApplications().notFound().build()).build(); } return Response.ok(getVariants(application)).build(); } WebPushVariantEndpoint();   WebPushVariantEndpoint(Validator validator, SearchManager searchManager); }
WebPushVariantEndpoint extends AbstractVariantEndpoint<WebPushVariant> { @GET @Produces(MediaType.APPLICATION_JSON) public Response listAllWebPushVariationsForPushApp(@PathParam("pushAppID") String pushApplicationID) { final PushApplication application = getSearch().findByPushApplicationIDForDeveloper(pushApplicationID); if (application == null) { return Response.status(Response.Status.NOT_FOUND).entity(ErrorBuilder.forPushApplications().notFound().build()).build(); } return Response.ok(getVariants(application)).build(); } WebPushVariantEndpoint();   WebPushVariantEndpoint(Validator validator, SearchManager searchManager); @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response registerWebPushVariant(
            WebPushVariant webPushVariant,
            @PathParam("pushAppID") String pushApplicationID,
            @Context UriInfo uriInfo); @GET @Produces(MediaType.APPLICATION_JSON) Response listAllWebPushVariationsForPushApp(@PathParam("pushAppID") String pushApplicationID); @PUT @Path("/{webPushID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response updateWebPushVariant(@PathParam("pushAppID") String pushApplicationID,
                                         @PathParam("webPushID") String webPushID, WebPushVariant updatedVariant); @PUT @Path("/{variantId}/renew") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response renewKeys(@PathParam("pushAppID") String pushApplicationID,
                                @PathParam("variantId") String variantId); }
WebPushVariantEndpoint extends AbstractVariantEndpoint<WebPushVariant> { @GET @Produces(MediaType.APPLICATION_JSON) public Response listAllWebPushVariationsForPushApp(@PathParam("pushAppID") String pushApplicationID) { final PushApplication application = getSearch().findByPushApplicationIDForDeveloper(pushApplicationID); if (application == null) { return Response.status(Response.Status.NOT_FOUND).entity(ErrorBuilder.forPushApplications().notFound().build()).build(); } return Response.ok(getVariants(application)).build(); } WebPushVariantEndpoint();   WebPushVariantEndpoint(Validator validator, SearchManager searchManager); @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response registerWebPushVariant(
            WebPushVariant webPushVariant,
            @PathParam("pushAppID") String pushApplicationID,
            @Context UriInfo uriInfo); @GET @Produces(MediaType.APPLICATION_JSON) Response listAllWebPushVariationsForPushApp(@PathParam("pushAppID") String pushApplicationID); @PUT @Path("/{webPushID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response updateWebPushVariant(@PathParam("pushAppID") String pushApplicationID,
                                         @PathParam("webPushID") String webPushID, WebPushVariant updatedVariant); @PUT @Path("/{variantId}/renew") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response renewKeys(@PathParam("pushAppID") String pushApplicationID,
                                @PathParam("variantId") String variantId);  }