From a2f468b0b53ba89844679089d09b0f687ee6024f Mon Sep 17 00:00:00 2001 From: SanHalacogluImproving <144171266+SanHalacogluImproving@users.noreply.github.com> Date: Thu, 4 Apr 2024 12:28:45 -0700 Subject: [PATCH 1/6] Java: Add Zmscore command. (Sorted Set Command Group) (#173) --- CHANGELOG.md | 1 + glide-core/src/protobuf/redis_request.proto | 3 +- .../src/main/java/glide/api/BaseClient.java | 10 +++++++ .../api/commands/SortedSetBaseCommands.java | 19 +++++++++++++ .../glide/api/models/BaseTransaction.java | 19 +++++++++++++ .../test/java/glide/api/RedisClientTest.java | 26 +++++++++++++++++ .../glide/api/models/TransactionTests.java | 7 +++++ .../test/java/glide/SharedCommandTests.java | 28 +++++++++++++++++++ .../java/glide/TransactionTestUtilities.java | 2 ++ 9 files changed, 114 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75aa8272ef..6c20a92d77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ * Core: Enabled Cluster Mode periodic checks by default ([#1089](https://github.com/aws/glide-for-redis/pull/1089)) * Node: Added Rename command. ([#1124](https://github.com/aws/glide-for-redis/pull/1124)) * Python: Added JSON.TOGGLE command ([#1184](https://github.com/aws/glide-for-redis/pull/1184)) +* Java: Added ZMSCORE command (TODO ADD HERE PR #) #### Features diff --git a/glide-core/src/protobuf/redis_request.proto b/glide-core/src/protobuf/redis_request.proto index 08428b92ea..61f0747bd2 100644 --- a/glide-core/src/protobuf/redis_request.proto +++ b/glide-core/src/protobuf/redis_request.proto @@ -143,6 +143,7 @@ enum RequestType { Blpop = 100; RPushX = 102; LPushX = 103; + ZMScore = 104; } message Command { @@ -169,7 +170,7 @@ message Transaction { message RedisRequest { uint32 callback_idx = 1; - + oneof command { Command single_command = 2; Transaction transaction = 3; diff --git a/java/client/src/main/java/glide/api/BaseClient.java b/java/client/src/main/java/glide/api/BaseClient.java index 6422a66a0a..c0ba073d90 100644 --- a/java/client/src/main/java/glide/api/BaseClient.java +++ b/java/client/src/main/java/glide/api/BaseClient.java @@ -63,6 +63,7 @@ import static redis_request.RedisRequestOuterClass.RequestType.ZPopMax; import static redis_request.RedisRequestOuterClass.RequestType.ZPopMin; import static redis_request.RedisRequestOuterClass.RequestType.ZScore; +import static redis_request.RedisRequestOuterClass.RequestType.ZMScore; import static redis_request.RedisRequestOuterClass.RequestType.Zadd; import static redis_request.RedisRequestOuterClass.RequestType.Zcard; import static redis_request.RedisRequestOuterClass.RequestType.Zrange; @@ -714,6 +715,15 @@ public CompletableFuture zrankWithScore(@NonNull String key, @NonNull Zrank, new String[] {key, member, WITH_SCORE_REDIS_API}, this::handleArrayOrNullResponse); } + @Override + public CompletableFuture zmscore(@NonNull String key, @NonNull String[] members) { + String[] arguments = ArrayUtils.addFirst(members, key); + return commandManager.submitNewCommand( + ZMScore, + arguments, + response -> castArray(handleArrayOrNullResponse(response), Double.class)); + } + @Override public CompletableFuture xadd(@NonNull String key, @NonNull Map values) { return xadd(key, values, StreamAddOptions.builder().build()); diff --git a/java/client/src/main/java/glide/api/commands/SortedSetBaseCommands.java b/java/client/src/main/java/glide/api/commands/SortedSetBaseCommands.java index d4a9e5d4ea..eff74f03ee 100644 --- a/java/client/src/main/java/glide/api/commands/SortedSetBaseCommands.java +++ b/java/client/src/main/java/glide/api/commands/SortedSetBaseCommands.java @@ -456,4 +456,23 @@ CompletableFuture> zrangeWithScores( * } */ CompletableFuture zrankWithScore(String key, String member); + + /** + * Returns the scores associated with the specified members in the sorted set stored + * at key. + * + * @see redis.io for more details. + * @param key The key of the sorted set. + * @param members An array of members whose scores are to be retrieved. + * @return An array representing the scores for the specified members. + *
+ * If a member does not exist, the corresponding value in the array + * will be null. + * @example + *
{@code
+     * Double[] payload = client.zmscore(key1, new String[] {"one", "nonExistentMember", "three"}).get();
+     * assert payload.equals(new Double[] {1.0, null, 3.0});
+     * }
+ */ + CompletableFuture zmscore(String key, String[] members); } diff --git a/java/client/src/main/java/glide/api/models/BaseTransaction.java b/java/client/src/main/java/glide/api/models/BaseTransaction.java index 9a59ce1b46..4af591aec9 100644 --- a/java/client/src/main/java/glide/api/models/BaseTransaction.java +++ b/java/client/src/main/java/glide/api/models/BaseTransaction.java @@ -74,6 +74,7 @@ import static redis_request.RedisRequestOuterClass.RequestType.ZPopMax; import static redis_request.RedisRequestOuterClass.RequestType.ZPopMin; import static redis_request.RedisRequestOuterClass.RequestType.ZScore; +import static redis_request.RedisRequestOuterClass.RequestType.ZMScore; import static redis_request.RedisRequestOuterClass.RequestType.Zadd; import static redis_request.RedisRequestOuterClass.RequestType.Zcard; import static redis_request.RedisRequestOuterClass.RequestType.Zrange; @@ -1514,6 +1515,24 @@ public T zrankWithScore(@NonNull String key, @NonNull String member) { return getThis(); } + /** + * Returns the scores associated with the specified members in the sorted set stored + * at key. + * + * @see redis.io for more details. + * @param key The key of the sorted set. + * @param members An array of members whose scores are to be retrieved. + * @return Command Response - An array representing the scores for the specified + * members.
+ * If a member does not exist, the corresponding value in the array + * will be null. + */ + public T zmscore(@NonNull String key, @NonNull String[] members) { + ArgsArray commandArgs = buildArgs(ArrayUtils.addFirst(members, key)); + protobufTransaction.addCommands(buildCommand(ZMScore, commandArgs)); + return getThis(); + } + /** * Adds an entry to the specified stream. * diff --git a/java/client/src/test/java/glide/api/RedisClientTest.java b/java/client/src/test/java/glide/api/RedisClientTest.java index 15deb678cd..7a5205f56a 100644 --- a/java/client/src/test/java/glide/api/RedisClientTest.java +++ b/java/client/src/test/java/glide/api/RedisClientTest.java @@ -90,6 +90,7 @@ import static redis_request.RedisRequestOuterClass.RequestType.Time; import static redis_request.RedisRequestOuterClass.RequestType.Type; import static redis_request.RedisRequestOuterClass.RequestType.Unlink; +import static redis_request.RedisRequestOuterClass.RequestType.ZMScore; import static redis_request.RedisRequestOuterClass.RequestType.XAdd; import static redis_request.RedisRequestOuterClass.RequestType.ZPopMax; import static redis_request.RedisRequestOuterClass.RequestType.ZPopMin; @@ -2270,6 +2271,31 @@ public void zrankWithScore_returns_success() { assertEquals(value, payload); } + @SneakyThrows + @Test + public void zmscore_returns_success() { + // setup + String key = "testKey"; + String[] members = new String[] {"member1", "member2"}; + String[] arguments = new String[] {key, "member1", "member2"}; + Double[] value = new Double[] {2.5, 8.2}; + + CompletableFuture testResponse = new CompletableFuture<>(); + testResponse.complete(value); + + // match on protobuf request + when(commandManager.submitNewCommand(eq(ZMScore), eq(arguments), any())) + .thenReturn(testResponse); + + // exercise + CompletableFuture response = service.zmscore(key, members); + Double[] payload = response.get(); + + // verify + assertEquals(testResponse, response); + assertEquals(value, payload); + } + @SneakyThrows @Test public void xadd_returns_success() { diff --git a/java/client/src/test/java/glide/api/models/TransactionTests.java b/java/client/src/test/java/glide/api/models/TransactionTests.java index 886a4c56df..791eb8e766 100644 --- a/java/client/src/test/java/glide/api/models/TransactionTests.java +++ b/java/client/src/test/java/glide/api/models/TransactionTests.java @@ -68,6 +68,7 @@ import static redis_request.RedisRequestOuterClass.RequestType.Time; import static redis_request.RedisRequestOuterClass.RequestType.Type; import static redis_request.RedisRequestOuterClass.RequestType.Unlink; +import static redis_request.RedisRequestOuterClass.RequestType.ZMScore; import static redis_request.RedisRequestOuterClass.RequestType.XAdd; import static redis_request.RedisRequestOuterClass.RequestType.ZPopMax; import static redis_request.RedisRequestOuterClass.RequestType.ZPopMin; @@ -459,6 +460,12 @@ public void transaction_builds_protobuf_request(BaseTransaction transaction) .addArgs(WITH_SCORE_REDIS_API) .build())); + transaction.zmscore("key", new String[] {"member1", "member2"}); + results.add( + Pair.of( + ZMScore, + ArgsArray.newBuilder().addArgs("key").addArgs("member1").addArgs("member2").build())); + transaction.xadd("key", Map.of("field1", "foo1")); results.add( Pair.of( diff --git a/java/integTest/src/test/java/glide/SharedCommandTests.java b/java/integTest/src/test/java/glide/SharedCommandTests.java index 2477549b72..0d9d72d553 100644 --- a/java/integTest/src/test/java/glide/SharedCommandTests.java +++ b/java/integTest/src/test/java/glide/SharedCommandTests.java @@ -1315,6 +1315,34 @@ public void zrank(BaseClient client) { assertTrue(executionException.getCause() instanceof RequestException); } + @SneakyThrows + @ParameterizedTest + @MethodSource("getClients") + public void zmscore(BaseClient client) { + String key1 = UUID.randomUUID().toString(); + String key2 = UUID.randomUUID().toString(); + Map membersScores = Map.of("one", 1.0, "two", 2.0, "three", 3.0); + assertEquals(3, client.zadd(key1, membersScores).get()); + assertArrayEquals( + new Double[] {1.0, 2.0, 3.0}, + client.zmscore(key1, new String[] {"one", "two", "three"}).get()); + assertArrayEquals( + new Double[] {2.0, 3.0}, client.zmscore(key1, new String[] {"two", "three"}).get()); + assertArrayEquals( + new Double[] {1.0, null, 3.0}, + client.zmscore(key1, new String[] {"one", "nonExistentMember", "three"}).get()); + assertArrayEquals( + new Double[] {null}, + client.zmscore("nonExistentKey", new String[] {"nonExistentMember"}).get()); + + // Key exists, but it is not a set + assertEquals(OK, client.set(key2, "bar").get()); + ExecutionException executionException = + assertThrows( + ExecutionException.class, () -> client.zmscore(key2, new String[] {"one"}).get()); + assertTrue(executionException.getCause() instanceof RequestException); + } + @SneakyThrows @ParameterizedTest @MethodSource("getClients") diff --git a/java/integTest/src/test/java/glide/TransactionTestUtilities.java b/java/integTest/src/test/java/glide/TransactionTestUtilities.java index 95e1014727..d93dd7362f 100644 --- a/java/integTest/src/test/java/glide/TransactionTestUtilities.java +++ b/java/integTest/src/test/java/glide/TransactionTestUtilities.java @@ -101,6 +101,7 @@ public static BaseTransaction transactionTest(BaseTransaction baseTransact baseTransaction.zaddIncr(key8, "one", 3); baseTransaction.zrem(key8, new String[] {"one"}); baseTransaction.zcard(key8); + baseTransaction.zmscore(key8, new String[] {"two", "three"}); baseTransaction.zrange(key8, new RangeByIndex(0, 1)); baseTransaction.zrangeWithScores(key8, new RangeByIndex(0, 1)); baseTransaction.zscore(key8, "two"); @@ -192,6 +193,7 @@ public static Object[] transactionTestResult() { 4.0, 1L, 2L, + new Double[] {2.0, 3.0}, // zmscore(key8, new String[] {"two", "three"}) new String[] {"two", "three"}, // zrange Map.of("two", 2.0, "three", 3.0), // zrangeWithScores 2.0, // zscore(key8, "two") From ae0825f8eee7cf087ec66a0e4e4f108c12287596 Mon Sep 17 00:00:00 2001 From: SanHalacogluImproving Date: Thu, 4 Apr 2024 12:45:37 -0700 Subject: [PATCH 2/6] Minor update + remove change log. --- CHANGELOG.md | 1 - java/client/src/main/java/glide/api/models/BaseTransaction.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c20a92d77..75aa8272ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,7 +45,6 @@ * Core: Enabled Cluster Mode periodic checks by default ([#1089](https://github.com/aws/glide-for-redis/pull/1089)) * Node: Added Rename command. ([#1124](https://github.com/aws/glide-for-redis/pull/1124)) * Python: Added JSON.TOGGLE command ([#1184](https://github.com/aws/glide-for-redis/pull/1184)) -* Java: Added ZMSCORE command (TODO ADD HERE PR #) #### Features diff --git a/java/client/src/main/java/glide/api/models/BaseTransaction.java b/java/client/src/main/java/glide/api/models/BaseTransaction.java index 4af591aec9..e9492caa31 100644 --- a/java/client/src/main/java/glide/api/models/BaseTransaction.java +++ b/java/client/src/main/java/glide/api/models/BaseTransaction.java @@ -1523,7 +1523,7 @@ public T zrankWithScore(@NonNull String key, @NonNull String member) { * @param key The key of the sorted set. * @param members An array of members whose scores are to be retrieved. * @return Command Response - An array representing the scores for the specified - * members.
+ * members.
* If a member does not exist, the corresponding value in the array * will be null. */ From c9580eea491dc459cfdd3a7c023bb58d1359b4df Mon Sep 17 00:00:00 2001 From: SanHalacogluImproving Date: Fri, 5 Apr 2024 11:16:18 -0700 Subject: [PATCH 3/6] Minor documentation update. --- .../java/glide/api/commands/SortedSetBaseCommands.java | 7 +++---- .../src/main/java/glide/api/models/BaseTransaction.java | 7 +++---- java/integTest/src/test/java/glide/SharedCommandTests.java | 2 -- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/java/client/src/main/java/glide/api/commands/SortedSetBaseCommands.java b/java/client/src/main/java/glide/api/commands/SortedSetBaseCommands.java index eff74f03ee..0e048a3bfe 100644 --- a/java/client/src/main/java/glide/api/commands/SortedSetBaseCommands.java +++ b/java/client/src/main/java/glide/api/commands/SortedSetBaseCommands.java @@ -463,10 +463,9 @@ CompletableFuture> zrangeWithScores( * * @see redis.io for more details. * @param key The key of the sorted set. - * @param members An array of members whose scores are to be retrieved. - * @return An array representing the scores for the specified members. - *
- * If a member does not exist, the corresponding value in the array + * @param members An array of members in the sorted set. + * @return An Array of scores of the members.
+ * If a member does not exist, the corresponding value in the Array * will be null. * @example *
{@code
diff --git a/java/client/src/main/java/glide/api/models/BaseTransaction.java b/java/client/src/main/java/glide/api/models/BaseTransaction.java
index e9492caa31..5adc690831 100644
--- a/java/client/src/main/java/glide/api/models/BaseTransaction.java
+++ b/java/client/src/main/java/glide/api/models/BaseTransaction.java
@@ -1521,10 +1521,9 @@ public T zrankWithScore(@NonNull String key, @NonNull String member) {
      *
      * @see redis.io for more details.
      * @param key The key of the sorted set.
-     * @param members An array of members whose scores are to be retrieved.
-     * @return Command Response - An array representing the scores for the specified
-     *     members.
- * If a member does not exist, the corresponding value in the array + * @param members An array of members in the sorted set. + * @return Command Response - An Array of scores of the members.
+ * If a member does not exist, the corresponding value in the Array * will be null. */ public T zmscore(@NonNull String key, @NonNull String[] members) { diff --git a/java/integTest/src/test/java/glide/SharedCommandTests.java b/java/integTest/src/test/java/glide/SharedCommandTests.java index 0d9d72d553..ab6647e698 100644 --- a/java/integTest/src/test/java/glide/SharedCommandTests.java +++ b/java/integTest/src/test/java/glide/SharedCommandTests.java @@ -1326,8 +1326,6 @@ public void zmscore(BaseClient client) { assertArrayEquals( new Double[] {1.0, 2.0, 3.0}, client.zmscore(key1, new String[] {"one", "two", "three"}).get()); - assertArrayEquals( - new Double[] {2.0, 3.0}, client.zmscore(key1, new String[] {"two", "three"}).get()); assertArrayEquals( new Double[] {1.0, null, 3.0}, client.zmscore(key1, new String[] {"one", "nonExistentMember", "three"}).get()); From 4a60c4026da49da35a63fc701ed2c92126b2c200 Mon Sep 17 00:00:00 2001 From: SanHalacogluImproving Date: Fri, 5 Apr 2024 11:39:48 -0700 Subject: [PATCH 4/6] Minor IT update. --- java/integTest/src/test/java/glide/SharedCommandTests.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/java/integTest/src/test/java/glide/SharedCommandTests.java b/java/integTest/src/test/java/glide/SharedCommandTests.java index ab6647e698..bf05792f63 100644 --- a/java/integTest/src/test/java/glide/SharedCommandTests.java +++ b/java/integTest/src/test/java/glide/SharedCommandTests.java @@ -1327,8 +1327,10 @@ public void zmscore(BaseClient client) { new Double[] {1.0, 2.0, 3.0}, client.zmscore(key1, new String[] {"one", "two", "three"}).get()); assertArrayEquals( - new Double[] {1.0, null, 3.0}, - client.zmscore(key1, new String[] {"one", "nonExistentMember", "three"}).get()); + new Double[] {1.0, null, null, 3.0}, + client + .zmscore(key1, new String[] {"one", "nonExistentMember", "nonExistentMember", "three"}) + .get()); assertArrayEquals( new Double[] {null}, client.zmscore("nonExistentKey", new String[] {"nonExistentMember"}).get()); From cbd51922500aab86fa3cdab7f664c3cb45b75880 Mon Sep 17 00:00:00 2001 From: SanHalacogluImproving Date: Wed, 10 Apr 2024 11:34:03 -0700 Subject: [PATCH 5/6] Rebase + Spotless. --- glide-core/src/request_type.rs | 3 +++ java/client/src/main/java/glide/api/BaseClient.java | 8 ++++---- .../main/java/glide/api/models/BaseTransaction.java | 2 +- .../src/test/java/glide/api/RedisClientTest.java | 4 ++-- .../test/java/glide/api/models/TransactionTests.java | 8 ++++---- .../src/test/java/glide/SharedCommandTests.java | 12 ++++++------ 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/glide-core/src/request_type.rs b/glide-core/src/request_type.rs index ffed834871..41138cadaf 100644 --- a/glide-core/src/request_type.rs +++ b/glide-core/src/request_type.rs @@ -111,6 +111,7 @@ pub enum RequestType { Blpop = 100, RPushX = 102, LPushX = 103, + ZMScore = 104, } fn get_two_word_command(first: &str, second: &str) -> Cmd { @@ -225,6 +226,7 @@ impl From<::protobuf::EnumOrUnknown> for RequestType { ProtobufRequestType::LPushX => RequestType::LPushX, ProtobufRequestType::Blpop => RequestType::Blpop, ProtobufRequestType::Spop => RequestType::Spop, + ProtobufRequestType::ZMScore => RequestType::ZMScore, } } } @@ -335,6 +337,7 @@ impl RequestType { RequestType::LPushX => Some(cmd("LPUSHX")), RequestType::Blpop => Some(cmd("BLPOP")), RequestType::Spop => Some(cmd("SPOP")), + RequestType::ZMScore => Some(cmd("ZMSCORE")), } } } diff --git a/java/client/src/main/java/glide/api/BaseClient.java b/java/client/src/main/java/glide/api/BaseClient.java index c0ba073d90..bf29fb4389 100644 --- a/java/client/src/main/java/glide/api/BaseClient.java +++ b/java/client/src/main/java/glide/api/BaseClient.java @@ -60,10 +60,10 @@ import static redis_request.RedisRequestOuterClass.RequestType.Type; import static redis_request.RedisRequestOuterClass.RequestType.Unlink; import static redis_request.RedisRequestOuterClass.RequestType.XAdd; +import static redis_request.RedisRequestOuterClass.RequestType.ZMScore; import static redis_request.RedisRequestOuterClass.RequestType.ZPopMax; import static redis_request.RedisRequestOuterClass.RequestType.ZPopMin; import static redis_request.RedisRequestOuterClass.RequestType.ZScore; -import static redis_request.RedisRequestOuterClass.RequestType.ZMScore; import static redis_request.RedisRequestOuterClass.RequestType.Zadd; import static redis_request.RedisRequestOuterClass.RequestType.Zcard; import static redis_request.RedisRequestOuterClass.RequestType.Zrange; @@ -719,9 +719,9 @@ public CompletableFuture zrankWithScore(@NonNull String key, @NonNull public CompletableFuture zmscore(@NonNull String key, @NonNull String[] members) { String[] arguments = ArrayUtils.addFirst(members, key); return commandManager.submitNewCommand( - ZMScore, - arguments, - response -> castArray(handleArrayOrNullResponse(response), Double.class)); + ZMScore, + arguments, + response -> castArray(handleArrayOrNullResponse(response), Double.class)); } @Override diff --git a/java/client/src/main/java/glide/api/models/BaseTransaction.java b/java/client/src/main/java/glide/api/models/BaseTransaction.java index 5adc690831..a467e5bdf6 100644 --- a/java/client/src/main/java/glide/api/models/BaseTransaction.java +++ b/java/client/src/main/java/glide/api/models/BaseTransaction.java @@ -71,10 +71,10 @@ import static redis_request.RedisRequestOuterClass.RequestType.Type; import static redis_request.RedisRequestOuterClass.RequestType.Unlink; import static redis_request.RedisRequestOuterClass.RequestType.XAdd; +import static redis_request.RedisRequestOuterClass.RequestType.ZMScore; import static redis_request.RedisRequestOuterClass.RequestType.ZPopMax; import static redis_request.RedisRequestOuterClass.RequestType.ZPopMin; import static redis_request.RedisRequestOuterClass.RequestType.ZScore; -import static redis_request.RedisRequestOuterClass.RequestType.ZMScore; import static redis_request.RedisRequestOuterClass.RequestType.Zadd; import static redis_request.RedisRequestOuterClass.RequestType.Zcard; import static redis_request.RedisRequestOuterClass.RequestType.Zrange; diff --git a/java/client/src/test/java/glide/api/RedisClientTest.java b/java/client/src/test/java/glide/api/RedisClientTest.java index 7a5205f56a..aef934bf52 100644 --- a/java/client/src/test/java/glide/api/RedisClientTest.java +++ b/java/client/src/test/java/glide/api/RedisClientTest.java @@ -90,8 +90,8 @@ import static redis_request.RedisRequestOuterClass.RequestType.Time; import static redis_request.RedisRequestOuterClass.RequestType.Type; import static redis_request.RedisRequestOuterClass.RequestType.Unlink; -import static redis_request.RedisRequestOuterClass.RequestType.ZMScore; import static redis_request.RedisRequestOuterClass.RequestType.XAdd; +import static redis_request.RedisRequestOuterClass.RequestType.ZMScore; import static redis_request.RedisRequestOuterClass.RequestType.ZPopMax; import static redis_request.RedisRequestOuterClass.RequestType.ZPopMin; import static redis_request.RedisRequestOuterClass.RequestType.ZScore; @@ -2285,7 +2285,7 @@ public void zmscore_returns_success() { // match on protobuf request when(commandManager.submitNewCommand(eq(ZMScore), eq(arguments), any())) - .thenReturn(testResponse); + .thenReturn(testResponse); // exercise CompletableFuture response = service.zmscore(key, members); diff --git a/java/client/src/test/java/glide/api/models/TransactionTests.java b/java/client/src/test/java/glide/api/models/TransactionTests.java index 791eb8e766..a9989308ed 100644 --- a/java/client/src/test/java/glide/api/models/TransactionTests.java +++ b/java/client/src/test/java/glide/api/models/TransactionTests.java @@ -68,8 +68,8 @@ import static redis_request.RedisRequestOuterClass.RequestType.Time; import static redis_request.RedisRequestOuterClass.RequestType.Type; import static redis_request.RedisRequestOuterClass.RequestType.Unlink; -import static redis_request.RedisRequestOuterClass.RequestType.ZMScore; import static redis_request.RedisRequestOuterClass.RequestType.XAdd; +import static redis_request.RedisRequestOuterClass.RequestType.ZMScore; import static redis_request.RedisRequestOuterClass.RequestType.ZPopMax; import static redis_request.RedisRequestOuterClass.RequestType.ZPopMin; import static redis_request.RedisRequestOuterClass.RequestType.ZScore; @@ -462,9 +462,9 @@ public void transaction_builds_protobuf_request(BaseTransaction transaction) transaction.zmscore("key", new String[] {"member1", "member2"}); results.add( - Pair.of( - ZMScore, - ArgsArray.newBuilder().addArgs("key").addArgs("member1").addArgs("member2").build())); + Pair.of( + ZMScore, + ArgsArray.newBuilder().addArgs("key").addArgs("member1").addArgs("member2").build())); transaction.xadd("key", Map.of("field1", "foo1")); results.add( diff --git a/java/integTest/src/test/java/glide/SharedCommandTests.java b/java/integTest/src/test/java/glide/SharedCommandTests.java index bf05792f63..6ec3691343 100644 --- a/java/integTest/src/test/java/glide/SharedCommandTests.java +++ b/java/integTest/src/test/java/glide/SharedCommandTests.java @@ -1324,22 +1324,22 @@ public void zmscore(BaseClient client) { Map membersScores = Map.of("one", 1.0, "two", 2.0, "three", 3.0); assertEquals(3, client.zadd(key1, membersScores).get()); assertArrayEquals( - new Double[] {1.0, 2.0, 3.0}, - client.zmscore(key1, new String[] {"one", "two", "three"}).get()); + new Double[] {1.0, 2.0, 3.0}, + client.zmscore(key1, new String[] {"one", "two", "three"}).get()); assertArrayEquals( new Double[] {1.0, null, null, 3.0}, client .zmscore(key1, new String[] {"one", "nonExistentMember", "nonExistentMember", "three"}) .get()); assertArrayEquals( - new Double[] {null}, - client.zmscore("nonExistentKey", new String[] {"nonExistentMember"}).get()); + new Double[] {null}, + client.zmscore("nonExistentKey", new String[] {"nonExistentMember"}).get()); // Key exists, but it is not a set assertEquals(OK, client.set(key2, "bar").get()); ExecutionException executionException = - assertThrows( - ExecutionException.class, () -> client.zmscore(key2, new String[] {"one"}).get()); + assertThrows( + ExecutionException.class, () -> client.zmscore(key2, new String[] {"one"}).get()); assertTrue(executionException.getCause() instanceof RequestException); } From 0cb79899591aefdf533ecf57f54ef6fd2bc7f071 Mon Sep 17 00:00:00 2001 From: SanHalacogluImproving Date: Wed, 10 Apr 2024 11:36:49 -0700 Subject: [PATCH 6/6] Minor IT test update. --- java/integTest/src/test/java/glide/SharedCommandTests.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/java/integTest/src/test/java/glide/SharedCommandTests.java b/java/integTest/src/test/java/glide/SharedCommandTests.java index 6ec3691343..d1e27596a6 100644 --- a/java/integTest/src/test/java/glide/SharedCommandTests.java +++ b/java/integTest/src/test/java/glide/SharedCommandTests.java @@ -1332,8 +1332,7 @@ public void zmscore(BaseClient client) { .zmscore(key1, new String[] {"one", "nonExistentMember", "nonExistentMember", "three"}) .get()); assertArrayEquals( - new Double[] {null}, - client.zmscore("nonExistentKey", new String[] {"nonExistentMember"}).get()); + new Double[] {null}, client.zmscore("nonExistentKey", new String[] {"one"}).get()); // Key exists, but it is not a set assertEquals(OK, client.set(key2, "bar").get());