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/12/08 22:24:07 UTC
[25/50] [abbrv] incubator-usergrid git commit: Minor formatting
changes only.
Minor formatting changes only.
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/c4973e93
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/c4973e93
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/c4973e93
Branch: refs/heads/no-source-in-es
Commit: c4973e939b580f973f40b6991e5d1b1dac204181
Parents: eeb22b5
Author: Dave Johnson <dm...@apigee.com>
Authored: Thu Dec 4 17:38:14 2014 -0500
Committer: Dave Johnson <dm...@apigee.com>
Committed: Thu Dec 4 17:38:14 2014 -0500
----------------------------------------------------------------------
.../org/apache/usergrid/persistence/GeoIT.java | 41 +++++++++++++-------
1 file changed, 28 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c4973e93/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 f48b88d..4100cfd 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
@@ -17,21 +17,23 @@
package org.apache.usergrid.persistence;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
import org.apache.usergrid.AbstractCoreIT;
import org.apache.usergrid.cassandra.Concurrent;
import org.apache.usergrid.persistence.geo.model.Point;
import org.apache.usergrid.persistence.index.query.Query;
import org.apache.usergrid.persistence.model.field.value.Location;
import org.apache.usergrid.utils.MapUtils;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.*;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
@Concurrent()
public class GeoIT extends AbstractCoreIT {
@@ -39,11 +41,13 @@ public class GeoIT extends AbstractCoreIT {
int NEARBY_RADIUS = 10000;
int CIRCUMFERENCE_OF_THE_EARTH = 40000000;
+
/*
A list of concrete entities with locations to be used for geoQuery tests
NOTE: Adding or removing items from this list could affect test outcome!!!
*/
- private static List<Map<String, Object>> LOCATION_PROPERTIES = new ArrayList<Map<String, Object>>();
+ private static List<Map<String, Object>> LOCATION_PROPERTIES =
+ new ArrayList<Map<String, Object>>();
static {
LOCATION_PROPERTIES.add(new LinkedHashMap<String, Object>() {{
@@ -194,11 +198,17 @@ public class GeoIT extends AbstractCoreIT {
em.refreshIndex();
//4. Test that the user is within 2000m of the entity
Results emSearchResults = em.searchConnectedEntities(user,
- Query.fromQL("location within 2000 of " + ((LinkedHashMap<String, Object>) userProperties.get("location")).get("latitude") + ", " + ((LinkedHashMap<String, Object>) userProperties.get("location")).get("longitude")).setConnectionType("likes"));
+ Query.fromQL("location within 2000 of "
+ + ((LinkedHashMap<String, Object>) userProperties.get("location")).get("latitude")
+ + ", " + ((LinkedHashMap<String, Object>)
+ userProperties.get("location")).get("longitude")).setConnectionType("likes"));
assertEquals(1, emSearchResults.size());
//5. Test that the user is NOT within 1000m of the entity
emSearchResults = em.searchConnectedEntities(user,
- Query.fromQL("location within 1000 of " + ((LinkedHashMap<String, Object>) userProperties.get("location")).get("latitude") + ", " + ((LinkedHashMap<String, Object>) userProperties.get("location")).get("longitude")).setConnectionType("likes"));
+ Query.fromQL("location within 1000 of "
+ + ((LinkedHashMap<String, Object>) userProperties.get("location")).get("latitude")
+ + ", " + ((LinkedHashMap<String, Object>)
+ userProperties.get("location")).get("longitude")).setConnectionType("likes"));
assertEquals(0, emSearchResults.size());
//cleanup
em.delete(user);
@@ -263,7 +273,8 @@ public class GeoIT extends AbstractCoreIT {
+ center.getLat() + "," + center.getLon());
listResults = em.searchCollection(em.getApplicationRef(), "stores", query2);
- assertEquals("Results within " + CIRCUMFERENCE_OF_THE_EARTH + "m from center", LOCATION_PROPERTIES.size(), listResults.size());
+ assertEquals("Results within " + CIRCUMFERENCE_OF_THE_EARTH
+ + "m from center", LOCATION_PROPERTIES.size(), listResults.size());
}
@@ -297,7 +308,8 @@ public class GeoIT extends AbstractCoreIT {
query = Query.fromQL("select * where location within " + CIRCUMFERENCE_OF_THE_EARTH + " of "
+ center.getLat() + "," + center.getLon());
listResults = em.searchCollection(em.getApplicationRef(), "stores", query);
- assertEquals("Results within " + CIRCUMFERENCE_OF_THE_EARTH + "m from center", LOCATION_PROPERTIES.size(), listResults.size());
+ assertEquals("Results within " + CIRCUMFERENCE_OF_THE_EARTH
+ + "m from center", LOCATION_PROPERTIES.size(), listResults.size());
}
/**
@@ -338,7 +350,8 @@ public class GeoIT extends AbstractCoreIT {
Query query2 = Query.fromQL("select * where location within 40000000 of "
+ center.getLat() + "," + center.getLon());
listResults = em.searchCollection(em.getApplicationRef(), "stores", query2);
- assertEquals("Results from center point to ridiculously far", LOCATION_PROPERTIES.size(), listResults.size());
+ assertEquals("Results from center point to ridiculously far",
+ LOCATION_PROPERTIES.size(), listResults.size());
}
}
@@ -541,7 +554,8 @@ public class GeoIT extends AbstractCoreIT {
// String queryString = String.format("select * where location within 100 of 0,
// 0 and index >= %d and index < %d order by index",min, max);
- String queryString = String.format("select * where index >= %d and index < %d order by index", min, max);
+ String queryString = String.format(
+ "select * where index >= %d and index < %d order by index", min, max);
Query query = Query.fromQL(queryString);
@@ -588,7 +602,8 @@ public class GeoIT extends AbstractCoreIT {
float latitude = minLatitude + latitudeDelta * i;
float longitude = minLongitude + longitudeDelta * i;
- Map<String, Float> location = MapUtils.hashMap("latitude", latitude).map("longitude", longitude);
+ Map<String, Float> location =
+ MapUtils.hashMap("latitude", latitude).map("longitude", longitude);
Map<String, Object> data = new HashMap<String, Object>(2);
data.put("name", String.valueOf(i));