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/11/18 04:17:25 UTC

incubator-usergrid git commit: Fixes CollectionIT app scopes

Repository: incubator-usergrid
Updated Branches:
  refs/heads/two-dot-o b1aa75e8d -> c28edda3c


Fixes CollectionIT app scopes


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

Branch: refs/heads/two-dot-o
Commit: c28edda3c8ffc58283b7ddbf799b1a7c3ce210b0
Parents: b1aa75e
Author: Todd Nine <tn...@apigee.com>
Authored: Mon Nov 17 20:17:19 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Mon Nov 17 20:17:19 2014 -0700

----------------------------------------------------------------------
 .../usergrid/persistence/CollectionIT.java      | 188 +++++--------------
 1 file changed, 46 insertions(+), 142 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c28edda3/stack/core/src/test/java/org/apache/usergrid/persistence/CollectionIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/CollectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/CollectionIT.java
index a201d85..23983e1 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/CollectionIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/CollectionIT.java
@@ -215,10 +215,8 @@ public class
     public void userFirstNameSearch() throws Exception {
         LOG.debug( "userFirstNameSearch" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testFirstName" );
-        assertNotNull( applicationId );
 
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         String firstName = "firstName" + UUIDUtils.newTimeUUID();
@@ -279,10 +277,7 @@ public class
     public void userMiddleNameSearch() throws Exception {
         LOG.debug( "userMiddleNameSearch" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testMiddleName" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         String middleName = "middleName" + UUIDUtils.newTimeUUID();
@@ -315,10 +310,7 @@ public class
     public void userLastNameSearch() throws Exception {
         LOG.debug( "userLastNameSearch" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testLastName" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         String lastName = "lastName" + UUIDUtils.newTimeUUID();
@@ -351,10 +343,7 @@ public class
     public void testGroups() throws Exception {
         LOG.debug( "testGroups" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testGroups" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         Map<String, Object> properties = new LinkedHashMap<String, Object>();
@@ -400,10 +389,7 @@ public class
     public void groupNameSearch() throws Exception {
         LOG.debug( "groupNameSearch" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "groupNameSearch" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         String groupName = "groupName" + UUIDUtils.newTimeUUID();
@@ -436,10 +422,7 @@ public class
     public void groupTitleSearch() throws Exception {
         LOG.debug( "groupTitleSearch" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "groupTitleSearch" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         String titleName = "groupName" + UUIDUtils.newTimeUUID();
@@ -472,10 +455,7 @@ public class
     public void testSubkeys() throws Exception {
         LOG.debug( "testSubkeys" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testSubkeys" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         Map<String, Object> properties = new LinkedHashMap<String, Object>();
@@ -525,10 +505,7 @@ public class
     public void emptyQuery() throws Exception {
         LOG.debug( "emptyQuery" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testEmptyQuery" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         String firstName = "firstName" + UUIDUtils.newTimeUUID();
@@ -571,10 +548,7 @@ public class
     public void emptyQueryReverse() throws Exception {
         LOG.debug( "emptyQueryReverse" );
 
-        UUID applicationId = setup.createApplication( "emptyQueryReverseOrg", "testEmptyQueryReverseApp" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         String firstName = "firstName" + UUIDUtils.newTimeUUID();
@@ -618,10 +592,7 @@ public class
     public void orQuery() throws Exception {
         LOG.debug( "orQuery" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "orQuery" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         Map<String, Object> properties = new LinkedHashMap<String, Object>();
@@ -700,10 +671,7 @@ public class
     public void andQuery() throws Exception {
         LOG.debug( "andQuery" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "andQuery" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         Map<String, Object> properties = new LinkedHashMap<String, Object>();
@@ -764,10 +732,7 @@ public class
     public void notQuery() throws Exception {
         LOG.debug( "notQuery" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "notQuery" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         Map<String, Object> properties = new LinkedHashMap<String, Object>();
@@ -842,10 +807,7 @@ public class
 
     @Test
     public void notSubObjectQuery() throws Exception {
-        UUID applicationId = setup.createApplication( "testOrganization", "notSubObjectQuery" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         // create two game entities, each with an array of entities that have subField = 'Foo'
@@ -903,10 +865,7 @@ public class
     public void testKeywordsOrQuery() throws Exception {
         LOG.debug( "testKeywordsOrQuery" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testKeywordsOrQuery" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         Map<String, Object> properties = new LinkedHashMap<String, Object>();
@@ -937,10 +896,7 @@ public class
     public void testKeywordsAndQuery() throws Exception {
         LOG.debug( "testKeywordsOrQuery" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testKeywordsAndQuery" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         Map<String, Object> properties = new LinkedHashMap<String, Object>();
@@ -975,10 +931,7 @@ public class
         LOG.debug( "pagingAfterDelete" );
 
         
-        UUID applicationId = setup.createApplication( "testOrganization", "pagingAfterDelete" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         int size = 20;
@@ -1045,11 +998,7 @@ public class
     public void pagingLessThanWithCriteria() throws Exception {
         LOG.debug( "pagingLessThanWithCriteria" );
 
-
-        UUID applicationId = setup.createApplication( "testOrganization", "pagingLessThanWithCriteria" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         int size = 40;
@@ -1102,10 +1051,7 @@ public class
         LOG.debug( "pagingGreaterThanWithCriteria" );
 
 
-        UUID applicationId = setup.createApplication( "testOrganization", "pagingGreaterThanWithCriteria" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         int size = 40;
@@ -1157,10 +1103,7 @@ public class
     public void pagingWithBoundsCriteria() throws Exception {
         LOG.debug( "pagingWithBoundsCriteria" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "pagingWithBoundsCriteria" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         int size = 40;
@@ -1212,10 +1155,7 @@ public class
     public void testPagingWithGetNextResults() throws Exception {
         LOG.debug( "testPagingWithGetNextResults" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "pagingWithBoundsCriteria2" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         int size = 40;
@@ -1260,6 +1200,10 @@ public class
 
     @Test
     public void subpropertyQuerying() throws Exception {
+
+        EntityManager em = app.getEntityManager();
+        assertNotNull( em );
+
         LOG.debug( "subpropertyQuerying" );
 
         Map<String, Object> root = new HashMap<String, Object>();
@@ -1273,11 +1217,7 @@ public class
 
         root.put( "subentity", subEntity );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "subpropertyQuerying" );
-        assertNotNull( applicationId );
 
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
-        assertNotNull( em );
 
         Entity saved = em.create( "test", root );
 
@@ -1317,6 +1257,8 @@ public class
 
     @Test
     public void arrayQuerying() throws Exception {
+        EntityManager em = app.getEntityManager();
+        assertNotNull( em );
         LOG.debug( "arrayQuerying" );
 
 
@@ -1327,11 +1269,6 @@ public class
 
         Map<String, Object> jsonData = ( Map<String, Object> ) JsonUtils.parse( JsonUtils.mapToJsonString( root ) );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "arrayQuerying" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
-        assertNotNull( em );
 
         Entity saved = em.create( "test", jsonData );
 
@@ -1387,17 +1324,15 @@ public class
 
     @Test
     public void stringWithSpaces() throws Exception {
+        EntityManager em = app.getEntityManager();
+        assertNotNull( em );
+
         LOG.debug( "stringWithSpaces" );
 
         Map<String, Object> props = new HashMap<String, Object>();
 
         props.put( "myString", "My simple string" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "stringWithSpaces" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
-        assertNotNull( em );
 
         Entity saved = em.create( "test", props );
 
@@ -1417,12 +1352,10 @@ public class
     @Test
     public void testSelectTerms() throws Exception {
         LOG.debug( "testSelectTerms" );
+        EntityManager em = app.getEntityManager();
+                assertNotNull( em );
 
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testSelectTerms" );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
-
         Map<String, Object> properties = new LinkedHashMap<String, Object>();
         properties.put( "username", "edanuff" );
         properties.put( "email", "ed@anuff.com" );
@@ -1450,10 +1383,8 @@ public class
     public void testRedefineTerms() throws Exception {
         LOG.debug( "testRedefineTerms" );
 
-
-        UUID applicationId = setup.createApplication( "testOrganization", "testRedefineTerms" );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
+        assertNotNull( em );
 
         Map<String, Object> properties = new LinkedHashMap<String, Object>();
         properties.put( "username", "edanuff" );
@@ -1484,10 +1415,8 @@ public class
     public void testSelectEmailViaConnection() throws Exception {
         LOG.debug( "testSelectEmailViaConnection" );
 
-
-        UUID applicationId = setup.createApplication( "testOrganization", "testSelectEmail" );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
+        assertNotNull( em );
 
         Map<String, Object> properties = new LinkedHashMap<String, Object>();
         properties.put( "username", "ed@anuff.com" );
@@ -1541,9 +1470,8 @@ public class
         LOG.debug( "testNotQueryAnd" );
 
 
-        UUID applicationId = setup.createApplication( "testOrganization", "testNotQueryAnd" );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
+        assertNotNull( em );
 
         Map<String, Object> location = new LinkedHashMap<String, Object>();
         location.put( "Place", "24 Westminster Avenue, Venice, CA 90291, USA" );
@@ -1609,10 +1537,7 @@ public class
         LOG.debug( "runtimeTypeCorrect" );
 
 
-        UUID applicationId = setup.createApplication( "testOrganization", "runtimeTypeCorrect" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         int size = 20;
@@ -1649,11 +1574,7 @@ public class
     public void badOrderByBadGrammarAsc() throws Exception {
         LOG.debug( "badOrderByBadGrammarAsc" );
 
-
-        UUID applicationId = setup.createApplication( "testOrganization", "badOrderByBadGrammarAsc" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         String s = "select * where name = 'bob' order by";
@@ -1683,10 +1604,7 @@ public class
     public void badOrderByBadGrammarDesc() throws Exception {
         LOG.debug( "badOrderByBadGrammarDesc" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "badOrderByBadGrammarDesc" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         String s = "select * where name = 'bob' order by";
@@ -1717,10 +1635,7 @@ public class
     public void uuidIdentifierTest() throws Exception {
         LOG.debug( "uuidIdentifierTest" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "uuidIdentifierTest" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         Map<String, Object> properties = new LinkedHashMap<String, Object>();
@@ -1751,12 +1666,10 @@ public class
     public void nameIdentifierTest() throws Exception {
         LOG.debug( "nameIdentifierTest" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "nameIdentifierTest" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
+
         Map<String, Object> properties = new LinkedHashMap<String, Object>();
         properties.put( "keywords", "blah,test,game" );
         properties.put( "title", "Solitaire" );
@@ -1787,10 +1700,7 @@ public class
     public void emailIdentifierTest() throws Exception {
         LOG.debug( "emailIdentifierTest" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "emailIdentifierTest" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         User user = new User();
@@ -1824,10 +1734,7 @@ public class
     public void duplicateIdentifierTest() throws Exception {
         LOG.debug( "duplicateIdentifierTest" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "duplicateIdentifierTest" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         User user = new User();
@@ -1849,10 +1756,7 @@ public class
     public void duplicateNameTest() throws Exception {
         LOG.debug( "duplicateNameTest" );
 
-        UUID applicationId = setup.createApplication( "testOrganization", "duplicateNameTest" );
-        assertNotNull( applicationId );
-
-        EntityManager em = setup.getEmf().getEntityManager( applicationId );
+        EntityManager em = app.getEntityManager();
         assertNotNull( em );
 
         DynamicEntity restaurant = new DynamicEntity();