Repository: usergrid Updated Branches: refs/heads/master 2455b6a65 -> 7349e25e8
Added the test from the issue , still needs to be fixed to highlight he issue. Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/27b703e1 Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/27b703e1 Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/27b703e1 Branch: refs/heads/master Commit: 27b703e19be504eeacbd3061c6c240bd53be6748 Parents: fa01f84 Author: George Reyes <[email protected]> Authored: Mon Jan 11 10:26:39 2016 -0800 Committer: George Reyes <[email protected]> Committed: Mon Jan 11 10:26:39 2016 -0800 ---------------------------------------------------------------------- .../org/apache/usergrid/persistence/GeoIT.java | 73 ++++++++++++++++++++ 1 file changed, 73 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/27b703e1/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 0b15e09..bbdb1eb 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 @@ -78,6 +78,79 @@ public class GeoIT extends AbstractCoreIT { * 4. Repeat the query, expecting no results */ @Test + public void testRoundingGeolocationIssue() throws Exception { + //Get the EntityManager instance + EntityManager em = app.getEntityManager(); + 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); + 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 market = em.create("testCollection", properties); + 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); + 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); + assertNotNull(news); + + + 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()); + + } + + + @Test public void testRemovedLocationQuery() throws Exception { //Get the EntityManager instance EntityManager em = app.getEntityManager();
