Package org.jboss.aerogear.unifiedpush.api

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


        variantTwo.setVariantID("231543432432");
        pmi.getVariantInformations().add(variantTwo);
        pushMessageInformationDao.update(pmi);


        final AndroidVariant androidVariant = new AndroidVariant();
        androidVariant.setGoogleKey("123");
        androidVariant.setVariantID("231543432432");
        androidVariant.setDeveloper(loginName);
        entityManager.persist(androidVariant);

        final AndroidVariant androidVariant1 = new AndroidVariant();
        androidVariant1.setGoogleKey("123");
        androidVariant1.setVariantID("23154343243333");
        androidVariant1.setDeveloper(loginName);
        entityManager.persist(androidVariant1);

        final AndroidVariant androidVariant2 = new AndroidVariant();
        androidVariant2.setGoogleKey("123");
        androidVariant2.setVariantID("231543432434");
        androidVariant2.setDeveloper(loginName);
        entityManager.persist(androidVariant2);

        flushAndClear();

        Map<String, Long> busyVariants = pushMessageInformationDao.findTopThreeBusyVariantIDs(loginName);
View Full Code Here


        variantFour.setReceivers(200);
        variantFour.setVariantID("231543432434");
        pushMessageInformation.getVariantInformations().add(variantFour);
        pushMessageInformationDao.update(pushMessageInformation);

        final AndroidVariant androidVariant = new AndroidVariant();
        androidVariant.setGoogleKey("123");
        androidVariant.setVariantID("231543432432");
        androidVariant.setDeveloper(loginName);
        entityManager.persist(androidVariant);

        final AndroidVariant androidVariant1 = new AndroidVariant();
        androidVariant1.setGoogleKey("123");
        androidVariant1.setVariantID("23154343243333");
        androidVariant1.setDeveloper(loginName);
        entityManager.persist(androidVariant1);

        final AndroidVariant androidVariant2 = new AndroidVariant();
        androidVariant2.setGoogleKey("123");
        androidVariant2.setVariantID("231543432434");
        androidVariant2.setDeveloper("other");
        entityManager.persist(androidVariant2);
        flushAndClear();

        final List<String> variantIDsWithWarnings = pushMessageInformationDao.findVariantIDsWithWarnings(loginName);
View Full Code Here

        entityManager.clear();

        PushApplication pa = pushApplicationDao.find(id);
        assertThat(pa.getId()).isEqualTo(id);

        AndroidVariant av = new AndroidVariant();
        av.setName("Android Variant");
        av.setGoogleKey("KEY...");
        variantDao.create(av);

        Installation androidInstallation1 = new Installation();
        androidInstallation1.setDeviceToken("1234543212232312345432122323123454321223231234543212232312345432122323123454321223231234543212232312345432122323");
        installationDao.create(androidInstallation1);

        androidInstallation1.setVariant(av);
        variantDao.update(av);

        pa.getVariants().add(av);
        pushApplicationDao.update(pa);

        assertThat(installationDao.find(androidInstallation1.getId())).isNotNull();

        pushApplicationDao.delete(pa);
        // flush to be sure that it's in the database
        entityManager.flush();
        // clear the cache otherwise finding the entity will not perform a select but get the entity from cache
        entityManager.clear();

        // Installation should be gone:
        assertThat(installationDao.find(androidInstallation1.getId())).isNull();


        // Variant should be gone:
        assertThat(variantDao.find(av.getId())).isNull();

        // PushApp should be gone:
        assertThat(pushApplicationDao.find(id)).isNull();
    }
