usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [3/9] incubator-usergrid git commit: New test for getIdField()
Date Mon, 06 Apr 2015 20:50:51 GMT
New test for getIdField()


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

Branch: refs/heads/USERGRID-533-create-app-test
Commit: d159bec75f9ae7a1699ad870a66e634e9d07c605
Parents: fdd7193
Author: Dave Johnson <dmjohnson@apigee.com>
Authored: Fri Apr 3 15:36:14 2015 -0400
Committer: Dave Johnson <dmjohnson@apigee.com>
Committed: Fri Apr 3 15:36:14 2015 -0400

----------------------------------------------------------------------
 .../collection/EntityCollectionManagerIT.java    | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d159bec7/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java
b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java
index f6d9782..53f8052 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java
@@ -719,4 +719,23 @@ public class EntityCollectionManagerIT {
         assertFalse( uniqueValues.iterator().hasNext() );
 
     }
+
+    @Test
+    public void testGetIdField() throws Exception {
+
+        ApplicationScope context =  new ApplicationScopeImpl( new SimpleId( "organization"
) );
+
+        Entity entity1 = new Entity( new SimpleId( "item" ) );
+        entity1.setField( new StringField( "unique_id", "1", true ));
+        EntityCollectionManager manager = factory.createCollectionManager( context );
+        manager.write( entity1 ).toBlocking().last();
+
+        final Observable<Id> idO = manager.getIdField("item", new StringField("unique_id",
"1"));
+        Id id = idO.toBlocking().lastOrDefault(null);
+        assertEquals(entity1.getId(), id);
+
+        final Observable<Id> badIdO = manager.getIdField("deleted_item", new StringField("unique_id",
"1"));
+        Id badId = badIdO.toBlocking().lastOrDefault(null);
+        assertEquals(entity1.getId(), badId );
+    }
 }


Mime
View raw message