You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2014/10/15 21:40:34 UTC

git commit: fix service

Repository: incubator-usergrid
Updated Branches:
  refs/heads/delete-device-connections b5470f197 -> 3b1276650


fix service


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/3b127665
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/3b127665
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/3b127665

Branch: refs/heads/delete-device-connections
Commit: 3b1276650eb1da5e7cab64c94a79a9a00a283d98
Parents: b5470f1
Author: Shawn Feldman <sf...@apache.org>
Authored: Wed Oct 15 13:39:55 2014 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Wed Oct 15 13:39:55 2014 -0600

----------------------------------------------------------------------
 .../notifications/NotificationsService.java     |   5 +-
 .../apns/NotificationsServiceIT.java            | 108 ++-----------
 .../gcm/NotificationsServiceIT.java             | 153 ++-----------------
 3 files changed, 27 insertions(+), 239 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3b127665/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java b/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java
index 36c3a14..ee5c1cb 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/notifications/NotificationsService.java
@@ -60,7 +60,6 @@ public class NotificationsService extends AbstractCollectionService {
     private static final int PAGE = 100;
     private static final Logger LOG = LoggerFactory.getLogger(NotificationsService.class);
     //need a mocking framework, this is to substitute for no mocking
-    public static PathQuery<Device> TEST_PATH_QUERY = null;
     public static QueueManager TEST_QUEUE_MANAGER = null;
 
     public static final String NOTIFIER_ID_POSTFIX = ".notifier.id";
@@ -139,7 +138,7 @@ public class NotificationsService extends AbstractCollectionService {
         postMeter.mark();
         try {
             validate(null, context.getPayload());
-            PathQuery<Device> pathQuery = TEST_PATH_QUERY != null ? TEST_PATH_QUERY : getPathQuery(context.getRequest().getOriginalParameters());
+            PathQuery<Device> pathQuery = getPathQuery(context.getRequest().getOriginalParameters());
             context.getProperties().put("state", Notification.State.CREATED);
             context.getProperties().put("pathQuery", pathQuery);
             context.setOwner(sm.getApplication());
@@ -177,7 +176,7 @@ public class NotificationsService extends AbstractCollectionService {
             org.apache.usergrid.persistence.index.query.Query query = sp.getQuery();
             if (query == null) {
                 query = new Query();
-                if(sp.isName() && !sp.getName().equals("notifications")) {
+                if(!sp.isName() ||  (sp.isName() && !sp.getName().equals("notifications"))) {
                     query.addIdentifier(sp.getIdentifier());
                 }
             }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3b127665/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
index 76dbed3..905483e 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/notifications/apns/NotificationsServiceIT.java
@@ -117,41 +117,16 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         user1 = app.getEm().create(user1);
 
         // create User
-         user2 = new User();
+        user2 = new User();
         user2.setUsername("user2");
         user2.setEmail("user2@usergrid.org");
         user2 = app.getEm().create(user2);
 
-        app.clear();
-        e = app.testRequest(ServiceAction.POST, 1, "users",user2.getUuid(),"devices",device1.getUuid()).getEntity();
-        app.clear();
-        e = app.testRequest(ServiceAction.POST, 1, "users",user1.getUuid(),"devices",device1.getUuid()).getEntity();
-        List device1Users = app.getEm().getCollection(device1,"users",null,100, Query.Level.REFS,false).getEntities();
-        assertEquals(device1Users.size(),1);
-
-        app.clear();
-        e = app.testRequest(ServiceAction.POST, 1, "users",user1.getUuid(),"devices",device2.getUuid()).getEntity();
-
-
-        // create Group
-        group1 = new Group();
-        group1.setPath("path");
-        group1 = app.getEm().create(group1);
-        app.getEm().createConnection(group1, "users", user1);
-
         ns = getNotificationService();
 
         TestQueueManager qm = new TestQueueManager();
         ns.TEST_QUEUE_MANAGER = qm;
 
-        Query query = new Query();
-        //query.addIdentifier(sp.getIdentifier());
-        query.setLimit(100);
-        query.setCollection("devices");
-        query.setResultsLevel(Query.Level.ALL_PROPERTIES);
-        PathQuery pathQuery = new PathQuery( new SimpleEntityRef(app.getEm().getApplicationRef()), query);
-
-        ns.TEST_PATH_QUERY = pathQuery;
         app.getEm().refreshIndex();
 
         listener = new QueueListener(ns.getServiceManagerFactory(),ns.getEntityManagerFactory(),ns.getMetricsFactory(), new Properties());
@@ -177,13 +152,6 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
 
         // give queue manager a query for loading 100 devices from an application (why?)
         app.clear();
-        Query pQuery = new Query();
-        pQuery.setLimit(100);
-        pQuery.setCollection("devices");
-        pQuery.setResultsLevel(Query.Level.ALL_PROPERTIES);
-        pQuery.addIdentifier(new ServiceParameter.NameParameter(device1.getUuid().toString()).getIdentifier());
-        ns.TEST_PATH_QUERY =  new PathQuery( new SimpleEntityRef(app.getEm().getApplicationRef()), pQuery);
-
         // create a "hellow world" notification
         String payload = getPayload();
         Map<String, String> payloads = new HashMap<String, String>(1);
@@ -193,7 +161,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         app.put("debug",true);
 
         // post notification to service manager
-        Entity e = app.testRequest(ServiceAction.POST, 1, "notifications").getEntity();
+        Entity e = app.testRequest(ServiceAction.POST, 1,"devices",device1.getUuid(), "notifications").getEntity();
 
         // ensure notification it was created
         app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid());
@@ -270,14 +238,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         app.put("queued", System.currentTimeMillis());
         app.put("debug",true);
 
-        Query pQuery = new Query();
-        pQuery.setLimit(100);
-        pQuery.setCollection("devices");
-        pQuery.setResultsLevel(Query.Level.ALL_PROPERTIES);
-        pQuery.addIdentifier(new ServiceParameter.NameParameter("1234").getIdentifier());
-        ns.TEST_PATH_QUERY =   new PathQuery( new SimpleEntityRef(app.getEm().getApplicationRef()), pQuery);
-        e = app.testRequest(ServiceAction.POST, 1, "notifications").getEntity();
-        app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid());
+        app.testRequest(ServiceAction.GET, 1,  "notifications", e.getUuid());
 
         Notification notification = app.getEm().get(e.getUuid(),  Notification.class);
         assertEquals(
@@ -326,7 +287,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         app.put("queued", System.currentTimeMillis());
         app.put("debug",true);
 
-        Entity e = app.testRequest(ServiceAction.POST, 1, "notifications")
+        Entity e = app.testRequest(ServiceAction.POST, 1,"devices",device1.getUuid(), "notifications")
                 .getEntity();
         app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid());
 
@@ -387,7 +348,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         app.put("payloads", payloads);
         payloads.put("xxx", "");
         try {
-            Entity e = app.testRequest(ServiceAction.POST, 1, "notifications")
+            Entity e = app.testRequest(ServiceAction.POST, 1,"devices",device1.getUuid(), "notifications")
                     .getEntity();
             fail("invalid payload should have been rejected");
         } catch (IllegalArgumentException ex) {
@@ -466,7 +427,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         properties.put("queued", System.currentTimeMillis());
         properties.put("debug",true);
 
-        Entity e = app.testRequest(ServiceAction.POST, 1, "notifications")
+        Entity e = app.testRequest(ServiceAction.POST, 1,"devices",device1.getUuid(), "notifications")
                 .getEntity();
         app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid());
 
@@ -502,7 +463,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         app.put("queued", System.currentTimeMillis());
         app.put("debug",true);
 
-        Entity e = app.testRequest(ServiceAction.POST, 1, "notifications").getEntity();
+        Entity e = app.testRequest(ServiceAction.POST, 1, "notifications",";ql=notifications").getEntity();
         app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid());
 
         Notification notification = app.getEm().get(e.getUuid(),Notification.class);
@@ -560,7 +521,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         app.put("queued", System.currentTimeMillis());
         app.put("debug",true);
 
-        e = app.testRequest(ServiceAction.POST, 1, "notifications").getEntity();
+        e = app.testRequest(ServiceAction.POST, 1, "notifications",";ql=notifications").getEntity();
         app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid());
 
         app.getEm().refreshIndex();
@@ -621,7 +582,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         app.put("queued", System.currentTimeMillis());
         app.put("debug",true);
 
-        e = app.testRequest(ServiceAction.POST, 1, "notifications").getEntity();
+        e = app.testRequest(ServiceAction.POST, 1,"devices",device1.getUuid(), "notifications").getEntity();
         app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid());
 
         app.getEm().refreshIndex();
