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

[2/9] incubator-usergrid git commit: Added collection level entity creation. Added todos for places that need attention. Added distinction between CustomCollections and Collections ( created collections as a way to keep track of rest level calls ) Fixed

Added collection level entity creation.
Added todos for places that need attention.
Added distinction between CustomCollections and Collections ( created collections as a way to keep track of rest level calls )
Fixed tests that used CustomCollections so that they make the distinction.
Changed applications so that they also use Collections.
Changed UsersCollections so that it uses rest level calls and extends the base Collection class.


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

Branch: refs/heads/two-dot-o-events
Commit: 968352de5faaa027c1978a65b74526a94489ad2a
Parents: 7d5697b
Author: grey <gr...@apigee.com>
Authored: Thu Nov 20 14:01:29 2014 -0800
Committer: grey <gr...@apigee.com>
Committed: Thu Nov 20 14:01:29 2014 -0800

----------------------------------------------------------------------
 .../apache/usergrid/rest/AbstractRestIT.java    |  3 +-
 .../collection/BrowserCompatibilityTest.java    |  2 +-
 .../collection/DuplicateNameIT.java             |  2 +-
 .../collection/activities/PutTest.java          |  2 +-
 .../collection/paging/PagingEntitiesTest.java   |  4 +-
 .../collection/paging/PagingResourceIT.java     | 14 ++--
 .../users/ConnectionResourceTest.java           | 16 ++--
 .../collection/users/OwnershipResourceIT.java   | 18 ++---
 .../collection/users/RetrieveUsersTest.java     |  4 +-
 .../applications/queries/AndOrQueryTest.java    | 13 ++--
 .../queries/BadGrammarQueryTest.java            |  2 +-
 .../applications/queries/GeoPagingTest.java     | 81 ++++++++++++++++++--
 .../applications/queries/MatrixQueryTests.java  |  2 +-
 .../rest/applications/queries/OrderByTest.java  |  6 +-
 .../rest/test/resource/TestContext.java         | 15 +++-
 .../rest/test/resource/ValueResource.java       |  1 +
 .../rest/test/resource/app/Application.java     |  8 +-
 .../rest/test/resource/app/Collection.java      | 47 ++++++++++++
 .../rest/test/resource/app/UsersCollection.java | 14 +++-
 19 files changed, 199 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/968352de/stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java
index 60944af..4665bc6 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java
@@ -430,7 +430,8 @@ public abstract class AbstractRestIT extends JerseyTest {
         LOG.debug("Refreshed index for appId {}", appId );
     }
 
