@Test public void shouldListAllAndroidVariationsForPushAppSuccessfully() { final Variant androidVariant = new AndroidVariant(); final Variant iOSVariant = new iOSVariant(); final PushApplication pushApp = new PushApplication(); pushApp.setVariants(Lists.newArrayList(androidVariant, iOSVariant)); when(searchService.findByPushApplicationIDForDeveloper("push-app-id")).thenReturn(pushApp); final Response response = this.endpoint.listAllAndroidVariationsForPushApp("push-app-id"); assertEquals(response.getStatus(), 200); assertTrue(((Collection) response.getEntity()).iterator().next() == androidVariant); }
@GET @Produces(MediaType.APPLICATION_JSON) public Response listAllAndroidVariationsForPushApp(@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(); }
AndroidVariantEndpoint extends AbstractVariantEndpoint<AndroidVariant> { @GET @Produces(MediaType.APPLICATION_JSON) public Response listAllAndroidVariationsForPushApp(@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(); } }
AndroidVariantEndpoint extends AbstractVariantEndpoint<AndroidVariant> { @GET @Produces(MediaType.APPLICATION_JSON) public Response listAllAndroidVariationsForPushApp(@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(); } AndroidVariantEndpoint();   AndroidVariantEndpoint(Validator validator, SearchManager searchManager); }
AndroidVariantEndpoint extends AbstractVariantEndpoint<AndroidVariant> { @GET @Produces(MediaType.APPLICATION_JSON) public Response listAllAndroidVariationsForPushApp(@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(); } AndroidVariantEndpoint();   AndroidVariantEndpoint(Validator validator, SearchManager searchManager); @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response registerAndroidVariant(
            AndroidVariant androidVariant,
            @PathParam("pushAppID") String pushApplicationID,
            @Context UriInfo uriInfo); @GET @Produces(MediaType.APPLICATION_JSON) Response listAllAndroidVariationsForPushApp(@PathParam("pushAppID") String pushApplicationID); @PUT @Path("/{androidID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response updateAndroidVariant(
            @PathParam("pushAppID") String pushApplicationId,
            @PathParam("androidID") String androidID,
            AndroidVariant updatedAndroidApplication); }
AndroidVariantEndpoint extends AbstractVariantEndpoint<AndroidVariant> { @GET @Produces(MediaType.APPLICATION_JSON) public Response listAllAndroidVariationsForPushApp(@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(); } AndroidVariantEndpoint();   AndroidVariantEndpoint(Validator validator, SearchManager searchManager); @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response registerAndroidVariant(
            AndroidVariant androidVariant,
            @PathParam("pushAppID") String pushApplicationID,
            @Context UriInfo uriInfo); @GET @Produces(MediaType.APPLICATION_JSON) Response listAllAndroidVariationsForPushApp(@PathParam("pushAppID") String pushApplicationID); @PUT @Path("/{androidID}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response updateAndroidVariant(
            @PathParam("pushAppID") String pushApplicationId,
            @PathParam("androidID") String androidID,
            AndroidVariant updatedAndroidApplication);  }