Skip to content

Commit

Permalink
add mget
Browse files Browse the repository at this point in the history
Signed-off-by: Chloe <[email protected]>
  • Loading branch information
cyip10 committed Nov 16, 2024
1 parent cf9d187 commit f9f0e6a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions java/integTest/src/test/java/glide/modules/JsonTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import glide.api.GlideClusterClient;
import glide.api.commands.servermodules.Json;
import glide.api.commands.servermodules.MultiJson;
import glide.api.logging.Logger;
import glide.api.models.ClusterTransaction;
import glide.api.models.GlideString;
import glide.api.models.commands.ConditionalChange;
Expand All @@ -45,7 +44,6 @@ public static void init() {
GlideClusterClient.createClient(commonClusterClientConfig().requestTimeout(5000).build())
.get();
client.flushall(FlushMode.SYNC, ALL_PRIMARIES).get();
Logger.init(Logger.Level.DEBUG, "/home/ubuntu/acarbo/java/log/mylogger.log");
}

@AfterAll
Expand Down Expand Up @@ -1212,8 +1210,6 @@ public void json_type() {
@SneakyThrows
@Test
public void transaction_tests() {
// TODO
// do MGET

ClusterTransaction transaction = new ClusterTransaction();
ArrayList<Object> expectedResult = new ArrayList<>();
Expand All @@ -1222,6 +1218,8 @@ public void transaction_tests() {
String key2 = "{key}-2" + UUID.randomUUID();
String key3 = "{key}-3" + UUID.randomUUID();
String key4 = "{key}-4" + UUID.randomUUID();
String key5 = "{key}-5" + UUID.randomUUID();
String key6 = "{key}-6" + UUID.randomUUID();

MultiJson.set(transaction, key1, "$", "{\"a\": \"one\", \"b\": [\"one\", \"two\"]}");
expectedResult.add(OK);
Expand Down Expand Up @@ -1392,6 +1390,16 @@ public void transaction_tests() {
MultiJson.forget(transaction, key4, "$");
expectedResult.add(1L);

// mget, key5 and key6
MultiJson.set(transaction, key5, "$", "{\"a\": 1, \"b\": [\"one\", \"two\"]}");
expectedResult.add(OK);

MultiJson.set(transaction, key6, "$", "{\"a\": 1, \"c\": false}");
expectedResult.add(OK);

MultiJson.mget(transaction, new String[] {key5, key6}, "$.c");
expectedResult.add(new String[] {"[]", "[false]"});

Object[] results = client.exec(transaction).get();
assertDeepEquals(expectedResult.toArray(), results);
}
Expand Down

0 comments on commit f9f0e6a

Please sign in to comment.