usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject [1/2] incubator-usergrid git commit: Created test that makes 10 cats and gets them back.
Date Mon, 16 Mar 2015 22:39:03 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/USERGRID-460 [created] 65ff858db


Created test that makes 10 cats and gets them back.


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

Branch: refs/heads/USERGRID-460
Commit: 7c5b070215647137dde868fed1a47c03da96ebcf
Parents: b0a07ba
Author: GERey <greyes@apigee.com>
Authored: Mon Mar 16 11:10:49 2015 -0700
Committer: GERey <greyes@apigee.com>
Committed: Mon Mar 16 11:10:49 2015 -0700

----------------------------------------------------------------------
 .../applications/queries/GeoPagingTest.java     | 42 ++++++++++++++++++++
 1 file changed, 42 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7c5b0702/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 f9fe5b3..38ebeaf 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
@@ -197,6 +197,48 @@ public class GeoPagingTest extends AbstractRestIT {
     }
   }
 
+    /**
+     * Test that geo-query returns co-located entities in expected order.
+     */
+    @Test // USERGRID-1401
+    public void groupQueriesWithDistanceOrderedResults() throws IOException {
+
+        int maxRangeLimit = 10;
+        Entity[] cats = new Entity[maxRangeLimit];
+
+        // 1. Create several entities
+        for (int i = 0; i < maxRangeLimit; i++) {
+            float latDelta = i;
+            Entity cat = new Entity();
+            cat.put("name", "cat" + i);
+            cat.put("location", new MapUtils.HashMapBuilder<String, Double>()
+                .map("latitude", 37.0+(latDelta/10))
+                .map("longitude", (-75.0)));
+            cats[i] = cat;
+            this.app().collection("cats").post(cat);
+        }
+        this.refreshIndex();
+
+        QueryParameters params = new QueryParameters();
+        String query = String.format(
+            "select * where location within 1000000 of 37, -75");
+        params.setQuery(query);
+        Collection collection = this.app().collection("cats").get(params);
+        assertNotNull( collection );
+        List entities = collection.getResponse().getEntities();
+        assertNotNull( entities );
+
+        for (int consistent = 0; consistent < maxRangeLimit; consistent++) {
+//got entities back, just need to page through them and make sure that i got them in location
order.
+            Object entity = entities.get( consistent );
+            assertNotNull( entity );
+
+
+
+
+        }
+    }
+
 
   /**
    * Creates a store right on top of the center store and checks to see if we can find that
store, then find both


Mime
View raw message