@@ -689,7 +650,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         app.put("queued", System.currentTimeMillis());
         app.put("debug",true);
 
-        e = app.testRequest(ServiceAction.POST, 1, "notifications").getEntity();
+        e = app.testRequest(ServiceAction.POST, 1,"devices",device1.getUuid(), "notifications").getEntity();
         app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid());
 
         Notification notification = app.getEm().get(e.getUuid(),
@@ -746,7 +707,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         app.put("queued", System.currentTimeMillis());
         app.put("debug",true);
 
-        Entity e = app.testRequest(ServiceAction.POST, 1, "notifications")
+        Entity e = app.testRequest(ServiceAction.POST, 1,"devices",device1.getUuid(), "notifications")
                 .getEntity();
         app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid());
 
@@ -797,8 +758,6 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
 
         // give queue manager a query for loading 100 devices from an application (why?)
         app.clear();
-        ns.TEST_PATH_QUERY =  null;
-
         // create a "hello world" notification
         String payload = getPayload();
         Map<String, String> payloads = new HashMap<String, String>(1);
@@ -883,7 +842,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         app.put("debug",true);
 
         // create a notification
-        entity = app.testRequest(ServiceAction.POST, 1, "notifications").getEntity();
+        entity = app.testRequest(ServiceAction.POST, 1, "notifications",";ql=notifications").getEntity();
         app.testRequest(ServiceAction.GET, 1, "notifications", entity.getUuid());
         app.getEm().refreshIndex();
 
