Upgrade to SRP 0.5
DATAREDIS-132, DATAREDIS-130, DATAREDIS-152 - Upgrade to fix broken config_get in SRP 0.2 - Fix syntax errors in sort methods - Fix syntax errors in zRange/zRevRange methods with offset and count
This commit is contained in:
@@ -288,8 +288,7 @@ abstract public class AbstractConnectionPipelineIntegrationTests extends
|
||||
connection.get("testitnow");
|
||||
connection.exec();
|
||||
List<Object> convertedResults = convertResults();
|
||||
assertEquals(Arrays.asList(new Object[] { Arrays.asList(new String[] { "OK",
|
||||
"somethingelse" }) }), convertedResults);
|
||||
assertEquals(Arrays.asList(new Object[] {"somethingelse"}), convertedResults);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -61,34 +61,6 @@ public class SrpConnectionIntegrationTests extends AbstractConnectionIntegration
|
||||
public void testWatch() {
|
||||
}
|
||||
|
||||
@Ignore("DATAREDIS-130, sort not working")
|
||||
public void testSort() {
|
||||
}
|
||||
|
||||
@Ignore("DATAREDIS-130, sort not working")
|
||||
public void testSortStore() {
|
||||
}
|
||||
|
||||
@Ignore("DATAREDIS-132 config get broken in SRP 0.2")
|
||||
public void testGetConfig() {
|
||||
}
|
||||
|
||||
@Ignore("DATAREDIS-152 Syntax error on zRangeByScore when using offset and count")
|
||||
public void testZRangeByScoreOffsetCount() {
|
||||
}
|
||||
|
||||
@Ignore("DATAREDIS-152 Syntax error on zRangeByScoreWithScores when using offset and count")
|
||||
public void testZRangeByScoreWithScoresOffsetCount() {
|
||||
}
|
||||
|
||||
@Ignore("DATAREDIS-152 Syntax error on zRevRangeByScore when using offset and count")
|
||||
public void testZRevRangeByScoreOffsetCount() {
|
||||
}
|
||||
|
||||
@Ignore("DATAREDIS-152 Syntax error on zRevRangeByScoreWithScores when using offset and count")
|
||||
public void testZRevRangeByScoreWithScoresOffsetCount() {
|
||||
}
|
||||
|
||||
@Ignore("DATAREDIS-156 SRP bRPopLPush ClassCastException")
|
||||
public void testBRPopLPushTimeout() {
|
||||
}
|
||||
|
||||
@@ -54,50 +54,14 @@ import redis.reply.Reply;
|
||||
public class SrpConnectionPipelineIntegrationTests extends
|
||||
AbstractConnectionPipelineIntegrationTests {
|
||||
|
||||
@Ignore("DATAREDIS-123, exec does not return command results")
|
||||
public void testMultiExec() throws Exception {
|
||||
}
|
||||
|
||||
@Ignore("DATAREDIS-123, exec does not return command results")
|
||||
@Ignore("DATAREDIS-169 SRP discard does not clear txReplies, results in inconsistent results on next tx exec")
|
||||
public void testMultiDiscard() {
|
||||
}
|
||||
|
||||
@Ignore("DATAREDIS-123, exec does not return command results")
|
||||
@Ignore("DATAREDIS-168 SRP exec throws TransactionFailedException if watched value modified")
|
||||
public void testWatch() {
|
||||
}
|
||||
|
||||
@Ignore("DATAREDIS-123, exec does not return command results")
|
||||
public void testUnwatch() {
|
||||
}
|
||||
|
||||
@Ignore("DATAREDIS-130, sort not working")
|
||||
public void testSort() {
|
||||
}
|
||||
|
||||
@Ignore("DATAREDIS-130, sort not working")
|
||||
public void testSortStore() {
|
||||
}
|
||||
|
||||
@Ignore("DATAREDIS-132 config get broken in SRP 0.2")
|
||||
public void testGetConfig() {
|
||||
}
|
||||
|
||||
@Ignore("DATAREDIS-152 Syntax error on zRangeByScore when using offset and count")
|
||||
public void testZRangeByScoreOffsetCount() {
|
||||
}
|
||||
|
||||
@Ignore("DATAREDIS-152 Syntax error on zRangeByScoreWithScores when using offset and count")
|
||||
public void testZRangeByScoreWithScoresOffsetCount() {
|
||||
}
|
||||
|
||||
@Ignore("DATAREDIS-152 Syntax error on zRevRangeByScore when using offset and count")
|
||||
public void testZRevRangeByScoreOffsetCount() {
|
||||
}
|
||||
|
||||
@Ignore("DATAREDIS-152 Syntax error on zRevRangeByScoreWithScores when using offset and count")
|
||||
public void testZRevRangeByScoreWithScoresOffsetCount() {
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void testZInterStoreAggWeights() {
|
||||
super.testZInterStoreAggWeights();
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* Copyright 2011-2013 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.redis.connection.srp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.redis.connection.DefaultSortParameters;
|
||||
import org.springframework.data.redis.connection.SortParameters;
|
||||
|
||||
/**
|
||||
* Unit test of {@link SrpUtils}
|
||||
*
|
||||
* @author Jennifer Hickey
|
||||
*
|
||||
*/
|
||||
public class SrpUtilsTests {
|
||||
|
||||
@Test
|
||||
public void testSortParamsWithAllParams() {
|
||||
SortParameters sortParams = new DefaultSortParameters().alpha().asc()
|
||||
.by("weight_*".getBytes()).get("object_*".getBytes())
|
||||
.limit(0, 5);
|
||||
Object[] sort = SrpUtils.sortParams(sortParams, "foo".getBytes());
|
||||
assertArrayEquals(new String[] { "BY", "weight_*", "LIMIT 0 5", "GET",
|
||||
"object_*", "ASC", "ALPHA", "STORE", "foo" },
|
||||
convertByteArrays(sort));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSortParamsOnlyBy() {
|
||||
SortParameters sortParams = new DefaultSortParameters().numeric().by(
|
||||
"weight_*".getBytes());
|
||||
Object[] sort = SrpUtils.sortParams(sortParams);
|
||||
assertArrayEquals(new String[] { "BY", "weight_*" },
|
||||
convertByteArrays(sort));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSortParamsOnlyLimit() {
|
||||
SortParameters sortParams = new DefaultSortParameters().numeric()
|
||||
.limit(0, 5);
|
||||
Object[] sort = SrpUtils.sortParams(sortParams);
|
||||
assertArrayEquals(new String[] { "LIMIT 0 5" }, convertByteArrays(sort));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSortParamsOnlyGetPatterns() {
|
||||
SortParameters sortParams = new DefaultSortParameters().numeric()
|
||||
.get("foo".getBytes()).get("bar".getBytes());
|
||||
Object[] sort = SrpUtils.sortParams(sortParams);
|
||||
assertArrayEquals(new String[] { "GET", "foo", "GET", "bar" },
|
||||
convertByteArrays(sort));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSortParamsOnlyOrder() {
|
||||
SortParameters sortParams = new DefaultSortParameters().numeric()
|
||||
.desc();
|
||||
Object[] sort = SrpUtils.sortParams(sortParams);
|
||||
assertArrayEquals(new String[] { "DESC" }, convertByteArrays(sort));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSortParamsOnlyAlpha() {
|
||||
SortParameters sortParams = new DefaultSortParameters().alpha();
|
||||
Object[] sort = SrpUtils.sortParams(sortParams);
|
||||
assertArrayEquals(new String[] { "ALPHA" }, convertByteArrays(sort));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSortParamsOnlyStore() {
|
||||
SortParameters sortParams = new DefaultSortParameters().numeric();
|
||||
Object[] sort = SrpUtils.sortParams(sortParams, "storelist".getBytes());
|
||||
assertArrayEquals(new String[] { "STORE", "storelist" },
|
||||
convertByteArrays(sort));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSortWithAllParams() {
|
||||
SortParameters sortParams = new DefaultSortParameters().alpha().asc()
|
||||
.by("weight_*".getBytes()).get("object_*".getBytes())
|
||||
.limit(0, 5);
|
||||
byte[] sort = SrpUtils.sort(sortParams, "foo".getBytes());
|
||||
assertEquals("BY weight_* LIMIT 0 5 GET object_* ASC ALPHA STORE foo",
|
||||
new String(sort));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSortOnlyBy() {
|
||||
SortParameters sortParams = new DefaultSortParameters().numeric().by(
|
||||
"weight_*".getBytes());
|
||||
byte[] sort = SrpUtils.sort(sortParams);
|
||||
assertEquals("BY weight_*", new String(sort));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSortOnlyLimit() {
|
||||
SortParameters sortParams = new DefaultSortParameters().numeric()
|
||||
.limit(0, 5);
|
||||
byte[] sort = SrpUtils.sort(sortParams);
|
||||
assertEquals("LIMIT 0 5", new String(sort));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSortOnlyGetPatterns() {
|
||||
SortParameters sortParams = new DefaultSortParameters().numeric()
|
||||
.get("foo".getBytes()).get("bar".getBytes());
|
||||
byte[] sort = SrpUtils.sort(sortParams);
|
||||
assertEquals("GET foo GET bar", new String(sort));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSortOnlyOrder() {
|
||||
SortParameters sortParams = new DefaultSortParameters().numeric()
|
||||
.desc();
|
||||
byte[] sort = SrpUtils.sort(sortParams);
|
||||
assertEquals("DESC", new String(sort));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSortOnlyAlpha() {
|
||||
SortParameters sortParams = new DefaultSortParameters().alpha();
|
||||
byte[] sort = SrpUtils.sort(sortParams);
|
||||
assertEquals("ALPHA", new String(sort));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSortOnlyStore() {
|
||||
SortParameters sortParams = new DefaultSortParameters().numeric();
|
||||
byte[] sort = SrpUtils.sort(sortParams, "storelist".getBytes());
|
||||
assertEquals("STORE storelist", new String(sort));
|
||||
}
|
||||
|
||||
private String[] convertByteArrays(Object[] bytes) {
|
||||
List<String> convertedParams = new ArrayList<String>();
|
||||
for (Object b : bytes) {
|
||||
convertedParams.add(new String((byte[]) b));
|
||||
}
|
||||
return convertedParams.toArray(new String[0]);
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,7 @@ import java.util.concurrent.TimeUnit;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.core.task.SimpleAsyncTaskExecutor;
|
||||
@@ -200,7 +201,7 @@ public class PubSubResubscribeTests {
|
||||
* a thread executing its PatternSubscriptionTask
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Ignore("DATAREDIS-166 Intermittent corrupted input/output streams subscribing to both patterns and channels in RMLC")
|
||||
public void testInitializeContainerWithMultipleTopicsIncludingPattern() throws Exception {
|
||||
container.removeMessageListener(adapter);
|
||||
container.stop();
|
||||
|
||||
Reference in New Issue
Block a user