You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by to...@apache.org on 2014/10/16 06:30:47 UTC

[05/15] git commit: register devices

register devices


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

Branch: refs/heads/cloudformation-update
Commit: 9c1c57c66da5e53d9cb1086daac77437518ee74a
Parents: dc9211b
Author: Shawn Feldman <sf...@apache.org>
Authored: Tue Oct 14 16:43:16 2014 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Tue Oct 14 16:43:16 2014 -0600

----------------------------------------------------------------------
 .../apns/NotificationsServiceIT.java              | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/9c1c57c6/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 aef4da5..45bd1bb 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
@@ -778,6 +778,22 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
     }
 
     @Test
+    public void deviceTest() throws Exception{
+        app.clear();
+        Entity 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();
+        app.clear();
+        e = app.testRequest(ServiceAction.POST, 1, "users",user1.getUuid(),"devices",device2.getUuid()).getEntity();
+
+        List device1Users = app.getEm().getCollection(device1,"users",null,100, Query.Level.REFS,false).getEntities();
+        assertEquals(device1Users.size(),1);
+        List user1Devices = app.getEm().getCollection(user1,"devices",null,100, Query.Level.REFS,false).getEntities();
+        assertEquals(user1Devices.size(),2);
+
+    }
+
+    @Test
     public void batchTest() throws Exception {
 
         final int NUM_DEVICES = 50;
@@ -881,6 +897,8 @@ public class NotificationsServiceIT extends AbstractServiceNotificationIT {
         String payload = builder.buildWithDefaultMaximumLength();
         return payload;
     }
+
+
     // todo: can't do the following tests here. do it in the REST tier...
     // private Notification postNotification(String path) throws Exception {
     // HashMap<String, Object> properties = new LinkedHashMap<String, Object>();