-
+    //TODO: move refresh index into context so that we automatically refresh the indexs without needing to call
+    //different values of context.
     public void refreshIndex( String orgName, String appName ) {
 
         LOG.debug("Refreshing index for app {}/{}", orgName, appName );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/968352de/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/BrowserCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/BrowserCompatibilityTest.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/BrowserCompatibilityTest.java
index fe12766..3bca666 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/BrowserCompatibilityTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/BrowserCompatibilityTest.java
@@ -66,7 +66,7 @@ public class BrowserCompatibilityTest extends AbstractRestIT {
     private void testBrowserAccept( String acceptHeader ) throws IOException {
 
 
-        CustomCollection things = context.application().collection( "things" );
+        CustomCollection things = context.application().customCollection( "things" );
 
         Map<String, String> entity = hashMap( "name", "thing1" );
         JsonNode response = things.create( entity );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/968352de/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java
index 0273f04..39344d0 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/DuplicateNameIT.java
@@ -43,7 +43,7 @@ public class DuplicateNameIT extends AbstractRestIT {
     @Test
     public void duplicateNamePrevention() {
 
-        CustomCollection things = context.application().collection( "things" );
+        CustomCollection things = context.application().customCollection( "things" );
 
         Map<String, String> entity = MapUtils.hashMap( "name", "enzo" );
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/968352de/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/PutTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/PutTest.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/PutTest.java
index 3d6dac9..850bd0e 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/PutTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/PutTest.java
@@ -44,7 +44,7 @@ public class PutTest extends AbstractRestIT {
     @Test //USERGRID-545
     public void putMassUpdateTest() throws IOException {
 
-        CustomCollection activities = context.collection( "activities" );
+        CustomCollection activities = context.customCollection( "activities" );
 
         Map actor = hashMap( "displayName", "Erin" );
         Map newActor = hashMap( "displayName", "Bob" );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/968352de/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/paging/PagingEntitiesTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/paging/PagingEntitiesTest.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/paging/PagingEntitiesTest.java
index 93a061d..dcd4188 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/paging/PagingEntitiesTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/paging/PagingEntitiesTest.java
@@ -49,7 +49,7 @@ public class PagingEntitiesTest extends AbstractRestIT {
     @Test //USERGRID-266
     public void pageThroughConnectedEntities() throws IOException {
 
-        CustomCollection activities = context.collection( "activities" );
+        CustomCollection activities = context.customCollection( "activities" );
 
         long created = 0;
         int maxSize = 100;
@@ -96,7 +96,7 @@ public class PagingEntitiesTest extends AbstractRestIT {
     @Test //USERGRID-1253
     public void pagingQueryReturnCorrectResults() throws Exception {
 
-        CustomCollection activities = context.collection( "activities" );
+        CustomCollection activities = context.customCollection( "activities" );
 
         long created = 0;
         int maxSize = 23;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/968352de/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/paging/PagingResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/paging/PagingResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/paging/PagingResourceIT.java
index e60a657..50f5f58 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/paging/PagingResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/paging/PagingResourceIT.java
@@ -19,7 +19,7 @@ package org.apache.usergrid.rest.applications.collection.paging;
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import java.io.IOException;
+
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -66,7 +66,7 @@ public class PagingResourceIT extends AbstractRestIT {
     @Test
     public void collectionPaging() throws Exception {
 
-        CustomCollection things = context.application().collection( "test1things" );
+        CustomCollection things = context.application().customCollection( "test1things" );
 
         int size = 40;
 
@@ -111,7 +111,7 @@ public class PagingResourceIT extends AbstractRestIT {
             + "see also: https://issues.apache.org/jira/browse/USERGRID-211 ")
     public void startPaging() throws Exception {
 
-        CustomCollection things = context.application().collection( "test2things" );
+        CustomCollection things = context.application().customCollection( "test2things" );
 
         int size = 40;
 
@@ -159,7 +159,7 @@ public class PagingResourceIT extends AbstractRestIT {
     @Test
     public void collectionBatchDeleting() throws Exception {
 
-        CustomCollection things = context.application().collection( "test3things" );
+        CustomCollection things = context.application().customCollection( "test3things" );
 
         int size = 40;
 
@@ -202,7 +202,7 @@ public class PagingResourceIT extends AbstractRestIT {
     @Test
     public void emptyQlandLimitIgnored() throws Exception {
 
-        CustomCollection things = context.application().collection( "test4things" );
+        CustomCollection things = context.application().customCollection( "test4things" );
 
         Map<String, String> data = hashMap( "name", "thing1" );
         JsonNode response = things.create( data );
@@ -245,7 +245,7 @@ public class PagingResourceIT extends AbstractRestIT {
         // test that we do get cursor when we need one
         // create 50 widgets
         int widgetsSize = 50;
-        CustomCollection widgets = context.application().collection("widgets");
+        CustomCollection widgets = context.application().customCollection( "widgets" );
         for (int i = 0; i < widgetsSize; i++) {
             Map<String, String> entity = hashMap("name", String.valueOf(i));
             widgets.create(entity);
@@ -264,7 +264,7 @@ public class PagingResourceIT extends AbstractRestIT {
         // test that we DO NOT get cursor when we should not get cursor
         // create 5 trinkets
         int trinketsSize = 5;
-        CustomCollection trinkets = context.application().collection("trinkets");
+        CustomCollection trinkets = context.application().customCollection( "trinkets" );
         for (int i = 0; i < trinketsSize; i++) {
             Map<String, String> entity = hashMap("name", String.valueOf(i));
             trinkets.create(entity);

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/968352de/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/ConnectionResourceTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/ConnectionResourceTest.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/ConnectionResourceTest.java
index e034443..21b30d3 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/ConnectionResourceTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/ConnectionResourceTest.java
@@ -55,7 +55,7 @@ public class ConnectionResourceTest extends AbstractRestIT {
     public void connectionsQueryTest() throws IOException {
 
 
-        CustomCollection activities = context.collection( "peeps" );
+        CustomCollection activities = context.customCollection( "peeps" );
 
         Map stuff = hashMap( "type", "chicken" );
 
@@ -113,7 +113,7 @@ public class ConnectionResourceTest extends AbstractRestIT {
     @Test
     public void connectionsLoopbackTest() throws IOException {
 
-        CustomCollection things = context.collection( "things" );
+        CustomCollection things = context.customCollection( "things" );
 
         UUID thing1Id = getEntityId( things.create( hashMap( "name", "thing1" ) ), 0 );
 
@@ -143,7 +143,7 @@ public class ConnectionResourceTest extends AbstractRestIT {
 
         //now that we know the URl is correct, follow it
 
-        response = context.collection( url ).get();
+        response = context.customCollection( url ).get();
 
         UUID returnedUUID = getEntityId( response, 0 );
 
@@ -161,7 +161,7 @@ public class ConnectionResourceTest extends AbstractRestIT {
 
         //now we should get thing1 from the loopback url
 
-        response = context.collection( url ).get();
+        response = context.customCollection( url ).get();
 
         UUID returned = getEntityId( response, 0 );
 
@@ -172,7 +172,7 @@ public class ConnectionResourceTest extends AbstractRestIT {
     @Test
     public void connectionsUUIDTest() throws IOException {
 
-        CustomCollection things = context.collection( "things" );
+        CustomCollection things = context.customCollection( "things" );
 
         UUID thing1Id = getEntityId( things.create( hashMap( "name", "thing1" ) ), 0 );
 
@@ -202,7 +202,7 @@ public class ConnectionResourceTest extends AbstractRestIT {
 
         //now that we know the URl is correct, follow it
 
-        response = context.collection( url ).get();
+        response = context.customCollection( url ).get();
 
         UUID returnedUUID = getEntityId( response, 0 );
 
@@ -222,7 +222,7 @@ public class ConnectionResourceTest extends AbstractRestIT {
     @Test //USERGRID-3011
     public void connectionsDeleteSecondEntityInConnectionTest() throws IOException {
 
-        CustomCollection things = context.collection( "things" );
+        CustomCollection things = context.customCollection( "things" );
 
         UUID thing1Id = getEntityId( things.create( hashMap( "name", "thing1" ) ), 0 );
 
@@ -246,7 +246,7 @@ public class ConnectionResourceTest extends AbstractRestIT {
     @Test //USERGRID-3011
     public void connectionsDeleteFirstEntityInConnectionTest() throws IOException {
 
-        CustomCollection things = context.collection( "things" );
+        CustomCollection things = context.customCollection( "things" );
 
         UUID thing1Id = getEntityId( things.create( hashMap( "name", "thing1" ) ), 0 );
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/968352de/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/OwnershipResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/OwnershipResourceIT.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/OwnershipResourceIT.java
index a514781..17d99ec 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/OwnershipResourceIT.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/OwnershipResourceIT.java
@@ -196,7 +196,7 @@ public class OwnershipResourceIT extends AbstractRestIT {
 
         // create a 4peaks restaurant
         JsonNode data = context.application()
-                .collection( "restaurants" ).create( MapUtils.hashMap( "name", "4peaks" ) );
+                .customCollection( "restaurants" ).create( MapUtils.hashMap( "name", "4peaks" ) );
 
         refreshIndex(context.getOrgName(), context.getAppName());
 
@@ -219,7 +219,7 @@ public class OwnershipResourceIT extends AbstractRestIT {
         user2.login( context ).makeActive( context );
         refreshIndex(context.getOrgName(), context.getAppName());
 
-        data = context.application().collection( "restaurants" )
+        data = context.application().customCollection( "restaurants" )
                       .create( MapUtils.hashMap( "name", "arrogantbutcher" ) );
         refreshIndex(context.getOrgName(), context.getAppName());
 
@@ -288,7 +288,7 @@ public class OwnershipResourceIT extends AbstractRestIT {
 
         // test for user 1
 
-        CustomCollection restaurants = context.withUser( user1 ).application().collection( "restaurants" );
+        CustomCollection restaurants = context.withUser( user1 ).application().customCollection( "restaurants" );
         data = restaurants.entity( "4peaks" ).get();
 
         assertNotNull( data );
@@ -300,7 +300,7 @@ public class OwnershipResourceIT extends AbstractRestIT {
         assertEquals( "arrogantbutcher", getEntity( data, 0 ).get( "name" ).asText() );
 
         // test for user 2
-        restaurants = context.withUser( user1 ).application().collection( "restaurants" );
+        restaurants = context.withUser( user1 ).application().customCollection( "restaurants" );
         data = restaurants.entity( "4peaks" ).get();
 
         assertNotNull( data );
@@ -317,7 +317,7 @@ public class OwnershipResourceIT extends AbstractRestIT {
     public void contextualConnectionOwnershipGuestAccess() throws IOException {
 
         //set up full GET,PUT,POST,DELETE access for guests
-        context.application().collection( "roles" ).entity( "guest" ).collection( "permissions" )
+        context.application().customCollection( "roles" ).entity( "guest" ).collection( "permissions" )
                .create( MapUtils.hashMap( "permission", "get,put,post,delete:/**" ) );
 
 
@@ -325,19 +325,19 @@ public class OwnershipResourceIT extends AbstractRestIT {
         context.clearUser();
 
 
-        JsonNode city = context.application().collection( "cities" ).create( MapUtils.hashMap( "name", "tempe" ) );
+        JsonNode city = context.application().customCollection( "cities" ).create( MapUtils.hashMap( "name", "tempe" ) );
 
         refreshIndex(context.getOrgName(), context.getAppName());
 
         String cityId = getEntity( city, 0 ).get( "uuid" ).asText();
 
         // create a 4peaks restaurant
-        JsonNode data = context.application().collection( "cities" ).entity( "tempe" ).connection( "likes" )
+        JsonNode data = context.application().customCollection( "cities" ).entity( "tempe" ).connection( "likes" )
                                .collection( "restaurants" ).create( MapUtils.hashMap( "name", "4peaks" ) );
 
         String peaksId = getEntity( data, 0 ).get( "uuid" ).asText();
 
-        data = context.application().collection( "cities" ).entity( "tempe" ).connection( "likes" )
+        data = context.application().customCollection( "cities" ).entity( "tempe" ).connection( "likes" )
                       .collection( "restaurants" ).create( MapUtils.hashMap( "name", "arrogantbutcher" ) );
 
         String arrogantButcherId = getEntity( data, 0 ).get( "uuid" ).asText();
@@ -345,7 +345,7 @@ public class OwnershipResourceIT extends AbstractRestIT {
         // now query on user 1.
 
         Connection likeRestaurants =
-                context.application().collection( "cities" ).entity( "tempe" ).connection( "likes" );
+                context.application().customCollection( "cities" ).entity( "tempe" ).connection( "likes" );
 
         refreshIndex(context.getOrgName(), context.getAppName());
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/968352de/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/RetrieveUsersTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/RetrieveUsersTest.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/RetrieveUsersTest.java
index da7d59e..5a8d363 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/RetrieveUsersTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/users/RetrieveUsersTest.java
@@ -49,7 +49,7 @@ public class RetrieveUsersTest extends AbstractRestIT {
 
     @Test // USERGRID-1222
     public void queryForUsername() throws IOException {
-        CustomCollection users = context.collection( "users" );
+        CustomCollection users = context.customCollection( "users" );
 
         Map props = new HashMap();
 
@@ -70,7 +70,7 @@ public class RetrieveUsersTest extends AbstractRestIT {
 
     @Test // USERGRID-1727
     public void userEntityDictionaryHasRoles() throws IOException {
-        CustomCollection users = context.collection( "users" );
+        CustomCollection users = context.customCollection( "users" );
 
         Map props = new HashMap();
         props.put( "username", "Nina" );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/968352de/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/AndOrQueryTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/AndOrQueryTest.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/AndOrQueryTest.java
index 942044d..2003faf 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/AndOrQueryTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/AndOrQueryTest.java
@@ -49,7 +49,7 @@ public class AndOrQueryTest extends AbstractRestIT {
     @Test //USERGRID-900
     public void queriesWithAndPastLimit() throws IOException {
 
-        CustomCollection activities = context.collection( "activities" );
+        CustomCollection activities = context.customCollection( "activities" );
 
         long created = 0;
         Map actor = hashMap( "displayName", "Erin" );
@@ -87,7 +87,7 @@ public class AndOrQueryTest extends AbstractRestIT {
     @Test //USERGRID-1475
     public void displayFullQueriesInLimit() throws IOException {
 
-        CustomCollection activities = context.collection( "activities" );
+        CustomCollection activities = context.customCollection( "activities" );
 
         Map actor = hashMap( "displayName", "Erin" );
         Map props = new HashMap();
@@ -124,7 +124,7 @@ public class AndOrQueryTest extends AbstractRestIT {
     @Test //USERGRID-1615
     public void queryReturnCount() throws Exception {
 
-        CustomCollection activities = context.collection( "activities" );
+        CustomCollection activities = context.customCollection( "activities" );
 
         Map actor = hashMap( "displayName", "Erin" );
         Map props = new HashMap();
@@ -149,7 +149,8 @@ public class AndOrQueryTest extends AbstractRestIT {
     @Test //Check to make sure that asc works
     public void queryCheckAsc() throws Exception {
 
-        CustomCollection madeupStuff = context.collection( "imagination" + RandomStringUtils.randomAlphabetic(5));
+        CustomCollection madeupStuff = context.customCollection(
+                "imagination" + RandomStringUtils.randomAlphabetic( 5 ) );
         Map character = hashMap( "WhoHelpedYou", "Ruff" );
 
         JsonNode[] correctValues;
@@ -168,7 +169,7 @@ public class AndOrQueryTest extends AbstractRestIT {
 
     @Ignore("Test to make sure all 1000 exist with a regular query")
     public void queryReturnCheck() throws Exception {
-        CustomCollection madeupStuff = context.collection( "imagination" );
+        CustomCollection madeupStuff = context.customCollection( "imagination" );
         Map character = hashMap( "WhoHelpedYou", "Ruff" );
 
         int numOfEntities = 1000;
@@ -187,7 +188,7 @@ public class AndOrQueryTest extends AbstractRestIT {
 
     @Ignore
     public void queryReturnCheckWithShortHand() throws IOException {
-        CustomCollection madeupStuff = context.collection( "imagination" );
+        CustomCollection madeupStuff = context.customCollection( "imagination" );
         Map character = hashMap( "WhoHelpedYou", "Ruff" );
 
         madeupStuff.createEntitiesWithOrdinal( character, 1000 );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/968352de/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BadGrammarQueryTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BadGrammarQueryTest.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BadGrammarQueryTest.java
index 0ac0558..a6eb831 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BadGrammarQueryTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/BadGrammarQueryTest.java
@@ -48,7 +48,7 @@ public class BadGrammarQueryTest extends AbstractRestIT {
     @Test
     public void catchBadQueryGrammar() throws IOException {
 
-        CustomCollection things = context.collection( "things" );
+        CustomCollection things = context.customCollection( "things" );
 
         Map actor = hashMap( "displayName", "Erin" );
         Map props = new HashMap();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/968352de/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/GeoPagingTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/GeoPagingTest.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/GeoPagingTest.java
index 9224029..fb9eb70 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/GeoPagingTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/GeoPagingTest.java
@@ -21,15 +21,22 @@ import java.util.HashMap;
 import java.util.Map;
 
 import com.fasterxml.jackson.databind.JsonNode;
+import com.sun.jersey.api.client.UniformInterfaceException;
+
 import java.io.IOException;
 import org.junit.Rule;
 import org.junit.Test;
+
+import org.apache.usergrid.persistence.geo.model.Point;
+import org.apache.usergrid.persistence.index.query.Query;
 import org.apache.usergrid.rest.AbstractRestIT;
 import org.apache.usergrid.rest.TestContextSetup;
 import org.apache.usergrid.rest.test.resource.CustomCollection;
 
 import static org.junit.Assert.assertEquals;
 import static org.apache.usergrid.utils.MapUtils.hashMap;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
 
 
 /**
@@ -47,7 +54,7 @@ public class GeoPagingTest extends AbstractRestIT {
     @Test //("Test uses up to many resources to run reliably") // USERGRID-1403
     public void groupQueriesWithGeoPaging() throws IOException {
 
-        CustomCollection groups = context.application().collection( "test1groups" );
+        CustomCollection groups = context.application().customCollection( "test1groups" );
 
         int maxRangeLimit = 2000;
         long[] index = new long[maxRangeLimit];
@@ -73,7 +80,7 @@ public class GeoPagingTest extends AbstractRestIT {
         refreshIndex(context.getOrgName(), context.getAppName());
 
         String query = "select * where location within 20000 of 37,-75 "
-                + " and created > " + index[2] 
+                + " and created > " + index[2]
                 + " and created < " + index[4] + "";
 
         JsonNode node = groups.withQuery( query ).get();
@@ -86,7 +93,7 @@ public class GeoPagingTest extends AbstractRestIT {
     @Test // USERGRID-1401
     public void groupQueriesWithConsistentResults() throws IOException {
 
-        CustomCollection groups = context.application().collection( "test2groups" );
+        CustomCollection groups = context.application().customCollection( "test2groups" );
 
         int maxRangeLimit = 20;
         JsonNode[] saved = new JsonNode[maxRangeLimit];
@@ -110,12 +117,11 @@ public class GeoPagingTest extends AbstractRestIT {
         }
 
         refreshIndex(context.getOrgName(), context.getAppName());
-
         JsonNode node = null;
         for ( int consistent = 0; consistent < 20; consistent++ ) {
 
-            String query = String.format( 
-                "select * where location within 100 of 37, -75 and ordinal >= %d and ordinal < %d", 
+            String query = String.format(
+                "select * where location within 100 of 37, -75 and ordinal >= %d and ordinal < %d",
                 saved[7].get( "ordinal" ).asLong(), saved[10].get( "ordinal" ).asLong() );
 
             node = groups.withQuery( query ).get(); //groups.query(query);
@@ -130,4 +136,67 @@ public class GeoPagingTest extends AbstractRestIT {
             }
         }
     }
+
+
+    /**
+     * Creates a store then queries to check ability to find different store from up to 40 mil meters away
+     * @throws IOException
+     */
+    @Test
+    public void testFarAwayLocationFromCenter() throws IOException {
+
+        JsonNode node = null;
+        String collectionName = "testFarAwayLocation";
+        Map store1 = entityMapLocationCreator( "usergrid",-33.746369 ,150.952183 );
+        Map store2 = entityMapLocationCreator( "usergrid2",-33.889058, 151.124024  );
+        Point center = new Point( 37.776753, -122.407846 );
+        //TODO: make query builder for this
+        Query queryClose = locationQuery( 10000 ,center );
+        Query queryFar = locationQuery( 40000000, center );
+
+        /*Create */
+        try {
+            node = context.collection( collectionName ).post( store1);
+        }
+        catch ( UniformInterfaceException e ) {
+            JsonNode nodeError = mapper.readTree( e.getResponse().getEntity( String.class ) );
+            fail( node.get( "error" ).textValue() );
+        }
+        assertNotNull( node );
+        assertEquals( "usergrid", node.get( "name" ).asText() );
+//TODO: check to see if context.application.collection is broken?
+        try {
+            node = context.collection( collectionName ).post( store2 );
+        }
+        catch ( UniformInterfaceException e ) {
+            JsonNode nodeError = mapper.readTree( e.getResponse().getEntity( String.class ) );
+            fail( node.get( "error" ).textValue() );
+        }
+
+        refreshIndex( context.getOrgName(),context.getAppName() );
+
+        /* run queries */
+        //context.collection( collectionName ).query(  )
+
+
+
+        // assertEquals(node.get(  ))
+    }
+
+    private Map entityMapLocationCreator(String name,Double lat, Double lon){
+        Map<String, Double> latLon = hashMap( "latitude", lat );
+        latLon.put( "longitude", lon );
+        Map<String, Object> entityData = new HashMap<String, Object>();
+        entityData.put( "name", name );
+        entityData.put( "location", latLon );
+
+        return entityData;
+    }
+
+    private Query locationQuery(int  metersAway, Point startingPoint){
+        return Query.fromQL( "select * where location within " + String.valueOf( metersAway ) + " of "
+                + startingPoint.getLat() + "," + startingPoint.getLon());
+    }
+
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/968352de/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/MatrixQueryTests.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/MatrixQueryTests.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/MatrixQueryTests.java
index 25bc33b..9531a14 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/MatrixQueryTests.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/MatrixQueryTests.java
@@ -61,7 +61,7 @@ public class MatrixQueryTests extends AbstractRestIT {
 
         //now create 4 restaurants
 
-        CustomCollection restaurants = context.collection( "restaurants" );
+        CustomCollection restaurants = context.customCollection( "restaurants" );
 
 
         Map restaurant1 = hashMap( "name", "Old Major" );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/968352de/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/OrderByTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/OrderByTest.java b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/OrderByTest.java
index 481f753..f00912c 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/OrderByTest.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/applications/queries/OrderByTest.java
@@ -50,7 +50,7 @@ public class OrderByTest extends AbstractRestIT {
     // USERGRID-1400
     public void orderByShouldNotAffectResults() throws IOException {
 
-        CustomCollection activities = context.collection( "activities" );
+        CustomCollection activities = context.customCollection( "activities" );
 
         long created = 0;
         Map actor = hashMap( "displayName", "Erin" );
@@ -82,7 +82,7 @@ public class OrderByTest extends AbstractRestIT {
     // USERGRID-1520
     public void orderByComesBeforeLimitResult() throws IOException {
 
-        CustomCollection activities = context.collection( "activities" );
+        CustomCollection activities = context.customCollection( "activities" );
 
         Map actor = hashMap( "displayName", "Erin" );
         Map props = new HashMap();
@@ -122,7 +122,7 @@ public class OrderByTest extends AbstractRestIT {
     // USERGRID-1521
     public void orderByReturnCorrectResults() throws IOException {
 
-        CustomCollection activities = context.collection( "activities" );
+        CustomCollection activities = context.customCollection( "activities" );
 
         int size = 200;
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/968352de/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/TestContext.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/TestContext.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/TestContext.java
index c75945e..2c0531a 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/TestContext.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/TestContext.java
@@ -20,6 +20,7 @@ package org.apache.usergrid.rest.test.resource;
 import java.util.UUID;
 
 import org.apache.usergrid.rest.test.resource.app.Application;
+import org.apache.usergrid.rest.test.resource.app.Collection;
 import org.apache.usergrid.rest.test.resource.app.User;
 import org.apache.usergrid.rest.test.resource.app.UsersCollection;
 import org.apache.usergrid.rest.test.resource.mgmt.Management;
@@ -72,12 +73,18 @@ public class TestContext {
         return withUser( null );
     }
 
+    public TestContext withOrg(){
+        return this;
+    }
 
     public TestContext withOrg( String orgName ) {
         testOrganization = new TestOrganization( orgName );
         return this;
     }
 
+    public TestContext withApp ( ) {
+        return this;
+    }
 
     public TestContext withApp( String appName ) {
         this.appName = appName;
@@ -156,9 +163,13 @@ public class TestContext {
         return new Application( getOrgName(), appName, root() );
     }
 
+//TODO: remove custom collections!
+    public CustomCollection customCollection( String str ) {
+        return application().customCollection( str );
+    }
 
-    public CustomCollection collection( String str ) {
-        return application().collection( str );
+    public Collection collection (String name) {
+        return application().collection( name );
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/968352de/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/ValueResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/ValueResource.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/ValueResource.java
index 4012cc4..3a9181a 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/ValueResource.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/ValueResource.java
@@ -94,6 +94,7 @@ public abstract class ValueResource extends NamedResource {
 
 
     /** post to the entity set */
+    //TODO: fix error reporting 
     protected JsonNode postInternal( Map<String, ?> entity ) throws IOException {
 
         return mapper.readTree( jsonMedia( withParams( withToken( resource() ) ) ).post( String.class, entity ));

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/968352de/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Application.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Application.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Application.java
index dd393fc..9de259d 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Application.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Application.java
@@ -67,8 +67,12 @@ public class Application extends ValueResource {
         return new DevicesCollection( this );
     }
 
-
-    public CustomCollection collection( String name ) {
+//TODO: work out differences between CustomCollections and replace tests with a general collection method.
+    public CustomCollection customCollection( String name ) {
         return new CustomCollection( name, this );
     }
+
+    public Collection collection( String name ) {
+        return new Collection( name,this );
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/968352de/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Collection.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Collection.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Collection.java
new file mode 100644
index 0000000..12592b5
--- /dev/null
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/Collection.java
@@ -0,0 +1,47 @@
+package org.apache.usergrid.rest.test.resource.app;
+
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.usergrid.rest.test.resource.NamedResource;
+import org.apache.usergrid.rest.test.resource.SetResource;
+import org.apache.usergrid.utils.MapUtils;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+
+//TODO: G make sure this no longer returns JsonNodes and instead returns EntityObjects.
+//TODO: Add in full rest suite of GET,PUT,DELETE methods. Delete will be mostly universal.
+public class Collection extends SetResource {
+
+    public Collection( String collectionName, NamedResource parent ) {
+        super( collectionName, parent );
+    }
+
+    /** Create the user in a collection using only the username */
+    public JsonNode post( String name ) throws IOException {
+        Map<String, String> data = MapUtils.hashMap( "name", name );
+
+        JsonNode response = this.postInternal( data );
+
+        return getEntity( response, 0 );
+    }
+
+
+    /**
+     * Create the user in a collection using username,email,password
+     * @param entityData
+     * @return
+     * @throws IOException
+     */
+    public JsonNode post(Map entityData) throws IOException{
+
+        JsonNode response = this.postInternal( entityData );
+
+        return getEntity( response, 0 );
+    }
+
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/968352de/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/UsersCollection.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/UsersCollection.java b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/UsersCollection.java
index 32b3ab8..da9cccc 100644
--- a/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/UsersCollection.java
+++ b/stack/rest/src/test/java/org/apache/usergrid/rest/test/resource/app/UsersCollection.java
@@ -29,7 +29,7 @@ import org.apache.usergrid.utils.MapUtils;
 
 
 /** @author tnine */
-public class UsersCollection extends CollectionResource {
+public class UsersCollection extends Collection {
 
 
     public UsersCollection( NamedResource parent ) {
@@ -48,7 +48,7 @@ public class UsersCollection extends CollectionResource {
 
 
     /** Create the user */
-    public JsonNode create( String username, String email, String password ) throws IOException {
+    public JsonNode post( String username, String email, String password ) throws IOException {
         Map<String, String> data =
                 MapUtils.hashMap( "username", username ).map( "email", email ).map( "password", password );
 
@@ -57,6 +57,16 @@ public class UsersCollection extends CollectionResource {
         return getEntity( response, 0 );
     }
 
+    /** Create the user */
+    //TODO: delete create method once rest calls are implemented
+    public JsonNode create( String username, String email, String password ) throws IOException {
+        Map<String, String> data =
+                MapUtils.hashMap( "username", username ).map( "email", email ).map( "password", password );
+
+        JsonNode response = this.postInternal( data );
+
+        return getEntity( response, 0 );
+    }
 
     public Me me() {
         return new Me( this );