Skip to content

Commit 6b9d338

Browse files
authored
Fix incompatibilities with the latest RedisStack (#3855)
* Fix tests - Skip Graph tests - Fix JSON RESP3 test * JSON.GET behaves identically on RESP2 and RESP3
1 parent 11ce88e commit 6b9d338

File tree

9 files changed

+15
-38
lines changed

9 files changed

+15
-38
lines changed

src/main/java/redis/clients/jedis/CommandObjects.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -3495,8 +3495,7 @@ 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),
3499-
protocol != RedisProtocol.RESP3 ? JSON_GENERIC_OBJECT : JsonBuilderFactory.JSON_OBJECT);
3498+
return new CommandObject<>(commandArguments(JsonCommand.GET).key(key), JSON_GENERIC_OBJECT);
35003499
}
35013500

35023501
@Deprecated

src/test/java/redis/clients/jedis/commands/commandobjects/CommandObjectsJsonCommandsTest.java

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

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

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

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

282281
@Test

src/test/java/redis/clients/jedis/mocked/pipeline/PipeliningBaseGraphCommandsTest.java

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

12+
import org.junit.Ignore;
1213
import org.junit.Test;
1314
import redis.clients.jedis.Response;
1415
import redis.clients.jedis.graph.ResultSet;
1516

17+
@Ignore
1618
public class PipeliningBaseGraphCommandsTest extends PipeliningBaseMockedTestBase {
1719

1820
@Test

src/test/java/redis/clients/jedis/modules/graph/GraphAPITest.java

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

1010
import java.util.*;
1111

12-
import org.junit.After;
13-
import org.junit.Assert;
14-
import org.junit.BeforeClass;
15-
import org.junit.Test;
12+
import org.junit.*;
1613
import org.junit.runner.RunWith;
1714
import org.junit.runners.Parameterized;
1815

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

2623
import redis.clients.jedis.modules.RedisModuleCommandsTestBase;
2724

25+
@Ignore
2826
@RunWith(Parameterized.class)
2927
public class GraphAPITest extends RedisModuleCommandsTestBase {
3028

src/test/java/redis/clients/jedis/modules/graph/GraphPipelineTest.java

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

12-
import org.junit.After;
13-
import org.junit.Before;
14-
import org.junit.BeforeClass;
15-
import org.junit.Test;
12+
import org.junit.*;
1613
import org.junit.runner.RunWith;
1714
import org.junit.runners.Parameterized;
1815

@@ -26,6 +23,7 @@
2623
import redis.clients.jedis.graph.entities.Property;
2724
import redis.clients.jedis.modules.RedisModuleCommandsTestBase;
2825

26+
@Ignore
2927
@RunWith(Parameterized.class)
3028
public class GraphPipelineTest extends RedisModuleCommandsTestBase {
3129

src/test/java/redis/clients/jedis/modules/graph/GraphTransactionTest.java

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

1212
import org.junit.BeforeClass;
13+
import org.junit.Ignore;
1314
import org.junit.Test;
1415
import org.junit.runner.RunWith;
1516
import org.junit.runners.Parameterized;
@@ -23,6 +24,7 @@
2324
import redis.clients.jedis.graph.entities.Property;
2425
import redis.clients.jedis.modules.RedisModuleCommandsTestBase;
2526

27+
@Ignore
2628
@RunWith(Parameterized.class)
2729
public class GraphTransactionTest extends RedisModuleCommandsTestBase {
2830

src/test/java/redis/clients/jedis/modules/graph/GraphValuesTest.java

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

55
import org.junit.BeforeClass;
6+
import org.junit.Ignore;
67
import org.junit.Test;
78
import org.junit.runner.RunWith;
89
import org.junit.runners.Parameterized;
@@ -12,6 +13,7 @@
1213
import redis.clients.jedis.graph.ResultSet;
1314
import redis.clients.jedis.modules.RedisModuleCommandsTestBase;
1415

16+
@Ignore
1517
@RunWith(Parameterized.class)
1618
public class GraphValuesTest extends RedisModuleCommandsTestBase {
1719

src/test/java/redis/clients/jedis/modules/graph/PathBuilderTest.java

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

6+
import org.junit.Ignore;
67
import org.junit.Test;
78
import redis.clients.jedis.graph.entities.Edge;
89

10+
@Ignore
911
public class PathBuilderTest {
1012

1113
@Test

src/test/java/redis/clients/jedis/modules/json/RedisJsonV2Test.java

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

5151
@Test
5252
public void basicSetGetShouldSucceed() {
53-
Assume.assumeFalse(protocol == RedisProtocol.RESP3);
54-
5553
// naive set with a path
5654
jsonV2.jsonSetWithEscape("null", ROOT_PATH, (Object) null);
5755
assertJsonArrayEquals(jsonArray((Object) null), jsonV2.jsonGet("null", ROOT_PATH));
@@ -72,29 +70,6 @@ public void basicSetGetShouldSucceed() {
7270
assertJsonArrayEquals(jsonArray("strung"), jsonV2.jsonGet("obj", p));
7371
}
7472

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-
9873
@Test
9974
public void setExistingPathOnlyIfExistsShouldSucceed() {
10075
jsonV2.jsonSetWithEscape("obj", new IRLObject());

0 commit comments

Comments
 (0)