Fix Jredis sort to store results under new key
DATAREDIS-135 - Also fix NPE on parsing null getPattern in DefaultSortParameters
This commit is contained in:
@@ -39,6 +39,7 @@ import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.data.redis.Address;
|
||||
import org.springframework.data.redis.ConnectionFactoryTracker;
|
||||
import org.springframework.data.redis.Person;
|
||||
import org.springframework.data.redis.connection.SortParameters.Order;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||
import org.springframework.data.redis.connection.rjc.RjcConnectionFactory;
|
||||
import org.springframework.data.redis.connection.srp.SrpConnectionFactory;
|
||||
@@ -401,6 +402,17 @@ public abstract class AbstractConnectionIntegrationTests {
|
||||
assertNull(connection.bRPop(1, "rclist"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSortStore() {
|
||||
connection.del("sortlist");
|
||||
connection.rPush("sortlist", "foo");
|
||||
connection.rPush("sortlist", "bar");
|
||||
connection.rPush("sortlist", "baz");
|
||||
assertEquals(Long.valueOf(3),
|
||||
connection.sort("sortlist", new DefaultSortParameters(null, Order.ASC, true), "newlist"));
|
||||
assertEquals(Arrays.asList(new String[] {"bar", "baz", "foo"}), connection.lRange("newlist", 0, 9));
|
||||
}
|
||||
|
||||
private boolean isAsync() {
|
||||
return (getConnectionFactory() instanceof LettuceConnectionFactory) ||
|
||||
(getConnectionFactory() instanceof SrpConnectionFactory);
|
||||
|
||||
@@ -21,6 +21,7 @@ import static org.junit.Assert.assertNull;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.redis.SettingsUtils;
|
||||
import org.springframework.data.redis.connection.AbstractConnectionIntegrationTests;
|
||||
@@ -77,4 +78,8 @@ public class RjcConnectionIntegrationTests extends AbstractConnectionIntegration
|
||||
List<Object> result = connection.closePipeline();
|
||||
assertEquals(4, result.size());
|
||||
}
|
||||
|
||||
@Ignore("DATAREDIS-134 string ops do not work with encoded values")
|
||||
public void testSortStore() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,8 +44,11 @@ public class SrpConnectionIntegrationTests extends AbstractConnectionIntegration
|
||||
public void testNullCollections() throws Exception {
|
||||
}
|
||||
|
||||
//DATAREDIS-123, exec does not return command results
|
||||
@Ignore
|
||||
@Ignore("DATAREDIS-123, exec does not return command results")
|
||||
public void testMulti() throws Exception {
|
||||
}
|
||||
|
||||
@Ignore("DATAREDIS-130, sort not working")
|
||||
public void testSortStore() {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user