Add Redis 2.6 incrBy/hincrBy float ops to Connections
DATAREDIS-181
This commit is contained in:
@@ -747,6 +747,15 @@ public abstract class AbstractConnectionIntegrationTests {
|
||||
verifyResults(Arrays.asList(new Object[] { 1l, 8l }), actual);
|
||||
}
|
||||
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6")
|
||||
public void testIncrByDouble() {
|
||||
connection.set("tdb", "4.5");
|
||||
actual.add(connection.incrBy("tdb", 7.2));
|
||||
actual.add(connection.get("tdb"));
|
||||
verifyResults(Arrays.asList(new Object[] { 11.7d, "11.7" }), actual);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIncDecr() {
|
||||
connection.set("incrtest", "0");
|
||||
@@ -1338,6 +1347,15 @@ public abstract class AbstractConnectionIntegrationTests {
|
||||
verifyResults(Arrays.asList(new Object[] { true, 5l, "5" }), actual);
|
||||
}
|
||||
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6")
|
||||
public void testHIncrByDouble() {
|
||||
actual.add(connection.hSet("test", "key", "2.9"));
|
||||
actual.add(connection.hIncrBy("test", "key", 3.5));
|
||||
actual.add(connection.hGet("test", "key"));
|
||||
verifyResults(Arrays.asList(new Object[] { true, 6.4d, "6.4" }), actual);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHKeys() {
|
||||
connection.hSet("test", "key", "2");
|
||||
|
||||
@@ -145,6 +145,16 @@ public class JedisConnectionIntegrationTests extends AbstractConnectionIntegrati
|
||||
super.testBitOpNotMultipleSources();
|
||||
}
|
||||
|
||||
@Test(expected=UnsupportedOperationException.class)
|
||||
public void testHIncrByDouble() {
|
||||
super.testHIncrByDouble();
|
||||
}
|
||||
|
||||
@Test(expected=UnsupportedOperationException.class)
|
||||
public void testIncrByDouble() {
|
||||
super.testIncrByDouble();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIncrDecrByLong() {
|
||||
String key = "test.count";
|
||||
|
||||
@@ -232,6 +232,16 @@ public class JedisConnectionPipelineIntegrationTests extends
|
||||
super.testZRevRangeByScoreWithScoresOffsetCount();
|
||||
}
|
||||
|
||||
@Test(expected=UnsupportedOperationException.class)
|
||||
public void testHIncrByDouble() {
|
||||
super.testHIncrByDouble();
|
||||
}
|
||||
|
||||
@Test(expected=UnsupportedOperationException.class)
|
||||
public void testIncrByDouble() {
|
||||
super.testIncrByDouble();
|
||||
}
|
||||
|
||||
// Overrides, usually due to return values being Long vs Boolean or Set vs
|
||||
// List
|
||||
|
||||
|
||||
@@ -383,6 +383,16 @@ public class JRedisConnectionIntegrationTests extends AbstractConnectionIntegrat
|
||||
super.testBitOpNotMultipleSources();
|
||||
}
|
||||
|
||||
@Test(expected=UnsupportedOperationException.class)
|
||||
public void testHIncrByDouble() {
|
||||
super.testHIncrByDouble();
|
||||
}
|
||||
|
||||
@Test(expected=UnsupportedOperationException.class)
|
||||
public void testIncrByDouble() {
|
||||
super.testIncrByDouble();
|
||||
}
|
||||
|
||||
// Jredis returns null for rPush
|
||||
@Test
|
||||
public void testSort() {
|
||||
|
||||
@@ -20,7 +20,6 @@ import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -31,7 +30,6 @@ import java.util.Set;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.data.redis.RedisVersionUtils;
|
||||
import org.springframework.data.redis.connection.AbstractConnectionPipelineIntegrationTests;
|
||||
import org.springframework.data.redis.connection.DefaultStringRedisConnection;
|
||||
import org.springframework.data.redis.connection.DefaultStringTuple;
|
||||
@@ -172,6 +170,26 @@ public class SrpConnectionPipelineIntegrationTests extends
|
||||
super.testGetRangeSetRange();
|
||||
}
|
||||
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6")
|
||||
public void testIncrByDouble() {
|
||||
connection.set("tdb", "4.5");
|
||||
actual.add(connection.incrBy("tdb", 7.2));
|
||||
actual.add(connection.get("tdb"));
|
||||
// pipelined incrBy returns value as a byte[] instead of Double
|
||||
verifyResults(Arrays.asList(new Object[] { "11.7" , "11.7" }), actual);
|
||||
}
|
||||
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6")
|
||||
public void testHIncrByDouble() {
|
||||
actual.add(connection.hSet("test", "key", "2.9"));
|
||||
actual.add(connection.hIncrBy("test", "key", 3.5));
|
||||
actual.add(connection.hGet("test", "key"));
|
||||
// pipelined hIncrBy returns value as a byte[] instead of Double
|
||||
verifyResults(Arrays.asList(new Object[] { 1l, "6.4", "6.4" }), actual);
|
||||
}
|
||||
|
||||
protected Object convertResult(Object result) {
|
||||
Object convertedResult = super.convertResult(result);
|
||||
if (convertedResult instanceof Reply[]) {
|
||||
|
||||
Reference in New Issue
Block a user