Package org.jboss.aerogear.unifiedpush.api

Examples of org.jboss.aerogear.unifiedpush.api.PushApplication


            @PathParam("pushAppID") String pushApplicationID,
            @Context UriInfo uriInfo,
            @Context HttpServletRequest request) {

        // find the root push app
        PushApplication pushApp = pushAppService.findByPushApplicationIDForDeveloper(pushApplicationID, extractUsername(request));

        if (pushApp == null) {
            return Response.status(Status.NOT_FOUND).entity("Could not find requested PushApplicationEntity").build();
        }
View Full Code Here


    // READ
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Response listAllAndroidVariationsForPushApp(@Context HttpServletRequest request, @PathParam("pushAppID") String pushApplicationID) {
        final PushApplication application = pushAppService.findByPushApplicationIDForDeveloper(pushApplicationID, extractUsername(request));
        return Response.ok(getVariantsByType(application, AndroidVariant.class)).build();
    }
View Full Code Here

            @PathParam("pushAppID") String pushApplicationID,
            @Context UriInfo uriInfo,
            @Context HttpServletRequest request) {

        // find the root push app
        PushApplication pushApp = pushAppService.findByPushApplicationIDForDeveloper(pushApplicationID, extractUsername(request));

        if (pushApp == null) {
            return Response.status(Status.NOT_FOUND).entity("Could not find requested PushApplicationEntity").build();
        }
View Full Code Here

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Response listAllSimplePushVariationsForPushApp(@PathParam("pushAppID") String pushApplicationID,
                                                          @Context HttpServletRequest request) {

        final PushApplication application = pushAppService.findByPushApplicationIDForDeveloper(pushApplicationID, extractUsername(request));
        return Response.ok(getVariantsByType(application, SimplePushVariant.class)).build();
    }
View Full Code Here

    @Test
    public void countMessagesPerApplicationID() {

        final String loginName = "admin";

        final PushApplication pushApp = new PushApplication();
        pushApp.setName("app");
        pushApp.setPushApplicationID("231231231");
        pushApp.setDeveloper(loginName);
        entityManager.persist(pushApp);

        final PushApplication pushApp1 = new PushApplication();
        pushApp1.setName("app1");
        pushApp1.setPushApplicationID("231231232");
        pushApp1.setDeveloper(loginName);
        entityManager.persist(pushApp1);

        long number = pushMessageInformationDao.getNumberOfPushMessagesForApplications(loginName);
        assertThat(number).isEqualTo(1);

        for (int i = 0; i < 100; i++) {

            PushMessageInformation pmi = new PushMessageInformation();
            pmi.setPushApplicationId(pushApp.getPushApplicationID());

            pushMessageInformationDao.create(pmi);
        }

        number = pushMessageInformationDao.getNumberOfPushMessagesForApplications(loginName);
        assertThat(number).isEqualTo(101);

        // a few more for different PushApplication...
        for (int i = 0; i < 100; i++) {

            PushMessageInformation pmi = new PushMessageInformation();
            pmi.setPushApplicationId(pushApp1.getPushApplicationID());

            pushMessageInformationDao.create(pmi);
        }

        number = pushMessageInformationDao.getNumberOfPushMessagesForApplications(loginName);
View Full Code Here

    public void findMostBusyVariants() {
        pushMessageInformation = pushMessageInformationDao.find(pushMessageInformationID);

        final String loginName = "admin";

        final PushApplication pushAppInitial = new PushApplication();
        pushAppInitial.setName("app");
        pushAppInitial.setPushApplicationID("231231231");
        pushAppInitial.setDeveloper(loginName);
        entityManager.persist(pushAppInitial);

        VariantMetricInformation variantOne = new VariantMetricInformation();
        variantOne.setDeliveryStatus(Boolean.FALSE);
        variantOne.setReceivers(200);
        variantOne.setVariantID("231543432432");
        pushMessageInformation.getVariantInformations().add(variantOne);
        pushMessageInformationDao.update(pushMessageInformation);

        VariantMetricInformation variantThree = new VariantMetricInformation();
        variantThree.setDeliveryStatus(Boolean.FALSE);
        variantThree.setReceivers(300);
        variantThree.setVariantID("23154343243333");
        pushMessageInformation.getVariantInformations().add(variantThree);
        pushMessageInformationDao.update(pushMessageInformation);

        VariantMetricInformation variantFour = new VariantMetricInformation();
        variantFour.setDeliveryStatus(Boolean.FALSE);
        variantFour.setReceivers(1000);
        variantFour.setVariantID("231543432434");
        pushMessageInformation.getVariantInformations().add(variantFour);
        pushMessageInformationDao.update(pushMessageInformation);

        final PushApplication pushApp = new PushApplication();
        pushApp.setName("app");
        pushApp.setPushApplicationID("231231232");
        pushApp.setDeveloper(loginName);
        entityManager.persist(pushApp);

        PushMessageInformation pmi = new PushMessageInformation();
        pmi.setPushApplicationId("231231232");
        pushMessageInformationDao.create(pmi);
        VariantMetricInformation variantTwo = new VariantMetricInformation();
        variantTwo.setDeliveryStatus(Boolean.TRUE);
        variantTwo.setReceivers(2000);
        variantTwo.setVariantID("231543432432");
        pmi.getVariantInformations().add(variantTwo);
        pushMessageInformationDao.update(pmi);

        final PushApplication pushApp1 = new PushApplication();
        pushApp1.setName("app");
        pushApp1.setPushApplicationID("231231233");
        pushApp1.setDeveloper(loginName);
        entityManager.persist(pushApp1);

        PushMessageInformation pmi1 = new PushMessageInformation();
        pmi1.setPushApplicationId("231231233");
        pushMessageInformationDao.create(pmi);
View Full Code Here

    public void findMostBusyVariantsForOnlyTwo() {
        pushMessageInformation = pushMessageInformationDao.find(pushMessageInformationID);

        final String loginName = "admin";

        final PushApplication pushAppInitial = new PushApplication();
        pushAppInitial.setName("app");
        pushAppInitial.setPushApplicationID("231231231");
        pushAppInitial.setDeveloper(loginName);
        entityManager.persist(pushAppInitial);

        VariantMetricInformation variantOne = new VariantMetricInformation();
        variantOne.setDeliveryStatus(Boolean.FALSE);
        variantOne.setReceivers(200);
        variantOne.setVariantID("231543432432");
        pushMessageInformation.getVariantInformations().add(variantOne);
        pushMessageInformationDao.update(pushMessageInformation);

        VariantMetricInformation variantThree = new VariantMetricInformation();
        variantThree.setDeliveryStatus(Boolean.FALSE);
        variantThree.setReceivers(300);
        variantThree.setVariantID("23154343243333");
        pushMessageInformation.getVariantInformations().add(variantThree);
        pushMessageInformationDao.update(pushMessageInformation);

        VariantMetricInformation variantFour = new VariantMetricInformation();
        variantFour.setDeliveryStatus(Boolean.FALSE);
        variantFour.setReceivers(1000);
        variantFour.setVariantID("231543432434");
        pushMessageInformation.getVariantInformations().add(variantFour);
        pushMessageInformationDao.update(pushMessageInformation);

        final PushApplication pushApp = new PushApplication();
        pushApp.setName("app");
        pushApp.setPushApplicationID("231231232");
        pushApp.setDeveloper(loginName);
        entityManager.persist(pushApp);

        PushMessageInformation pmi = new PushMessageInformation();
        pmi.setPushApplicationId("231231232");
        pushMessageInformationDao.create(pmi);
View Full Code Here

            @PathParam("pushAppID") String pushApplicationID,
            @Context UriInfo uriInfo,
            @Context HttpServletRequest request) {

        // find the root push app
        PushApplication pushApp = pushAppService.findByPushApplicationIDForDeveloper(pushApplicationID, extractUsername(request));

        if (pushApp == null) {
            return Response.status(Response.Status.NOT_FOUND).entity("Could not find requested PushApplicationEntity").build();
        }
View Full Code Here

    // READ
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Response listAllChromePackagedAppVariationsForPushApp(@Context HttpServletRequest request, @PathParam("pushAppID") String pushApplicationID) {
        final PushApplication application = pushAppService.findByPushApplicationIDForDeveloper(pushApplicationID, extractUsername(request));
        return Response.ok(getVariantsByType(application, ChromePackagedAppVariant.class)).build();
    }
View Full Code Here

     */
    @POST
    @Consumes(MediaType.APPLICATION_JSON)
    public Response send(final Map<String, Object> message, @Context HttpServletRequest request) {

        final PushApplication pushApplication = loadPushApplicationWhenAuthorized(request);
        if (pushApplication == null) {
            return Response.status(Status.UNAUTHORIZED)
                    .header("WWW-Authenticate", "Basic realm=\"AeroGear UnifiedPush Server\"")
                    .entity("Unauthorized Request")
                    .build();
View Full Code Here

TOP

Related Classes of org.jboss.aerogear.unifiedpush.api.PushApplication

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.