View Full Code Here

        final String id = pushApplication1.getId();
        pushApplicationDao.create(pushApplication1);

        PushApplication pa = pushApplicationDao.find(id);

        AndroidVariant av = new AndroidVariant();
        av.setName("Android Variant");
        av.setGoogleKey("KEY...");
        variantDao.create(av);

        iOSVariant ios = new iOSVariant();
        ios.setName("spelling is hard");
        ios.setPassphrase("123");
        ios.setCertificate("12".getBytes());
        variantDao.create(ios);

        Installation androidInstallation1 = new Installation();
        androidInstallation1.setDeviceToken("CSPA91bGDWDdlxW3EmSs2bH7Qlo5AOfbCJtmyOukYxVHq8KKUqpPLBLUjettGYoN2nahBbAe3GgmxKPcZnqEIFFxHw3brKOSmeXjZQuEVehSJTUdJuXUCmR3XweZ2MM455fYMcvkUse1DIp1wjxnik2uHYSNl87wrJzLddoC7tPpgch3eJAf");
        installationDao.create(androidInstallation1);

        Installation androidInstallation2 = new Installation();
        androidInstallation2.setDeviceToken("ASPA91bGDWDdlxW3EmSs2bH7Qlo5AOfbCJtmyOukYxVHq8KKUqpPLBLUjettGYoN2nahBbAe3GgmxKPcZnqEIFFxHw3brKOSmeXjZQuEVehSJTUdJuXUCmR3XweZ2MM455fYMcvkUse1DIp1wjxnik2uHYSNl87wrJzLddoC7tPpgch3eJAf");
        installationDao.create(androidInstallation2);

        Installation iosInstallation1 = new Installation();
        iosInstallation1.setDeviceToken("33ee51dad49a77ca7b45924074bcc4f19aea20308f5feda202fbba3baed7073d7");
        installationDao.create(iosInstallation1);

        androidInstallation1.setVariant(av);
        androidInstallation2.setVariant(av);
        iosInstallation1.setVariant(ios);
        variantDao.update(av);
        variantDao.update(ios);

        pa.getVariants().add(av);
        pa.getVariants().add(ios);
        pushApplicationDao.update(pa);

        // flush to be sure that it's in the database
        entityManager.flush();
        // clear the cache otherwise finding the entity will not perform a select but get the entity from cache
        entityManager.clear();

        final Map<String, Long> result = pushApplicationDao.countInstallationsByType(pushApplication1.getPushApplicationID());

        System.out.println("result = " + result);
        assertThat(result).isNotEmpty();
        assertThat(result.get(av.getVariantID())).isEqualTo(2L);
        assertThat(result.get(ios.getVariantID())).isEqualTo(1L);
    }
View Full Code Here

        final String id = pushApplication1.getId();
        pushApplicationDao.create(pushApplication1);

        PushApplication pa = pushApplicationDao.find(id);

        AndroidVariant av = new AndroidVariant();
        av.setName("Android Variant");
        av.setGoogleKey("KEY...");
        variantDao.create(av);

        AndroidVariant ignored = new AndroidVariant();
        ignored.setName("ignored");
        ignored.setGoogleKey("123");
        variantDao.create(ignored);

        iOSVariant iOSVariant = new iOSVariant();
        iOSVariant.setName("ignored");
        iOSVariant.setCertificate(new byte[1]);
View Full Code Here

        variantSix.setVariantID("231543432432");
        pmi1.getVariantInformations().add(variantSix);
        pushMessageInformationDao.update( pmi1);


        final AndroidVariant androidVariant = new AndroidVariant();
        androidVariant.setGoogleKey("123");
        androidVariant.setVariantID("231543432432");
        androidVariant.setDeveloper(loginName);
        entityManager.persist(androidVariant);

        final AndroidVariant androidVariant1 = new AndroidVariant();
        androidVariant1.setGoogleKey("123");
        androidVariant1.setVariantID("23154343243333");
        androidVariant1.setDeveloper(loginName);
        entityManager.persist(androidVariant1);

        final AndroidVariant androidVariant2 = new AndroidVariant();
        androidVariant2.setGoogleKey("123");
        androidVariant2.setVariantID("231543432434");
        androidVariant2.setDeveloper(loginName);
        entityManager.persist(androidVariant2);

        flushAndClear();

        List<PushMessageInformation> lastActivity = pushMessageInformationDao.findLastThreeActivity(loginName);
