diff --git a/src/main/java/org/springframework/data/redis/core/BoundGeoOperations.java b/src/main/java/org/springframework/data/redis/core/BoundGeoOperations.java index c9d647f17..e32a2d18b 100644 --- a/src/main/java/org/springframework/data/redis/core/BoundGeoOperations.java +++ b/src/main/java/org/springframework/data/redis/core/BoundGeoOperations.java @@ -38,7 +38,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Add {@link Point} with given member {@literal name} to {@literal key}. - * + * * @param point must not be {@literal null}. * @param member must not be {@literal null}. * @return Number of elements added. @@ -49,7 +49,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Add {@link Point} with given member {@literal name} to {@literal key}. - * + * * @param point must not be {@literal null}. * @param member must not be {@literal null}. * @return Number of elements added. @@ -63,7 +63,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Add {@link GeoLocation} to {@literal key}. - * + * * @param location must not be {@literal null}. * @return Number of elements added. * @since 2.0 @@ -73,7 +73,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Add {@link GeoLocation} to {@literal key}. - * + * * @param location must not be {@literal null}. * @return Number of elements added. * @see Redis Documentation: GEOADD @@ -86,7 +86,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Add {@link Map} of member / {@link Point} pairs to {@literal key}. - * + * * @param memberCoordinateMap must not be {@literal null}. * @return Number of elements added. * @since 2.0 @@ -96,7 +96,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Add {@link Map} of member / {@link Point} pairs to {@literal key}. - * + * * @param memberCoordinateMap must not be {@literal null}. * @return Number of elements added. * @see Redis Documentation: GEOADD @@ -109,7 +109,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Add {@link GeoLocation}s to {@literal key} - * + * * @param locations must not be {@literal null}. * @return Number of elements added. * @since 2.0 @@ -119,7 +119,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Add {@link GeoLocation}s to {@literal key} - * + * * @param locations must not be {@literal null}. * @return Number of elements added. * @see Redis Documentation: GEOADD @@ -132,7 +132,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Get the {@link Distance} between {@literal member1} and {@literal member2}. - * + * * @param member1 must not be {@literal null}. * @param member2 must not be {@literal null}. * @return can be {@literal null}. @@ -143,7 +143,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Get the {@link Distance} between {@literal member1} and {@literal member2}. - * + * * @param member1 must not be {@literal null}. * @param member2 must not be {@literal null}. * @return can be {@literal null}. @@ -157,7 +157,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Get the {@link Distance} between {@literal member1} and {@literal member2} in the given {@link Metric}. - * + * * @param member1 must not be {@literal null}. * @param member2 must not be {@literal null}. * @param metric must not be {@literal null}. @@ -169,7 +169,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Get the {@link Distance} between {@literal member1} and {@literal member2} in the given {@link Metric}. - * + * * @param member1 must not be {@literal null}. * @param member2 must not be {@literal null}. * @param metric must not be {@literal null}. @@ -184,7 +184,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Get Geohash representation of the position for one or more {@literal member}s. - * + * * @param members must not be {@literal null}. * @return never {@literal null}. * @since 2.0 @@ -194,7 +194,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Get Geohash representation of the position for one or more {@literal member}s. - * + * * @param members must not be {@literal null}. * @return never {@literal null}. * @see Redis Documentation: GEOHASH @@ -207,7 +207,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Get the {@link Point} representation of positions for one or more {@literal member}s. - * + * * @param members must not be {@literal null}. * @return never {@literal null}. * @since 2.0 @@ -217,7 +217,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Get the {@link Point} representation of positions for one or more {@literal member}s. - * + * * @param members must not be {@literal null}. * @return never {@literal null}. * @see Redis Documentation: GEOPOS @@ -230,7 +230,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Get the {@literal member}s within the boundaries of a given {@link Circle}. - * + * * @param within must not be {@literal null}. * @return never {@literal null}. * @since 2.0 @@ -240,7 +240,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Get the {@literal member}s within the boundaries of a given {@link Circle}. - * + * * @param within must not be {@literal null}. * @return never {@literal null}. * @see Redis Documentation: GEORADIUS @@ -253,7 +253,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Get the {@literal member}s within the boundaries of a given {@link Circle} applying {@link GeoRadiusCommandArgs}. - * + * * @param within must not be {@literal null}. * @param args must not be {@literal null}. * @return never {@literal null}. @@ -264,7 +264,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Get the {@literal member}s within the boundaries of a given {@link Circle} applying {@link GeoRadiusCommandArgs}. - * + * * @param within must not be {@literal null}. * @param args must not be {@literal null}. * @return never {@literal null}. @@ -279,7 +279,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Get the {@literal member}s within the circle defined by the {@literal members} coordinates and given * {@literal radius}. - * + * * @param member must not be {@literal null}. * @param radius * @return never {@literal null}. @@ -291,7 +291,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Get the {@literal member}s within the circle defined by the {@literal members} coordinates and given * {@literal radius}. - * + * * @param member must not be {@literal null}. * @param radius * @return never {@literal null}. @@ -306,7 +306,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Get the {@literal member}s within the circle defined by the {@literal members} coordinates and given * {@literal radius} applying {@link Metric}. - * + * * @param member must not be {@literal null}. * @param distance must not be {@literal null}. * @return never {@literal null}. @@ -318,7 +318,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Get the {@literal member}s within the circle defined by the {@literal members} coordinates and given * {@literal radius} applying {@link Metric}. - * + * * @param member must not be {@literal null}. * @param distance must not be {@literal null}. * @return never {@literal null}. @@ -333,7 +333,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Get the {@literal member}s within the circle defined by the {@literal members} coordinates and given * {@literal radius} applying {@link Metric} and {@link GeoRadiusCommandArgs}. - * + * * @param member must not be {@literal null}. * @param distance must not be {@literal null}. * @param args must not be {@literal null}. @@ -346,7 +346,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Get the {@literal member}s within the circle defined by the {@literal members} coordinates and given * {@literal radius} applying {@link Metric} and {@link GeoRadiusCommandArgs}. - * + * * @param member must not be {@literal null}. * @param distance must not be {@literal null}. * @param args must not be {@literal null}. @@ -361,7 +361,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Remove the {@literal member}s. - * + * * @param members must not be {@literal null}. * @return Number of elements removed. * @since 2.0 @@ -370,7 +370,7 @@ public interface BoundGeoOperations extends BoundKeyOperations { /** * Remove the {@literal member}s. - * + * * @param members must not be {@literal null}. * @return Number of elements removed. * @deprecated since 2.0, use {@link #remove(Object[])}. diff --git a/src/main/java/org/springframework/data/redis/core/GeoOperations.java b/src/main/java/org/springframework/data/redis/core/GeoOperations.java index 0ab03b8e4..321b1bb24 100644 --- a/src/main/java/org/springframework/data/redis/core/GeoOperations.java +++ b/src/main/java/org/springframework/data/redis/core/GeoOperations.java @@ -39,7 +39,7 @@ public interface GeoOperations { /** * Add {@link Point} with given member {@literal name} to {@literal key}. - * + * * @param key must not be {@literal null}. * @param point must not be {@literal null}. * @param member must not be {@literal null}. @@ -51,7 +51,7 @@ public interface GeoOperations { /** * Add {@link Point} with given member {@literal name} to {@literal key}. - * + * * @param key must not be {@literal null}. * @param point must not be {@literal null}. * @param member must not be {@literal null}. @@ -66,7 +66,7 @@ public interface GeoOperations { /** * Add {@link GeoLocation} to {@literal key}. - * + * * @param key must not be {@literal null}. * @param location must not be {@literal null}. * @return Number of elements added. @@ -77,7 +77,7 @@ public interface GeoOperations { /** * Add {@link GeoLocation} to {@literal key}. - * + * * @param key must not be {@literal null}. * @param location must not be {@literal null}. * @return Number of elements added. @@ -91,7 +91,7 @@ public interface GeoOperations { /** * Add {@link Map} of member / {@link Point} pairs to {@literal key}. - * + * * @param key must not be {@literal null}. * @param memberCoordinateMap must not be {@literal null}. * @return Number of elements added. @@ -102,7 +102,7 @@ public interface GeoOperations { /** * Add {@link Map} of member / {@link Point} pairs to {@literal key}. - * + * * @param key must not be {@literal null}. * @param memberCoordinateMap must not be {@literal null}. * @return Number of elements added. @@ -116,7 +116,7 @@ public interface GeoOperations { /** * Add {@link GeoLocation}s to {@literal key} - * + * * @param key must not be {@literal null}. * @param locations must not be {@literal null}. * @return Number of elements added. @@ -127,7 +127,7 @@ public interface GeoOperations { /** * Add {@link GeoLocation}s to {@literal key} - * + * * @param key must not be {@literal null}. * @param locations must not be {@literal null}. * @return Number of elements added. @@ -141,7 +141,7 @@ public interface GeoOperations { /** * Get the {@link Distance} between {@literal member1} and {@literal member2}. - * + * * @param key must not be {@literal null}. * @param member1 must not be {@literal null}. * @param member2 must not be {@literal null}. @@ -153,7 +153,7 @@ public interface GeoOperations { /** * Get the {@link Distance} between {@literal member1} and {@literal member2}. - * + * * @param key must not be {@literal null}. * @param member1 must not be {@literal null}. * @param member2 must not be {@literal null}. @@ -168,7 +168,7 @@ public interface GeoOperations { /** * Get the {@link Distance} between {@literal member1} and {@literal member2} in the given {@link Metric}. - * + * * @param key must not be {@literal null}. * @param member1 must not be {@literal null}. * @param member2 must not be {@literal null}. @@ -181,7 +181,7 @@ public interface GeoOperations { /** * Get the {@link Distance} between {@literal member1} and {@literal member2} in the given {@link Metric}. - * + * * @param key must not be {@literal null}. * @param member1 must not be {@literal null}. * @param member2 must not be {@literal null}. @@ -197,7 +197,7 @@ public interface GeoOperations { /** * Get Geohash representation of the position for one or more {@literal member}s. - * + * * @param key must not be {@literal null}. * @param members must not be {@literal null}. * @return never {@literal null}. @@ -208,7 +208,7 @@ public interface GeoOperations { /** * Get Geohash representation of the position for one or more {@literal member}s. - * + * * @param key must not be {@literal null}. * @param members must not be {@literal null}. * @return never {@literal null}. @@ -222,7 +222,7 @@ public interface GeoOperations { /** * Get the {@link Point} representation of positions for one or more {@literal member}s. - * + * * @param key must not be {@literal null}. * @param members must not be {@literal null}. * @return never {@literal null}. @@ -233,7 +233,7 @@ public interface GeoOperations { /** * Get the {@link Point} representation of positions for one or more {@literal member}s. - * + * * @param key must not be {@literal null}. * @param members must not be {@literal null}. * @return never {@literal null}. @@ -247,7 +247,7 @@ public interface GeoOperations { /** * Get the {@literal member}s within the boundaries of a given {@link Circle}. - * + * * @param key must not be {@literal null}. * @param within must not be {@literal null}. * @return never {@literal null}. @@ -258,7 +258,7 @@ public interface GeoOperations { /** * Get the {@literal member}s within the boundaries of a given {@link Circle}. - * + * * @param key must not be {@literal null}. * @param within must not be {@literal null}. * @return never {@literal null}. @@ -272,7 +272,7 @@ public interface GeoOperations { /** * Get the {@literal member}s within the boundaries of a given {@link Circle} applying {@link GeoRadiusCommandArgs}. - * + * * @param key must not be {@literal null}. * @param within must not be {@literal null}. * @param args must not be {@literal null}. @@ -284,7 +284,7 @@ public interface GeoOperations { /** * Get the {@literal member}s within the boundaries of a given {@link Circle} applying {@link GeoRadiusCommandArgs}. - * + * * @param key must not be {@literal null}. * @param within must not be {@literal null}. * @param args must not be {@literal null}. @@ -300,7 +300,7 @@ public interface GeoOperations { /** * Get the {@literal member}s within the circle defined by the {@literal members} coordinates and given * {@literal radius}. - * + * * @param key must not be {@literal null}. * @param member must not be {@literal null}. * @param radius @@ -313,7 +313,7 @@ public interface GeoOperations { /** * Get the {@literal member}s within the circle defined by the {@literal members} coordinates and given * {@literal radius}. - * + * * @param key must not be {@literal null}. * @param member must not be {@literal null}. * @param radius @@ -329,7 +329,7 @@ public interface GeoOperations { /** * Get the {@literal member}s within the circle defined by the {@literal members} coordinates and given * {@literal radius} applying {@link Metric}. - * + * * @param key must not be {@literal null}. * @param member must not be {@literal null}. * @param distance must not be {@literal null}. @@ -342,7 +342,7 @@ public interface GeoOperations { /** * Get the {@literal member}s within the circle defined by the {@literal members} coordinates and given * {@literal radius} applying {@link Metric}. - * + * * @param key must not be {@literal null}. * @param member must not be {@literal null}. * @param distance must not be {@literal null}. @@ -358,7 +358,7 @@ public interface GeoOperations { /** * Get the {@literal member}s within the circle defined by the {@literal members} coordinates and given * {@literal radius} applying {@link Metric} and {@link GeoRadiusCommandArgs}. - * + * * @param key must not be {@literal null}. * @param member must not be {@literal null}. * @param distance must not be {@literal null}. @@ -372,7 +372,7 @@ public interface GeoOperations { /** * Get the {@literal member}s within the circle defined by the {@literal members} coordinates and given * {@literal radius} applying {@link Metric} and {@link GeoRadiusCommandArgs}. - * + * * @param key must not be {@literal null}. * @param member must not be {@literal null}. * @param distance must not be {@literal null}. @@ -388,7 +388,7 @@ public interface GeoOperations { /** * Remove the {@literal member}s. - * + * * @param key must not be {@literal null}. * @param members must not be {@literal null}. * @return Number of elements removed. @@ -398,7 +398,7 @@ public interface GeoOperations { /** * Remove the {@literal member}s. - * + * * @param key must not be {@literal null}. * @param members must not be {@literal null}. * @return Number of elements removed. diff --git a/src/test/java/org/springframework/data/redis/core/DefaultGeoOperationsTests.java b/src/test/java/org/springframework/data/redis/core/DefaultGeoOperationsTests.java index c6f53cbab..609702c86 100644 --- a/src/test/java/org/springframework/data/redis/core/DefaultGeoOperationsTests.java +++ b/src/test/java/org/springframework/data/redis/core/DefaultGeoOperationsTests.java @@ -110,97 +110,97 @@ public class DefaultGeoOperationsTests { }); } - @Test // DATAREDIS-438 + @Test // DATAREDIS-438, DATAREDIS-614 public void testGeoAdd() { - Long numAdded = geoOperations.geoAdd(keyFactory.instance(), POINT_PALERMO, valueFactory.instance()); + Long numAdded = geoOperations.add(keyFactory.instance(), POINT_PALERMO, valueFactory.instance()); assertThat(numAdded, is(1L)); } - @Test // DATAREDIS-438 + @Test // DATAREDIS-438, DATAREDIS-614 public void testGeoAddWithLocationMap() { Map memberCoordinateMap = new HashMap<>(); memberCoordinateMap.put(valueFactory.instance(), POINT_PALERMO); memberCoordinateMap.put(valueFactory.instance(), POINT_CATANIA); - Long numAdded = geoOperations.geoAdd(keyFactory.instance(), memberCoordinateMap); + Long numAdded = geoOperations.add(keyFactory.instance(), memberCoordinateMap); assertThat(numAdded, is(2L)); } - @Test // DATAREDIS-438 + @Test // DATAREDIS-438, DATAREDIS-614 public void geoDistShouldReturnDistanceInMetersByDefault() { K key = keyFactory.instance(); M member1 = valueFactory.instance(); M member2 = valueFactory.instance(); - geoOperations.geoAdd(key, POINT_PALERMO, member1); - geoOperations.geoAdd(key, POINT_CATANIA, member2); + geoOperations.add(key, POINT_PALERMO, member1); + geoOperations.add(key, POINT_CATANIA, member2); - Distance dist = geoOperations.geoDist(key, member1, member2); + Distance dist = geoOperations.distance(key, member1, member2); assertThat(dist.getValue(), closeTo(DISTANCE_PALERMO_CATANIA_METERS, 0.005)); assertThat(dist.getUnit(), is(equalTo("m"))); } - @Test // DATAREDIS-438 + @Test // DATAREDIS-438, DATAREDIS-614 public void geoDistShouldReturnDistanceInKilometersCorrectly() { K key = keyFactory.instance(); M member1 = valueFactory.instance(); M member2 = valueFactory.instance(); - geoOperations.geoAdd(key, POINT_PALERMO, member1); - geoOperations.geoAdd(key, POINT_CATANIA, member2); + geoOperations.add(key, POINT_PALERMO, member1); + geoOperations.add(key, POINT_CATANIA, member2); - Distance dist = geoOperations.geoDist(key, member1, member2, KILOMETERS); + Distance dist = geoOperations.distance(key, member1, member2, KILOMETERS); assertThat(dist.getValue(), closeTo(DISTANCE_PALERMO_CATANIA_KILOMETERS, 0.005)); assertThat(dist.getUnit(), is(equalTo("km"))); } - @Test // DATAREDIS-438 + @Test // DATAREDIS-438, DATAREDIS-614 public void geoDistShouldReturnDistanceInMilesCorrectly() { K key = keyFactory.instance(); M member1 = valueFactory.instance(); M member2 = valueFactory.instance(); - geoOperations.geoAdd(key, POINT_PALERMO, member1); - geoOperations.geoAdd(key, POINT_CATANIA, member2); + geoOperations.add(key, POINT_PALERMO, member1); + geoOperations.add(key, POINT_CATANIA, member2); - Distance dist = geoOperations.geoDist(key, member1, member2, DistanceUnit.MILES); + Distance dist = geoOperations.distance(key, member1, member2, DistanceUnit.MILES); assertThat(dist.getValue(), closeTo(DISTANCE_PALERMO_CATANIA_MILES, 0.005)); assertThat(dist.getUnit(), is(equalTo("mi"))); } - @Test // DATAREDIS-438 + @Test // DATAREDIS-438, DATAREDIS-614 public void geoDistShouldReturnDistanceInFeeCorrectly() { K key = keyFactory.instance(); M member1 = valueFactory.instance(); M member2 = valueFactory.instance(); - geoOperations.geoAdd(key, POINT_PALERMO, member1); - geoOperations.geoAdd(key, POINT_CATANIA, member2); + geoOperations.add(key, POINT_PALERMO, member1); + geoOperations.add(key, POINT_CATANIA, member2); - Distance dist = geoOperations.geoDist(key, member1, member2, DistanceUnit.FEET); + Distance dist = geoOperations.distance(key, member1, member2, DistanceUnit.FEET); assertThat(dist.getValue(), closeTo(DISTANCE_PALERMO_CATANIA_FEET, 0.005)); assertThat(dist.getUnit(), is(equalTo("ft"))); } - @Test // DATAREDIS-438 + @Test // DATAREDIS-438, DATAREDIS-614 public void testGeoHash() { K key = keyFactory.instance(); M v1 = valueFactory.instance(); M v2 = valueFactory.instance(); - geoOperations.geoAdd(key, POINT_PALERMO, v1); - geoOperations.geoAdd(key, POINT_CATANIA, v2); + geoOperations.add(key, POINT_PALERMO, v1); + geoOperations.add(key, POINT_CATANIA, v2); - List result = geoOperations.geoHash(key, v1, v2); + List result = geoOperations.hash(key, v1, v2); assertThat(result, hasSize(2)); final RedisSerializer serializer = new StringRedisSerializer(); @@ -209,7 +209,7 @@ public class DefaultGeoOperationsTests { assertThat(result.get(1), is(equalTo("sqdtr74hyu0"))); } - @Test // DATAREDIS-438 + @Test // DATAREDIS-438, DATAREDIS-614 public void testGeoPos() { K key = keyFactory.instance(); @@ -217,10 +217,10 @@ public class DefaultGeoOperationsTests { M v2 = valueFactory.instance(); M v3 = valueFactory.instance(); - geoOperations.geoAdd(key, POINT_PALERMO, v1); - geoOperations.geoAdd(key, POINT_CATANIA, v2); + geoOperations.add(key, POINT_PALERMO, v1); + geoOperations.add(key, POINT_CATANIA, v2); - List result = geoOperations.geoPos(key, v1, v2, v3);// v3 is nonexisting + List result = geoOperations.position(key, v1, v2, v3);// v3 is nonexisting assertThat(result, hasSize(3)); assertThat(result.get(0).getX(), is(closeTo(POINT_PALERMO.getX(), 0.005))); @@ -232,33 +232,33 @@ public class DefaultGeoOperationsTests { assertThat(result.get(2), is(nullValue())); } - @Test // DATAREDIS-438 + @Test // DATAREDIS-438, DATAREDIS-614 public void geoRadiusShouldReturnMembersCorrectly() { K key = keyFactory.instance(); M member1 = valueFactory.instance(); M member2 = valueFactory.instance(); - geoOperations.geoAdd(key, POINT_PALERMO, member1); - geoOperations.geoAdd(key, POINT_CATANIA, member2); + geoOperations.add(key, POINT_PALERMO, member1); + geoOperations.add(key, POINT_CATANIA, member2); - GeoResults> result = geoOperations.geoRadius(key, + GeoResults> result = geoOperations.radius(key, new Circle(new Point(15D, 37D), new Distance(200D, KILOMETERS))); assertThat(result.getContent(), hasSize(2)); } - @Test // DATAREDIS-438 + @Test // DATAREDIS-438, DATAREDIS-614 public void geoRadiusShouldReturnLocationsWithDistance() { K key = keyFactory.instance(); M member1 = valueFactory.instance(); M member2 = valueFactory.instance(); - geoOperations.geoAdd(key, POINT_PALERMO, member1); - geoOperations.geoAdd(key, POINT_CATANIA, member2); + geoOperations.add(key, POINT_PALERMO, member1); + geoOperations.add(key, POINT_CATANIA, member2); - GeoResults> result = geoOperations.geoRadius(key, + GeoResults> result = geoOperations.radius(key, new Circle(new Point(15, 37), new Distance(200, KILOMETERS)), newGeoRadiusArgs().includeDistance().sortDescending()); @@ -272,17 +272,17 @@ public class DefaultGeoOperationsTests { assertThat(result.getContent().get(1).getContent().getName(), is(member2)); } - @Test // DATAREDIS-438 + @Test // DATAREDIS-438, DATAREDIS-614 public void geoRadiusShouldReturnLocationsWithCoordinates() { K key = keyFactory.instance(); M member1 = valueFactory.instance(); M member2 = valueFactory.instance(); - geoOperations.geoAdd(key, POINT_PALERMO, member1); - geoOperations.geoAdd(key, POINT_CATANIA, member2); + geoOperations.add(key, POINT_PALERMO, member1); + geoOperations.add(key, POINT_CATANIA, member2); - GeoResults> result = geoOperations.geoRadius(key, + GeoResults> result = geoOperations.radius(key, new Circle(new Point(15, 37), new Distance(200, KILOMETERS)), newGeoRadiusArgs().includeCoordinates().sortAscending()); @@ -296,17 +296,17 @@ public class DefaultGeoOperationsTests { assertThat(result.getContent().get(1).getContent().getName(), is(member1)); } - @Test // DATAREDIS-438 + @Test // DATAREDIS-438, DATAREDIS-614 public void geoRadiusShouldReturnLocationsWithCoordinatesAndDistance() { K key = keyFactory.instance(); M member1 = valueFactory.instance(); M member2 = valueFactory.instance(); - geoOperations.geoAdd(key, POINT_PALERMO, member1); - geoOperations.geoAdd(key, POINT_CATANIA, member2); + geoOperations.add(key, POINT_PALERMO, member1); + geoOperations.add(key, POINT_CATANIA, member2); - GeoResults> result = geoOperations.geoRadius(key, + GeoResults> result = geoOperations.radius(key, new Circle(new Point(15, 37), new Distance(200, KILOMETERS)), newGeoRadiusArgs().includeCoordinates().includeDistance().sortAscending()); assertThat(result.getContent(), hasSize(2)); @@ -324,7 +324,7 @@ public class DefaultGeoOperationsTests { assertThat(result.getContent().get(1).getContent().getName(), is(member1)); } - @Test // DATAREDIS-438 + @Test // DATAREDIS-438, DATAREDIS-614 public void geoRadiusByMemberShouldReturnMembersCorrectly() { K key = keyFactory.instance(); @@ -332,15 +332,15 @@ public class DefaultGeoOperationsTests { M member2 = valueFactory.instance(); M member3 = valueFactory.instance(); - geoOperations.geoAdd(key, POINT_PALERMO, member1); - geoOperations.geoAdd(key, POINT_CATANIA, member2); - geoOperations.geoAdd(key, POINT_ARIGENTO, member3); + geoOperations.add(key, POINT_PALERMO, member1); + geoOperations.add(key, POINT_CATANIA, member2); + geoOperations.add(key, POINT_ARIGENTO, member3); - GeoResults> result = geoOperations.geoRadiusByMember(key, member3, new Distance(200, KILOMETERS)); + GeoResults> result = geoOperations.radius(key, member3, new Distance(200, KILOMETERS)); assertThat(result.getContent(), hasSize(3)); } - @Test // DATAREDIS-438 + @Test // DATAREDIS-438, DATAREDIS-614 public void geoRadiusByMemberShouldReturnDistanceCorrectly() { K key = keyFactory.instance(); @@ -348,11 +348,11 @@ public class DefaultGeoOperationsTests { M member2 = valueFactory.instance(); M member3 = valueFactory.instance(); - geoOperations.geoAdd(key, POINT_PALERMO, member1); - geoOperations.geoAdd(key, POINT_CATANIA, member2); - geoOperations.geoAdd(key, POINT_ARIGENTO, member3); + geoOperations.add(key, POINT_PALERMO, member1); + geoOperations.add(key, POINT_CATANIA, member2); + geoOperations.add(key, POINT_ARIGENTO, member3); - GeoResults> result = geoOperations.geoRadiusByMember(key, member3, new Distance(100, KILOMETERS), + GeoResults> result = geoOperations.radius(key, member3, new Distance(100, KILOMETERS), newGeoRadiusArgs().includeDistance().sortDescending()); assertThat(result.getContent(), hasSize(2)); @@ -362,7 +362,7 @@ public class DefaultGeoOperationsTests { assertThat(result.getContent().get(1).getContent().getName(), is(member3)); } - @Test // DATAREDIS-438 + @Test // DATAREDIS-438, DATAREDIS-614 public void geoRadiusByMemberShouldReturnCoordinates() { K key = keyFactory.instance(); @@ -370,12 +370,12 @@ public class DefaultGeoOperationsTests { M member2 = valueFactory.instance(); M member3 = valueFactory.instance(); - geoOperations.geoAdd(key, POINT_PALERMO, member1); - geoOperations.geoAdd(key, POINT_CATANIA, member2); - geoOperations.geoAdd(key, POINT_ARIGENTO, member3); + geoOperations.add(key, POINT_PALERMO, member1); + geoOperations.add(key, POINT_CATANIA, member2); + geoOperations.add(key, POINT_ARIGENTO, member3); - GeoResults> result = geoOperations.geoRadiusByMember(key, member3, - new Distance(100, DistanceUnit.KILOMETERS), newGeoRadiusArgs().includeCoordinates().sortAscending()); + GeoResults> result = geoOperations.radius(key, member3, new Distance(100, DistanceUnit.KILOMETERS), + newGeoRadiusArgs().includeCoordinates().sortAscending()); assertThat(result.getContent(), hasSize(2)); assertThat(result.getContent().get(0).getContent().getPoint().getX(), is(closeTo(POINT_ARIGENTO.getX(), 0.005))); @@ -387,7 +387,7 @@ public class DefaultGeoOperationsTests { assertThat(result.getContent().get(1).getContent().getName(), is(member1)); } - @Test // DATAREDIS-438 + @Test // DATAREDIS-438, DATAREDIS-614 public void geoRadiusByMemberShouldReturnCoordinatesAndDistance() { K key = keyFactory.instance(); @@ -395,12 +395,12 @@ public class DefaultGeoOperationsTests { M member2 = valueFactory.instance(); M member3 = valueFactory.instance(); - geoOperations.geoAdd(key, POINT_PALERMO, member1); - geoOperations.geoAdd(key, POINT_CATANIA, member2); - geoOperations.geoAdd(key, POINT_ARIGENTO, member3); + geoOperations.add(key, POINT_PALERMO, member1); + geoOperations.add(key, POINT_CATANIA, member2); + geoOperations.add(key, POINT_ARIGENTO, member3); // with coord and dist, ascending - GeoResults> result = geoOperations.geoRadiusByMember(key, member1, new Distance(100, KILOMETERS), + GeoResults> result = geoOperations.radius(key, member1, new Distance(100, KILOMETERS), newGeoRadiusArgs().includeCoordinates().includeDistance().sortAscending()); assertThat(result.getContent(), hasSize(2)); @@ -415,14 +415,14 @@ public class DefaultGeoOperationsTests { assertThat(result.getContent().get(1).getContent().getName(), is(member3)); } - @Test // DATAREDIS-438 + @Test // DATAREDIS-438, DATAREDIS-614 public void testGeoRemove() { K key = keyFactory.instance(); M member1 = valueFactory.instance(); - geoOperations.geoAdd(key, POINT_PALERMO, member1); + geoOperations.add(key, POINT_PALERMO, member1); - assertThat(geoOperations.geoRemove(key, member1), is(1L)); + assertThat(geoOperations.remove(key, member1), is(1L)); } } diff --git a/src/test/java/org/springframework/data/redis/core/RedisKeyValueAdapterTests.java b/src/test/java/org/springframework/data/redis/core/RedisKeyValueAdapterTests.java index 9b04e5ff2..d3e824120 100644 --- a/src/test/java/org/springframework/data/redis/core/RedisKeyValueAdapterTests.java +++ b/src/test/java/org/springframework/data/redis/core/RedisKeyValueAdapterTests.java @@ -558,7 +558,7 @@ public class RedisKeyValueAdapterTests { assertThat(template.opsForZSet().score("persons:address:location", "1"), is(nullValue())); } - @Test // DATAREDIS-533 + @Test // DATAREDIS-533, DATAREDIS-614 public void updateShouldAlterGeoIndexCorrectlyOnUpdate() { Person tam = new Person(); @@ -575,7 +575,7 @@ public class RedisKeyValueAdapterTests { adapter.update(update); assertThat(template.opsForZSet().score("persons:address:location", "1"), is(notNullValue())); - Point updatedLocation = template.opsForGeo().geoPos("persons:address:location", "1").iterator().next(); + Point updatedLocation = template.opsForGeo().position("persons:address:location", "1").iterator().next(); assertThat(updatedLocation.getX(), is(closeTo(17D, 0.005))); assertThat(updatedLocation.getY(), is(closeTo(18D, 0.005)));