From e1b421f942617c77fe7aae81d6ebc512accc8ecc Mon Sep 17 00:00:00 2001 From: Jennifer Hickey Date: Thu, 19 Sep 2013 11:00:18 -0400 Subject: [PATCH] DATAREDIS-237 - Upgrade to Jedis 2.2.1. Update to Jedis 2.2.1 and Implement newly supported Operations. Handle removed BinaryTransaction class. Handle some Jedis return types changed from String to bytes. Handle some Jedis arg types changed from int to long by removing casting. Remove ignored tests for issues fixed in Jedis 2.2.1 Throw UnsupportedOpException on multi-arg bitOp NOT Ensure consistent results across all drivers when bitOp is called with NOT and more than one arg. --- gradle.properties | 2 +- .../connection/jedis/JedisConnection.java | 626 +++++++++++------- .../connection/jedis/JedisConverters.java | 17 + .../redis/connection/srp/SrpConnection.java | 3 + .../AbstractConnectionIntegrationTests.java | 2 +- ...actConnectionPipelineIntegrationTests.java | 6 - .../JedisConnectionIntegrationTests.java | 141 +--- ...disConnectionPipelineIntegrationTests.java | 224 ------- ...sConnectionPipelineTxIntegrationTests.java | 36 +- ...ConnectionTransactionIntegrationTests.java | 240 +------ .../JRedisConnectionIntegrationTests.java | 5 - .../LettuceConnectionIntegrationTests.java | 9 - ...uceConnectionPipelineIntegrationTests.java | 14 - ...ConnectionTransactionIntegrationTests.java | 5 - ...pConnectionPipelineTxIntegrationTests.java | 6 - .../data/redis/core/RedisTemplateTests.java | 5 +- .../atomic/RedisAtomicDoubleTests.java | 2 +- 17 files changed, 434 insertions(+), 909 deletions(-) diff --git a/gradle.properties b/gradle.properties index 7c9da4a0d..f1e9c33e2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ slf4jVersion=1.7.5 junitVersion=4.10 jredisVersion=06052013 -jedisVersion=2.1.0 +jedisVersion=2.2.1 springVersion=3.2.6.RELEASE log4jVersion=1.2.17 version=1.2.0.BUILD-SNAPSHOT diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java index a12f0e89b..2313bbc5c 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConnection.java @@ -46,7 +46,6 @@ import org.springframework.util.ReflectionUtils; import redis.clients.jedis.BinaryJedis; import redis.clients.jedis.BinaryJedisPubSub; -import redis.clients.jedis.BinaryTransaction; import redis.clients.jedis.Builder; import redis.clients.jedis.Client; import redis.clients.jedis.Connection; @@ -86,7 +85,7 @@ public class JedisConnection implements RedisConnection { private final Jedis jedis; private final Client client; - private final BinaryTransaction transaction; + private final Transaction transaction; private final Pool pool; /** flag indicating whether the connection needs to be dropped or not */ private boolean broken = false; @@ -353,11 +352,9 @@ public class JedisConnection implements RedisConnection { try { if (isPipelined()) { if (sortParams != null) { - pipeline(new JedisResult(pipeline.sort(key, sortParams), JedisConverters.stringListToByteList())); + pipeline(new JedisResult(pipeline.sort(key, sortParams))); } else { - // Jedis pipeline gets ClassCastException trying to return Long instead of List - // so no point trying to convert pipeline(new JedisResult(pipeline.sort(key))); } @@ -470,13 +467,10 @@ public class JedisConnection implements RedisConnection { pipeline(new JedisStatusResult(pipeline.bgsave())); return; } - } catch (Exception ex) { - throw convertJedisAccessException(ex); - } - if (isQueueing()) { - throw new UnsupportedOperationException(); - } - try { + if (isQueueing()) { + transaction(new JedisStatusResult(transaction.bgsave())); + return; + } jedis.bgsave(); } catch (Exception ex) { throw convertJedisAccessException(ex); @@ -490,13 +484,10 @@ public class JedisConnection implements RedisConnection { pipeline(new JedisStatusResult(pipeline.bgrewriteaof())); return; } - } catch (Exception ex) { - throw convertJedisAccessException(ex); - } - if (isQueueing()) { - throw new UnsupportedOperationException(); - } - try { + if (isQueueing()) { + transaction(new JedisStatusResult(transaction.bgrewriteaof())); + return; + } jedis.bgrewriteaof(); } catch (Exception ex) { throw convertJedisAccessException(ex); @@ -510,13 +501,10 @@ public class JedisConnection implements RedisConnection { pipeline(new JedisStatusResult(pipeline.save())); return; } - } catch (Exception ex) { - throw convertJedisAccessException(ex); - } - if (isQueueing()) { - throw new UnsupportedOperationException(); - } - try { + if (isQueueing()) { + transaction(new JedisStatusResult(transaction.save())); + return; + } jedis.save(); } catch (Exception ex) { throw convertJedisAccessException(ex); @@ -530,13 +518,10 @@ public class JedisConnection implements RedisConnection { pipeline(new JedisResult(pipeline.configGet(param))); return null; } - } catch (Exception ex) { - throw convertJedisAccessException(ex); - } - if (isQueueing()) { - throw new UnsupportedOperationException(); - } - try { + if (isQueueing()) { + transaction(new JedisResult(transaction.configGet(param))); + return null; + } return jedis.configGet(param); } catch (Exception ex) { throw convertJedisAccessException(ex); @@ -545,13 +530,15 @@ public class JedisConnection implements RedisConnection { public Properties info() { - if (isQueueing()) { - throw new UnsupportedOperationException(); - } - if (isPipelined()) { - throw new UnsupportedOperationException(); - } try { + if (isPipelined()) { + pipeline(new JedisResult(pipeline.info(), JedisConverters.stringToProps())); + return null; + } + if (isQueueing()) { + transaction(new JedisResult(transaction.info(), JedisConverters.stringToProps())); + return null; + } return JedisConverters.toProperties(jedis.info()); } catch (Exception ex) { throw convertJedisAccessException(ex); @@ -560,7 +547,17 @@ public class JedisConnection implements RedisConnection { public Properties info(String section) { - throw new UnsupportedOperationException(); + if (isPipelined()) { + throw new UnsupportedOperationException(); + } + if (isQueueing()) { + throw new UnsupportedOperationException(); + } + try { + return JedisConverters.toProperties(jedis.info(section)); + } catch (Exception ex) { + throw convertJedisAccessException(ex); + } } @@ -570,13 +567,10 @@ public class JedisConnection implements RedisConnection { pipeline(new JedisResult(pipeline.lastsave())); return null; } - } catch (Exception ex) { - throw convertJedisAccessException(ex); - } - if (isQueueing()) { - throw new UnsupportedOperationException(); - } - try { + if (isQueueing()) { + transaction(new JedisResult(transaction.lastsave())); + return null; + } return jedis.lastsave(); } catch (Exception ex) { throw convertJedisAccessException(ex); @@ -590,13 +584,10 @@ public class JedisConnection implements RedisConnection { pipeline(new JedisStatusResult(pipeline.configSet(param, value))); return; } - } catch (Exception ex) { - throw convertJedisAccessException(ex); - } - if (isQueueing()) { - throw new UnsupportedOperationException(); - } - try { + if (isQueueing()) { + transaction(new JedisStatusResult(transaction.configSet(param, value))); + return; + } jedis.configSet(param, value); } catch (Exception ex) { throw convertJedisAccessException(ex); @@ -611,13 +602,10 @@ public class JedisConnection implements RedisConnection { pipeline(new JedisStatusResult(pipeline.configResetStat())); return; } - } catch (Exception ex) { - throw convertJedisAccessException(ex); - } - if (isQueueing()) { - throw new UnsupportedOperationException(); - } - try { + if (isQueueing()) { + transaction(new JedisStatusResult(transaction.configResetStat())); + return; + } jedis.configResetStat(); } catch (Exception ex) { throw convertJedisAccessException(ex); @@ -626,13 +614,15 @@ public class JedisConnection implements RedisConnection { public void shutdown() { - if (isQueueing()) { - throw new UnsupportedOperationException(); - } - if (isPipelined()) { - throw new UnsupportedOperationException(); - } try { + if (isPipelined()) { + pipeline(new JedisStatusResult(pipeline.shutdown())); + return; + } + if (isQueueing()) { + transaction(new JedisStatusResult(transaction.shutdown())); + return; + } jedis.shutdown(); } catch (Exception ex) { throw convertJedisAccessException(ex); @@ -643,16 +633,13 @@ public class JedisConnection implements RedisConnection { public byte[] echo(byte[] message) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.echo(message),JedisConverters.stringToBytes())); + pipeline(new JedisResult(pipeline.echo(message))); + return null; + } + if (isQueueing()) { + transaction(new JedisResult(transaction.echo(message))); return null; } - } catch (Exception ex) { - throw convertJedisAccessException(ex); - } - if (isQueueing()) { - throw new UnsupportedOperationException(); - } - try { return jedis.echo(message); } catch (Exception ex) { throw convertJedisAccessException(ex); @@ -661,13 +648,15 @@ public class JedisConnection implements RedisConnection { public String ping() { - if (isQueueing()) { - throw new UnsupportedOperationException(); - } - if (isPipelined()) { - throw new UnsupportedOperationException(); - } try { + if (isPipelined()) { + pipeline(new JedisResult(pipeline.ping())); + return null; + } + if (isQueueing()) { + transaction(new JedisResult(transaction.ping())); + return null; + } return jedis.ping(); } catch (Exception ex) { throw convertJedisAccessException(ex); @@ -779,7 +768,7 @@ public class JedisConnection implements RedisConnection { public Set keys(byte[] pattern) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.keys(pattern), JedisConverters.stringSetToByteSet())); + pipeline(new JedisResult(pipeline.keys(pattern))); return null; } if (isQueueing()) { @@ -844,13 +833,15 @@ public class JedisConnection implements RedisConnection { public byte[] randomKey() { - if (isQueueing()) { - throw new UnsupportedOperationException(); - } - if (isPipelined()) { - throw new UnsupportedOperationException(); - } try { + if (isPipelined()) { + pipeline(new JedisResult(pipeline.randomKeyBinary())); + return null; + } + if (isQueueing()) { + transaction(new JedisResult(transaction.randomKeyBinary())); + return null; + } return jedis.randomBinaryKey(); } catch (Exception ex) { throw convertJedisAccessException(ex); @@ -893,13 +884,15 @@ public class JedisConnection implements RedisConnection { public void select(int dbIndex) { - if (isQueueing()) { - throw new UnsupportedOperationException(); - } - if (isPipelined()) { - throw new UnsupportedOperationException(); - } try { + if (isPipelined()) { + pipeline(new JedisStatusResult(pipeline.select(dbIndex))); + return; + } + if (isQueueing()) { + transaction(new JedisStatusResult(transaction.select(dbIndex))); + return; + } jedis.select(dbIndex); } catch (Exception ex) { throw convertJedisAccessException(ex); @@ -924,23 +917,89 @@ public class JedisConnection implements RedisConnection { } public Boolean pExpire(byte[] key, long millis) { - throw new UnsupportedOperationException(); + try { + if (isPipelined()) { + pipeline(new JedisResult(pipeline.pexpire(key, (int) millis), + JedisConverters.longToBoolean())); + return null; + } + if (isQueueing()) { + transaction(new JedisResult(transaction.pexpire(key, (int) millis), + JedisConverters.longToBoolean())); + return null; + } + return JedisConverters.toBoolean(jedis.pexpire(key, (int) millis)); + } catch (Exception ex) { + throw convertJedisAccessException(ex); + } } public Boolean pExpireAt(byte[] key, long unixTimeInMillis) { - throw new UnsupportedOperationException(); + try { + if (isPipelined()) { + pipeline(new JedisResult(pipeline.pexpireAt(key, unixTimeInMillis), + JedisConverters.longToBoolean())); + return null; + } + if (isQueueing()) { + transaction(new JedisResult(transaction.pexpireAt(key, unixTimeInMillis), + JedisConverters.longToBoolean())); + return null; + } + return JedisConverters.toBoolean(jedis.pexpireAt(key, unixTimeInMillis)); + } catch (Exception ex) { + throw convertJedisAccessException(ex); + } } public Long pTtl(byte[] key) { - throw new UnsupportedOperationException(); + try { + if (isPipelined()) { + pipeline(new JedisResult(pipeline.pttl(key))); + return null; + } + if (isQueueing()) { + transaction(new JedisResult(transaction.pttl(key))); + return null; + } + return jedis.pttl(key); + } catch (Exception ex) { + throw convertJedisAccessException(ex); + } } public byte[] dump(byte[] key) { - throw new UnsupportedOperationException(); + try { + if (isPipelined()) { + pipeline(new JedisResult(pipeline.dump(key))); + return null; + } + if (isQueueing()) { + transaction(new JedisResult(transaction.dump(key))); + return null; + } + return jedis.dump(key); + } catch (Exception ex) { + throw convertJedisAccessException(ex); + } } public void restore(byte[] key, long ttlInMillis, byte[] serializedValue) { - throw new UnsupportedOperationException(); + try { + if (isPipelined()) { + pipeline(new JedisStatusResult(pipeline.restore(key, (int) ttlInMillis, + serializedValue))); + return; + } + if (isQueueing()) { + transaction(new JedisStatusResult(transaction.restore(key, (int) ttlInMillis, + serializedValue))); + return; + } + jedis.restore(key, (int) ttlInMillis, serializedValue); + } catch (Exception ex) { + throw convertJedisAccessException(ex); + } } public DataType type(byte[] key) { @@ -1035,7 +1094,7 @@ public class JedisConnection implements RedisConnection { return null; } if (isQueueing()) { - transaction(new JedisResult(transaction.getSet(key, value), JedisConverters.stringToBytes())); + transaction(new JedisResult(transaction.getSet(key, value))); return null; } return jedis.getSet(key, value); @@ -1065,7 +1124,7 @@ public class JedisConnection implements RedisConnection { public List mGet(byte[]... keys) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.mget(keys), JedisConverters.stringListToByteList())); + pipeline(new JedisResult(pipeline.mget(keys))); return null; } if (isQueueing()) { @@ -1237,17 +1296,31 @@ public class JedisConnection implements RedisConnection { } public Double incrBy(byte[] key, double value) { - throw new UnsupportedOperationException(); + try { + if (isPipelined()) { + pipeline(new JedisResult(pipeline.incrByFloat(key, value))); + return null; + } + if (isQueueing()) { + transaction(new JedisResult(transaction.incrByFloat(key, value))); + return null; + } + return jedis.incrByFloat(key, value); + } catch (Exception ex) { + throw convertJedisAccessException(ex); + } } public Boolean getBit(byte[] key, long offset) { - if (isQueueing()) { - throw new UnsupportedOperationException(); - } - if (isPipelined()) { - throw new UnsupportedOperationException(); - } try { + if (isPipelined()) { + pipeline(new JedisResult(pipeline.getbit(key, offset))); + return null; + } + if (isQueueing()) { + transaction(new JedisResult(transaction.getbit(key, offset))); + return null; + } // compatibility check for Jedis 2.0.0 Object getBit = jedis.getbit(key, offset); // Jedis 2.0 @@ -1263,13 +1336,15 @@ public class JedisConnection implements RedisConnection { public void setBit(byte[] key, long offset, boolean value) { - if (isQueueing()) { - throw new UnsupportedOperationException(); - } - if (isPipelined()) { - throw new UnsupportedOperationException(); - } try { + if (isPipelined()) { + pipeline(new JedisStatusResult(pipeline.setbit(key, offset, JedisConverters.toBit(value)))); + return; + } + if (isQueueing()) { + transaction(new JedisStatusResult(transaction.setbit(key, offset, JedisConverters.toBit(value)))); + return; + } jedis.setbit(key, offset, JedisConverters.toBit(value)); } catch (Exception ex) { throw convertJedisAccessException(ex); @@ -1278,13 +1353,15 @@ public class JedisConnection implements RedisConnection { public void setRange(byte[] key, byte[] value, long start) { - if (isQueueing()) { - throw new UnsupportedOperationException(); - } - if (isPipelined()) { - throw new UnsupportedOperationException(); - } try { + if (isPipelined()) { + pipeline(new JedisStatusResult(pipeline.setrange(key, start, value))); + return; + } + if (isQueueing()) { + transaction(new JedisStatusResult(transaction.setrange(key, start, value))); + return; + } jedis.setrange(key, start, value); } catch (Exception ex) { throw convertJedisAccessException(ex); @@ -1310,17 +1387,56 @@ public class JedisConnection implements RedisConnection { public Long bitCount(byte[] key) { - throw new UnsupportedOperationException(); + try { + if (isPipelined()) { + pipeline(new JedisResult(pipeline.bitcount(key))); + return null; + } + if (isQueueing()) { + transaction(new JedisResult(transaction.bitcount(key))); + return null; + } + return jedis.bitcount(key); + } catch (Exception ex) { + throw convertJedisAccessException(ex); + } } public Long bitCount(byte[] key, long begin, long end) { - throw new UnsupportedOperationException(); + try { + if (isPipelined()) { + pipeline(new JedisResult(pipeline.bitcount(key, begin, end))); + return null; + } + if (isQueueing()) { + transaction(new JedisResult(transaction.bitcount(key, begin, end))); + return null; + } + return jedis.bitcount(key, begin, end); + } catch (Exception ex) { + throw convertJedisAccessException(ex); + } } public Long bitOp(BitOperation op, byte[] destination, byte[]... keys) { - throw new UnsupportedOperationException(); + if(op == BitOperation.NOT && keys.length > 1) { + throw new UnsupportedOperationException("Bitop NOT should only be performed against one key"); + } + try { + if (isPipelined()) { + pipeline(new JedisResult(pipeline.bitop(JedisConverters.toBitOp(op), destination, keys))); + return null; + } + if (isQueueing()) { + transaction(new JedisResult(transaction.bitop(JedisConverters.toBitOp(op), destination, keys))); + return null; + } + return jedis.bitop(JedisConverters.toBitOp(op), destination, keys); + } catch (Exception ex) { + throw convertJedisAccessException(ex); + } } // @@ -1328,17 +1444,13 @@ public class JedisConnection implements RedisConnection { // public Long lPush(byte[] key, byte[]... values) { - if((isPipelined() || isQueueing()) && values.length > 1) { - throw new UnsupportedOperationException("lPush of multiple fields not supported " + - "in pipeline or transaction"); - } try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.lpush(key, values[0]))); + pipeline(new JedisResult(pipeline.lpush(key, values))); return null; } if (isQueueing()) { - transaction(new JedisResult(transaction.lpush(key, values[0]))); + transaction(new JedisResult(transaction.lpush(key, values))); return null; } return jedis.lpush(key, values); @@ -1349,17 +1461,13 @@ public class JedisConnection implements RedisConnection { public Long rPush(byte[] key, byte[]... values) { - if((isPipelined() || isQueueing()) && values.length > 1) { - throw new UnsupportedOperationException("rPush of multiple fields not supported " + - "in pipeline or transaction"); - } try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.rpush(key, values[0]))); + pipeline(new JedisResult(pipeline.rpush(key, values))); return null; } if (isQueueing()) { - transaction(new JedisResult(transaction.rpush(key, values[0]))); + transaction(new JedisResult(transaction.rpush(key, values))); return null; } return jedis.rpush(key, values); @@ -1372,13 +1480,11 @@ public class JedisConnection implements RedisConnection { public List bLPop(int timeout, byte[]... keys) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.blpop(bXPopArgs(timeout, keys)), - JedisConverters.stringListToByteList())); + pipeline(new JedisResult(pipeline.blpop(bXPopArgs(timeout, keys)))); return null; } if (isQueueing()) { - transaction(new JedisResult(transaction.blpop(bXPopArgs(timeout, keys)), - JedisConverters.stringListToByteList())); + transaction(new JedisResult(transaction.blpop(bXPopArgs(timeout, keys)))); return null; } return jedis.blpop(timeout, keys); @@ -1391,13 +1497,11 @@ public class JedisConnection implements RedisConnection { public List bRPop(int timeout, byte[]... keys) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.brpop(bXPopArgs(timeout, keys)), - JedisConverters.stringListToByteList())); + pipeline(new JedisResult(pipeline.brpop(bXPopArgs(timeout, keys)))); return null; } if (isQueueing()) { - transaction(new JedisResult(transaction.brpop(bXPopArgs(timeout, keys)), - JedisConverters.stringListToByteList())); + transaction(new JedisResult(transaction.brpop(bXPopArgs(timeout, keys)))); return null; } return jedis.brpop(timeout, keys); @@ -1410,14 +1514,14 @@ public class JedisConnection implements RedisConnection { public byte[] lIndex(byte[] key, long index) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.lindex(key, (int) index), JedisConverters.stringToBytes())); + pipeline(new JedisResult(pipeline.lindex(key, index))); return null; } if (isQueueing()) { - transaction(new JedisResult(transaction.lindex(key, (int) index))); + transaction(new JedisResult(transaction.lindex(key, index))); return null; } - return jedis.lindex(key, (int) index); + return jedis.lindex(key, index); } catch (Exception ex) { throw convertJedisAccessException(ex); } @@ -1463,7 +1567,7 @@ public class JedisConnection implements RedisConnection { public byte[] lPop(byte[] key) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.lpop(key), JedisConverters.stringToBytes())); + pipeline(new JedisResult(pipeline.lpop(key))); return null; } if (isQueueing()) { @@ -1480,15 +1584,14 @@ public class JedisConnection implements RedisConnection { public List lRange(byte[] key, long start, long end) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.lrange(key, (int) start, (int) end), - JedisConverters.stringListToByteList())); + pipeline(new JedisResult(pipeline.lrange(key, start, end))); return null; } if (isQueueing()) { - transaction(new JedisResult(transaction.lrange(key, (int) start, (int) end))); + transaction(new JedisResult(transaction.lrange(key, start, end))); return null; } - return jedis.lrange(key, (int) start, (int) end); + return jedis.lrange(key, start, end); } catch (Exception ex) { throw convertJedisAccessException(ex); } @@ -1498,14 +1601,14 @@ public class JedisConnection implements RedisConnection { public Long lRem(byte[] key, long count, byte[] value) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.lrem(key, (int) count, value))); + pipeline(new JedisResult(pipeline.lrem(key, count, value))); return null; } if (isQueueing()) { - transaction(new JedisResult(transaction.lrem(key, (int) count, value))); + transaction(new JedisResult(transaction.lrem(key, count, value))); return null; } - return jedis.lrem(key, (int) count, value); + return jedis.lrem(key, count, value); } catch (Exception ex) { throw convertJedisAccessException(ex); } @@ -1515,14 +1618,14 @@ public class JedisConnection implements RedisConnection { public void lSet(byte[] key, long index, byte[] value) { try { if (isPipelined()) { - pipeline(new JedisStatusResult(pipeline.lset(key, (int) index, value))); + pipeline(new JedisStatusResult(pipeline.lset(key, index, value))); return; } if (isQueueing()) { - transaction(new JedisStatusResult(transaction.lset(key, (int) index, value))); + transaction(new JedisStatusResult(transaction.lset(key, index, value))); return; } - jedis.lset(key, (int) index, value); + jedis.lset(key, index, value); } catch (Exception ex) { throw convertJedisAccessException(ex); } @@ -1532,14 +1635,14 @@ public class JedisConnection implements RedisConnection { public void lTrim(byte[] key, long start, long end) { try { if (isPipelined()) { - pipeline(new JedisStatusResult(pipeline.ltrim(key, (int) start, (int) end))); + pipeline(new JedisStatusResult(pipeline.ltrim(key, start, end))); return; } if (isQueueing()) { - transaction(new JedisStatusResult(transaction.ltrim(key, (int) start, (int) end))); + transaction(new JedisStatusResult(transaction.ltrim(key, start, end))); return; } - jedis.ltrim(key, (int) start, (int) end); + jedis.ltrim(key, start, end); } catch (Exception ex) { throw convertJedisAccessException(ex); } @@ -1549,7 +1652,7 @@ public class JedisConnection implements RedisConnection { public byte[] rPop(byte[] key) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.rpop(key), JedisConverters.stringToBytes())); + pipeline(new JedisResult(pipeline.rpop(key))); return null; } if (isQueueing()) { @@ -1566,7 +1669,7 @@ public class JedisConnection implements RedisConnection { public byte[] rPopLPush(byte[] srcKey, byte[] dstKey) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.rpoplpush(srcKey, dstKey), JedisConverters.stringToBytes())); + pipeline(new JedisResult(pipeline.rpoplpush(srcKey, dstKey))); return null; } if (isQueueing()) { @@ -1583,7 +1686,7 @@ public class JedisConnection implements RedisConnection { public byte[] bRPopLPush(int timeout, byte[] srcKey, byte[] dstKey) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.brpoplpush(srcKey, dstKey, timeout), JedisConverters.stringToBytes())); + pipeline(new JedisResult(pipeline.brpoplpush(srcKey, dstKey, timeout))); return null; } if (isQueueing()) { @@ -1637,17 +1740,13 @@ public class JedisConnection implements RedisConnection { public Long sAdd(byte[] key, byte[]... values) { - if((isPipelined() || isQueueing()) && values.length > 1) { - throw new UnsupportedOperationException("sAdd of multiple fields not supported " + - "in pipeline or transaction"); - } try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.sadd(key, values[0]))); + pipeline(new JedisResult(pipeline.sadd(key, values))); return null; } if (isQueueing()) { - transaction(new JedisResult(transaction.sadd(key, values[0]))); + transaction(new JedisResult(transaction.sadd(key, values))); return null; } return jedis.sadd(key, values); @@ -1677,7 +1776,7 @@ public class JedisConnection implements RedisConnection { public Set sDiff(byte[]... keys) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.sdiff(keys), JedisConverters.stringSetToByteSet())); + pipeline(new JedisResult(pipeline.sdiff(keys))); return null; } if (isQueueing()) { @@ -1711,7 +1810,7 @@ public class JedisConnection implements RedisConnection { public Set sInter(byte[]... keys) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.sinter(keys), JedisConverters.stringSetToByteSet())); + pipeline(new JedisResult(pipeline.sinter(keys))); return null; } if (isQueueing()) { @@ -1762,7 +1861,7 @@ public class JedisConnection implements RedisConnection { public Set sMembers(byte[] key) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.smembers(key), JedisConverters.stringSetToByteSet())); + pipeline(new JedisResult(pipeline.smembers(key))); return null; } if (isQueueing()) { @@ -1797,7 +1896,7 @@ public class JedisConnection implements RedisConnection { public byte[] sPop(byte[] key) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.spop(key), JedisConverters.stringToBytes())); + pipeline(new JedisResult(pipeline.spop(key))); return null; } if (isQueueing()) { @@ -1814,7 +1913,7 @@ public class JedisConnection implements RedisConnection { public byte[] sRandMember(byte[] key) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.srandmember(key), JedisConverters.stringToBytes())); + pipeline(new JedisResult(pipeline.srandmember(key))); return null; } if (isQueueing()) { @@ -1828,21 +1927,29 @@ public class JedisConnection implements RedisConnection { } public List sRandMember(byte[] key, long count) { - throw new UnsupportedOperationException(); - } - - public Long sRem(byte[] key, byte[]... values) { - if((isPipelined() || isQueueing()) && values.length > 1) { - throw new UnsupportedOperationException("sRem of multiple fields not supported " + - "in pipeline or transaction"); - } try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.srem(key, values[0]))); + pipeline(new JedisResult(pipeline.srandmember(key, (int) count))); return null; } if (isQueueing()) { - transaction(new JedisResult(transaction.srem(key, values[0]))); + transaction(new JedisResult(transaction.srandmember(key, (int) count))); + return null; + } + return jedis.srandmember(key, (int) count); + } catch (Exception ex) { + throw convertJedisAccessException(ex); + } + } + + public Long sRem(byte[] key, byte[]... values) { + try { + if (isPipelined()) { + pipeline(new JedisResult(pipeline.srem(key, values))); + return null; + } + if (isQueueing()) { + transaction(new JedisResult(transaction.srem(key, values))); return null; } return jedis.srem(key, values); @@ -1855,7 +1962,7 @@ public class JedisConnection implements RedisConnection { public Set sUnion(byte[]... keys) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.sunion(keys), JedisConverters.stringSetToByteSet())); + pipeline(new JedisResult(pipeline.sunion(keys))); return null; } if (isQueueing()) { @@ -2010,14 +2117,14 @@ public class JedisConnection implements RedisConnection { public Set zRange(byte[] key, long start, long end) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.zrange(key, (int) start, (int) end), JedisConverters.stringSetToByteSet())); + pipeline(new JedisResult(pipeline.zrange(key, start, end))); return null; } if (isQueueing()) { - transaction(new JedisResult(transaction.zrange(key, (int) start, (int) end))); + transaction(new JedisResult(transaction.zrange(key, start, end))); return null; } - return jedis.zrange(key, (int) start, (int) end); + return jedis.zrange(key, start, end); } catch (Exception ex) { throw convertJedisAccessException(ex); } @@ -2027,16 +2134,16 @@ public class JedisConnection implements RedisConnection { public Set zRangeWithScores(byte[] key, long start, long end) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.zrangeWithScores(key, (int) start, (int) end), + pipeline(new JedisResult(pipeline.zrangeWithScores(key, start, end), JedisConverters.tupleSetToTupleSet())); return null; } if (isQueueing()) { - transaction(new JedisResult(transaction.zrangeWithScores(key, (int) start, (int) end), + transaction(new JedisResult(transaction.zrangeWithScores(key, start, end), JedisConverters.tupleSetToTupleSet())); return null; } - return JedisConverters.toTupleSet(jedis.zrangeWithScores(key, (int) start, (int) end)); + return JedisConverters.toTupleSet(jedis.zrangeWithScores(key, start, end)); } catch (Exception ex) { throw convertJedisAccessException(ex); } @@ -2046,7 +2153,7 @@ public class JedisConnection implements RedisConnection { public Set zRangeByScore(byte[] key, double min, double max) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.zrangeByScore(key, min, max), JedisConverters.stringSetToByteSet())); + pipeline(new JedisResult(pipeline.zrangeByScore(key, min, max))); return null; } if (isQueueing()) { @@ -2082,16 +2189,16 @@ public class JedisConnection implements RedisConnection { public Set zRevRangeWithScores(byte[] key, long start, long end) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.zrevrangeWithScores(key, (int) start, (int) end), + pipeline(new JedisResult(pipeline.zrevrangeWithScores(key, start, end), JedisConverters.tupleSetToTupleSet())); return null; } if (isQueueing()) { - transaction(new JedisResult(transaction.zrevrangeWithScores(key, (int) start, (int) end), + transaction(new JedisResult(transaction.zrevrangeWithScores(key, start, end), JedisConverters.tupleSetToTupleSet())); return null; } - return JedisConverters.toTupleSet(jedis.zrevrangeWithScores(key, (int) start, (int) end)); + return JedisConverters.toTupleSet(jedis.zrevrangeWithScores(key, start, end)); } catch (Exception ex) { throw convertJedisAccessException(ex); } @@ -2101,8 +2208,7 @@ public class JedisConnection implements RedisConnection { public Set zRangeByScore(byte[] key, double min, double max, long offset, long count) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.zrangeByScore(key, min, max, (int) offset, (int) count), - JedisConverters.stringSetToByteSet())); + pipeline(new JedisResult(pipeline.zrangeByScore(key, min, max, (int) offset, (int) count))); return null; } if (isQueueing()) { @@ -2136,13 +2242,15 @@ public class JedisConnection implements RedisConnection { public Set zRevRangeByScore(byte[] key, double min, double max, long offset, long count) { - if (isQueueing()) { - throw new UnsupportedOperationException(); - } - if (isPipelined()) { - throw new UnsupportedOperationException(); - } try { + if (isPipelined()) { + pipeline(new JedisResult(pipeline.zrevrangeByScore(key, max, min, (int) offset, (int) count))); + return null; + } + if (isQueueing()) { + transaction(new JedisResult(transaction.zrevrangeByScore(key, max, min, (int) offset, (int) count))); + return null; + } return jedis.zrevrangeByScore(key, max, min, (int) offset, (int) count); } catch (Exception ex) { throw convertJedisAccessException(ex); @@ -2151,13 +2259,15 @@ public class JedisConnection implements RedisConnection { public Set zRevRangeByScore(byte[] key, double min, double max) { - if (isQueueing()) { - throw new UnsupportedOperationException(); - } - if (isPipelined()) { - throw new UnsupportedOperationException(); - } try { + if (isPipelined()) { + pipeline(new JedisResult(pipeline.zrevrangeByScore(key, max, min))); + return null; + } + if (isQueueing()) { + transaction(new JedisResult(transaction.zrevrangeByScore(key, max, min))); + return null; + } return jedis.zrevrangeByScore(key, max, min); } catch (Exception ex) { throw convertJedisAccessException(ex); @@ -2166,13 +2276,17 @@ public class JedisConnection implements RedisConnection { public Set zRevRangeByScoreWithScores(byte[] key, double min, double max, long offset, long count) { - if (isQueueing()) { - throw new UnsupportedOperationException(); - } - if (isPipelined()) { - throw new UnsupportedOperationException(); - } try { + if (isPipelined()) { + pipeline(new JedisResult(pipeline.zrevrangeByScoreWithScores(key, max, min, (int) offset, + (int) count), JedisConverters.tupleSetToTupleSet())); + return null; + } + if (isQueueing()) { + transaction(new JedisResult(transaction.zrevrangeByScoreWithScores(key, max, min, (int) offset, + (int) count), JedisConverters.tupleSetToTupleSet())); + return null; + } return JedisConverters.toTupleSet(jedis.zrevrangeByScoreWithScores(key, max, min, (int) offset, (int) count)); } catch (Exception ex) { @@ -2182,13 +2296,17 @@ public class JedisConnection implements RedisConnection { public Set zRevRangeByScoreWithScores(byte[] key, double min, double max) { - if (isQueueing()) { - throw new UnsupportedOperationException(); - } - if (isPipelined()) { - throw new UnsupportedOperationException(); - } try { + if (isPipelined()) { + pipeline(new JedisResult(pipeline.zrevrangeByScoreWithScores(key, max, min), + JedisConverters.tupleSetToTupleSet())); + return null; + } + if (isQueueing()) { + transaction(new JedisResult(transaction.zrevrangeByScoreWithScores(key, max, min), + JedisConverters.tupleSetToTupleSet())); + return null; + } return JedisConverters.toTupleSet(jedis.zrevrangeByScoreWithScores(key, max, min)); } catch (Exception ex) { throw convertJedisAccessException(ex); @@ -2214,17 +2332,13 @@ public class JedisConnection implements RedisConnection { public Long zRem(byte[] key, byte[]... values) { - if((isPipelined() || isQueueing()) && values.length > 1) { - throw new UnsupportedOperationException("zRem of multiple fields not supported " + - "in pipeline or transaction"); - } try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.zrem(key, values[0]))); + pipeline(new JedisResult(pipeline.zrem(key, values))); return null; } if (isQueueing()) { - transaction(new JedisResult(transaction.zrem(key, values[0]))); + transaction(new JedisResult(transaction.zrem(key, values))); return null; } return jedis.zrem(key, values); @@ -2237,14 +2351,14 @@ public class JedisConnection implements RedisConnection { public Long zRemRange(byte[] key, long start, long end) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.zremrangeByRank(key, (int) start, (int) end))); + pipeline(new JedisResult(pipeline.zremrangeByRank(key, start, end))); return null; } if (isQueueing()) { - transaction(new JedisResult(transaction.zremrangeByRank(key, (int) start, (int) end))); + transaction(new JedisResult(transaction.zremrangeByRank(key, start, end))); return null; } - return jedis.zremrangeByRank(key, (int) start, (int) end); + return jedis.zremrangeByRank(key, start, end); } catch (Exception ex) { throw convertJedisAccessException(ex); } @@ -2271,15 +2385,14 @@ public class JedisConnection implements RedisConnection { public Set zRevRange(byte[] key, long start, long end) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.zrevrange(key, (int) start, (int) end), - JedisConverters.stringSetToByteSet())); + pipeline(new JedisResult(pipeline.zrevrange(key, start, end))); return null; } if (isQueueing()) { - transaction(new JedisResult(transaction.zrevrange(key, (int) start, (int) end))); + transaction(new JedisResult(transaction.zrevrange(key, start, end))); return null; } - return jedis.zrevrange(key, (int) start, (int) end); + return jedis.zrevrange(key, start, end); } catch (Exception ex) { throw convertJedisAccessException(ex); } @@ -2399,17 +2512,13 @@ public class JedisConnection implements RedisConnection { public Long hDel(byte[] key, byte[]... fields) { - if((isPipelined() || isQueueing()) && fields.length > 1) { - throw new UnsupportedOperationException("hDel of multiple fields not supported " + - "in pipeline or transaction"); - } try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.hdel(key, fields[0]))); + pipeline(new JedisResult(pipeline.hdel(key, fields))); return null; } if (isQueueing()) { - transaction(new JedisResult(transaction.hdel(key, fields[0]))); + transaction(new JedisResult(transaction.hdel(key, fields))); return null; } return jedis.hdel(key, fields); @@ -2439,7 +2548,7 @@ public class JedisConnection implements RedisConnection { public byte[] hGet(byte[] key, byte[] field) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.hget(key, field), JedisConverters.stringToBytes())); + pipeline(new JedisResult(pipeline.hget(key, field))); return null; } if (isQueueing()) { @@ -2456,11 +2565,11 @@ public class JedisConnection implements RedisConnection { public Map hGetAll(byte[] key) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.hgetAll(key), JedisConverters.stringMapToByteMap())); + pipeline(new JedisResult(pipeline.hgetAll(key))); return null; } if (isQueueing()) { - transaction(new JedisResult(transaction.hgetAll(key), JedisConverters.stringMapToByteMap())); + transaction(new JedisResult(transaction.hgetAll(key))); return null; } return jedis.hgetAll(key); @@ -2487,13 +2596,25 @@ public class JedisConnection implements RedisConnection { } public Double hIncrBy(byte[] key, byte[] field, double delta) { - throw new UnsupportedOperationException(); + try { + if (isPipelined()) { + pipeline(new JedisResult(pipeline.hincrByFloat(key, field, delta))); + return null; + } + if (isQueueing()) { + transaction(new JedisResult(transaction.hincrByFloat(key, field, delta))); + return null; + } + return jedis.hincrByFloat(key, field, delta); + } catch (Exception ex) { + throw convertJedisAccessException(ex); + } } public Set hKeys(byte[] key) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.hkeys(key), JedisConverters.stringSetToByteSet())); + pipeline(new JedisResult(pipeline.hkeys(key))); return null; } if (isQueueing()) { @@ -2527,7 +2648,7 @@ public class JedisConnection implements RedisConnection { public List hMGet(byte[] key, byte[]... fields) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.hmget(key, fields), JedisConverters.stringListToByteList())); + pipeline(new JedisResult(pipeline.hmget(key, fields))); return null; } if (isQueueing()) { @@ -2561,7 +2682,7 @@ public class JedisConnection implements RedisConnection { public List hVals(byte[] key) { try { if (isPipelined()) { - pipeline(new JedisResult(pipeline.hvals(key), JedisConverters.stringListToByteList())); + pipeline(new JedisResult(pipeline.hvals(key))); return null; } if (isQueueing()) { @@ -2585,13 +2706,10 @@ public class JedisConnection implements RedisConnection { pipeline(new JedisResult(pipeline.publish(channel, message))); return null; } - } catch (Exception ex) { - throw convertJedisAccessException(ex); - } - if (isQueueing()) { - throw new UnsupportedOperationException(); - } - try { + if (isQueueing()) { + transaction(new JedisResult(transaction.publish(channel, message))); + return null; + } return jedis.publish(channel, message); } catch (Exception ex) { throw convertJedisAccessException(ex); diff --git a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConverters.java b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConverters.java index 7465d5672..8468a5a35 100644 --- a/src/main/java/org/springframework/data/redis/connection/jedis/JedisConverters.java +++ b/src/main/java/org/springframework/data/redis/connection/jedis/JedisConverters.java @@ -22,6 +22,7 @@ import org.springframework.core.convert.converter.Converter; import org.springframework.dao.DataAccessException; import org.springframework.data.redis.connection.DefaultTuple; import org.springframework.data.redis.connection.RedisListCommands.Position; +import org.springframework.data.redis.connection.RedisStringCommands.BitOperation; import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; import org.springframework.data.redis.connection.SortParameters; import org.springframework.data.redis.connection.SortParameters.Order; @@ -33,6 +34,7 @@ import org.springframework.data.redis.connection.convert.SetConverter; import org.springframework.util.Assert; import redis.clients.jedis.BinaryClient.LIST_POSITION; +import redis.clients.jedis.BitOP; import redis.clients.jedis.SortingParams; import redis.clients.util.SafeEncoder; @@ -159,4 +161,19 @@ abstract public class JedisConverters extends Converters { } return jedisParams; } + + public static BitOP toBitOp(BitOperation bitOp) { + switch(bitOp) { + case AND: + return BitOP.AND; + case OR: + return BitOP.OR; + case NOT: + return BitOP.NOT; + case XOR: + return BitOP.XOR; + default: + throw new IllegalArgumentException(); + } + } } diff --git a/src/main/java/org/springframework/data/redis/connection/srp/SrpConnection.java b/src/main/java/org/springframework/data/redis/connection/srp/SrpConnection.java index 14eb75db7..2fdc24304 100644 --- a/src/main/java/org/springframework/data/redis/connection/srp/SrpConnection.java +++ b/src/main/java/org/springframework/data/redis/connection/srp/SrpConnection.java @@ -1102,6 +1102,9 @@ public class SrpConnection implements RedisConnection { public Long bitOp(BitOperation op, byte[] destination, byte[]... keys) { + if(op == BitOperation.NOT && keys.length > 1) { + throw new UnsupportedOperationException("Bitop NOT should only be performed against one key"); + } try { if (isPipelined()) { pipeline(new SrpResult(pipeline.bitop(SrpConverters.toBytes(op), destination, (Object[]) keys))); diff --git a/src/test/java/org/springframework/data/redis/connection/AbstractConnectionIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/AbstractConnectionIntegrationTests.java index 297105a58..e9f75df60 100644 --- a/src/test/java/org/springframework/data/redis/connection/AbstractConnectionIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/AbstractConnectionIntegrationTests.java @@ -480,7 +480,7 @@ public abstract class AbstractConnectionIntegrationTests { verifyResults(Arrays.asList(new Object[] { 4l })); } - @Test(expected = RedisSystemException.class) + @Test(expected =UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6") public void testBitOpNotMultipleSources() { connection.set("key1", "abcd"); diff --git a/src/test/java/org/springframework/data/redis/connection/AbstractConnectionPipelineIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/AbstractConnectionPipelineIntegrationTests.java index e5d8d7d38..892aebe60 100644 --- a/src/test/java/org/springframework/data/redis/connection/AbstractConnectionPipelineIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/AbstractConnectionPipelineIntegrationTests.java @@ -92,12 +92,6 @@ abstract public class AbstractConnectionPipelineIntegrationTests extends super.testEvalReturnSingleError(); } - @Test(expected = RedisPipelineException.class) - @IfProfileValue(name = "redisVersion", value = "2.6") - public void testBitOpNotMultipleSources() { - super.testBitOpNotMultipleSources(); - } - @Test(expected = RedisPipelineException.class) @IfProfileValue(name = "redisVersion", value = "2.6") public void testRestoreBadData() { diff --git a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionIntegrationTests.java index edda5a9ee..50b39bba8 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionIntegrationTests.java @@ -75,135 +75,6 @@ public class JedisConnectionIntegrationTests extends AbstractConnectionIntegrati connection = null; } - @Test(expected=UnsupportedOperationException.class) - public void testPExpire() { - super.testPExpire(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testPExpireKeyNotExists() { - super.testPExpireKeyNotExists(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testPExpireAt() { - super.testPExpireAt(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testPExpireAtKeyNotExists() { - super.testPExpireAtKeyNotExists(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testPTtl() { - super.testPTtl(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testPTtlNoExpire() { - super.testPTtlNoExpire(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testDumpAndRestore() { - super.testDumpAndRestore(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testDumpNonExistentKey() { - super.testDumpNonExistentKey(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testRestoreBadData() { - super.testRestoreBadData(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testRestoreExistingKey() { - super.testRestoreExistingKey(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testRestoreTtl() { - super.testRestoreTtl(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testBitCount() { - super.testBitCount(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testBitCountInterval() { - super.testBitCountInterval(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testBitCountNonExistentKey() { - super.testBitCountNonExistentKey(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testBitOpAnd() { - super.testBitOpAnd(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testBitOpOr() { - super.testBitOpOr(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testBitOpXOr() { - super.testBitOpXOr(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testBitOpNot() { - super.testBitOpNot(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testBitOpNotMultipleSources() { - super.testBitOpNotMultipleSources(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testHIncrByDouble() { - super.testHIncrByDouble(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testIncrByDouble() { - super.testIncrByDouble(); - } - - @Test(expected=UnsupportedOperationException.class) - @IfProfileValue(name = "redisVersion", value = "2.6") - public void testSRandMemberCount() { - super.testSRandMemberCount(); - } - - @Test(expected=UnsupportedOperationException.class) - @IfProfileValue(name = "redisVersion", value = "2.6") - public void testSRandMemberCountKeyNotExists() { - super.testSRandMemberCountKeyNotExists(); - } - - @Test(expected=UnsupportedOperationException.class) - @IfProfileValue(name = "redisVersion", value = "2.6") - public void testSRandMemberCountNegative() { - super.testSRandMemberCountNegative(); - } - - @Test(expected=UnsupportedOperationException.class) - @IfProfileValue(name = "redisVersion", value = "2.6") - public void testInfoBySection() throws Exception { - super.testInfoBySection(); - } - @Test public void testCreateConnectionWithDb() { JedisConnectionFactory factory2 = new JedisConnectionFactory(); @@ -270,6 +141,18 @@ public class JedisConnectionIntegrationTests extends AbstractConnectionIntegrati super.testEvalShaArrayError(); } + @Test(expected=InvalidDataAccessApiUsageException.class) + @IfProfileValue(name = "redisVersion", value = "2.6") + public void testRestoreBadData() { + super.testRestoreBadData(); + } + + @Test(expected=InvalidDataAccessApiUsageException.class) + @IfProfileValue(name = "redisVersion", value = "2.6") + public void testRestoreExistingKey() { + super.testRestoreExistingKey(); + } + @Test(expected=InvalidDataAccessApiUsageException.class) public void testExecWithoutMulti() { super.testExecWithoutMulti(); diff --git a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionPipelineIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionPipelineIntegrationTests.java index e9e064977..af32505cd 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionPipelineIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionPipelineIntegrationTests.java @@ -63,22 +63,6 @@ public class JedisConnectionPipelineIntegrationTests extends public void testGetConfig() { } - @Ignore("https://github.com/xetorthio/jedis/pull/389 Pipeline tries to return List instead of Long on sort") - public void testSortStore() { - } - - @Ignore("Jedis issue: Pipeline tries to return Long instead of List on sort with no params") - public void testSortNullParams() { - } - - @Ignore("https://github.com/xetorthio/jedis/pull/389 Pipeline tries to return Long instead of List on sort with no params") - public void testSortStoreNullParams() { - } - - @Ignore("https://github.com/xetorthio/jedis/issues/438 Cannot get results from Pipeline after tx discard called") - public void testMultiDiscard() { - } - @Test public void testWatch() { connection.set("testitnow", "willdo"); @@ -141,166 +125,6 @@ public class JedisConnectionPipelineIntegrationTests extends } // Unsupported Ops - @Test(expected=UnsupportedOperationException.class) - public void testPExpire() { - super.testPExpire(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testPExpireKeyNotExists() { - super.testPExpireKeyNotExists(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testPExpireAt() { - super.testPExpireAt(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testPExpireAtKeyNotExists() { - super.testPExpireAtKeyNotExists(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testPTtl() { - super.testPTtl(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testPTtlNoExpire() { - super.testPTtlNoExpire(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testDumpAndRestore() { - super.testDumpAndRestore(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testDumpNonExistentKey() { - super.testDumpNonExistentKey(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testRestoreBadData() { - super.testRestoreBadData(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testRestoreExistingKey() { - super.testRestoreExistingKey(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testRestoreTtl() { - super.testRestoreTtl(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testBitSet() throws Exception { - super.testBitSet(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testBitGet() { - connection.getBit("bitly", 1l); - } - - @Test(expected=UnsupportedOperationException.class) - public void testBitCount() { - connection.bitCount("foo"); - } - - @Test(expected=UnsupportedOperationException.class) - public void testBitCountInterval() { - super.testBitCountInterval(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testBitCountNonExistentKey() { - super.testBitCountNonExistentKey(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testBitOpAnd() { - super.testBitOpAnd(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testBitOpOr() { - super.testBitOpOr(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testBitOpXOr() { - super.testBitOpXOr(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testBitOpNot() { - super.testBitOpNot(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testBitOpNotMultipleSources() { - super.testBitOpNotMultipleSources(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testRandomKey() { - super.testRandomKey(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testGetRangeSetRange() { - super.testGetRangeSetRange(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testPingPong() throws Exception { - super.testPingPong(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testInfo() throws Exception { - super.testInfo(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testZRevRangeByScore() { - super.testZRevRangeByScore(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testZRevRangeByScoreOffsetCount() { - super.testZRevRangeByScoreOffsetCount(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testZRevRangeByScoreWithScores() { - super.testZRevRangeByScoreWithScores(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testZRevRangeByScoreWithScoresOffsetCount() { - super.testZRevRangeByScoreWithScoresOffsetCount(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testSelect() { - super.testSelect(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testHIncrByDouble() { - super.testHIncrByDouble(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testIncrByDouble() { - super.testIncrByDouble(); - } - @Test(expected=UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6") public void testScriptLoadEvalSha() { @@ -415,62 +239,14 @@ public class JedisConnectionPipelineIntegrationTests extends connection.scriptFlush(); } - @Test(expected=UnsupportedOperationException.class) - @IfProfileValue(name = "redisVersion", value = "2.6") - public void testSRandMemberCount() { - super.testSRandMemberCount(); - } - - @Test(expected=UnsupportedOperationException.class) - @IfProfileValue(name = "redisVersion", value = "2.6") - public void testSRandMemberCountKeyNotExists() { - super.testSRandMemberCountKeyNotExists(); - } - - @Test(expected=UnsupportedOperationException.class) - @IfProfileValue(name = "redisVersion", value = "2.6") - public void testSRandMemberCountNegative() { - super.testSRandMemberCountNegative(); - } - @Test(expected=UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6") public void testInfoBySection() throws Exception { super.testInfoBySection(); } - @Test(expected=UnsupportedOperationException.class) - public void testHDelMultiple() { - super.testHDelMultiple(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testLPushMultiple() { - super.testLPushMultiple(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testRPushMultiple() { - super.testRPushMultiple(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testSAddMultiple() { - super.testSAddMultiple(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testSRemMultiple() { - super.testSRemMultiple(); - } - @Test(expected=UnsupportedOperationException.class) public void testZAddMultiple() { super.testZAddMultiple(); } - - @Test(expected=UnsupportedOperationException.class) - public void testZRemMultiple() { - super.testZRemMultiple(); - } } diff --git a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionPipelineTxIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionPipelineTxIntegrationTests.java index 4cbef626c..55f9316e3 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionPipelineTxIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionPipelineTxIntegrationTests.java @@ -1,15 +1,14 @@ package org.springframework.data.redis.connection.jedis; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; -import java.util.Arrays; import java.util.List; import org.junit.Ignore; import org.junit.Test; import org.springframework.data.redis.connection.RedisPipelineException; +import org.springframework.test.annotation.IfProfileValue; public class JedisConnectionPipelineTxIntegrationTests extends JedisConnectionTransactionIntegrationTests { @@ -18,24 +17,6 @@ public class JedisConnectionPipelineTxIntegrationTests extends JedisConnectionTr public void testGetConfig() { } - @Ignore("https://github.com/xetorthio/jedis/pull/389 Pipeline tries to return List instead of Long on sort") - public void testSortStore() { - } - - @Ignore("Jedis issue: Pipeline tries to return Long instead of List on sort with no params") - public void testSortNullParams() { - } - - @Ignore("https://github.com/xetorthio/jedis/pull/389 Pipeline tries to return Long instead of List on sort with no params") - public void testSortStoreNullParams() { - } - - @Test - public void testEcho() { - actual.add(connection.echo("Hello World")); - verifyResults(Arrays.asList(new Object[] { "Hello World" })); - } - @Test(expected=RedisPipelineException.class) public void exceptionExecuteNative() throws Exception { connection.execute("set", "foo"); @@ -43,11 +24,16 @@ public class JedisConnectionPipelineTxIntegrationTests extends JedisConnectionTr getResults(); } - @Test - public void testLastSave() { - connection.lastSave(); - List results = getResults(); - assertNotNull(results.get(0)); + @Test(expected=RedisPipelineException.class) + @IfProfileValue(name = "redisVersion", value = "2.6") + public void testRestoreBadData() { + super.testRestoreBadData(); + } + + @Test(expected=RedisPipelineException.class) + @IfProfileValue(name = "redisVersion", value = "2.6") + public void testRestoreExistingKey() { + super.testRestoreExistingKey(); } protected void initConnection() { diff --git a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionTransactionIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionTransactionIntegrationTests.java index 387951e5f..ce5affc7e 100644 --- a/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionTransactionIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jedis/JedisConnectionTransactionIntegrationTests.java @@ -19,6 +19,7 @@ import org.junit.After; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; +import org.springframework.dao.InvalidDataAccessApiUsageException; import org.springframework.data.redis.connection.AbstractConnectionTransactionIntegrationTests; import org.springframework.test.annotation.IfProfileValue; import org.springframework.test.context.ContextConfiguration; @@ -53,170 +54,11 @@ public class JedisConnectionTransactionIntegrationTests extends connection = null; } - @Ignore("DATAREDIS-143 transaction tries to return List instead of Long on sort") - public void testSortStore() { - } - - @Ignore("DATAREDIS-143 transaction tries to return Long instead of List on sort with no params") - public void testSortStoreNullParams() { + @Ignore("Jedis issue: Transaction tries to return String instead of List") + public void testGetConfig() { } // Unsupported Ops - @Test(expected = UnsupportedOperationException.class) - public void testPExpire() { - super.testPExpire(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testPExpireKeyNotExists() { - super.testPExpireKeyNotExists(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testPExpireAt() { - super.testPExpireAt(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testPExpireAtKeyNotExists() { - super.testPExpireAtKeyNotExists(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testPTtl() { - super.testPTtl(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testPTtlNoExpire() { - super.testPTtlNoExpire(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testDumpAndRestore() { - super.testDumpAndRestore(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testDumpNonExistentKey() { - super.testDumpNonExistentKey(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testRestoreBadData() { - super.testRestoreBadData(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testRestoreExistingKey() { - super.testRestoreExistingKey(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testRestoreTtl() { - super.testRestoreTtl(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testBitSet() throws Exception { - super.testBitSet(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testBitGet() { - connection.getBit("bitly", 1l); - } - - @Test(expected = UnsupportedOperationException.class) - public void testBitCount() { - connection.bitCount("foo"); - } - - @Test(expected = UnsupportedOperationException.class) - public void testBitCountInterval() { - super.testBitCountInterval(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testBitCountNonExistentKey() { - super.testBitCountNonExistentKey(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testBitOpAnd() { - super.testBitOpAnd(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testBitOpOr() { - super.testBitOpOr(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testBitOpXOr() { - super.testBitOpXOr(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testBitOpNot() { - super.testBitOpNot(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testBitOpNotMultipleSources() { - super.testBitOpNotMultipleSources(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testRandomKey() { - super.testRandomKey(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testGetRangeSetRange() { - super.testGetRangeSetRange(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testPingPong() throws Exception { - super.testPingPong(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testInfo() throws Exception { - super.testInfo(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testZRevRangeByScore() { - super.testZRevRangeByScore(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testZRevRangeByScoreOffsetCount() { - super.testZRevRangeByScoreOffsetCount(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testZRevRangeByScoreWithScores() { - super.testZRevRangeByScoreWithScores(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testZRevRangeByScoreWithScoresOffsetCount() { - byteConnection.zRevRangeByScoreWithScores("myset".getBytes(), 0d, 3d, 0, 1); - } - - @Test(expected = UnsupportedOperationException.class) - public void testHIncrByDouble() { - super.testHIncrByDouble(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testIncrByDouble() { - super.testIncrByDouble(); - } - @Test(expected = UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6") public void testScriptLoadEvalSha() { @@ -331,82 +173,26 @@ public class JedisConnectionTransactionIntegrationTests extends connection.scriptFlush(); } - @Test(expected = UnsupportedOperationException.class) - @IfProfileValue(name = "redisVersion", value = "2.6") - public void testSRandMemberCount() { - super.testSRandMemberCount(); - } - - @Test(expected = UnsupportedOperationException.class) - @IfProfileValue(name = "redisVersion", value = "2.6") - public void testSRandMemberCountKeyNotExists() { - super.testSRandMemberCountKeyNotExists(); - } - - @Test(expected = UnsupportedOperationException.class) - @IfProfileValue(name = "redisVersion", value = "2.6") - public void testSRandMemberCountNegative() { - super.testSRandMemberCountNegative(); - } - @Test(expected = UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6") public void testInfoBySection() throws Exception { super.testInfoBySection(); } - @Test(expected = UnsupportedOperationException.class) - public void testGetConfig() { - connection.getConfig("*"); - } - - @Test(expected = UnsupportedOperationException.class) - public void testEcho() { - super.testEcho(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testSelect() { - super.testSelect(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testLastSave() { - super.testLastSave(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testHDelMultiple() { - super.testHDelMultiple(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testLPushMultiple() { - super.testLPushMultiple(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testRPushMultiple() { - super.testRPushMultiple(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testSAddMultiple() { - super.testSAddMultiple(); - } - - @Test(expected=UnsupportedOperationException.class) - public void testSRemMultiple() { - super.testSRemMultiple(); - } - @Test(expected=UnsupportedOperationException.class) public void testZAddMultiple() { super.testZAddMultiple(); } - @Test(expected=UnsupportedOperationException.class) - public void testZRemMultiple() { - super.testZRemMultiple(); + @Test(expected=InvalidDataAccessApiUsageException.class) + @IfProfileValue(name = "redisVersion", value = "2.6") + public void testRestoreBadData() { + super.testRestoreBadData(); + } + + @Test(expected=InvalidDataAccessApiUsageException.class) + @IfProfileValue(name = "redisVersion", value = "2.6") + public void testRestoreExistingKey() { + super.testRestoreExistingKey(); } } diff --git a/src/test/java/org/springframework/data/redis/connection/jredis/JRedisConnectionIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/jredis/JRedisConnectionIntegrationTests.java index 8fe1bb03c..5fa38011d 100644 --- a/src/test/java/org/springframework/data/redis/connection/jredis/JRedisConnectionIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/jredis/JRedisConnectionIntegrationTests.java @@ -415,11 +415,6 @@ public class JRedisConnectionIntegrationTests extends AbstractConnectionIntegrat super.testBitOpNot(); } - @Test(expected=UnsupportedOperationException.class) - public void testBitOpNotMultipleSources() { - super.testBitOpNotMultipleSources(); - } - @Test(expected=UnsupportedOperationException.class) public void testHIncrByDouble() { super.testHIncrByDouble(); diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionIntegrationTests.java index af95a1869..7730e1e1c 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionIntegrationTests.java @@ -27,7 +27,6 @@ import org.springframework.data.redis.TestCondition; import org.springframework.data.redis.connection.AbstractConnectionIntegrationTests; import org.springframework.data.redis.connection.DefaultStringRedisConnection; import org.springframework.data.redis.connection.RedisConnection; -import org.springframework.data.redis.connection.RedisStringCommands.BitOperation; import org.springframework.data.redis.connection.ReturnType; import org.springframework.data.redis.connection.StringRedisConnection; import org.springframework.test.annotation.IfProfileValue; @@ -227,14 +226,6 @@ public class LettuceConnectionIntegrationTests extends AbstractConnectionIntegra super.testSelect(); } - @Test(expected=UnsupportedOperationException.class) - @IfProfileValue(name = "redisVersion", value = "2.6") - public void testBitOpNotMultipleSources() { - connection.set("key1", "abcd"); - connection.set("key2", "efgh"); - actual.add(connection.bitOp(BitOperation.NOT, "key3", "key1", "key2")); - } - @Test(expected=UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6") public void testSRandMemberCountNegative() { diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionPipelineIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionPipelineIntegrationTests.java index c9568fd58..106f99cf4 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionPipelineIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionPipelineIntegrationTests.java @@ -23,7 +23,6 @@ import org.springframework.data.redis.SettingsUtils; import org.springframework.data.redis.TestCondition; import org.springframework.data.redis.connection.AbstractConnectionPipelineIntegrationTests; import org.springframework.data.redis.connection.DefaultStringRedisConnection; -import org.springframework.data.redis.connection.RedisStringCommands.BitOperation; import org.springframework.data.redis.connection.ReturnType; import org.springframework.data.redis.connection.StringRedisConnection; import org.springframework.test.annotation.IfProfileValue; @@ -55,19 +54,6 @@ public class LettuceConnectionPipelineIntegrationTests extends super.testSelect(); } - // LettuceConnection throws an UnsupportedOpException before we close the pipeline - @Test(expected=UnsupportedOperationException.class) - @IfProfileValue(name = "redisVersion", value = "2.6") - public void testBitOpNotMultipleSources() { - connection.set("key1", "abcd"); - connection.set("key2", "efgh"); - try { - actual.add(connection.bitOp(BitOperation.NOT, "key3", "key1", "key2")); - }finally { - getResults(); - } - } - @Test(expected=UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6") public void testSRandMemberCountNegative() { diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionTransactionIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionTransactionIntegrationTests.java index f4ea294d0..18695ca43 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionTransactionIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionTransactionIntegrationTests.java @@ -47,11 +47,6 @@ public class LettuceConnectionTransactionIntegrationTests extends public void exceptionExecuteNative() throws Exception { } - @Test(expected = UnsupportedOperationException.class) - public void testBitOpNotMultipleSources() { - super.testBitOpNotMultipleSources(); - } - @Test(expected = UnsupportedOperationException.class) @IfProfileValue(name = "redisVersion", value = "2.6") public void testSRandMemberCountNegative() { diff --git a/src/test/java/org/springframework/data/redis/connection/srp/SrpConnectionPipelineTxIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/srp/SrpConnectionPipelineTxIntegrationTests.java index 8e7eb32e7..02d30c801 100644 --- a/src/test/java/org/springframework/data/redis/connection/srp/SrpConnectionPipelineTxIntegrationTests.java +++ b/src/test/java/org/springframework/data/redis/connection/srp/SrpConnectionPipelineTxIntegrationTests.java @@ -77,12 +77,6 @@ public class SrpConnectionPipelineTxIntegrationTests extends SrpConnectionTransa super.testRestoreExistingKey(); } - @Test(expected = RedisPipelineException.class) - @IfProfileValue(name = "redisVersion", value = "2.6") - public void testBitOpNotMultipleSources() { - super.testBitOpNotMultipleSources(); - } - @Test(expected = RedisPipelineException.class) @IfProfileValue(name = "redisVersion", value = "2.6") public void testRestoreBadData() { diff --git a/src/test/java/org/springframework/data/redis/core/RedisTemplateTests.java b/src/test/java/org/springframework/data/redis/core/RedisTemplateTests.java index 3cb28c386..59460670e 100644 --- a/src/test/java/org/springframework/data/redis/core/RedisTemplateTests.java +++ b/src/test/java/org/springframework/data/redis/core/RedisTemplateTests.java @@ -54,6 +54,7 @@ import org.springframework.data.redis.connection.DataType; import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.StringRedisConnection; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; +import org.springframework.data.redis.connection.jredis.JredisConnectionFactory; import org.springframework.data.redis.connection.srp.SrpConnectionFactory; import org.springframework.data.redis.core.ZSetOperations.TypedTuple; import org.springframework.data.redis.core.query.SortQueryBuilder; @@ -451,8 +452,8 @@ public class RedisTemplateTests { final K key1 = keyFactory.instance(); V value1 = valueFactory.instance(); assumeTrue(key1 instanceof String && value1 instanceof String); - // Jedis does not support pExpire - JedisConnectionFactory factory = new JedisConnectionFactory(); + // JRedis does not support pExpire + JredisConnectionFactory factory = new JredisConnectionFactory(); factory.setHostName(SettingsUtils.getHost()); factory.setPort(SettingsUtils.getPort()); factory.afterPropertiesSet(); diff --git a/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicDoubleTests.java b/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicDoubleTests.java index 2fb2d51b8..1b3448bfa 100644 --- a/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicDoubleTests.java +++ b/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicDoubleTests.java @@ -153,7 +153,7 @@ public class RedisAtomicDoubleTests { // JRedis converts Unix time to millis before sending command, so it expires right away assumeTrue(!ConnectionUtils.isJredis(factory)); doubleCounter.set(7.8); - assertTrue(doubleCounter.expireAt(new Date(System.currentTimeMillis() + 2000))); + assertTrue(doubleCounter.expireAt(new Date(System.currentTimeMillis() + 10000))); assertTrue(doubleCounter.getExpire() > 0); }