View Full Code Here

            @Context HttpServletRequest request,
            @PathParam("pushAppID") String id,
            @PathParam("androidID") String androidID,
            AndroidVariant updatedAndroidApplication) {

        AndroidVariant androidVariant = (AndroidVariant) variantService.findByVariantIDForDeveloper(androidID, extractUsername(request));
        if (androidVariant != null) {

            // some validation
            try {
                validateModelClass(updatedAndroidApplication);
            } catch (ConstraintViolationException cve) {

                // Build and return the 400 (Bad Request) response
                ResponseBuilder builder = createBadRequestResponse(cve.getConstraintViolations());

                return builder.build();
            }

            // apply updated data:
            androidVariant.setGoogleKey(updatedAndroidApplication.getGoogleKey());
            androidVariant.setProjectNumber(updatedAndroidApplication.getProjectNumber());
            androidVariant.setName(updatedAndroidApplication.getName());
            androidVariant.setDescription(updatedAndroidApplication.getDescription());
            variantService.updateVariant(androidVariant);
            return Response.noContent().build();
        }

        return Response.status(Status.NOT_FOUND).entity("Could not find requested Variant").build();
View Full Code Here

        variantTwo.setReceivers(2000);
        variantTwo.setVariantID("231543432432");
        pmi.getVariantInformations().add(variantTwo);
        pushMessageInformationDao.update(pmi);

        final AndroidVariant androidVariant = new AndroidVariant();
        androidVariant.setGoogleKey("123");
        androidVariant.setVariantID("231543432432");
        androidVariant.setDeveloper(loginName);
        entityManager.persist(androidVariant);

        final AndroidVariant androidVariant1 = new AndroidVariant();
        androidVariant1.setGoogleKey("123");
        androidVariant1.setVariantID("23154343243333");
        androidVariant1.setDeveloper(loginName);
        entityManager.persist(androidVariant1);

        final AndroidVariant androidVariant2 = new AndroidVariant();
        androidVariant2.setGoogleKey("123");
        androidVariant2.setVariantID("231543432434");
        androidVariant2.setDeveloper(loginName);
        entityManager.persist(androidVariant2);

        flushAndClear();

        List<PushMessageInformation> lastActivity = pushMessageInformationDao.findLastThreeActivity(loginName);
View Full Code Here

        variantFour.setReceivers(200);
        variantFour.setVariantID("231543432434");
        pushMessageInformation.getVariantInformations().add(variantFour);
        pushMessageInformationDao.update(pushMessageInformation);

        final AndroidVariant androidVariant = new AndroidVariant();
        androidVariant.setGoogleKey("123");
        androidVariant.setVariantID("231543432432");
        androidVariant.setDeveloper(loginName);
        entityManager.persist(androidVariant);

        final AndroidVariant androidVariant1 = new AndroidVariant();
        androidVariant1.setGoogleKey("123");
        androidVariant1.setVariantID("23154343243333");
        androidVariant1.setDeveloper(loginName);
        entityManager.persist(androidVariant1);

        final AndroidVariant androidVariant2 = new AndroidVariant();
        androidVariant2.setGoogleKey("123");
        androidVariant2.setVariantID("231543432434");
        androidVariant2.setDeveloper("other");
        entityManager.persist(androidVariant2);
        flushAndClear();

        final List<String> variantIDsWithWarnings = pushMessageInformationDao.findVariantIDsWithWarnings(loginName);
View Full Code Here

    }

    @Test
    public void updateAndDeleteVariant() {

        final AndroidVariant av = new AndroidVariant();
        av.setGoogleKey("KEY");
        av.setDeveloper("admin");
        final String uuid  = av.getVariantID();

        variantDao.create(av);

        AndroidVariant queriedVariant = (AndroidVariant) variantDao.findByVariantID(uuid);
        final String primaryKey = queriedVariant.getId();
        assertThat(queriedVariant).isNotNull();
        assertThat(queriedVariant.getGoogleKey()).isEqualTo("KEY");

        queriedVariant.setGoogleKey("NEW_KEY");
        variantDao.update(queriedVariant);

        queriedVariant = (AndroidVariant) variantDao.findByVariantID(uuid);
        assertThat(queriedVariant).isNotNull();
        assertThat(queriedVariant.getGoogleKey()).isEqualTo("NEW_KEY");
        assertThat(queriedVariant.getId()).isEqualTo(primaryKey);

        variantDao.delete(queriedVariant);
        assertThat(variantDao.findByVariantID(uuid)).isNull();
    }
View Full Code Here

TOP

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

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.