Return null from SRP exec if watched value modified

DATAREDIS-168
This commit is contained in:
Jennifer Hickey
2013-06-13 22:20:23 -07:00
parent 37e79bafd5
commit 5817e24b9e
5 changed files with 23 additions and 13 deletions

View File

@@ -20,7 +20,6 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeTrue;
import org.junit.After;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.data.redis.RedisVersionUtils;
@@ -55,10 +54,6 @@ public class SrpConnectionIntegrationTests extends AbstractConnectionIntegration
connection = null;
}
@Ignore("DATAREDIS-168 SRP exec throws TransactionFailedException if watched value modified")
public void testWatch() {
}
@Test(expected = UnsupportedOperationException.class)
public void testZInterStoreAggWeights() {
super.testZInterStoreAggWeights();

View File

@@ -19,8 +19,8 @@ import static org.junit.Assert.assertEquals;
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 static org.junit.Assume.assumeTrue;
import java.util.ArrayList;
import java.util.Arrays;
@@ -29,7 +29,6 @@ import java.util.List;
import java.util.Properties;
import java.util.Set;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.data.redis.RedisVersionUtils;
@@ -78,8 +77,21 @@ public class SrpConnectionPipelineIntegrationTests extends
testMultiExec();
}
@Ignore("DATAREDIS-168 SRP exec throws TransactionFailedException if watched value modified")
public void testWatch() {
// SRP sets results of all commands in the pipeline to RedisException if exec returns a
// null multi-bulk reply
@Test(expected=RedisPipelineException.class)
public void testWatch() throws Exception {
connection.set("testitnow", "willdo");
connection.watch("testitnow".getBytes());
DefaultStringRedisConnection conn2 = new DefaultStringRedisConnection(
connectionFactory.getConnection());
conn2.set("testitnow", "something");
conn2.close();
connection.multi();
connection.set("testitnow", "somethingelse");
actual.add(connection.exec());
actual.add(connection.get("testitnow"));
verifyResults(Arrays.asList(new Object[] { null, "something" }), actual);
}
@Test(expected = UnsupportedOperationException.class)

View File

@@ -45,6 +45,7 @@ public class SrpConnectionTransactionIntegrationTests extends
}
@Ignore
@Test
public void testWatch() {
}

View File

@@ -139,8 +139,8 @@ public class RedisAtomicTests {
// DATAREDIS-108
@Test
public void testCompareSet() throws Exception {
// Txs not supported in Jredis, SRP checkAndSet not working DATAREDIS-123
assumeTrue(!ConnectionUtils.isJredis(factory) && !ConnectionUtils.isSrp(factory));
// Txs not supported in Jredis
assumeTrue(!ConnectionUtils.isJredis(factory));
final AtomicBoolean alreadySet = new AtomicBoolean(false);
final int NUM = 50;
final String KEY = getClass().getSimpleName() + ":atomic:counter";