Upgrade to SRP 0.6
DATAREDIS-186 - Handle a few method signature changes to varargs - Handle possibility of exec() throwing Exceptions if ErrorReply received in Redis 2.6
This commit is contained in:
@@ -55,18 +55,10 @@ public class SrpConnectionIntegrationTests extends AbstractConnectionIntegration
|
||||
connection = null;
|
||||
}
|
||||
|
||||
@Ignore("DATAREDIS-169 SRP discard does not clear txReplies, results in inconsistent results on next tx exec")
|
||||
public void testMultiDiscard() {
|
||||
}
|
||||
|
||||
@Ignore("DATAREDIS-168 SRP exec throws TransactionFailedException if watched value modified")
|
||||
public void testWatch() {
|
||||
}
|
||||
|
||||
@Ignore("DATAREDIS-156 SRP bRPopLPush ClassCastException")
|
||||
public void testBRPopLPushTimeout() {
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void testZInterStoreAggWeights() {
|
||||
super.testZInterStoreAggWeights();
|
||||
|
||||
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -33,7 +34,9 @@ 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;
|
||||
import org.springframework.data.redis.connection.RedisPipelineException;
|
||||
import org.springframework.data.redis.connection.RedisZSetCommands.Tuple;
|
||||
import org.springframework.data.redis.connection.StringRedisConnection.StringTuple;
|
||||
import org.springframework.data.redis.serializer.SerializationUtils;
|
||||
@@ -55,8 +58,24 @@ import redis.reply.Reply;
|
||||
public class SrpConnectionPipelineIntegrationTests extends
|
||||
AbstractConnectionPipelineIntegrationTests {
|
||||
|
||||
@Ignore("DATAREDIS-169 SRP discard does not clear txReplies, results in inconsistent results on next tx exec")
|
||||
public void testMultiDiscard() {
|
||||
@Test
|
||||
public void testMultiDiscard() throws Exception {
|
||||
DefaultStringRedisConnection conn2 = new DefaultStringRedisConnection(
|
||||
connectionFactory.getConnection());
|
||||
conn2.set("testitnow", "willdo");
|
||||
connection.multi();
|
||||
connection.set("testitnow2", "notok");
|
||||
connection.discard();
|
||||
// SRP throws Exception on transaction discard, so we expect pipeline exception here
|
||||
try {
|
||||
getResults();
|
||||
fail("Closing the pipeline on a discarded tx should throw a RedisPipelineException");
|
||||
}catch(RedisPipelineException e) {
|
||||
}
|
||||
assertEquals("willdo", connection.get("testitnow"));
|
||||
connection.openPipeline();
|
||||
// Ensure we can run a new tx after discarding previous one
|
||||
testMultiExec();
|
||||
}
|
||||
|
||||
@Ignore("DATAREDIS-168 SRP exec throws TransactionFailedException if watched value modified")
|
||||
|
||||
@@ -17,13 +17,13 @@ package org.springframework.data.redis.connection.srp;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.redis.RedisSystemException;
|
||||
import org.springframework.data.redis.RedisVersionUtils;
|
||||
import org.springframework.data.redis.connection.RedisPipelineException;
|
||||
import org.springframework.test.annotation.IfProfileValue;
|
||||
@@ -34,23 +34,30 @@ import org.springframework.test.annotation.IfProfileValue;
|
||||
* @author Jennifer Hickey
|
||||
*
|
||||
*/
|
||||
public class SrpConnectionPipelineTxIntegrationTests extends
|
||||
SrpConnectionTransactionIntegrationTests {
|
||||
public class SrpConnectionPipelineTxIntegrationTests extends SrpConnectionTransactionIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void exceptionExecuteNative() throws Exception {
|
||||
// DATAREDIS-172 SRP ClassCastException when exec() returns an
|
||||
// ErrorReply in Redis 2.6
|
||||
connection.exec();
|
||||
connection.closePipeline();
|
||||
boolean execErrorSupported = RedisVersionUtils.atMost("2.6.4", connection);
|
||||
initConnection();
|
||||
assumeTrue(execErrorSupported);
|
||||
connection.execute("ZadD", getClass() + "#foo\t0.90\titem");
|
||||
try {
|
||||
getResults();
|
||||
fail("Execute failures should result in a RedisPipelineException");
|
||||
} catch (RedisPipelineException e) {
|
||||
fail("Expected an Exception to be thrown executing a command with syntax error");
|
||||
}catch(RedisPipelineException e) {
|
||||
// Redis 2.4, Exception occurs when we get the result of execute on closePipeline
|
||||
if(RedisVersionUtils.atLeast("2.6.4", byteConnection)) {
|
||||
fail("RedisPipelineException should not be thrown in Redis 2.6");
|
||||
}
|
||||
}catch(RedisSystemException e) {
|
||||
try {
|
||||
connection.closePipeline();
|
||||
}catch(Exception ex) {
|
||||
// Gonna get another error on closing the pipeline as results from execute
|
||||
}
|
||||
if(!RedisVersionUtils.atLeast("2.6", byteConnection)) {
|
||||
// Redis 2.6 returns an ErrorReploy on exec, the Exception occurs when we call exec()
|
||||
// b/c it waits on the response
|
||||
fail("RedisSystemException should only be thrown in Redis 2.6");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user