@@ -900,49 +859,6 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
 //        checkStatistics(notification, NUM_DEVICES, 0);
     }
 
-    @Ignore("Run only if you need to.")
-    @Test
-    public void loadTest() throws Exception {
-
-        MockSuccessfulProviderAdapter.install(ns, true);
-
-        final int NUM_DEVICES = 10000;
-
-        app.clear();
-        String payload = getPayload();
-        Map<String, String> payloads = new HashMap<String, String>(1);
-        payloads.put(notifier.getUuid().toString(), payload);
-        app.put("payloads", payloads);
-        app.put("queued", System.currentTimeMillis());
-        app.put("debug",true);
-
-        // create a notification
-        Entity e = app.testRequest(ServiceAction.POST, 1, "notifications")
-                .getEntity();
-        app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid());
-        Notification notification = (Notification) e.toTypedEntity();
-
-        // create a bunch of devices and add them to the notification
-        app.clear();
-        app.put(notifier.getName() + NOTIFIER_ID_POSTFIX, PUSH_TOKEN);
-        for (int i = 0; i < NUM_DEVICES; i++) {
-            Entity entity = app.getEm().create("device", app.getProperties());
-            ns.addDevice(notification, entity);
-        }
-
-        long time = System.currentTimeMillis();
-        LOG.error("START DELIVERY OF {} NOTIFICATIONS", NUM_DEVICES);
-
-        // perform push //
-        notification = scheduleNotificationAndWait(notification);
-        LOG.error("END DELIVERY OF {} NOTIFICATIONS ({})", NUM_DEVICES,
-                System.currentTimeMillis() - time);
-
-        // check receipts //
-        checkReceipts(notification, NUM_DEVICES);
-        checkStatistics(notification, NUM_DEVICES, 0);
-    }
-
     private String getPayload(){
         ApnsPayloadBuilder builder = new ApnsPayloadBuilder();
         builder.setAlertBody("Hello, World!");

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3b127665/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
index 81f1f77..7143413 100644
--- a/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/services/notifications/gcm/NotificationsServiceIT.java
@@ -88,8 +88,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         app.clear();
         app.put(key, PUSH_TOKEN);
 
-        Entity e = app.testRequest(ServiceAction.POST, 1, "devices")
-                .getEntity();
+        Entity e = app.testRequest(ServiceAction.POST, 1, "devices") .getEntity();
         app.testRequest(ServiceAction.GET, 1, "devices", e.getUuid());
 
         device1 = app.getEm().get(e.getUuid(), Device.class);
@@ -103,16 +102,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         TestQueueManager qm = new TestQueueManager();
         ns.TEST_QUEUE_MANAGER = qm;
 
-        Query query = new Query();
-        //query.addIdentifier(sp.getIdentifier());
-        query.setLimit(100);
-        query.setCollection("devices");
-        query.setResultsLevel(Query.Level.ALL_PROPERTIES);
-        PathQuery pathQuery =  new PathQuery(new SimpleEntityRef(  app.getEm().getApplicationRef()), query);
-
-        ns.TEST_PATH_QUERY = pathQuery;
-        listener = new QueueListener(ns.getServiceManagerFactory(),
-                ns.getEntityManagerFactory(),ns.getMetricsFactory(), new Properties());
+        listener = new QueueListener(ns.getServiceManagerFactory(), ns.getEntityManagerFactory(),ns.getMetricsFactory(), new Properties());
         listener.DEFAULT_SLEEP = 200;
         listener.TEST_QUEUE_MANAGER = qm;
         listener.start();
@@ -146,7 +136,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         app.put("debug",true);
         app.put("queued", System.currentTimeMillis());
 
-        Entity e = app.testRequest(ServiceAction.POST, 1, "notifications")
+        Entity e = app.testRequest(ServiceAction.POST, 1,"devices",device1.getUuid(), "notifications")
                 .getEntity();
         app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid());
 
