usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddn...@apache.org
Subject [09/50] incubator-usergrid git commit: Adding test for getIdField() to demonstrate that unique values are not per type as they should be.
Date Mon, 13 Apr 2015 17:45:34 GMT
Adding test for getIdField() to demonstrate that unique values are not per type as they should
be.


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

Branch: refs/heads/USERGRID-536
Commit: b62e76ff1318bc98d1bed39c406219109524fae2
Parents: 09734fa
Author: Dave Johnson <dmjohnson@apigee.com>
Authored: Fri Apr 3 17:00:47 2015 -0400
Committer: Dave Johnson <dmjohnson@apigee.com>
Committed: Fri Apr 3 17:00:47 2015 -0400

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


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b62e76ff/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 252ce1f..e81019b 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
@@ -705,4 +705,33 @@ public class EntityCollectionManagerIT {
         assertFalse( uniqueValues.iterator().hasNext() );
 
     }
+
+
+    @Test
+    public void testGetIdField() throws Exception {
+
+        ApplicationScope context =  new ApplicationScopeImpl( new SimpleId( "organization"
) );
+        EntityCollectionManager manager = factory.createCollectionManager( context );
+
+        // create an entity of type "item" with a unique_id field value = 1
+
+        Entity entity1 = new Entity( new SimpleId( "item" ) );
+        entity1.setField( new StringField( "unique_id", "1", true ));
+        manager.write( entity1 ).toBlocking().last();
+
+        final Observable<Id> idObs = manager.getIdField("item", new StringField("unique_id",
"1"));
+        Id id = idObs.toBlocking().lastOrDefault(null);
+        assertEquals(entity1.getId(), id);
+
+        // create an entity of type "deleted_item" with a unique_id field value = 1
+
+        Entity entity2 = new Entity( new SimpleId( "deleted_item" ) );
+        entity2.setField( new StringField( "unique_id", "1", true ));
+        manager = factory.createCollectionManager( context );
+        manager.write( entity2 ).toBlocking().last();
+
+        final Observable<Id> id2Obs = manager.getIdField("item", new StringField("unique_id",
"1"));
+        Id id2 = id2Obs.toBlocking().lastOrDefault(null);
+        assertEquals(entity2.getId(), id2);
+    }
 }


Mime
View raw message