Add Redis 2.6 srandmember with count to Connections
DATAREDIS-116
This commit is contained in:
@@ -1166,6 +1166,41 @@ public abstract class AbstractConnectionIntegrationTests {
|
||||
.contains(connection.sRandMember("myset")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSRandMemberKeyNotExists() {
|
||||
actual.add(connection.sRandMember("notexist"));
|
||||
assertNull(convertResults().get(0));
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6")
|
||||
public void testSRandMemberCount() {
|
||||
actual.add(connection.sAdd("myset", "foo"));
|
||||
actual.add(connection.sAdd("myset", "bar"));
|
||||
actual.add(connection.sAdd("myset", "baz"));
|
||||
actual.add(connection.sRandMember("myset", 2));
|
||||
assertTrue(((Set)convertResults().get(3)).size() == 2);
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6")
|
||||
public void testSRandMemberCountNegative() {
|
||||
actual.add(connection.sAdd("myset", "foo"));
|
||||
actual.add(connection.sRandMember("myset", -2));
|
||||
// APIs filter out duplicates so the negative has no effect
|
||||
assertTrue(((Set)convertResults().get(1)).size() == 1);
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6")
|
||||
public void testSRandMemberCountKeyNotExists() {
|
||||
actual.add(connection.sRandMember("notexist", 2));
|
||||
assertTrue(((Set)convertResults().get(0)).isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSRem() {
|
||||
connection.sAdd("myset", "foo");
|
||||
|
||||
@@ -158,6 +158,24 @@ public class JedisConnectionIntegrationTests extends AbstractConnectionIntegrati
|
||||
super.testIncrByDouble();
|
||||
}
|
||||
|
||||
@Test(expected=UnsupportedOperationException.class)
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6")
|
||||
public void testSRandMemberCount() {
|
||||
super.testSRandMemberCount();
|
||||
}
|
||||
|
||||
@Test(expected=UnsupportedOperationException.class)
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6")
|
||||
public void testSRandMemberCountKeyNotExists() {
|
||||
super.testSRandMemberCountKeyNotExists();
|
||||
}
|
||||
|
||||
@Test(expected=UnsupportedOperationException.class)
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6")
|
||||
public void testSRandMemberCountNegative() {
|
||||
super.testSRandMemberCountNegative();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIncrDecrByLong() {
|
||||
String key = "test.count";
|
||||
|
||||
@@ -345,6 +345,24 @@ public class JedisConnectionPipelineIntegrationTests extends
|
||||
super.testScriptFlush();
|
||||
}
|
||||
|
||||
@Test(expected=UnsupportedOperationException.class)
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6")
|
||||
public void testSRandMemberCount() {
|
||||
super.testSRandMemberCount();
|
||||
}
|
||||
|
||||
@Test(expected=UnsupportedOperationException.class)
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6")
|
||||
public void testSRandMemberCountKeyNotExists() {
|
||||
super.testSRandMemberCountKeyNotExists();
|
||||
}
|
||||
|
||||
@Test(expected=UnsupportedOperationException.class)
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6")
|
||||
public void testSRandMemberCountNegative() {
|
||||
super.testSRandMemberCountNegative();
|
||||
}
|
||||
|
||||
// Overrides, usually due to return values being Long vs Boolean or Set vs
|
||||
// List
|
||||
|
||||
|
||||
@@ -495,6 +495,24 @@ public class JRedisConnectionIntegrationTests extends AbstractConnectionIntegrat
|
||||
super.testScriptFlush();
|
||||
}
|
||||
|
||||
@Test(expected=UnsupportedOperationException.class)
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6")
|
||||
public void testSRandMemberCount() {
|
||||
super.testSRandMemberCount();
|
||||
}
|
||||
|
||||
@Test(expected=UnsupportedOperationException.class)
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6")
|
||||
public void testSRandMemberCountKeyNotExists() {
|
||||
super.testSRandMemberCountKeyNotExists();
|
||||
}
|
||||
|
||||
@Test(expected=UnsupportedOperationException.class)
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6")
|
||||
public void testSRandMemberCountNegative() {
|
||||
super.testSRandMemberCountNegative();
|
||||
}
|
||||
|
||||
// Jredis returns null for rPush
|
||||
@Test
|
||||
public void testSort() {
|
||||
|
||||
@@ -146,6 +146,27 @@ public class SrpConnectionPipelineIntegrationTests extends
|
||||
verifyResults(Arrays.asList(new Object[] { 1l, 1l, 1l, 0l }), actual);
|
||||
}
|
||||
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6")
|
||||
public void testSRandMemberCount() {
|
||||
convertResultToSet = true;
|
||||
super.testSRandMemberCount();
|
||||
}
|
||||
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6")
|
||||
public void testSRandMemberCountKeyNotExists() {
|
||||
convertResultToSet = true;
|
||||
super.testSRandMemberCountKeyNotExists();
|
||||
}
|
||||
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6")
|
||||
public void testSRandMemberCountNegative() {
|
||||
convertResultToSet = true;
|
||||
super.testSRandMemberCountNegative();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testZIncrBy() {
|
||||
actual.add(connection.zAdd("myset", 2, "Bob"));
|
||||
|
||||
Reference in New Issue
Block a user