@@ -161,13 +151,6 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
     @Test
     public void singlePushNotification() throws Exception {
 
-        Query pQuery = new Query();
-        pQuery.setLimit(100);
-        pQuery.setCollection("devices");
-        pQuery.setResultsLevel(Query.Level.ALL_PROPERTIES);
-        pQuery.addIdentifier(new ServiceParameter.NameParameter(device1.getUuid().toString()).getIdentifier());
-        ns.TEST_PATH_QUERY =  new PathQuery(new SimpleEntityRef( app.getEm().getApplicationRef()), pQuery);
-
         app.clear();
         String payload = "Hello, World!";
         Map<String, String> payloads = new HashMap<String, String>(1);
@@ -176,7 +159,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         app.put("queued", System.currentTimeMillis());
         app.put("debug",true);
 
-        Entity e = app.testRequest(ServiceAction.POST, 1, "notifications").getEntity();
+        Entity e = app.testRequest(ServiceAction.POST, 1, "devices",device1.getUuid(),"notifications").getEntity();
         app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid());
 
         Notification notification = app.getEm().get(e.getUuid(), Notification.class);
@@ -205,14 +188,6 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
                 user.getUuid(), "devices", device1.getUuid()).getEntity();
         assertEquals(device.getUuid(), device1.getUuid());
 
