DATAREDIS-674 - Polishing.
Rename JedisConverters.zAddArgsConvertor(…) to toTupleMap(…) and reorder method to group with other tuple conversion methods. Add author tags. Create tests for zadd with tuple using Redis Cluster. Enable pipelining and transactions for zadd using Jedis. Adopt tests. Original pull request: #263.
This commit is contained in:
@@ -1159,6 +1159,18 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
|
||||
assertThat(nativeConnection.zcard(KEY_1_BYTES), is(2L));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-674
|
||||
public void zAddShouldAddMultipleValuesWithScoreCorrectly() {
|
||||
|
||||
Set<Tuple> tuples = new HashSet<>();
|
||||
tuples.add(new DefaultTuple(VALUE_1_BYTES, 10D));
|
||||
tuples.add(new DefaultTuple(VALUE_2_BYTES, 20D));
|
||||
|
||||
clusterConnection.zAdd(KEY_1_BYTES, tuples);
|
||||
|
||||
assertThat(nativeConnection.zcard(KEY_1_BYTES), is(2L));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
public void zRemShouldRemoveValueWithScoreCorrectly() {
|
||||
|
||||
|
||||
@@ -37,10 +37,11 @@ import redis.clients.jedis.JedisPoolConfig;
|
||||
|
||||
/**
|
||||
* Integration test of {@link JedisConnection} pipeline functionality
|
||||
*
|
||||
*
|
||||
* @author Jennifer Hickey
|
||||
* @author Christoph Strobl
|
||||
* @author Thomas Darimont
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(RelaxedJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("JedisConnectionIntegrationTests-context.xml")
|
||||
@@ -250,11 +251,6 @@ public class JedisConnectionPipelineIntegrationTests extends AbstractConnectionP
|
||||
super.testInfoBySection();
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void testZAddMultiple() {
|
||||
super.testZAddMultiple();
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class) // DATAREDIS-269
|
||||
public void clientSetNameWorksCorrectly() {
|
||||
super.clientSetNameWorksCorrectly();
|
||||
|
||||
@@ -30,8 +30,9 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
* <p>
|
||||
* Each method of {@link JedisConnection} behaves differently if executed with a transaction (i.e. between multi and
|
||||
* exec or discard calls), so this test covers those branching points
|
||||
*
|
||||
*
|
||||
* @author Jennifer Hickey
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(RelaxedJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("JedisConnectionIntegrationTests-context.xml")
|
||||
@@ -181,11 +182,6 @@ public class JedisConnectionTransactionIntegrationTests extends AbstractConnecti
|
||||
super.testInfoBySection();
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void testZAddMultiple() {
|
||||
super.testZAddMultiple();
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testRestoreBadData() {
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -92,8 +93,8 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
|
||||
static final GeoLocation<String> CATANIA = new GeoLocation<>("catania", POINT_CATANIA);
|
||||
static final GeoLocation<String> PALERMO = new GeoLocation<>("palermo", POINT_PALERMO);
|
||||
|
||||
static final GeoLocation<byte[]> ARIGENTO_BYTES = new GeoLocation<>(
|
||||
"arigento".getBytes(Charset.forName("UTF-8")), POINT_ARIGENTO);
|
||||
static final GeoLocation<byte[]> ARIGENTO_BYTES = new GeoLocation<>("arigento".getBytes(Charset.forName("UTF-8")),
|
||||
POINT_ARIGENTO);
|
||||
static final GeoLocation<byte[]> CATANIA_BYTES = new GeoLocation<>("catania".getBytes(Charset.forName("UTF-8")),
|
||||
POINT_CATANIA);
|
||||
static final GeoLocation<byte[]> PALERMO_BYTES = new GeoLocation<>("palermo".getBytes(Charset.forName("UTF-8")),
|
||||
@@ -1165,6 +1166,18 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
|
||||
assertThat(nativeConnection.zcard(KEY_1), is(2L));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-674
|
||||
public void zAddShouldAddMultipleValuesWithScoreCorrectly() {
|
||||
|
||||
Set<Tuple> tuples = new HashSet<>();
|
||||
tuples.add(new DefaultTuple(VALUE_1_BYTES, 10D));
|
||||
tuples.add(new DefaultTuple(VALUE_2_BYTES, 20D));
|
||||
|
||||
clusterConnection.zAdd(KEY_1_BYTES, tuples);
|
||||
|
||||
assertThat(nativeConnection.zcard(KEY_1), is(2L));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
public void zRemShouldRemoveValueWithScoreCorrectly() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user