From 398d42812af00c6a1a95a88d13cbc3173aff00e8 Mon Sep 17 00:00:00 2001 From: roimenashe <33356310+roimenashe@users.noreply.github.com> Date: Sun, 14 Mar 2021 16:54:33 +0200 Subject: [PATCH] Feature/upgrade aerospike clients (#161) * Adding a latitude and longitude validation (otherwise Aerospike Client will throw an exception). * Upgrade Aerospike client versions: aerospike-client 4.4.18 -> 5.0.5 aerospike-reactor-client 4.4.10 -> 5.0.3 * Part of the upgrade required a Playtika embedded aerospike-server version configuration in bootstrap.properties file. --- pom.xml | 4 ++-- src/main/resources/bootstrap.properties | 1 + .../query/QueryEngineTestDataPopulator.java | 13 ++++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 src/main/resources/bootstrap.properties diff --git a/pom.xml b/pom.xml index eae1ae940..7cdd13a5d 100644 --- a/pom.xml +++ b/pom.xml @@ -21,8 +21,8 @@ 1.8 - 4.4.18 - 4.4.10 + 5.0.5 + 5.0.3 2.4.5 2.4.5 diff --git a/src/main/resources/bootstrap.properties b/src/main/resources/bootstrap.properties new file mode 100644 index 000000000..cb8604eb7 --- /dev/null +++ b/src/main/resources/bootstrap.properties @@ -0,0 +1 @@ +embedded.aerospike.dockerImage=aerospike/aerospike-server:5.5.0.3 \ No newline at end of file diff --git a/src/test/java/org/springframework/data/aerospike/query/QueryEngineTestDataPopulator.java b/src/test/java/org/springframework/data/aerospike/query/QueryEngineTestDataPopulator.java index 911911940..717d9267c 100644 --- a/src/test/java/org/springframework/data/aerospike/query/QueryEngineTestDataPopulator.java +++ b/src/test/java/org/springframework/data/aerospike/query/QueryEngineTestDataPopulator.java @@ -117,12 +117,19 @@ private void setupGeoData() { for (int i = 0; i < RECORD_COUNT; i++) { double lng = -122 + (0.1 * i); double lat = 37.5 + (0.1 * i); - Bin bin = Bin.asGeoJSON(GEO_BIN_NAME, buildGeoValue(lng, lat)); - client.put(null, new Key(namespace, GEO_SET, keyPrefix + i), bin); - client.put(null, new Key(namespace, INDEXED_GEO_SET, keyPrefix + i), bin); + if (isLatLngValidPair(lng, lat)) { + Bin bin = Bin.asGeoJSON(GEO_BIN_NAME, buildGeoValue(lng, lat)); + client.put(null, new Key(namespace, GEO_SET, keyPrefix + i), bin); + client.put(null, new Key(namespace, INDEXED_GEO_SET, keyPrefix + i), bin); + } } } + private boolean isLatLngValidPair(double lng, double lat) { + return (-180 <= lng && lng <= 180 + && -90 <= lat && lat <= 90); + } + private void setupSpecialCharsData() { Key ewsKey = new Key(namespace, SPECIAL_CHAR_SET, "ends-with-star"); Bin ewsBin = new Bin(SPECIAL_CHAR_BIN, "abcd.*");