Skip to content

Commit 7e6676d

Browse files
RyanADchristophstrobl
authored andcommitted
DATAREDIS-293 - JedisConnection, allow bulk addition with same score.
Support has been added in jedis 2.4 Original Pull Request: #62
1 parent 6d48c4a commit 7e6676d

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2923,10 +2923,6 @@ private Map<byte[], Double> zAddArgs(Set<Tuple> tuples) {
29232923

29242924
Map<byte[], Double> args = new HashMap<byte[], Double>();
29252925
for (Tuple tuple : tuples) {
2926-
if (args.containsValue(tuple.getScore())) {
2927-
throw new UnsupportedOperationException(
2928-
"Bulk add of multiple elements with the same score is not supported. Add the elements individually.");
2929-
}
29302926
args.put(tuple.getValue(), tuple.getScore());
29312927
}
29322928

src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionIntegrationTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,13 @@ public void testClosePool() {
117117
factory2.destroy();
118118
}
119119

120-
@Test(expected = UnsupportedOperationException.class)
120+
@Test
121121
public void testZAddSameScores() {
122122
Set<StringTuple> strTuples = new HashSet<StringTuple>();
123123
strTuples.add(new DefaultStringTuple("Bob".getBytes(), "Bob", 2.0));
124124
strTuples.add(new DefaultStringTuple("James".getBytes(), "James", 2.0));
125-
connection.zAdd("myset", strTuples);
125+
Long added = connection.zAdd("myset", strTuples);
126+
assertEquals(2L, added.longValue());
126127
}
127128

128129
@Test(expected = InvalidDataAccessApiUsageException.class)

0 commit comments

Comments
 (0)