Skip to content

Commit a0b0c59

Browse files
committed
Revert "Fix incompatibilities with the latest RedisStack (#3855)"
This reverts commit 6b9d338.
1 parent 6b9d338 commit a0b0c59

File tree

9 files changed

+38
-15
lines changed

9 files changed

+38
-15
lines changed

Diff for: src/main/java/redis/clients/jedis/CommandObjects.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -3495,7 +3495,8 @@ public final CommandObject<String> jsonMerge(String key, Path path, Object pojo)
34953495
}
34963496

34973497
public final CommandObject<Object> jsonGet(String key) {
3498-
return new CommandObject<>(commandArguments(JsonCommand.GET).key(key), JSON_GENERIC_OBJECT);
3498+
return new CommandObject<>(commandArguments(JsonCommand.GET).key(key),
3499+
protocol != RedisProtocol.RESP3 ? JSON_GENERIC_OBJECT : JsonBuilderFactory.JSON_OBJECT);
34993500
}
35003501

35013502
@Deprecated

Diff for: src/test/java/redis/clients/jedis/commands/commandobjects/CommandObjectsJsonCommandsTest.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -269,13 +269,14 @@ public void testJsonGenericObjectResp3() {
269269
assertThat(setResult, equalTo("OK"));
270270

271271
Object getRoot = exec(commandObjects.jsonGet(key));
272-
assertThat(getRoot, instanceOf(JSONObject.class));
272+
assertThat(getRoot, instanceOf(JSONArray.class));
273273

274274
JSONObject expectedPerson = new JSONObject();
275275
expectedPerson.put("name", "John Doe");
276276
expectedPerson.put("age", 30);
277277

278-
assertThat(expectedPerson, jsonEquals(getRoot));
278+
JSONArray expected = new JSONArray().put(expectedPerson);
279+
assertThat(getRoot, jsonEquals(expected));
279280
}
280281

281282
@Test

Diff for: src/test/java/redis/clients/jedis/mocked/pipeline/PipeliningBaseGraphCommandsTest.java

-2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@
99
import java.util.List;
1010
import java.util.Map;
1111

12-
import org.junit.Ignore;
1312
import org.junit.Test;
1413
import redis.clients.jedis.Response;
1514
import redis.clients.jedis.graph.ResultSet;
1615

