DATAREDIS-106 - Support for open interval for scores for sorted sets.
We now support open zset's interval for JedisConnection, JredisConnection, LettuceConnection, SrpConnection and DefaultStringRedisConnection. Original pull request: #97.
This commit is contained in:
committed by
Christoph Strobl
parent
5ca672d180
commit
cf46d6e766
@@ -35,6 +35,7 @@ import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
* @author Thomas Darimont
|
||||
* @author David Liu
|
||||
*/
|
||||
public class RedisConnectionUnitTests {
|
||||
@@ -790,5 +791,15 @@ public class RedisConnectionUnitTests {
|
||||
public <T> T evalSha(byte[] scriptSha, ReturnType returnType, int numKeys, byte[]... keysAndArgs) {
|
||||
return delegate.evalSha(scriptSha, returnType, numKeys, keysAndArgs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<byte[]> zRangeByScore(byte[] key, String min, String max) {
|
||||
return delegate.zRangeByScore(key, min, max);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<byte[]> zRangeByScore(byte[] key, String min, String max, long offset, long count) {
|
||||
return delegate.zRangeByScore(key, min, max, offset, count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ import redis.clients.jedis.JedisPoolConfig;
|
||||
* @author Jennifer Hickey
|
||||
* @author Thomas Darimont
|
||||
* @author Christoph Strobl
|
||||
* @author David Liu
|
||||
*/
|
||||
@RunWith(RelaxedJUnit4ClassRunner.class)
|
||||
@ContextConfiguration
|
||||
@@ -400,4 +401,19 @@ public class JedisConnectionIntegrationTests extends AbstractConnectionIntegrati
|
||||
.sentinel("127.0.0.1", 26379).sentinel("127.0.0.1", 26380));
|
||||
assertThat(connection.getSentinelConnection(), notNullValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREDIS-106
|
||||
*/
|
||||
@Test
|
||||
public void zRangeByScoreTest() {
|
||||
|
||||
connection.zAdd("myzset", 1, "one");
|
||||
connection.zAdd("myzset", 2, "two");
|
||||
connection.zAdd("myzset", 3, "three");
|
||||
|
||||
Set<byte[]> zRangeByScore = connection.zRangeByScore("myzset", "(1", "2");
|
||||
|
||||
assertEquals("two", new String(zRangeByScore.iterator().next()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import static org.springframework.data.redis.SpinBarrier.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.hamcrest.core.AllOf;
|
||||
@@ -52,6 +53,7 @@ import com.lambdaworks.redis.RedisAsyncConnection;
|
||||
* @author Jennifer Hickey
|
||||
* @author Thomas Darimont
|
||||
* @author Christoph Strobl
|
||||
* @author David Liu
|
||||
*/
|
||||
@RunWith(RelaxedJUnit4ClassRunner.class)
|
||||
@ContextConfiguration
|
||||
@@ -311,5 +313,20 @@ public class LettuceConnectionIntegrationTests extends AbstractConnectionIntegra
|
||||
assertEquals(Arrays.asList(new Object[] { "key1", "arg1" }),
|
||||
Arrays.asList(new Object[] { new String(scriptResults.get(0)), new String(scriptResults.get(1)) }));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREDIS-106
|
||||
*/
|
||||
@Test
|
||||
public void zRangeByScoreTest() {
|
||||
|
||||
connection.zAdd("myzset", 1, "one");
|
||||
connection.zAdd("myzset", 2, "two");
|
||||
connection.zAdd("myzset", 3, "three");
|
||||
|
||||
Set<byte[]> zRangeByScore = connection.zRangeByScore("myzset", "(1", "2");
|
||||
|
||||
assertEquals("two", new String(zRangeByScore.iterator().next()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2013 the original author or authors.
|
||||
* Copyright 2011-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import static org.junit.Assert.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hamcrest.core.Is;
|
||||
import org.hamcrest.core.IsInstanceOf;
|
||||
@@ -40,6 +41,8 @@ import redis.reply.Reply;
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Jennifer Hickey
|
||||
* @author Thomas Darimont
|
||||
* @author David Liu
|
||||
*/
|
||||
@RunWith(RelaxedJUnit4ClassRunner.class)
|
||||
@ContextConfiguration
|
||||
@@ -117,4 +120,18 @@ public class SrpConnectionIntegrationTests extends AbstractConnectionIntegration
|
||||
Arrays.asList(new Object[] { new String(scriptResults.get(0)), new String(scriptResults.get(1)) }));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREDIS-106
|
||||
*/
|
||||
@Test
|
||||
public void zRangeByScoreTest() {
|
||||
|
||||
connection.zAdd("myzset", 1, "one");
|
||||
connection.zAdd("myzset", 2, "two");
|
||||
connection.zAdd("myzset", 3, "three");
|
||||
|
||||
Set<byte[]> zRangeByScore = connection.zRangeByScore("myzset", "(1", "2");
|
||||
|
||||
Assert.assertEquals("two", new String(zRangeByScore.iterator().next()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user