usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject incubator-usergrid git commit: Cleaned some of the GeoPagingTest comments and added a test that ensures consistent order from elastic search.
Date Wed, 18 Mar 2015 20:20:17 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/USERGRID-460 6f3824b8b -> 4964ab62a


Cleaned some of the GeoPagingTest comments and added a test that ensures consistent order
from elastic search.


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

Branch: refs/heads/USERGRID-460
Commit: 4964ab62a3c846721aef657b36002b2a549f1674
Parents: 6f3824b
Author: GERey <greyes@apigee.com>
Authored: Wed Mar 18 13:20:12 2015 -0700
Committer: GERey <greyes@apigee.com>
Committed: Wed Mar 18 13:20:12 2015 -0700

----------------------------------------------------------------------
 .../org/apache/usergrid/persistence/GeoIT.java  | 25 ++++++++++++++++++--
 .../applications/queries/GeoPagingTest.java     |  2 +-
 2 files changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4964ab62/stack/core/src/test/java/org/apache/usergrid/persistence/GeoIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/GeoIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/GeoIT.java
index a1ac4ff..ad8a0dd 100644
--- a/stack/core/src/test/java/org/apache/usergrid/persistence/GeoIT.java
+++ b/stack/core/src/test/java/org/apache/usergrid/persistence/GeoIT.java
@@ -420,8 +420,13 @@ public class GeoIT extends AbstractCoreIT {
     }
 
 
+    /**
+     * Verify that elasticsearch does a secondary ordering on paging such that we get consistent
results
+     * back from a cursor despite having a geoquery with all the positions in the same location.
+     * @throws Exception
+     */
     @Test
-    public void testSamePointPaging() throws Exception {
+    public void testSamePointConsistantPaging() throws Exception {
 
         EntityManager em = app.getEntityManager();
         assertNotNull(em);
@@ -445,15 +450,31 @@ public class GeoIT extends AbstractCoreIT {
         // just to be save
         query.addFilter("location within 50000000 of 0, 0");
         query.setLimit(100);
+        List<String> names = new ArrayList<String>();
 
         int count = 0;
         Results results;
+        //get arraylist of entities from a search
+        do {
+            results = em.searchCollection(em.getApplicationRef(), "stores", query);
 
+            for (Entity entity : results.getEntities()) {
+                names.add( count,entity.getName() );
+                count++;
+            }
+
+            // set for the next "page"
+            query.setCursor(results.getCursor());
+        }
+        while (results.getCursor() != null);
+        //verify that entities come out in the same order when doing the same query against
the same data.
+        //aka make sure the elasticsearch does a secondary search.
+        count = 0;
         do {
             results = em.searchCollection(em.getApplicationRef(), "stores", query);
 
             for (Entity entity : results.getEntities()) {
-                assertEquals(String.valueOf(count), entity.getName());
+                assertEquals( names.get( count ),entity.getName() );
                 count++;
             }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4964ab62/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 a444fbd..553b387 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
@@ -200,7 +200,7 @@ public class GeoPagingTest extends AbstractRestIT {
     /**
      * Test that geo-query returns co-located entities in expected order.
      */
-    @Test // USERGRID-1401
+    @Test
     public void groupQueriesWithDistanceOrderedResults() throws IOException {
 
         int maxRangeLimit = 9;


Mime
View raw message