17-
@Ignore
1816
public class PipeliningBaseGraphCommandsTest extends PipeliningBaseMockedTestBase {
1917

2018
@Test

Diff for: src/test/java/redis/clients/jedis/modules/graph/GraphAPITest.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99

1010
import java.util.*;
1111

12-
import org.junit.*;
12+
import org.junit.After;
13+
import org.junit.Assert;
14+
import org.junit.BeforeClass;
15+
import org.junit.Test;
1316
import org.junit.runner.RunWith;
1417
import org.junit.runners.Parameterized;
1518

@@ -22,7 +25,6 @@
2225

2326
import redis.clients.jedis.modules.RedisModuleCommandsTestBase;
2427

25-
@Ignore
2628
@RunWith(Parameterized.class)
2729
public class GraphAPITest extends RedisModuleCommandsTestBase {
2830

Diff for: src/test/java/redis/clients/jedis/modules/graph/GraphPipelineTest.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
import java.util.Iterator;
1010
import java.util.List;
1111

12-
import org.junit.*;
12+
import org.junit.After;
13+
import org.junit.Before;
14+
import org.junit.BeforeClass;
15+
import org.junit.Test;
1316
import org.junit.runner.RunWith;
1417
import org.junit.runners.Parameterized;
1518

@@ -23,7 +26,6 @@
2326
import redis.clients.jedis.graph.entities.Property;
2427
import redis.clients.jedis.modules.RedisModuleCommandsTestBase;
2528

26-
@Ignore
2729
@RunWith(Parameterized.class)
2830
public class GraphPipelineTest extends RedisModuleCommandsTestBase {
2931

Diff for: src/test/java/redis/clients/jedis/modules/graph/GraphTransactionTest.java

-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import java.util.List;
1111

1212
import org.junit.BeforeClass;
13-
import org.junit.Ignore;
1413
import org.junit.Test;
1514
import org.junit.runner.RunWith;
1615
import org.junit.runners.Parameterized;
@@ -24,7 +23,6 @@
2423
import redis.clients.jedis.graph.entities.Property;
2524
import redis.clients.jedis.modules.RedisModuleCommandsTestBase;
2625

27-
@Ignore
2826
@RunWith(Parameterized.class)
2927
public class GraphTransactionTest extends RedisModuleCommandsTestBase {
3028

Diff for: src/test/java/redis/clients/jedis/modules/graph/GraphValuesTest.java

-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import static org.junit.Assert.assertEquals;
44

55
import org.junit.BeforeClass;
6-
import org.junit.Ignore;
76
import org.junit.Test;
87
import org.junit.runner.RunWith;
98
import org.junit.runners.Parameterized;
@@ -13,7 +12,6 @@
1312
import redis.clients.jedis.graph.ResultSet;
1413
import redis.clients.jedis.modules.RedisModuleCommandsTestBase;
1514

16-
@Ignore
1715
@RunWith(Parameterized.class)
1816
public class GraphValuesTest extends RedisModuleCommandsTestBase {
1917

Diff for: src/test/java/redis/clients/jedis/modules/graph/PathBuilderTest.java

-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
import static org.junit.Assert.assertThrows;
44
import static org.junit.Assert.assertTrue;
55

6-
import org.junit.Ignore;
76
import org.junit.Test;
87
import redis.clients.jedis.graph.entities.Edge;
98

10-
@Ignore
119
public class PathBuilderTest {
1210

1311
@Test

Diff for: src/test/java/redis/clients/jedis/modules/json/RedisJsonV2Test.java

+25
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ public void setUp() {
5050

5151
@Test
5252
public void basicSetGetShouldSucceed() {
53+
Assume.assumeFalse(protocol == RedisProtocol.RESP3);
54+
5355
// naive set with a path
5456
jsonV2.jsonSetWithEscape("null", ROOT_PATH, (Object) null);
5557
assertJsonArrayEquals(jsonArray((Object) null), jsonV2.jsonGet("null", ROOT_PATH));
@@ -70,6 +72,29 @@ public void basicSetGetShouldSucceed() {
7072
assertJsonArrayEquals(jsonArray("strung"), jsonV2.jsonGet("obj", p));
7173
}
7274

75+
@Test
76+
public void basicSetGetShouldSucceedResp3() {
77+
Assume.assumeTrue(protocol == RedisProtocol.RESP3);
78+
79+
// naive set with a path
80+
jsonV2.jsonSetWithEscape("null", ROOT_PATH, (Object) null);
81+
assertJsonArrayEquals(jsonArray((Object) null), jsonV2.jsonGet("null", ROOT_PATH));
82+
83+
// real scalar value and no path
84+
jsonV2.jsonSetWithEscape("str", "strong");
85+
assertJsonArrayEquals(jsonArray("strong"), jsonV2.jsonGet("str"));
86+
87+
// a slightly more complex object
88+
IRLObject obj = new IRLObject();
89+
jsonV2.jsonSetWithEscape("obj", obj);
90+
assertJsonArrayEquals(jsonArray(new JSONObject(gson.toJson(obj))), jsonV2.jsonGet("obj"));
91+
92+
// check an update
93+
Path2 p = Path2.of(".str");
94+
jsonV2.jsonSet("obj", p, gson.toJson("strung"));
95+
assertJsonArrayEquals(jsonArray("strung"), jsonV2.jsonGet("obj", p));
96+
}
97+
7398
@Test
7499
public void setExistingPathOnlyIfExistsShouldSucceed() {
75100
jsonV2.jsonSetWithEscape("obj", new IRLObject());

0 commit comments

Comments
 (0)