-        // create path query to search in user's device collection for device by UUID
-        Query pQuery = new Query();
-        pQuery.setLimit(100);
-        pQuery.setCollection("devices");
-        pQuery.setResultsLevel(Query.Level.ALL_PROPERTIES);
-        pQuery.addIdentifier(new ServiceParameter.NameParameter(
-            device.getUuid().toString()).getIdentifier()); 
-        ns.TEST_PATH_QUERY =  new PathQuery( user, pQuery );
 
         // create and post notification 
         String payload = "Hello, World!";
@@ -221,7 +196,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         app.put("payloads", payloads);
         app.put("queued", System.currentTimeMillis());
         app.put("debug",true);
-        Entity e = app.testRequest(ServiceAction.POST, 1, "notifications").getEntity();
+        Entity e = app.testRequest(ServiceAction.POST, 1,"users","asdf", "notifications").getEntity();
         app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid());
 
         app.getEm().refreshIndex();
@@ -246,12 +221,10 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         app.put("queued", System.currentTimeMillis());
         app.put("debug",true);
 
-        Entity e = app.testRequest(ServiceAction.POST, 1, "notifications")
-                .getEntity();
+        Entity e = app.testRequest(ServiceAction.POST, 1, "notifications",";ql=notifications")   .getEntity();
         app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid());
 
-        Notification notification = app.getEm().get(e.getUuid(),
-                Notification.class);
+        Notification notification = app.getEm().get(e.getUuid(),  Notification.class);
         assertEquals(
                 notification.getPayloads().get(notifier.getUuid().toString()),
                 payload);
@@ -297,7 +270,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         app.put("queued", System.currentTimeMillis());
         app.put("debug",true);
 
-        Entity e = app.testRequest(ServiceAction.POST, 1, "notifications")
+        Entity e = app.testRequest(ServiceAction.POST, 1,"devices",device1.getUuid(), "notifications")
                 .getEntity();
         app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid());
 
