Added a test proving that the issue does not exist.

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

Branch: refs/heads/master
Commit: bdec0191f316f2b8f42adb919ba829e389caf564
Parents: 27b703e
Author: George Reyes <[email protected]>
Authored: Mon Jan 11 14:47:48 2016 -0800
Committer: George Reyes <[email protected]>
Committed: Mon Jan 11 14:47:48 2016 -0800

----------------------------------------------------------------------
 .../org/apache/usergrid/persistence/GeoIT.java  | 75 +++++++-------------
 1 file changed, 26 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/bdec0191/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 bbdb1eb..33aeb00 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
@@ -84,69 +84,46 @@ public class GeoIT extends AbstractCoreIT {
         assertNotNull(em);
 
         //1. Create an entity with location
-        Map<String, Object> properties = new LinkedHashMap<String, Object>() {{
-            put("name", "Office");
-            put("location", new LinkedHashMap<String, Object>() {{
-                put("latitude", 37.334115);
-                put("longitude", -121.894340);
-            }});
-        }};
-
-        Entity office = em.create("testCollection", properties);
+        Entity office = createEntitywithLocation( 
em,"office",37.334115,-121.894340);
         assertNotNull(office);
 
-        properties = new LinkedHashMap<String, Object>() {{
-            put("name", "Amicis");
-            put("location", new LinkedHashMap<String, Object>() {{
-                put("latitude", 37.335616);
-                put("longitude", -121.894168);
-            }});
-        }};
-
-        Entity amicis = em.create("testCollection", properties);
-        assertNotNull(amicis);
-
-        properties = new LinkedHashMap<String, Object>() {{
-            put("name", "Market");
-            put("location", new LinkedHashMap<String, Object>() {{
-                put("latitude", 37.336499);
-                put("longitude", -121.894356);
-            }});
-        }};
+        Entity pizza = createEntitywithLocation( 
em,"pizza",37.335616,-121.894168);
+        assertNotNull(pizza);
 
-        Entity market = em.create("testCollection", properties);
+        Entity market = createEntitywithLocation( 
em,"market",37.336499,-121.894356);
         assertNotNull(market);
 
-        properties = new LinkedHashMap<String, Object>() {{
-            put("name", "park");
-            put("location", new LinkedHashMap<String, Object>() {{
-                put("latitude", 37.339079);
-                put("longitude", -121.891422);
-            }});
-        }};
-
-        Entity park = em.create("testCollection", properties);
+        Entity park = createEntitywithLocation( 
em,"park",37.339079,-121.891422);
         assertNotNull(park);
 
-        properties = new LinkedHashMap<String, Object>() {{
-            put("name", "news");
-            put("location", new LinkedHashMap<String, Object>() {{
-                put("latitude", 37.337812);
-                put("longitude", -121.890784);
-            }});
-        }};
-
-        Entity news = em.create("testCollection", properties);
+        Entity news = createEntitywithLocation( 
em,"news",37.337812,-121.890784);
         assertNotNull(news);
 
+        Entity hotel = createEntitywithLocation( 
em,"hotel",37.334370,-121.895081);
+        assertNotNull(hotel);
+
 
         app.refreshIndex();
 
         //2. Query with a globally large distance to verify location
-        Query query = Query.fromQL("select * where location within 610.0 of 
37.334110260009766, -121.89434051513672");
-        Results listResults = em.searchCollection(em.getApplicationRef(), 
"users", query);
-        assertEquals("1 result returned", 1, listResults.size());
 
+        Query query = Query.fromQL("select * where location within 609.8 of 
37.334110260009766, -121.89434051513672");
+        Results listResults = em.searchCollection(em.getApplicationRef(), 
"collars", query);
+        assertEquals("Nothing should get returned", 0, listResults.size());
+
+    }
+
+
+    private Entity createEntitywithLocation( final EntityManager em,String 
name ,Double lat,Double lon) throws Exception {
+        Map<String, Object> properties = new LinkedHashMap<String, Object>() {{
+        put("name", name);
+        put("location", new LinkedHashMap<String, Object>() {{
+            put("latitude", lat);
+            put("longitude", lon);
+        }});
+    }};
+
+        return em.create("collars", properties);
     }
 
 

Reply via email to