@@ -328,7 +301,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         app.put("debug",true);
 
         try {
-            app.testRequest(ServiceAction.POST, 1, "notifications");
+            app.testRequest(ServiceAction.POST, 1,"devices",device1.getUuid(), "notifications");
             fail("invalid payload should have been rejected");
         } catch (IllegalArgumentException ex) {
             // ok
@@ -340,7 +313,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         app.put("payloads", payloads);
         payloads.put("xxx", "");
         try {
-            app.testRequest(ServiceAction.POST, 1, "notifications");
+            app.testRequest(ServiceAction.POST, 1,"devices",device1.getUuid(), "notifications");
             fail("invalid payload should have been rejected");
         } catch (IllegalArgumentException ex) {
             // ok
@@ -372,7 +345,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         app.put("debug",true);
 
         try {
-            app.testRequest(ServiceAction.POST, 1, "notifications");
+            app.testRequest(ServiceAction.POST, 1, "devices",device1.getUuid(),"notifications");
             fail("invalid payload should have been rejected");
         } catch (Exception ex) {
             assertEquals("java.lang.IllegalArgumentException: GCM payloads must be 4096 characters or less",
@@ -410,7 +383,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         app.put("queued", System.currentTimeMillis());
         app.put("debug",true);
 
-        Entity e = app.testRequest(ServiceAction.POST, 1, "notifications")
+        Entity e = app.testRequest(ServiceAction.POST, 1, "devices",device1.getUuid(),"notifications")
                 .getEntity();
         app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid());
 
@@ -467,7 +440,7 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         app.put("queued", System.currentTimeMillis());
         app.put("debug",true);
 
-        Entity e = app.testRequest(ServiceAction.POST, 1, "notifications")
+        Entity e = app.testRequest(ServiceAction.POST, 1,"devices",device1.getUuid(), "notifications")
                 .getEntity();
         app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid());
 
@@ -488,104 +461,4 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         fail("Should have received a ConnectionException");
     }
 
-    @Ignore("Run only if you need to.")
-    @Test
-    public void loadTest() throws Exception {
-
-        final int NUM_DEVICES = 10000;
-
-        // create notification //
-
-        HashMap<String, Object> properties = new LinkedHashMap<String, Object>();
-        String payload = "Hello, World!";
-        Map<String, String> payloads = new HashMap<String, String>(1);
-        payloads.put(notifier.getUuid().toString(), payload);
-        properties.put("payloads", payloads);
-        properties.put("queued", System.currentTimeMillis());
-        properties.put("debug",true);
-
-        Entity e = app.testRequest(ServiceAction.POST, 1, "notifications")
-                .getEntity();
-        app.testRequest(ServiceAction.GET, 1, "notifications", e.getUuid());
-
-        Notification notification = app.getEm().get(e.getUuid(),
-                Notification.class);
-        assertEquals(
-                notification.getPayloads().get(notifier.getUuid().toString()),
-                payload);
-
-        // create a bunch of devices and add them to the notification
-        properties = new LinkedHashMap<String, Object>();
-        properties.put(notifier.getName() + NOTIFIER_ID_POSTFIX, PUSH_TOKEN);
-        for (int i = 0; i < NUM_DEVICES; i++) {
-            Entity entity = app.getEm().create("device", properties);
-            ns.addDevice(notification, entity);
-        }
-
-        long time = System.currentTimeMillis();
-        logger.error("START DELIVERY OF {} NOTIFICATIONS", NUM_DEVICES);
-
-        // perform push //
-        notification = scheduleNotificationAndWait(notification);
-        logger.error("END DELIVERY OF {} NOTIFICATIONS ({})", NUM_DEVICES,
-                System.currentTimeMillis() - time);
-
-        // check receipts //
-        checkReceipts(notification, NUM_DEVICES);
-        checkStatistics(notification, NUM_DEVICES, 0);
-    }
-
-    // @Test
-    // public void inactiveDeviceUpdate() throws Exception {
-    //
-    // if (!USE_REAL_CONNECTIONS) {
-    // // mock action (based on verified actual behavior) //
-    // NotificationsService.providerAdapters.put("apple", new
-    // MockSuccessfulProviderAdapter() {
-    // public Map<String,Date> getInactiveDevices(Notifier notifier,
-    // EntityManager em) throws Exception {
-    // return Collections.singletonMap(PUSH_TOKEN, new Date());
-    // }
-    // });
-    // }
-    //
-    // // create push notification //
-    //
-    // HashMap<String, Object> properties = new LinkedHashMap<String, Object>();
-    // String payload =
-    // APNS.newPayload().alertBody("Hello, World!").sound("chime").build();
-    // Map<String, String> payloads = new HashMap<String, String>(1);
-    // payloads.put(notifier.getUuid().toString(), payload);
-    // properties.put("payloads", payloads);
-    // properties.put("queued", System.currentTimeMillis());
-    //
-    // Entity e = testRequest(sm, ServiceAction.POST, 1, properties,
-    // "notifications").getEntity();
-    // testRequest(sm, ServiceAction.GET, 1, null, "notifications",
-    // e.getUuid());
-    //
-    // Notification notification = em.get(e.getUuid(), Notification.class);
-    // assertEquals(notification.getPayloads().get(notifier.getUuid().toString()),
-    // payload);
-    //
-    // ns.addDevice(notification, device1);
-    // ns.addDevice(notification, device2);
-    //
-    // assertNotNull(device1.getProperty(notifier.getName() +
-    // NOTIFIER_ID_POSTFIX));
-    // assertNotNull(device2.getProperty(notifier.getName() +
-    // NOTIFIER_ID_POSTFIX));
-    //
-    // // perform push //
-    // notification = scheduleNotificationAndWait(notification);
-    //
-    // // check provider IDs //
-    //
-    // device1 = em.get(device1, Device.class);
-    // assertNull(device1.getProperty(notifier.getName() +
-    // NOTIFIER_ID_POSTFIX));
-    // device2 = em.get(device2, Device.class);
-    // assertNull(device2.getProperty(notifier.getName() +
-    // NOTIFIER_ID_POSTFIX));
-    // }
 }