From d18cc4bd131aa5f146364c28b7efefaec7f66f05 Mon Sep 17 00:00:00 2001 From: Neil Gentleman Date: Tue, 23 Nov 2010 16:52:18 -0800 Subject: [PATCH] incr/decr operate on 64-bit numbers. Switching from Integer to Long --- .../java/redis/clients/jedis/BinaryJedis.java | 108 ++++++------- .../clients/jedis/BinaryJedisCommands.java | 66 ++++---- .../clients/jedis/BinaryShardedJedis.java | 66 ++++---- .../java/redis/clients/jedis/Connection.java | 4 +- src/main/java/redis/clients/jedis/Jedis.java | 147 ++++++++++-------- .../redis/clients/jedis/JedisCommands.java | 66 ++++---- .../java/redis/clients/jedis/JedisPubSub.java | 8 +- .../java/redis/clients/jedis/Protocol.java | 4 +- .../redis/clients/jedis/ShardedJedis.java | 69 ++++---- .../clients/jedis/tests/ProtocolTest.java | 2 +- .../commands/AllKindOfValuesCommandsTest.java | 30 ++-- .../commands/BinaryValuesCommandsTest.java | 16 +- .../tests/commands/ControlCommandsTest.java | 7 +- .../tests/commands/HashesCommandsTest.java | 12 +- .../tests/commands/ListCommandsTest.java | 24 +-- .../jedis/tests/commands/SetCommandsTest.java | 32 ++-- .../tests/commands/SortedSetCommandsTest.java | 62 ++++---- .../tests/commands/SortingCommandsTest.java | 4 +- .../commands/StringValuesCommandsTest.java | 16 +- .../commands/TransactionCommandsTest.java | 33 ++-- 20 files changed, 397 insertions(+), 379 deletions(-) diff --git a/src/main/java/redis/clients/jedis/BinaryJedis.java b/src/main/java/redis/clients/jedis/BinaryJedis.java index d4a1120..78021e9 100644 --- a/src/main/java/redis/clients/jedis/BinaryJedis.java +++ b/src/main/java/redis/clients/jedis/BinaryJedis.java @@ -93,7 +93,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @param key * @return Integer reply, "0" if the key exists, otherwise "1" */ - public Integer exists(final byte[] key) { + public Long exists(final byte[] key) { checkIsInMulti(); client.exists(key); return client.getIntegerReply(); @@ -109,7 +109,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @return Integer reply, specifically: an integer greater than 0 if one or * more keys were removed 0 if none of the specified key existed */ - public Integer del(final byte[]... keys) { + public Long del(final byte[]... keys) { checkIsInMulti(); client.del(keys); return client.getIntegerReply(); @@ -228,7 +228,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @return Integer reply, specifically: 1 if the key was renamed 0 if the * target key already exist */ - public Integer renamenx(final byte[] oldkey, final byte[] newkey) { + public Long renamenx(final byte[] oldkey, final byte[] newkey) { checkIsInMulti(); client.renamenx(oldkey, newkey); return client.getIntegerReply(); @@ -239,7 +239,7 @@ public class BinaryJedis implements BinaryJedisCommands { * * @return Integer reply */ - public Integer dbSize() { + public Long dbSize() { checkIsInMulti(); client.dbSize(); return client.getIntegerReply(); @@ -273,7 +273,7 @@ public class BinaryJedis implements BinaryJedisCommands { * 2.1.3 will happily update the timeout), or the key does not * exist. */ - public Integer expire(final byte[] key, final int seconds) { + public Long expire(final byte[] key, final int seconds) { checkIsInMulti(); client.expire(key, seconds); return client.getIntegerReply(); @@ -309,7 +309,7 @@ public class BinaryJedis implements BinaryJedisCommands { * 2.1.3 will happily update the timeout), or the key does not * exist. */ - public Integer expireAt(final byte[] key, final long unixTime) { + public Long expireAt(final byte[] key, final long unixTime) { checkIsInMulti(); client.expireAt(key, unixTime); return client.getIntegerReply(); @@ -326,7 +326,7 @@ public class BinaryJedis implements BinaryJedisCommands { * key that has an EXPIRE. If the Key does not exists or does not * have an associated expire, -1 is returned. */ - public Integer ttl(final byte[] key) { + public Long ttl(final byte[] key) { checkIsInMulti(); client.ttl(key); return client.getIntegerReply(); @@ -358,7 +358,7 @@ public class BinaryJedis implements BinaryJedisCommands { * was not moved because already present on the target DB or was not * found in the current DB. */ - public Integer move(final byte[] key, final int dbIndex) { + public Long move(final byte[] key, final int dbIndex) { checkIsInMulti(); client.move(key, dbIndex); return client.getIntegerReply(); @@ -421,7 +421,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @return Integer reply, specifically: 1 if the key was set 0 if the key * was not set */ - public Integer setnx(final byte[] key, final byte[] value) { + public Long setnx(final byte[] key, final byte[] value) { checkIsInMulti(); client.setnx(key, value); return client.getIntegerReply(); @@ -492,7 +492,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @return Integer reply, specifically: 1 if the all the keys were set 0 if * no key was set (at least one key already existed) */ - public Integer msetnx(final byte[]... keysvalues) { + public Long msetnx(final byte[]... keysvalues) { checkIsInMulti(); client.msetnx(keysvalues); return client.getIntegerReply(); @@ -520,7 +520,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @return Integer reply, this commands will reply with the new value of key * after the increment. */ - public Integer decrBy(final byte[] key, final int integer) { + public Long decrBy(final byte[] key, final int integer) { checkIsInMulti(); client.decrBy(key, integer); return client.getIntegerReply(); @@ -548,7 +548,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @return Integer reply, this commands will reply with the new value of key * after the increment. */ - public Integer decr(final byte[] key) { + public Long decr(final byte[] key) { checkIsInMulti(); client.decr(key); return client.getIntegerReply(); @@ -576,7 +576,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @return Integer reply, this commands will reply with the new value of key * after the increment. */ - public Integer incrBy(final byte[] key, final int integer) { + public Long incrBy(final byte[] key, final int integer) { checkIsInMulti(); client.incrBy(key, integer); return client.getIntegerReply(); @@ -604,7 +604,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @return Integer reply, this commands will reply with the new value of key * after the increment. */ - public Integer incr(final byte[] key) { + public Long incr(final byte[] key) { checkIsInMulti(); client.incr(key); return client.getIntegerReply(); @@ -626,7 +626,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @return Integer reply, specifically the total length of the string after * the append operation. */ - public Integer append(final byte[] key, final byte[] value) { + public Long append(final byte[] key, final byte[] value) { checkIsInMulti(); client.append(key, value); return client.getIntegerReply(); @@ -671,7 +671,7 @@ public class BinaryJedis implements BinaryJedisCommands { * of the value, 0 is returned, otherwise if a new field is created * 1 is returned. */ - public Integer hset(final byte[] key, final byte[] field, final byte[] value) { + public Long hset(final byte[] key, final byte[] field, final byte[] value) { checkIsInMulti(); client.hset(key, field, value); return client.getIntegerReply(); @@ -707,7 +707,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @return If the field already exists, 0 is returned, otherwise if a new * field is created 1 is returned. */ - public Integer hsetnx(final byte[] key, final byte[] field, + public Long hsetnx(final byte[] key, final byte[] field, final byte[] value) { checkIsInMulti(); client.hsetnx(key, field, value); @@ -769,7 +769,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @return Integer reply The new value at field after the increment * operation. */ - public Integer hincrBy(final byte[] key, final byte[] field, final int value) { + public Long hincrBy(final byte[] key, final byte[] field, final int value) { checkIsInMulti(); client.hincrBy(key, field, value); return client.getIntegerReply(); @@ -785,7 +785,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @return Return 1 if the hash stored at key contains the specified field. * Return 0 if the key is not found or the field is not present. */ - public Integer hexists(final byte[] key, final byte[] field) { + public Long hexists(final byte[] key, final byte[] field) { checkIsInMulti(); client.hexists(key, field); return client.getIntegerReply(); @@ -801,7 +801,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @return If the field was present in the hash it is deleted and 1 is * returned, otherwise 0 is returned and no operation is performed. */ - public Integer hdel(final byte[] key, final byte[] field) { + public Long hdel(final byte[] key, final byte[] field) { checkIsInMulti(); client.hdel(key, field); return client.getIntegerReply(); @@ -817,7 +817,7 @@ public class BinaryJedis implements BinaryJedisCommands { * key. If the specified key does not exist, 0 is returned assuming * an empty hash. */ - public Integer hlen(final byte[] key) { + public Long hlen(final byte[] key) { checkIsInMulti(); client.hlen(key); return client.getIntegerReply(); @@ -889,7 +889,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @return Integer reply, specifically, the number of elements inside the * list after the push operation. */ - public Integer rpush(final byte[] key, final byte[] string) { + public Long rpush(final byte[] key, final byte[] string) { checkIsInMulti(); client.rpush(key, string); return client.getIntegerReply(); @@ -910,7 +910,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @return Integer reply, specifically, the number of elements inside the * list after the push operation. */ - public Integer lpush(final byte[] key, final byte[] string) { + public Long lpush(final byte[] key, final byte[] string) { checkIsInMulti(); client.lpush(key, string); return client.getIntegerReply(); @@ -926,7 +926,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @param key * @return The length of the list. */ - public Integer llen(final byte[] key) { + public Long llen(final byte[] key) { checkIsInMulti(); client.llen(key); return client.getIntegerReply(); @@ -1086,7 +1086,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @return Integer Reply, specifically: The number of removed elements if * the operation succeeded */ - public Integer lrem(final byte[] key, final int count, final byte[] value) { + public Long lrem(final byte[] key, final int count, final byte[] value) { checkIsInMulti(); client.lrem(key, count, value); return client.getIntegerReply(); @@ -1167,7 +1167,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @return Integer reply, specifically: 1 if the new element was added 0 if * the element was already a member of the set */ - public Integer sadd(final byte[] key, final byte[] member) { + public Long sadd(final byte[] key, final byte[] member) { checkIsInMulti(); client.sadd(key, member); return client.getIntegerReply(); @@ -1201,7 +1201,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @return Integer reply, specifically: 1 if the new element was removed 0 * if the new element was not a member of the set */ - public Integer srem(final byte[] key, final byte[] member) { + public Long srem(final byte[] key, final byte[] member) { checkIsInMulti(); client.srem(key, member); return client.getIntegerReply(); @@ -1248,7 +1248,7 @@ public class BinaryJedis implements BinaryJedisCommands { * element was not found on the first set and no operation was * performed */ - public Integer smove(final byte[] srckey, final byte[] dstkey, + public Long smove(final byte[] srckey, final byte[] dstkey, final byte[] member) { checkIsInMulti(); client.smove(srckey, dstkey, member); @@ -1263,7 +1263,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @return Integer reply, specifically: the cardinality (number of elements) * of the set as an integer. */ - public Integer scard(final byte[] key) { + public Long scard(final byte[] key) { checkIsInMulti(); client.scard(key); return client.getIntegerReply(); @@ -1281,7 +1281,7 @@ public class BinaryJedis implements BinaryJedisCommands { * set 0 if the element is not a member of the set OR if the key * does not exist */ - public Integer sismember(final byte[] key, final byte[] member) { + public Long sismember(final byte[] key, final byte[] member) { checkIsInMulti(); client.sismember(key, member); return client.getIntegerReply(); @@ -1324,7 +1324,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @param keys * @return Status code reply */ - public Integer sinterstore(final byte[] dstkey, final byte[]... keys) { + public Long sinterstore(final byte[] dstkey, final byte[]... keys) { checkIsInMulti(); client.sinterstore(dstkey, keys); return client.getIntegerReply(); @@ -1365,7 +1365,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @param keys * @return Status code reply */ - public Integer sunionstore(final byte[] dstkey, final byte[]... keys) { + public Long sunionstore(final byte[] dstkey, final byte[]... keys) { checkIsInMulti(); client.sunionstore(dstkey, keys); return client.getIntegerReply(); @@ -1409,7 +1409,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @param keys * @return Status code reply */ - public Integer sdiffstore(final byte[] dstkey, final byte[]... keys) { + public Long sdiffstore(final byte[] dstkey, final byte[]... keys) { checkIsInMulti(); client.sdiffstore(dstkey, keys); return client.getIntegerReply(); @@ -1454,7 +1454,7 @@ public class BinaryJedis implements BinaryJedisCommands { * the element was already a member of the sorted set and the score * was updated */ - public Integer zadd(final byte[] key, final double score, + public Long zadd(final byte[] key, final double score, final byte[] member) { checkIsInMulti(); client.zadd(key, score, member); @@ -1483,7 +1483,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @return Integer reply, specifically: 1 if the new element was removed 0 * if the new element was not a member of the set */ - public Integer zrem(final byte[] key, final byte[] member) { + public Long zrem(final byte[] key, final byte[] member) { checkIsInMulti(); client.zrem(key, member); return client.getIntegerReply(); @@ -1541,7 +1541,7 @@ public class BinaryJedis implements BinaryJedisCommands { * element as an integer reply if the element exists. A nil bulk * reply if there is no such element. */ - public Integer zrank(final byte[] key, final byte[] member) { + public Long zrank(final byte[] key, final byte[] member) { checkIsInMulti(); client.zrank(key, member); return client.getIntegerReply(); @@ -1567,7 +1567,7 @@ public class BinaryJedis implements BinaryJedisCommands { * element as an integer reply if the element exists. A nil bulk * reply if there is no such element. */ - public Integer zrevrank(final byte[] key, final byte[] member) { + public Long zrevrank(final byte[] key, final byte[] member) { checkIsInMulti(); client.zrevrank(key, member); return client.getIntegerReply(); @@ -1606,7 +1606,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @param key * @return the cardinality (number of elements) of the set as an integer. */ - public Integer zcard(final byte[] key) { + public Long zcard(final byte[] key) { checkIsInMulti(); client.zcard(key); return client.getIntegerReply(); @@ -1880,7 +1880,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @param dstkey * @return The number of elements of the list at dstkey. */ - public Integer sort(final byte[] key, + public Long sort(final byte[] key, final SortingParams sortingParameters, final byte[] dstkey) { checkIsInMulti(); client.sort(key, sortingParameters, dstkey); @@ -1903,7 +1903,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @param dstkey * @return The number of elements of the list at dstkey. */ - public Integer sort(final byte[] key, final byte[] dstkey) { + public Long sort(final byte[] key, final byte[] dstkey) { checkIsInMulti(); client.sort(key, dstkey); return client.getIntegerReply(); @@ -2031,7 +2031,7 @@ public class BinaryJedis implements BinaryJedisCommands { client.rollbackTimeout(); } - public Integer publish(final String channel, final String message) { + public Long publish(final String channel, final String message) { client.publish(channel, message); return client.getIntegerReply(); } @@ -2043,7 +2043,7 @@ public class BinaryJedis implements BinaryJedisCommands { client.rollbackTimeout(); } - public Integer zcount(final byte[] key, final double min, final double max) { + public Long zcount(final byte[] key, final double min, final double max) { checkIsInMulti(); client.zcount(key, min, max); return client.getIntegerReply(); @@ -2337,7 +2337,7 @@ public class BinaryJedis implements BinaryJedisCommands { * operation * */ - public Integer zremrangeByRank(final byte[] key, final int start, + public Long zremrangeByRank(final byte[] key, final int start, final int end) { checkIsInMulti(); client.zremrangeByRank(key, start, end); @@ -2358,7 +2358,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @param end * @return Integer reply, specifically the number of elements removed. */ - public Integer zremrangeByScore(final byte[] key, final double start, + public Long zremrangeByScore(final byte[] key, final double start, final double end) { checkIsInMulti(); client.zremrangeByScore(key, start, end); @@ -2403,7 +2403,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @return Integer reply, specifically the number of elements in the sorted * set at dstkey */ - public Integer zunionstore(final byte[] dstkey, final byte[]... sets) { + public Long zunionstore(final byte[] dstkey, final byte[]... sets) { checkIsInMulti(); client.zunionstore(dstkey, sets); return client.getIntegerReply(); @@ -2448,7 +2448,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @return Integer reply, specifically the number of elements in the sorted * set at dstkey */ - public Integer zunionstore(final byte[] dstkey, final ZParams params, + public Long zunionstore(final byte[] dstkey, final ZParams params, final byte[]... sets) { checkIsInMulti(); client.zunionstore(dstkey, params, sets); @@ -2493,7 +2493,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @return Integer reply, specifically the number of elements in the sorted * set at dstkey */ - public Integer zinterstore(final byte[] dstkey, final byte[]... sets) { + public Long zinterstore(final byte[] dstkey, final byte[]... sets) { checkIsInMulti(); client.zinterstore(dstkey, sets); return client.getIntegerReply(); @@ -2538,7 +2538,7 @@ public class BinaryJedis implements BinaryJedisCommands { * @return Integer reply, specifically the number of elements in the sorted * set at dstkey */ - public Integer zinterstore(final byte[] dstkey, final ZParams params, + public Long zinterstore(final byte[] dstkey, final ZParams params, final byte[]... sets) { checkIsInMulti(); client.zinterstore(dstkey, params, sets); @@ -2615,7 +2615,7 @@ public class BinaryJedis implements BinaryJedisCommands { * * @return Integer reply, specifically an UNIX time stamp. */ - public Integer lastsave() { + public Long lastsave() { client.lastsave(); return client.getIntegerReply(); } @@ -2822,7 +2822,7 @@ public class BinaryJedis implements BinaryJedisCommands { return client.isConnected(); } - public Integer strlen(final byte[] key) { + public Long strlen(final byte[] key) { client.strlen(key); return client.getIntegerReply(); } @@ -2831,7 +2831,7 @@ public class BinaryJedis implements BinaryJedisCommands { client.sync(); } - public Integer lpushx(final byte[] key, final byte[] string) { + public Long lpushx(final byte[] key, final byte[] string) { client.lpushx(key, string); return client.getIntegerReply(); } @@ -2846,12 +2846,12 @@ public class BinaryJedis implements BinaryJedisCommands { * @return Integer reply, specifically: 1: the key is now persist. 0: the * key is not persist (only happens when key not set). */ - public Integer persist(final byte[] key) { + public Long persist(final byte[] key) { client.persist(key); return client.getIntegerReply(); } - public Integer rpushx(final byte[] key, final byte[] string) { + public Long rpushx(final byte[] key, final byte[] string) { client.rpushx(key, string); return client.getIntegerReply(); } @@ -2861,7 +2861,7 @@ public class BinaryJedis implements BinaryJedisCommands { return client.getBinaryBulkReply(); } - public Integer linsert(final byte[] key, final LIST_POSITION where, + public Long linsert(final byte[] key, final LIST_POSITION where, final byte[] pivot, final byte[] value) { client.linsert(key, where, pivot, value); return client.getIntegerReply(); diff --git a/src/main/java/redis/clients/jedis/BinaryJedisCommands.java b/src/main/java/redis/clients/jedis/BinaryJedisCommands.java index 052c686..c8bc30b 100644 --- a/src/main/java/redis/clients/jedis/BinaryJedisCommands.java +++ b/src/main/java/redis/clients/jedis/BinaryJedisCommands.java @@ -15,51 +15,51 @@ public interface BinaryJedisCommands { byte[] get(byte[] key); - Integer exists(byte[] key); + Long exists(byte[] key); String type(byte[] key); - Integer expire(byte[] key, int seconds); + Long expire(byte[] key, int seconds); - Integer expireAt(byte[] key, long unixTime); + Long expireAt(byte[] key, long unixTime); - Integer ttl(byte[] key); + Long ttl(byte[] key); byte[] getSet(byte[] key, byte[] value); - Integer setnx(byte[] key, byte[] value); + Long setnx(byte[] key, byte[] value); String setex(byte[] key, int seconds, byte[] value); - Integer decrBy(byte[] key, int integer); + Long decrBy(byte[] key, int integer); - Integer decr(byte[] key); + Long decr(byte[] key); - Integer incrBy(byte[] key, int integer); + Long incrBy(byte[] key, int integer); - Integer incr(byte[] key); + Long incr(byte[] key); - Integer append(byte[] key, byte[] value); + Long append(byte[] key, byte[] value); byte[] substr(byte[] key, int start, int end); - Integer hset(byte[] key, byte[] field, byte[] value); + Long hset(byte[] key, byte[] field, byte[] value); byte[] hget(byte[] key, byte[] field); - Integer hsetnx(byte[] key, byte[] field, byte[] value); + Long hsetnx(byte[] key, byte[] field, byte[] value); String hmset(byte[] key, Map hash); List hmget(byte[] key, byte[]... fields); - Integer hincrBy(byte[] key, byte[] field, int value); + Long hincrBy(byte[] key, byte[] field, int value); - Integer hexists(byte[] key, byte[] field); + Long hexists(byte[] key, byte[] field); - Integer hdel(byte[] key, byte[] field); + Long hdel(byte[] key, byte[] field); - Integer hlen(byte[] key); + Long hlen(byte[] key); Set hkeys(byte[] key); @@ -67,11 +67,11 @@ public interface BinaryJedisCommands { Map hgetAll(byte[] key); - Integer rpush(byte[] key, byte[] string); + Long rpush(byte[] key, byte[] string); - Integer lpush(byte[] key, byte[] string); + Long lpush(byte[] key, byte[] string); - Integer llen(byte[] key); + Long llen(byte[] key); List lrange(byte[] key, int start, int end); @@ -81,37 +81,37 @@ public interface BinaryJedisCommands { String lset(byte[] key, int index, byte[] value); - Integer lrem(byte[] key, int count, byte[] value); + Long lrem(byte[] key, int count, byte[] value); byte[] lpop(byte[] key); byte[] rpop(byte[] key); - Integer sadd(byte[] key, byte[] member); + Long sadd(byte[] key, byte[] member); Set smembers(byte[] key); - Integer srem(byte[] key, byte[] member); + Long srem(byte[] key, byte[] member); byte[] spop(byte[] key); - Integer scard(byte[] key); + Long scard(byte[] key); - Integer sismember(byte[] key, byte[] member); + Long sismember(byte[] key, byte[] member); byte[] srandmember(byte[] key); - Integer zadd(byte[] key, double score, byte[] member); + Long zadd(byte[] key, double score, byte[] member); Set zrange(byte[] key, int start, int end); - Integer zrem(byte[] key, byte[] member); + Long zrem(byte[] key, byte[] member); Double zincrby(byte[] key, double score, byte[] member); - Integer zrank(byte[] key, byte[] member); + Long zrank(byte[] key, byte[] member); - Integer zrevrank(byte[] key, byte[] member); + Long zrevrank(byte[] key, byte[] member); Set zrevrange(byte[] key, int start, int end); @@ -119,7 +119,7 @@ public interface BinaryJedisCommands { Set zrevrangeWithScores(byte[] key, int start, int end); - Integer zcard(byte[] key); + Long zcard(byte[] key); Double zscore(byte[] key, byte[] member); @@ -127,7 +127,7 @@ public interface BinaryJedisCommands { List sort(byte[] key, SortingParams sortingParameters); - Integer zcount(byte[] key, double min, double max); + Long zcount(byte[] key, double min, double max); Set zrangeByScore(byte[] key, double min, double max); @@ -147,11 +147,11 @@ public interface BinaryJedisCommands { int offset, int count); - Integer zremrangeByRank(byte[] key, int start, int end); + Long zremrangeByRank(byte[] key, int start, int end); - Integer zremrangeByScore(byte[] key, double start, double end); + Long zremrangeByScore(byte[] key, double start, double end); - Integer linsert( + Long linsert( byte[] key, LIST_POSITION where, byte[] pivot, diff --git a/src/main/java/redis/clients/jedis/BinaryShardedJedis.java b/src/main/java/redis/clients/jedis/BinaryShardedJedis.java index 6ecbe27..899e441 100644 --- a/src/main/java/redis/clients/jedis/BinaryShardedJedis.java +++ b/src/main/java/redis/clients/jedis/BinaryShardedJedis.java @@ -50,7 +50,7 @@ public class BinaryShardedJedis extends Sharded return j.get(key); } - public Integer exists(byte[] key) { + public Long exists(byte[] key) { Jedis j = getShard(key); return j.exists(key); } @@ -60,17 +60,17 @@ public class BinaryShardedJedis extends Sharded return j.type(key); } - public Integer expire(byte[] key, int seconds) { + public Long expire(byte[] key, int seconds) { Jedis j = getShard(key); return j.expire(key, seconds); } - public Integer expireAt(byte[] key, long unixTime) { + public Long expireAt(byte[] key, long unixTime) { Jedis j = getShard(key); return j.expireAt(key, unixTime); } - public Integer ttl(byte[] key) { + public Long ttl(byte[] key) { Jedis j = getShard(key); return j.ttl(key); } @@ -80,7 +80,7 @@ public class BinaryShardedJedis extends Sharded return j.getSet(key, value); } - public Integer setnx(byte[] key, byte[] value) { + public Long setnx(byte[] key, byte[] value) { Jedis j = getShard(key); return j.setnx(key, value); } @@ -90,27 +90,27 @@ public class BinaryShardedJedis extends Sharded return j.setex(key, seconds, value); } - public Integer decrBy(byte[] key, int integer) { + public Long decrBy(byte[] key, int integer) { Jedis j = getShard(key); return j.decrBy(key, integer); } - public Integer decr(byte[] key) { + public Long decr(byte[] key) { Jedis j = getShard(key); return j.decr(key); } - public Integer incrBy(byte[] key, int integer) { + public Long incrBy(byte[] key, int integer) { Jedis j = getShard(key); return j.incrBy(key, integer); } - public Integer incr(byte[] key) { + public Long incr(byte[] key) { Jedis j = getShard(key); return j.incr(key); } - public Integer append(byte[] key, byte[] value) { + public Long append(byte[] key, byte[] value) { Jedis j = getShard(key); return j.append(key, value); } @@ -120,7 +120,7 @@ public class BinaryShardedJedis extends Sharded return j.substr(key, start, end); } - public Integer hset(byte[] key, byte[] field, byte[] value) { + public Long hset(byte[] key, byte[] field, byte[] value) { Jedis j = getShard(key); return j.hset(key, field, value); } @@ -130,7 +130,7 @@ public class BinaryShardedJedis extends Sharded return j.hget(key, field); } - public Integer hsetnx(byte[] key, byte[] field, byte[] value) { + public Long hsetnx(byte[] key, byte[] field, byte[] value) { Jedis j = getShard(key); return j.hsetnx(key, field, value); } @@ -145,22 +145,22 @@ public class BinaryShardedJedis extends Sharded return j.hmget(key, fields); } - public Integer hincrBy(byte[] key, byte[] field, int value) { + public Long hincrBy(byte[] key, byte[] field, int value) { Jedis j = getShard(key); return j.hincrBy(key, field, value); } - public Integer hexists(byte[] key, byte[] field) { + public Long hexists(byte[] key, byte[] field) { Jedis j = getShard(key); return j.hexists(key, field); } - public Integer hdel(byte[] key, byte[] field) { + public Long hdel(byte[] key, byte[] field) { Jedis j = getShard(key); return j.hdel(key, field); } - public Integer hlen(byte[] key) { + public Long hlen(byte[] key) { Jedis j = getShard(key); return j.hlen(key); } @@ -180,17 +180,17 @@ public class BinaryShardedJedis extends Sharded return j.hgetAll(key); } - public Integer rpush(byte[] key, byte[] string) { + public Long rpush(byte[] key, byte[] string) { Jedis j = getShard(key); return j.rpush(key, string); } - public Integer lpush(byte[] key, byte[] string) { + public Long lpush(byte[] key, byte[] string) { Jedis j = getShard(key); return j.lpush(key, string); } - public Integer llen(byte[] key) { + public Long llen(byte[] key) { Jedis j = getShard(key); return j.llen(key); } @@ -215,7 +215,7 @@ public class BinaryShardedJedis extends Sharded return j.lset(key, index, value); } - public Integer lrem(byte[] key, int count, byte[] value) { + public Long lrem(byte[] key, int count, byte[] value) { Jedis j = getShard(key); return j.lrem(key, count, value); } @@ -230,7 +230,7 @@ public class BinaryShardedJedis extends Sharded return j.rpop(key); } - public Integer sadd(byte[] key, byte[] member) { + public Long sadd(byte[] key, byte[] member) { Jedis j = getShard(key); return j.sadd(key, member); } @@ -240,7 +240,7 @@ public class BinaryShardedJedis extends Sharded return j.smembers(key); } - public Integer srem(byte[] key, byte[] member) { + public Long srem(byte[] key, byte[] member) { Jedis j = getShard(key); return j.srem(key, member); } @@ -250,12 +250,12 @@ public class BinaryShardedJedis extends Sharded return j.spop(key); } - public Integer scard(byte[] key) { + public Long scard(byte[] key) { Jedis j = getShard(key); return j.scard(key); } - public Integer sismember(byte[] key, byte[] member) { + public Long sismember(byte[] key, byte[] member) { Jedis j = getShard(key); return j.sismember(key, member); } @@ -265,7 +265,7 @@ public class BinaryShardedJedis extends Sharded return j.srandmember(key); } - public Integer zadd(byte[] key, double score, byte[] member) { + public Long zadd(byte[] key, double score, byte[] member) { Jedis j = getShard(key); return j.zadd(key, score, member); } @@ -275,7 +275,7 @@ public class BinaryShardedJedis extends Sharded return j.zrange(key, start, end); } - public Integer zrem(byte[] key, byte[] member) { + public Long zrem(byte[] key, byte[] member) { Jedis j = getShard(key); return j.zrem(key, member); } @@ -285,12 +285,12 @@ public class BinaryShardedJedis extends Sharded return j.zincrby(key, score, member); } - public Integer zrank(byte[] key, byte[] member) { + public Long zrank(byte[] key, byte[] member) { Jedis j = getShard(key); return j.zrank(key, member); } - public Integer zrevrank(byte[] key, byte[] member) { + public Long zrevrank(byte[] key, byte[] member) { Jedis j = getShard(key); return j.zrevrank(key, member); } @@ -310,7 +310,7 @@ public class BinaryShardedJedis extends Sharded return j.zrevrangeWithScores(key, start, end); } - public Integer zcard(byte[] key) { + public Long zcard(byte[] key) { Jedis j = getShard(key); return j.zcard(key); } @@ -330,7 +330,7 @@ public class BinaryShardedJedis extends Sharded return j.sort(key, sortingParameters); } - public Integer zcount(byte[] key, double min, double max) { + public Long zcount(byte[] key, double min, double max) { Jedis j = getShard(key); return j.zcount(key, min, max); } @@ -357,17 +357,17 @@ public class BinaryShardedJedis extends Sharded return j.zrangeByScoreWithScores(key, min, max, offset, count); } - public Integer zremrangeByRank(byte[] key, int start, int end) { + public Long zremrangeByRank(byte[] key, int start, int end) { Jedis j = getShard(key); return j.zremrangeByRank(key, start, end); } - public Integer zremrangeByScore(byte[] key, double start, double end) { + public Long zremrangeByScore(byte[] key, double start, double end) { Jedis j = getShard(key); return j.zremrangeByScore(key, start, end); } - public Integer linsert(byte[] key, LIST_POSITION where, byte[] pivot, + public Long linsert(byte[] key, LIST_POSITION where, byte[] pivot, byte[] value) { Jedis j = getShard(key); return j.linsert(key, where, pivot, value); diff --git a/src/main/java/redis/clients/jedis/Connection.java b/src/main/java/redis/clients/jedis/Connection.java index f3728af..5277f37 100644 --- a/src/main/java/redis/clients/jedis/Connection.java +++ b/src/main/java/redis/clients/jedis/Connection.java @@ -163,9 +163,9 @@ public class Connection { return (byte[]) protocol.read(inputStream); } - public Integer getIntegerReply() { + public Long getIntegerReply() { pipelinedCommands--; - return (Integer) protocol.read(inputStream); + return (Long) protocol.read(inputStream); } public List getMultiBulkReply() { diff --git a/src/main/java/redis/clients/jedis/Jedis.java b/src/main/java/redis/clients/jedis/Jedis.java index bac1f9a..5a18975 100644 --- a/src/main/java/redis/clients/jedis/Jedis.java +++ b/src/main/java/redis/clients/jedis/Jedis.java @@ -30,7 +30,8 @@ public class Jedis extends BinaryJedis implements JedisCommands { super(shardInfo); } - public String ping() { + @Override + public String ping() { runChecks(); client.ping(); return client.getStatusCodeReply(); @@ -71,7 +72,8 @@ public class Jedis extends BinaryJedis implements JedisCommands { /** * Ask the server to silently close the connection. */ - public void quit() { + @Override + public void quit() { runChecks(); client.quit(); } @@ -86,7 +88,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @param key * @return Integer reply, "0" if the key exists, otherwise "1" */ - public Integer exists(final String key) { + public Long exists(final String key) { runChecks(); client.exists(key); return client.getIntegerReply(); @@ -102,7 +104,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return Integer reply, specifically: an integer greater than 0 if one or * more keys were removed 0 if none of the specified key existed */ - public Integer del(final String... keys) { + public Long del(final String... keys) { runChecks(); client.del(keys); return client.getIntegerReply(); @@ -134,7 +136,8 @@ public class Jedis extends BinaryJedis implements JedisCommands { * * @return Status code reply */ - public String flushDB() { + @Override + public String flushDB() { runChecks(); client.flushDB(); return client.getStatusCodeReply(); @@ -221,7 +224,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return Integer reply, specifically: 1 if the key was renamed 0 if the * target key already exist */ - public Integer renamenx(final String oldkey, final String newkey) { + public Long renamenx(final String oldkey, final String newkey) { runChecks(); client.renamenx(oldkey, newkey); return client.getIntegerReply(); @@ -232,7 +235,8 @@ public class Jedis extends BinaryJedis implements JedisCommands { * * @return Integer reply */ - public Integer dbSize() { + @Override + public Long dbSize() { runChecks(); client.dbSize(); return client.getIntegerReply(); @@ -266,7 +270,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * 2.1.3 will happily update the timeout), or the key does not * exist. */ - public Integer expire(final String key, final int seconds) { + public Long expire(final String key, final int seconds) { runChecks(); client.expire(key, seconds); return client.getIntegerReply(); @@ -302,7 +306,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * 2.1.3 will happily update the timeout), or the key does not * exist. */ - public Integer expireAt(final String key, final long unixTime) { + public Long expireAt(final String key, final long unixTime) { runChecks(); client.expireAt(key, unixTime); return client.getIntegerReply(); @@ -319,7 +323,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * key that has an EXPIRE. If the Key does not exists or does not * have an associated expire, -1 is returned. */ - public Integer ttl(final String key) { + public Long ttl(final String key) { runChecks(); client.ttl(key); return client.getIntegerReply(); @@ -332,7 +336,8 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @param index * @return Status code reply */ - public String select(final int index) { + @Override + public String select(final int index) { runChecks(); client.select(index); return client.getStatusCodeReply(); @@ -351,7 +356,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * was not moved because already present on the target DB or was not * found in the current DB. */ - public Integer move(final String key, final int dbIndex) { + public Long move(final String key, final int dbIndex) { runChecks(); client.move(key, dbIndex); return client.getIntegerReply(); @@ -363,7 +368,8 @@ public class Jedis extends BinaryJedis implements JedisCommands { * * @return Status code reply */ - public String flushAll() { + @Override + public String flushAll() { runChecks(); client.flushAll(); return client.getStatusCodeReply(); @@ -414,7 +420,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return Integer reply, specifically: 1 if the key was set 0 if the key * was not set */ - public Integer setnx(final String key, final String value) { + public Long setnx(final String key, final String value) { runChecks(); client.setnx(key, value); return client.getIntegerReply(); @@ -485,7 +491,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return Integer reply, specifically: 1 if the all the keys were set 0 if * no key was set (at least one key already existed) */ - public Integer msetnx(final String... keysvalues) { + public Long msetnx(final String... keysvalues) { runChecks(); client.msetnx(keysvalues); return client.getIntegerReply(); @@ -513,7 +519,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return Integer reply, this commands will reply with the new value of key * after the increment. */ - public Integer decrBy(final String key, final int integer) { + public Long decrBy(final String key, final int integer) { runChecks(); client.decrBy(key, integer); return client.getIntegerReply(); @@ -541,7 +547,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return Integer reply, this commands will reply with the new value of key * after the increment. */ - public Integer decr(final String key) { + public Long decr(final String key) { runChecks(); client.decr(key); return client.getIntegerReply(); @@ -569,7 +575,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return Integer reply, this commands will reply with the new value of key * after the increment. */ - public Integer incrBy(final String key, final int integer) { + public Long incrBy(final String key, final int integer) { runChecks(); client.incrBy(key, integer); return client.getIntegerReply(); @@ -597,7 +603,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return Integer reply, this commands will reply with the new value of key * after the increment. */ - public Integer incr(final String key) { + public Long incr(final String key) { runChecks(); client.incr(key); return client.getIntegerReply(); @@ -619,7 +625,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return Integer reply, specifically the total length of the string after * the append operation. */ - public Integer append(final String key, final String value) { + public Long append(final String key, final String value) { runChecks(); client.append(key, value); return client.getIntegerReply(); @@ -664,7 +670,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * of the value, 0 is returned, otherwise if a new field is created * 1 is returned. */ - public Integer hset(final String key, final String field, final String value) { + public Long hset(final String key, final String field, final String value) { runChecks(); client.hset(key, field, value); return client.getIntegerReply(); @@ -700,7 +706,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return If the field already exists, 0 is returned, otherwise if a new * field is created 1 is returned. */ - public Integer hsetnx(final String key, final String field, + public Long hsetnx(final String key, final String field, final String value) { runChecks(); client.hsetnx(key, field, value); @@ -762,7 +768,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return Integer reply The new value at field after the increment * operation. */ - public Integer hincrBy(final String key, final String field, final int value) { + public Long hincrBy(final String key, final String field, final int value) { runChecks(); client.hincrBy(key, field, value); return client.getIntegerReply(); @@ -778,7 +784,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return Return 1 if the hash stored at key contains the specified field. * Return 0 if the key is not found or the field is not present. */ - public Integer hexists(final String key, final String field) { + public Long hexists(final String key, final String field) { runChecks(); client.hexists(key, field); return client.getIntegerReply(); @@ -794,7 +800,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return If the field was present in the hash it is deleted and 1 is * returned, otherwise 0 is returned and no operation is performed. */ - public Integer hdel(final String key, final String field) { + public Long hdel(final String key, final String field) { runChecks(); client.hdel(key, field); return client.getIntegerReply(); @@ -810,7 +816,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * key. If the specified key does not exist, 0 is returned assuming * an empty hash. */ - public Integer hlen(final String key) { + public Long hlen(final String key) { runChecks(); client.hlen(key); return client.getIntegerReply(); @@ -882,7 +888,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return Integer reply, specifically, the number of elements inside the * list after the push operation. */ - public Integer rpush(final String key, final String string) { + public Long rpush(final String key, final String string) { runChecks(); client.rpush(key, string); return client.getIntegerReply(); @@ -903,7 +909,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return Integer reply, specifically, the number of elements inside the * list after the push operation. */ - public Integer lpush(final String key, final String string) { + public Long lpush(final String key, final String string) { runChecks(); client.lpush(key, string); return client.getIntegerReply(); @@ -919,7 +925,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @param key * @return The length of the list. */ - public Integer llen(final String key) { + public Long llen(final String key) { runChecks(); client.llen(key); return client.getIntegerReply(); @@ -1079,7 +1085,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return Integer Reply, specifically: The number of removed elements if * the operation succeeded */ - public Integer lrem(final String key, final int count, final String value) { + public Long lrem(final String key, final int count, final String value) { runChecks(); client.lrem(key, count, value); return client.getIntegerReply(); @@ -1160,7 +1166,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return Integer reply, specifically: 1 if the new element was added 0 if * the element was already a member of the set */ - public Integer sadd(final String key, final String member) { + public Long sadd(final String key, final String member) { runChecks(); client.sadd(key, member); return client.getIntegerReply(); @@ -1194,7 +1200,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return Integer reply, specifically: 1 if the new element was removed 0 * if the new element was not a member of the set */ - public Integer srem(final String key, final String member) { + public Long srem(final String key, final String member) { runChecks(); client.srem(key, member); return client.getIntegerReply(); @@ -1241,7 +1247,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * element was not found on the first set and no operation was * performed */ - public Integer smove(final String srckey, final String dstkey, + public Long smove(final String srckey, final String dstkey, final String member) { runChecks(); client.smove(srckey, dstkey, member); @@ -1256,7 +1262,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return Integer reply, specifically: the cardinality (number of elements) * of the set as an integer. */ - public Integer scard(final String key) { + public Long scard(final String key) { runChecks(); client.scard(key); return client.getIntegerReply(); @@ -1274,7 +1280,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * set 0 if the element is not a member of the set OR if the key * does not exist */ - public Integer sismember(final String key, final String member) { + public Long sismember(final String key, final String member) { runChecks(); client.sismember(key, member); return client.getIntegerReply(); @@ -1317,7 +1323,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @param keys * @return Status code reply */ - public Integer sinterstore(final String dstkey, final String... keys) { + public Long sinterstore(final String dstkey, final String... keys) { runChecks(); client.sinterstore(dstkey, keys); return client.getIntegerReply(); @@ -1358,7 +1364,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @param keys * @return Status code reply */ - public Integer sunionstore(final String dstkey, final String... keys) { + public Long sunionstore(final String dstkey, final String... keys) { runChecks(); client.sunionstore(dstkey, keys); return client.getIntegerReply(); @@ -1402,7 +1408,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @param keys * @return Status code reply */ - public Integer sdiffstore(final String dstkey, final String... keys) { + public Long sdiffstore(final String dstkey, final String... keys) { runChecks(); client.sdiffstore(dstkey, keys); return client.getIntegerReply(); @@ -1447,7 +1453,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * the element was already a member of the sorted set and the score * was updated */ - public Integer zadd(final String key, final double score, + public Long zadd(final String key, final double score, final String member) { runChecks(); client.zadd(key, score, member); @@ -1476,7 +1482,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return Integer reply, specifically: 1 if the new element was removed 0 * if the new element was not a member of the set */ - public Integer zrem(final String key, final String member) { + public Long zrem(final String key, final String member) { runChecks(); client.zrem(key, member); return client.getIntegerReply(); @@ -1534,7 +1540,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * element as an integer reply if the element exists. A nil bulk * reply if there is no such element. */ - public Integer zrank(final String key, final String member) { + public Long zrank(final String key, final String member) { runChecks(); client.zrank(key, member); return client.getIntegerReply(); @@ -1560,7 +1566,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * element as an integer reply if the element exists. A nil bulk * reply if there is no such element. */ - public Integer zrevrank(final String key, final String member) { + public Long zrevrank(final String key, final String member) { runChecks(); client.zrevrank(key, member); return client.getIntegerReply(); @@ -1599,7 +1605,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @param key * @return the cardinality (number of elements) of the set as an integer. */ - public Integer zcard(final String key) { + public Long zcard(final String key) { runChecks(); client.zcard(key); return client.getIntegerReply(); @@ -1623,13 +1629,15 @@ public class Jedis extends BinaryJedis implements JedisCommands { return (score != null ? new Double(score) : null); } - public Transaction multi() { + @Override + public Transaction multi() { client.multi(); client.getStatusCodeReply(); return new Transaction(client); } - public List multi(TransactionBlock jedisTransaction) { + @Override + public List multi(TransactionBlock jedisTransaction) { List results = null; try { jedisTransaction.setClient(client); @@ -1656,7 +1664,8 @@ public class Jedis extends BinaryJedis implements JedisCommands { } } - public void connect() throws UnknownHostException, IOException { + @Override + public void connect() throws UnknownHostException, IOException { if (!client.isConnected()) { client.connect(); if (this.password != null) { @@ -1665,7 +1674,8 @@ public class Jedis extends BinaryJedis implements JedisCommands { } } - public void disconnect() throws IOException { + @Override + public void disconnect() throws IOException { client.disconnect(); } @@ -1880,7 +1890,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @param dstkey * @return The number of elements of the list at dstkey. */ - public Integer sort(final String key, + public Long sort(final String key, final SortingParams sortingParameters, final String dstkey) { runChecks(); client.sort(key, sortingParameters, dstkey); @@ -1903,7 +1913,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @param dstkey * @return The number of elements of the list at dstkey. */ - public Integer sort(final String key, final String dstkey) { + public Long sort(final String key, final String dstkey) { runChecks(); client.sort(key, dstkey); return client.getIntegerReply(); @@ -2012,36 +2022,41 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @param password * @return Status code reply */ - public String auth(final String password) { + @Override + public String auth(final String password) { runChecks(); client.auth(password); return client.getStatusCodeReply(); } - public List pipelined(JedisPipeline jedisPipeline) { + @Override + public List pipelined(JedisPipeline jedisPipeline) { jedisPipeline.setClient(client); jedisPipeline.execute(); return client.getAll(); } - public void subscribe(JedisPubSub jedisPubSub, String... channels) { + @Override + public void subscribe(JedisPubSub jedisPubSub, String... channels) { client.setTimeoutInfinite(); jedisPubSub.proceed(client, channels); client.rollbackTimeout(); } - public Integer publish(String channel, String message) { + @Override + public Long publish(String channel, String message) { client.publish(channel, message); return client.getIntegerReply(); } - public void psubscribe(JedisPubSub jedisPubSub, String... patterns) { + @Override + public void psubscribe(JedisPubSub jedisPubSub, String... patterns) { client.setTimeoutInfinite(); jedisPubSub.proceedWithPatterns(client, patterns); client.rollbackTimeout(); } - public Integer zcount(final String key, final double min, final double max) { + public Long zcount(final String key, final double min, final double max) { runChecks(); client.zcount(key, min, max); return client.getIntegerReply(); @@ -2336,7 +2351,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * operation * */ - public Integer zremrangeByRank(final String key, final int start, + public Long zremrangeByRank(final String key, final int start, final int end) { runChecks(); client.zremrangeByRank(key, start, end); @@ -2357,7 +2372,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @param end * @return Integer reply, specifically the number of elements removed. */ - public Integer zremrangeByScore(final String key, final double start, + public Long zremrangeByScore(final String key, final double start, final double end) { runChecks(); client.zremrangeByScore(key, start, end); @@ -2402,7 +2417,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return Integer reply, specifically the number of elements in the sorted * set at dstkey */ - public Integer zunionstore(final String dstkey, final String... sets) { + public Long zunionstore(final String dstkey, final String... sets) { runChecks(); client.zunionstore(dstkey, sets); return client.getIntegerReply(); @@ -2447,7 +2462,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return Integer reply, specifically the number of elements in the sorted * set at dstkey */ - public Integer zunionstore(final String dstkey, final ZParams params, + public Long zunionstore(final String dstkey, final ZParams params, final String... sets) { runChecks(); client.zunionstore(dstkey, params, sets); @@ -2492,7 +2507,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return Integer reply, specifically the number of elements in the sorted * set at dstkey */ - public Integer zinterstore(final String dstkey, final String... sets) { + public Long zinterstore(final String dstkey, final String... sets) { runChecks(); client.zinterstore(dstkey, sets); return client.getIntegerReply(); @@ -2537,19 +2552,19 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return Integer reply, specifically the number of elements in the sorted * set at dstkey */ - public Integer zinterstore(final String dstkey, final ZParams params, + public Long zinterstore(final String dstkey, final ZParams params, final String... sets) { runChecks(); client.zinterstore(dstkey, params, sets); return client.getIntegerReply(); } - public Integer strlen(final String key) { + public Long strlen(final String key) { client.strlen(key); return client.getIntegerReply(); } - public Integer lpushx(final String key, final String string) { + public Long lpushx(final String key, final String string) { client.lpushx(key, string); return client.getIntegerReply(); } @@ -2564,12 +2579,12 @@ public class Jedis extends BinaryJedis implements JedisCommands { * @return Integer reply, specifically: 1: the key is now persist. 0: the * key is not persist (only happens when key not set). */ - public Integer persist(final String key) { + public Long persist(final String key) { client.persist(key); return client.getIntegerReply(); } - public Integer rpushx(final String key, final String string) { + public Long rpushx(final String key, final String string) { client.rpushx(key, string); return client.getIntegerReply(); } @@ -2579,7 +2594,7 @@ public class Jedis extends BinaryJedis implements JedisCommands { return client.getBulkReply(); } - public Integer linsert(final String key, final LIST_POSITION where, + public Long linsert(final String key, final LIST_POSITION where, final String pivot, final String value) { client.linsert(key, where, pivot, value); return client.getIntegerReply(); diff --git a/src/main/java/redis/clients/jedis/JedisCommands.java b/src/main/java/redis/clients/jedis/JedisCommands.java index a821519..a66d6dd 100644 --- a/src/main/java/redis/clients/jedis/JedisCommands.java +++ b/src/main/java/redis/clients/jedis/JedisCommands.java @@ -13,51 +13,51 @@ public interface JedisCommands { String get(String key); - Integer exists(String key); + Long exists(String key); String type(String key); - Integer expire(String key, int seconds); + Long expire(String key, int seconds); - Integer expireAt(String key, long unixTime); + Long expireAt(String key, long unixTime); - Integer ttl(String key); + Long ttl(String key); String getSet(String key, String value); - Integer setnx(String key, String value); + Long setnx(String key, String value); String setex(String key, int seconds, String value); - Integer decrBy(String key, int integer); + Long decrBy(String key, int integer); - Integer decr(String key); + Long decr(String key); - Integer incrBy(String key, int integer); + Long incrBy(String key, int integer); - Integer incr(String key); + Long incr(String key); - Integer append(String key, String value); + Long append(String key, String value); String substr(String key, int start, int end); - Integer hset(String key, String field, String value); + Long hset(String key, String field, String value); String hget(String key, String field); - Integer hsetnx(String key, String field, String value); + Long hsetnx(String key, String field, String value); String hmset(String key, Map hash); List hmget(String key, String... fields); - Integer hincrBy(String key, String field, int value); + Long hincrBy(String key, String field, int value); - Integer hexists(String key, String field); + Long hexists(String key, String field); - Integer hdel(String key, String field); + Long hdel(String key, String field); - Integer hlen(String key); + Long hlen(String key); Set hkeys(String key); @@ -65,11 +65,11 @@ public interface JedisCommands { Map hgetAll(String key); - Integer rpush(String key, String string); + Long rpush(String key, String string); - Integer lpush(String key, String string); + Long lpush(String key, String string); - Integer llen(String key); + Long llen(String key); List lrange(String key, int start, int end); @@ -79,37 +79,37 @@ public interface JedisCommands { String lset(String key, int index, String value); - Integer lrem(String key, int count, String value); + Long lrem(String key, int count, String value); String lpop(String key); String rpop(String key); - Integer sadd(String key, String member); + Long sadd(String key, String member); Set smembers(String key); - Integer srem(String key, String member); + Long srem(String key, String member); String spop(String key); - Integer scard(String key); + Long scard(String key); - Integer sismember(String key, String member); + Long sismember(String key, String member); String srandmember(String key); - Integer zadd(String key, double score, String member); + Long zadd(String key, double score, String member); Set zrange(String key, int start, int end); - Integer zrem(String key, String member); + Long zrem(String key, String member); Double zincrby(String key, double score, String member); - Integer zrank(String key, String member); + Long zrank(String key, String member); - Integer zrevrank(String key, String member); + Long zrevrank(String key, String member); Set zrevrange(String key, int start, int end); @@ -117,7 +117,7 @@ public interface JedisCommands { Set zrevrangeWithScores(String key, int start, int end); - Integer zcard(String key); + Long zcard(String key); Double zscore(String key, String member); @@ -125,7 +125,7 @@ public interface JedisCommands { List sort(String key, SortingParams sortingParameters); - Integer zcount(String key, double min, double max); + Long zcount(String key, double min, double max); Set zrangeByScore(String key, double min, double max); @@ -137,10 +137,10 @@ public interface JedisCommands { Set zrangeByScoreWithScores(String key, double min, double max, int offset, int count); - Integer zremrangeByRank(String key, int start, int end); + Long zremrangeByRank(String key, int start, int end); - Integer zremrangeByScore(String key, double start, double end); + Long zremrangeByScore(String key, double start, double end); - Integer linsert(String key, Client.LIST_POSITION where, String pivot, + Long linsert(String key, Client.LIST_POSITION where, String pivot, String value); } diff --git a/src/main/java/redis/clients/jedis/JedisPubSub.java b/src/main/java/redis/clients/jedis/JedisPubSub.java index 6ff0779..6fdbc3d 100644 --- a/src/main/java/redis/clients/jedis/JedisPubSub.java +++ b/src/main/java/redis/clients/jedis/JedisPubSub.java @@ -78,13 +78,13 @@ public abstract class JedisPubSub { } final byte[] resp = (byte[]) firstObj; if (Arrays.equals(SUBSCRIBE.raw, resp)) { - subscribedChannels = ((Integer) reply.get(2)).intValue(); + subscribedChannels = ((Long) reply.get(2)).intValue(); final byte[] bchannel = (byte[]) reply.get(1); final String strchannel = (bchannel == null) ? null : SafeEncoder.encode(bchannel); onSubscribe(strchannel, subscribedChannels); } else if (Arrays.equals(UNSUBSCRIBE.raw, resp)) { - subscribedChannels = ((Integer) reply.get(2)).intValue(); + subscribedChannels = ((Long) reply.get(2)).intValue(); final byte[] bchannel = (byte[]) reply.get(1); final String strchannel = (bchannel == null) ? null : SafeEncoder.encode(bchannel); @@ -109,13 +109,13 @@ public abstract class JedisPubSub { .encode(bmesg); onPMessage(strpattern, strchannel, strmesg); } else if (Arrays.equals(PSUBSCRIBE.raw, resp)) { - subscribedChannels = ((Integer) reply.get(2)).intValue(); + subscribedChannels = ((Long) reply.get(2)).intValue(); final byte[] bpattern = (byte[]) reply.get(1); final String strpattern = (bpattern == null) ? null : SafeEncoder.encode(bpattern); onPSubscribe(strpattern, subscribedChannels); } else if (Arrays.equals(PUNSUBSCRIBE.raw, resp)) { - subscribedChannels = ((Integer) reply.get(2)).intValue(); + subscribedChannels = ((Long) reply.get(2)).intValue(); final byte[] bpattern = (byte[]) reply.get(1); final String strpattern = (bpattern == null) ? null : SafeEncoder.encode(bpattern); diff --git a/src/main/java/redis/clients/jedis/Protocol.java b/src/main/java/redis/clients/jedis/Protocol.java index 7ec6f20..37f0717 100644 --- a/src/main/java/redis/clients/jedis/Protocol.java +++ b/src/main/java/redis/clients/jedis/Protocol.java @@ -100,9 +100,9 @@ public final class Protocol { return read; } - private Integer processInteger(final RedisInputStream is) { + private Long processInteger(final RedisInputStream is) { String num = is.readLine(); - return Integer.valueOf(num); + return Long.valueOf(num); } private List processMultiBulkReply(final RedisInputStream is) { diff --git a/src/main/java/redis/clients/jedis/ShardedJedis.java b/src/main/java/redis/clients/jedis/ShardedJedis.java index 7f66529..f3afbbc 100644 --- a/src/main/java/redis/clients/jedis/ShardedJedis.java +++ b/src/main/java/redis/clients/jedis/ShardedJedis.java @@ -28,7 +28,8 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands { super(shards, algo, keyTagPattern); } - public void disconnect() throws IOException { + @Override + public void disconnect() throws IOException { for (Jedis jedis : getAllShards()) { jedis.quit(); jedis.disconnect(); @@ -45,7 +46,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands { return j.get(key); } - public Integer exists(String key) { + public Long exists(String key) { Jedis j = getShard(key); return j.exists(key); } @@ -55,17 +56,17 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands { return j.type(key); } - public Integer expire(String key, int seconds) { + public Long expire(String key, int seconds) { Jedis j = getShard(key); return j.expire(key, seconds); } - public Integer expireAt(String key, long unixTime) { + public Long expireAt(String key, long unixTime) { Jedis j = getShard(key); return j.expireAt(key, unixTime); } - public Integer ttl(String key) { + public Long ttl(String key) { Jedis j = getShard(key); return j.ttl(key); } @@ -75,7 +76,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands { return j.getSet(key, value); } - public Integer setnx(String key, String value) { + public Long setnx(String key, String value) { Jedis j = getShard(key); return j.setnx(key, value); } @@ -85,27 +86,27 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands { return j.setex(key, seconds, value); } - public Integer decrBy(String key, int integer) { + public Long decrBy(String key, int integer) { Jedis j = getShard(key); return j.decrBy(key, integer); } - public Integer decr(String key) { + public Long decr(String key) { Jedis j = getShard(key); return j.decr(key); } - public Integer incrBy(String key, int integer) { + public Long incrBy(String key, int integer) { Jedis j = getShard(key); return j.incrBy(key, integer); } - public Integer incr(String key) { + public Long incr(String key) { Jedis j = getShard(key); return j.incr(key); } - public Integer append(String key, String value) { + public Long append(String key, String value) { Jedis j = getShard(key); return j.append(key, value); } @@ -115,7 +116,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands { return j.substr(key, start, end); } - public Integer hset(String key, String field, String value) { + public Long hset(String key, String field, String value) { Jedis j = getShard(key); return j.hset(key, field, value); } @@ -125,7 +126,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands { return j.hget(key, field); } - public Integer hsetnx(String key, String field, String value) { + public Long hsetnx(String key, String field, String value) { Jedis j = getShard(key); return j.hsetnx(key, field, value); } @@ -140,22 +141,22 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands { return j.hmget(key, fields); } - public Integer hincrBy(String key, String field, int value) { + public Long hincrBy(String key, String field, int value) { Jedis j = getShard(key); return j.hincrBy(key, field, value); } - public Integer hexists(String key, String field) { + public Long hexists(String key, String field) { Jedis j = getShard(key); return j.hexists(key, field); } - public Integer hdel(String key, String field) { + public Long hdel(String key, String field) { Jedis j = getShard(key); return j.hdel(key, field); } - public Integer hlen(String key) { + public Long hlen(String key) { Jedis j = getShard(key); return j.hlen(key); } @@ -175,17 +176,17 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands { return j.hgetAll(key); } - public Integer rpush(String key, String string) { + public Long rpush(String key, String string) { Jedis j = getShard(key); return j.rpush(key, string); } - public Integer lpush(String key, String string) { + public Long lpush(String key, String string) { Jedis j = getShard(key); return j.lpush(key, string); } - public Integer llen(String key) { + public Long llen(String key) { Jedis j = getShard(key); return j.llen(key); } @@ -210,7 +211,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands { return j.lset(key, index, value); } - public Integer lrem(String key, int count, String value) { + public Long lrem(String key, int count, String value) { Jedis j = getShard(key); return j.lrem(key, count, value); } @@ -225,7 +226,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands { return j.rpop(key); } - public Integer sadd(String key, String member) { + public Long sadd(String key, String member) { Jedis j = getShard(key); return j.sadd(key, member); } @@ -235,7 +236,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands { return j.smembers(key); } - public Integer srem(String key, String member) { + public Long srem(String key, String member) { Jedis j = getShard(key); return j.srem(key, member); } @@ -245,12 +246,12 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands { return j.spop(key); } - public Integer scard(String key) { + public Long scard(String key) { Jedis j = getShard(key); return j.scard(key); } - public Integer sismember(String key, String member) { + public Long sismember(String key, String member) { Jedis j = getShard(key); return j.sismember(key, member); } @@ -260,7 +261,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands { return j.srandmember(key); } - public Integer zadd(String key, double score, String member) { + public Long zadd(String key, double score, String member) { Jedis j = getShard(key); return j.zadd(key, score, member); } @@ -270,7 +271,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands { return j.zrange(key, start, end); } - public Integer zrem(String key, String member) { + public Long zrem(String key, String member) { Jedis j = getShard(key); return j.zrem(key, member); } @@ -280,12 +281,12 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands { return j.zincrby(key, score, member); } - public Integer zrank(String key, String member) { + public Long zrank(String key, String member) { Jedis j = getShard(key); return j.zrank(key, member); } - public Integer zrevrank(String key, String member) { + public Long zrevrank(String key, String member) { Jedis j = getShard(key); return j.zrevrank(key, member); } @@ -305,7 +306,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands { return j.zrevrangeWithScores(key, start, end); } - public Integer zcard(String key) { + public Long zcard(String key) { Jedis j = getShard(key); return j.zcard(key); } @@ -325,7 +326,7 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands { return j.sort(key, sortingParameters); } - public Integer zcount(String key, double min, double max) { + public Long zcount(String key, double min, double max) { Jedis j = getShard(key); return j.zcount(key, min, max); } @@ -352,17 +353,17 @@ public class ShardedJedis extends BinaryShardedJedis implements JedisCommands { return j.zrangeByScoreWithScores(key, min, max, offset, count); } - public Integer zremrangeByRank(String key, int start, int end) { + public Long zremrangeByRank(String key, int start, int end) { Jedis j = getShard(key); return j.zremrangeByRank(key, start, end); } - public Integer zremrangeByScore(String key, double start, double end) { + public Long zremrangeByScore(String key, double start, double end) { Jedis j = getShard(key); return j.zremrangeByScore(key, start, end); } - public Integer linsert(String key, LIST_POSITION where, String pivot, + public Long linsert(String key, LIST_POSITION where, String pivot, String value) { Jedis j = getShard(key); return j.linsert(key, where, pivot, value); diff --git a/src/test/java/redis/clients/jedis/tests/ProtocolTest.java b/src/test/java/redis/clients/jedis/tests/ProtocolTest.java index 2d97fd0..02d3cfb 100644 --- a/src/test/java/redis/clients/jedis/tests/ProtocolTest.java +++ b/src/test/java/redis/clients/jedis/tests/ProtocolTest.java @@ -77,7 +77,7 @@ public class ProtocolTest extends JedisTestBase { public void integerReply() { InputStream is = new ByteArrayInputStream(":123\r\n".getBytes()); Protocol protocol = new Protocol(); - int response = (Integer) protocol.read(new RedisInputStream(is)); + long response = (Long) protocol.read(new RedisInputStream(is)); assertEquals(123, response); } diff --git a/src/test/java/redis/clients/jedis/tests/commands/AllKindOfValuesCommandsTest.java b/src/test/java/redis/clients/jedis/tests/commands/AllKindOfValuesCommandsTest.java index 1aee8b8..d5f4598 100644 --- a/src/test/java/redis/clients/jedis/tests/commands/AllKindOfValuesCommandsTest.java +++ b/src/test/java/redis/clients/jedis/tests/commands/AllKindOfValuesCommandsTest.java @@ -37,7 +37,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase { status = jedis.set(bfoo, bbar); assertEquals("OK", status); - int reply = jedis.exists("foo"); + long reply = jedis.exists("foo"); assertEquals(1, reply); reply = jedis.exists(bfoo); @@ -62,7 +62,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase { jedis.set("foo2", "bar2"); jedis.set("foo3", "bar3"); - int reply = jedis.del("foo1", "foo2", "foo3"); + long reply = jedis.del("foo1", "foo2", "foo3"); assertEquals(3, reply); reply = jedis.exists("foo1"); @@ -222,7 +222,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase { @Test public void renamenx() { jedis.set("foo", "bar"); - int status = jedis.renamenx("foo", "bar"); + long status = jedis.renamenx("foo", "bar"); assertEquals(1, status); jedis.set("foo", "bar"); @@ -231,7 +231,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase { // Binary jedis.set(bfoo, bbar); - int bstatus = jedis.renamenx(bfoo, bbar); + long bstatus = jedis.renamenx(bfoo, bbar); assertEquals(1, bstatus); jedis.set(bfoo, bbar); @@ -242,7 +242,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase { @Test public void dbSize() { - int size = jedis.dbSize(); + long size = jedis.dbSize(); assertEquals(0, size); jedis.set("foo", "bar"); @@ -257,7 +257,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase { @Test public void expire() { - int status = jedis.expire("foo", 20); + long status = jedis.expire("foo", 20); assertEquals(0, status); jedis.set("foo", "bar"); @@ -265,7 +265,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase { assertEquals(1, status); // Binary - int bstatus = jedis.expire(bfoo, 20); + long bstatus = jedis.expire(bfoo, 20); assertEquals(0, bstatus); jedis.set(bfoo, bbar); @@ -278,7 +278,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase { public void expireAt() { long unixTime = (System.currentTimeMillis() / 1000L) + 20; - int status = jedis.expireAt("foo", unixTime); + long status = jedis.expireAt("foo", unixTime); assertEquals(0, status); jedis.set("foo", "bar"); @@ -287,7 +287,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase { assertEquals(1, status); // Binary - int bstatus = jedis.expireAt(bfoo, unixTime); + long bstatus = jedis.expireAt(bfoo, unixTime); assertEquals(0, bstatus); jedis.set(bfoo, bbar); @@ -299,7 +299,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase { @Test public void ttl() { - int ttl = jedis.ttl("foo"); + long ttl = jedis.ttl("foo"); assertEquals(-1, ttl); jedis.set("foo", "bar"); @@ -311,7 +311,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase { assertTrue(ttl >= 0 && ttl <= 20); // Binary - int bttl = jedis.ttl(bfoo); + long bttl = jedis.ttl(bfoo); assertEquals(-1, bttl); jedis.set(bfoo, bbar); @@ -345,7 +345,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase { @Test public void move() { - int status = jedis.move("foo", 1); + long status = jedis.move("foo", 1); assertEquals(0, status); jedis.set("foo", "bar"); @@ -358,7 +358,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase { // Binary jedis.select(0); - int bstatus = jedis.move(bfoo, 1); + long bstatus = jedis.move(bfoo, 1); assertEquals(0, bstatus); jedis.set(bfoo, bbar); @@ -428,14 +428,14 @@ public class AllKindOfValuesCommandsTest extends JedisCommandTestBase { public void persist() { jedis.setex("foo", 60 * 60, "bar"); assertTrue(jedis.ttl("foo") > 0); - int status = jedis.persist("foo"); + long status = jedis.persist("foo"); assertEquals(1, status); assertEquals(-1, jedis.ttl("foo").intValue()); // Binary jedis.setex(bfoo, 60 * 60, bbar); assertTrue(jedis.ttl(bfoo) > 0); - int bstatus = jedis.persist(bfoo); + long bstatus = jedis.persist(bfoo); assertEquals(1, bstatus); assertEquals(-1, jedis.ttl(bfoo).intValue()); diff --git a/src/test/java/redis/clients/jedis/tests/commands/BinaryValuesCommandsTest.java b/src/test/java/redis/clients/jedis/tests/commands/BinaryValuesCommandsTest.java index 001e2d3..28e4aa2 100644 --- a/src/test/java/redis/clients/jedis/tests/commands/BinaryValuesCommandsTest.java +++ b/src/test/java/redis/clients/jedis/tests/commands/BinaryValuesCommandsTest.java @@ -75,7 +75,7 @@ public class BinaryValuesCommandsTest extends JedisCommandTestBase { @Test public void setnx() { - int status = jedis.setnx(bfoo, binaryValue); + long status = jedis.setnx(bfoo, binaryValue); assertEquals(1, status); assertTrue(Arrays.equals(binaryValue, jedis.get(bfoo))); @@ -88,7 +88,7 @@ public class BinaryValuesCommandsTest extends JedisCommandTestBase { public void setex() { String status = jedis.setex(bfoo, 20, binaryValue); assertEquals(Keyword.OK.name(), status); - int ttl = jedis.ttl(bfoo); + long ttl = jedis.ttl(bfoo); assertTrue(ttl > 0 && ttl <= 20); } @@ -102,7 +102,7 @@ public class BinaryValuesCommandsTest extends JedisCommandTestBase { @Test public void msetnx() { - int status = jedis.msetnx(bfoo, binaryValue, bbar, bfoo); + long status = jedis.msetnx(bfoo, binaryValue, bbar, bfoo); assertEquals(1, status); assertTrue(Arrays.equals(binaryValue, jedis.get(bfoo))); assertTrue(Arrays.equals(bfoo, jedis.get(bbar))); @@ -121,7 +121,7 @@ public class BinaryValuesCommandsTest extends JedisCommandTestBase { @Test public void incr() { - int value = jedis.incr(bfoo); + long value = jedis.incr(bfoo); assertEquals(1, value); value = jedis.incr(bfoo); assertEquals(2, value); @@ -135,7 +135,7 @@ public class BinaryValuesCommandsTest extends JedisCommandTestBase { @Test public void incrBy() { - int value = jedis.incrBy(bfoo, 2); + long value = jedis.incrBy(bfoo, 2); assertEquals(2, value); value = jedis.incrBy(bfoo, 2); assertEquals(4, value); @@ -149,7 +149,7 @@ public class BinaryValuesCommandsTest extends JedisCommandTestBase { @Test public void decr() { - int value = jedis.decr(bfoo); + long value = jedis.decr(bfoo); assertEquals(-1, value); value = jedis.decr(bfoo); assertEquals(-2, value); @@ -163,7 +163,7 @@ public class BinaryValuesCommandsTest extends JedisCommandTestBase { @Test public void decrBy() { - int value = jedis.decrBy(bfoo, 2); + long value = jedis.decrBy(bfoo, 2); assertEquals(-2, value); value = jedis.decrBy(bfoo, 2); assertEquals(-4, value); @@ -173,7 +173,7 @@ public class BinaryValuesCommandsTest extends JedisCommandTestBase { public void append() { byte[] first512 = new byte[512]; System.arraycopy(binaryValue, 0, first512, 0, 512); - int value = jedis.append(bfoo, first512); + long value = jedis.append(bfoo, first512); assertEquals(512, value); assertTrue(Arrays.equals(first512, jedis.get(bfoo))); diff --git a/src/test/java/redis/clients/jedis/tests/commands/ControlCommandsTest.java b/src/test/java/redis/clients/jedis/tests/commands/ControlCommandsTest.java index 68be673..ecf480a 100644 --- a/src/test/java/redis/clients/jedis/tests/commands/ControlCommandsTest.java +++ b/src/test/java/redis/clients/jedis/tests/commands/ControlCommandsTest.java @@ -35,7 +35,7 @@ public class ControlCommandsTest extends JedisCommandTestBase { @Test public void lastsave() throws InterruptedException { - int before = jedis.lastsave(); + long before = jedis.lastsave(); String st = ""; while (!st.equals("OK")) { try { @@ -45,7 +45,7 @@ public class ControlCommandsTest extends JedisCommandTestBase { } } - int after = jedis.lastsave(); + long after = jedis.lastsave(); assertTrue((after - before) > 0); } @@ -58,7 +58,8 @@ public class ControlCommandsTest extends JedisCommandTestBase { @Test public void monitor() { jedis.monitor(new JedisMonitor() { - public void onCommand(String command) { + @Override + public void onCommand(String command) { assertTrue(command.contains("OK")); client.disconnect(); } diff --git a/src/test/java/redis/clients/jedis/tests/commands/HashesCommandsTest.java b/src/test/java/redis/clients/jedis/tests/commands/HashesCommandsTest.java index f7f4fd1..11971b0 100644 --- a/src/test/java/redis/clients/jedis/tests/commands/HashesCommandsTest.java +++ b/src/test/java/redis/clients/jedis/tests/commands/HashesCommandsTest.java @@ -17,13 +17,13 @@ public class HashesCommandsTest extends JedisCommandTestBase { @Test public void hset() { - int status = jedis.hset("foo", "bar", "car"); + long status = jedis.hset("foo", "bar", "car"); assertEquals(1, status); status = jedis.hset("foo", "bar", "foo"); assertEquals(0, status); // Binary - int bstatus = jedis.hset(bfoo, bbar, bcar); + long bstatus = jedis.hset(bfoo, bbar, bcar); assertEquals(1, bstatus); bstatus = jedis.hset(bfoo, bbar, bfoo); assertEquals(0, bstatus); @@ -46,7 +46,7 @@ public class HashesCommandsTest extends JedisCommandTestBase { @Test public void hsetnx() { - int status = jedis.hsetnx("foo", "bar", "car"); + long status = jedis.hsetnx("foo", "bar", "car"); assertEquals(1, status); assertEquals("car", jedis.hget("foo", "bar")); @@ -59,7 +59,7 @@ public class HashesCommandsTest extends JedisCommandTestBase { assertEquals("bar", jedis.hget("foo", "car")); // Binary - int bstatus = jedis.hsetnx(bfoo, bbar, bcar); + long bstatus = jedis.hsetnx(bfoo, bbar, bcar); assertEquals(1, bstatus); assertArrayEquals(bcar, jedis.hget(bfoo, bbar)); @@ -126,7 +126,7 @@ public class HashesCommandsTest extends JedisCommandTestBase { @Test public void hincrBy() { - int value = jedis.hincrBy("foo", "bar", 1); + long value = jedis.hincrBy("foo", "bar", 1); assertEquals(1, value); value = jedis.hincrBy("foo", "bar", -1); assertEquals(0, value); @@ -134,7 +134,7 @@ public class HashesCommandsTest extends JedisCommandTestBase { assertEquals(-10, value); // Binary - int bvalue = jedis.hincrBy(bfoo, bbar, 1); + long bvalue = jedis.hincrBy(bfoo, bbar, 1); assertEquals(1, bvalue); bvalue = jedis.hincrBy(bfoo, bbar, -1); assertEquals(0, bvalue); diff --git a/src/test/java/redis/clients/jedis/tests/commands/ListCommandsTest.java b/src/test/java/redis/clients/jedis/tests/commands/ListCommandsTest.java index 25ae7c9..a2b9f89 100644 --- a/src/test/java/redis/clients/jedis/tests/commands/ListCommandsTest.java +++ b/src/test/java/redis/clients/jedis/tests/commands/ListCommandsTest.java @@ -25,13 +25,13 @@ public class ListCommandsTest extends JedisCommandTestBase { @Test public void rpush() { - int size = jedis.rpush("foo", "bar"); + long size = jedis.rpush("foo", "bar"); assertEquals(1, size); size = jedis.rpush("foo", "foo"); assertEquals(2, size); // Binary - int bsize = jedis.rpush(bfoo, bbar); + long bsize = jedis.rpush(bfoo, bbar); assertEquals(1, bsize); bsize = jedis.rpush(bfoo, bfoo); assertEquals(2, bsize); @@ -40,13 +40,13 @@ public class ListCommandsTest extends JedisCommandTestBase { @Test public void lpush() { - int size = jedis.lpush("foo", "bar"); + long size = jedis.lpush("foo", "bar"); assertEquals(1, size); size = jedis.lpush("foo", "foo"); assertEquals(2, size); // Binary - int bsize = jedis.lpush(bfoo, bbar); + long bsize = jedis.lpush(bfoo, bbar); assertEquals(1, bsize); bsize = jedis.lpush(bfoo, bfoo); assertEquals(2, bsize); @@ -236,7 +236,7 @@ public class ListCommandsTest extends JedisCommandTestBase { jedis.lpush("foo", "b"); jedis.lpush("foo", "a"); - int count = jedis.lrem("foo", -2, "hello"); + long count = jedis.lrem("foo", -2, "hello"); List expected = new ArrayList(); expected.add("a"); @@ -258,7 +258,7 @@ public class ListCommandsTest extends JedisCommandTestBase { jedis.lpush(bfoo, bB); jedis.lpush(bfoo, bA); - int bcount = jedis.lrem(bfoo, -2, bhello); + long bcount = jedis.lrem(bfoo, -2, bhello); List bexpected = new ArrayList(); bexpected.add(bA); @@ -502,7 +502,7 @@ public class ListCommandsTest extends JedisCommandTestBase { @Test public void lpushx() { - int status = jedis.lpushx("foo", "bar"); + long status = jedis.lpushx("foo", "bar"); assertEquals(0, status); jedis.lpush("foo", "a"); @@ -510,7 +510,7 @@ public class ListCommandsTest extends JedisCommandTestBase { assertEquals(2, status); // Binary - int bstatus = jedis.lpushx(bfoo, bbar); + long bstatus = jedis.lpushx(bfoo, bbar); assertEquals(0, bstatus); jedis.lpush(bfoo, bA); @@ -521,7 +521,7 @@ public class ListCommandsTest extends JedisCommandTestBase { @Test public void rpushx() { - int status = jedis.rpushx("foo", "bar"); + long status = jedis.rpushx("foo", "bar"); assertEquals(0, status); jedis.lpush("foo", "a"); @@ -529,7 +529,7 @@ public class ListCommandsTest extends JedisCommandTestBase { assertEquals(2, status); // Binary - int bstatus = jedis.rpushx(bfoo, bbar); + long bstatus = jedis.rpushx(bfoo, bbar); assertEquals(0, bstatus); jedis.lpush(bfoo, bA); @@ -539,7 +539,7 @@ public class ListCommandsTest extends JedisCommandTestBase { @Test public void linsert() { - int status = jedis.linsert("foo", Client.LIST_POSITION.BEFORE, "bar", + long status = jedis.linsert("foo", Client.LIST_POSITION.BEFORE, "bar", "car"); assertEquals(0, status); @@ -559,7 +559,7 @@ public class ListCommandsTest extends JedisCommandTestBase { assertEquals(-1, status); // Binary - int bstatus = jedis.linsert(bfoo, Client.LIST_POSITION.BEFORE, bbar, + long bstatus = jedis.linsert(bfoo, Client.LIST_POSITION.BEFORE, bbar, bcar); assertEquals(0, bstatus); diff --git a/src/test/java/redis/clients/jedis/tests/commands/SetCommandsTest.java b/src/test/java/redis/clients/jedis/tests/commands/SetCommandsTest.java index f8add85..021dd82 100644 --- a/src/test/java/redis/clients/jedis/tests/commands/SetCommandsTest.java +++ b/src/test/java/redis/clients/jedis/tests/commands/SetCommandsTest.java @@ -18,13 +18,13 @@ public class SetCommandsTest extends JedisCommandTestBase { @Test public void sadd() { - int status = jedis.sadd("foo", "a"); + long status = jedis.sadd("foo", "a"); assertEquals(1, status); status = jedis.sadd("foo", "a"); assertEquals(0, status); - int bstatus = jedis.sadd(bfoo, ba); + long bstatus = jedis.sadd(bfoo, ba); assertEquals(1, bstatus); bstatus = jedis.sadd(bfoo, ba); @@ -63,7 +63,7 @@ public class SetCommandsTest extends JedisCommandTestBase { jedis.sadd("foo", "a"); jedis.sadd("foo", "b"); - int status = jedis.srem("foo", "a"); + long status = jedis.srem("foo", "a"); Set expected = new LinkedHashSet(); expected.add("b"); @@ -80,7 +80,7 @@ public class SetCommandsTest extends JedisCommandTestBase { jedis.sadd(bfoo, ba); jedis.sadd(bfoo, bb); - int bstatus = jedis.srem(bfoo, ba); + long bstatus = jedis.srem(bfoo, ba); Set bexpected = new LinkedHashSet(); bexpected.add(bb); @@ -128,7 +128,7 @@ public class SetCommandsTest extends JedisCommandTestBase { jedis.sadd("bar", "c"); - int status = jedis.smove("foo", "bar", "a"); + long status = jedis.smove("foo", "bar", "a"); Set expectedSrc = new LinkedHashSet(); expectedSrc.add("b"); @@ -151,7 +151,7 @@ public class SetCommandsTest extends JedisCommandTestBase { jedis.sadd(bbar, bc); - int bstatus = jedis.smove(bfoo, bbar, ba); + long bstatus = jedis.smove(bfoo, bbar, ba); Set bexpectedSrc = new LinkedHashSet(); bexpectedSrc.add(bb); @@ -174,7 +174,7 @@ public class SetCommandsTest extends JedisCommandTestBase { jedis.sadd("foo", "a"); jedis.sadd("foo", "b"); - int card = jedis.scard("foo"); + long card = jedis.scard("foo"); assertEquals(2, card); @@ -185,7 +185,7 @@ public class SetCommandsTest extends JedisCommandTestBase { jedis.sadd(bfoo, ba); jedis.sadd(bfoo, bb); - int bcard = jedis.scard(bfoo); + long bcard = jedis.scard(bfoo); assertEquals(2, bcard); @@ -199,7 +199,7 @@ public class SetCommandsTest extends JedisCommandTestBase { jedis.sadd("foo", "a"); jedis.sadd("foo", "b"); - int status = jedis.sismember("foo", "a"); + long status = jedis.sismember("foo", "a"); assertEquals(1, status); status = jedis.sismember("foo", "c"); @@ -209,7 +209,7 @@ public class SetCommandsTest extends JedisCommandTestBase { jedis.sadd(bfoo, ba); jedis.sadd(bfoo, bb); - int bstatus = jedis.sismember(bfoo, ba); + long bstatus = jedis.sismember(bfoo, ba); assertEquals(1, bstatus); bstatus = jedis.sismember(bfoo, bc); @@ -256,7 +256,7 @@ public class SetCommandsTest extends JedisCommandTestBase { Set expected = new LinkedHashSet(); expected.add("b"); - int status = jedis.sinterstore("car", "foo", "bar"); + long status = jedis.sinterstore("car", "foo", "bar"); assertEquals(1, status); assertEquals(expected, jedis.smembers("car")); @@ -271,7 +271,7 @@ public class SetCommandsTest extends JedisCommandTestBase { Set bexpected = new LinkedHashSet(); bexpected.add(bb); - int bstatus = jedis.sinterstore(bcar, bfoo, bbar); + long bstatus = jedis.sinterstore(bcar, bfoo, bbar); assertEquals(1, bstatus); assertEquals(bexpected, jedis.smembers(bcar)); @@ -324,7 +324,7 @@ public class SetCommandsTest extends JedisCommandTestBase { expected.add("b"); expected.add("c"); - int status = jedis.sunionstore("car", "foo", "bar"); + long status = jedis.sunionstore("car", "foo", "bar"); assertEquals(3, status); assertEquals(expected, jedis.smembers("car")); @@ -341,7 +341,7 @@ public class SetCommandsTest extends JedisCommandTestBase { bexpected.add(bc); bexpected.add(ba); - int bstatus = jedis.sunionstore(bcar, bfoo, bbar); + long bstatus = jedis.sunionstore(bcar, bfoo, bbar); assertEquals(3, bstatus); assertEquals(bexpected, jedis.smembers(bcar)); @@ -403,7 +403,7 @@ public class SetCommandsTest extends JedisCommandTestBase { expected.add("d"); expected.add("a"); - int status = jedis.sdiffstore("tar", "foo", "bar", "car"); + long status = jedis.sdiffstore("tar", "foo", "bar", "car"); assertEquals(2, status); assertEquals(expected, jedis.smembers("car")); @@ -422,7 +422,7 @@ public class SetCommandsTest extends JedisCommandTestBase { bexpected.add(bd); bexpected.add(ba); - int bstatus = jedis.sdiffstore("tar".getBytes(), bfoo, bbar, bcar); + long bstatus = jedis.sdiffstore("tar".getBytes(), bfoo, bbar, bcar); assertEquals(2, bstatus); assertEquals(bexpected, jedis.smembers(bcar)); diff --git a/src/test/java/redis/clients/jedis/tests/commands/SortedSetCommandsTest.java b/src/test/java/redis/clients/jedis/tests/commands/SortedSetCommandsTest.java index 76c7796..2c07bd9 100644 --- a/src/test/java/redis/clients/jedis/tests/commands/SortedSetCommandsTest.java +++ b/src/test/java/redis/clients/jedis/tests/commands/SortedSetCommandsTest.java @@ -19,7 +19,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { @Test public void zadd() { - int status = jedis.zadd("foo", 1d, "a"); + long status = jedis.zadd("foo", 1d, "a"); assertEquals(1, status); status = jedis.zadd("foo", 10d, "b"); @@ -32,7 +32,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { assertEquals(0, status); // Binary - int bstatus = jedis.zadd(bfoo, 1d, ba); + long bstatus = jedis.zadd(bfoo, 1d, ba); assertEquals(1, bstatus); bstatus = jedis.zadd(bfoo, 10d, bb); @@ -125,7 +125,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { jedis.zadd("foo", 1d, "a"); jedis.zadd("foo", 2d, "b"); - int status = jedis.zrem("foo", "a"); + long status = jedis.zrem("foo", "a"); Set expected = new LinkedHashSet(); expected.add("b"); @@ -141,7 +141,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { jedis.zadd(bfoo, 1d, ba); jedis.zadd(bfoo, 2d, bb); - int bstatus = jedis.zrem(bfoo, ba); + long bstatus = jedis.zrem(bfoo, ba); Set bexpected = new LinkedHashSet(); bexpected.add(bb); @@ -189,27 +189,25 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { jedis.zadd("foo", 1d, "a"); jedis.zadd("foo", 2d, "b"); - Integer rank = jedis.zrank("foo", "a"); - assertEquals(0, rank.intValue()); + long rank = jedis.zrank("foo", "a"); + assertEquals(0, rank); rank = jedis.zrank("foo", "b"); - assertEquals(1, rank.intValue()); + assertEquals(1, rank); - rank = jedis.zrank("car", "b"); - assertNull(rank); + assertNull(jedis.zrank("car", "b")); // Binary jedis.zadd(bfoo, 1d, ba); jedis.zadd(bfoo, 2d, bb); - Integer brank = jedis.zrank(bfoo, ba); - assertEquals(0, brank.intValue()); + long brank = jedis.zrank(bfoo, ba); + assertEquals(0, brank); brank = jedis.zrank(bfoo, bb); - assertEquals(1, brank.intValue()); + assertEquals(1, brank); - brank = jedis.zrank(bcar, bb); - assertNull(brank); + assertNull(jedis.zrank(bcar, bb)); } @@ -218,7 +216,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { jedis.zadd("foo", 1d, "a"); jedis.zadd("foo", 2d, "b"); - int rank = jedis.zrevrank("foo", "a"); + long rank = jedis.zrevrank("foo", "a"); assertEquals(1, rank); rank = jedis.zrevrank("foo", "b"); @@ -228,7 +226,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { jedis.zadd(bfoo, 1d, ba); jedis.zadd(bfoo, 2d, bb); - int brank = jedis.zrevrank(bfoo, ba); + long brank = jedis.zrevrank(bfoo, ba); assertEquals(1, brank); brank = jedis.zrevrank(bfoo, bb); @@ -317,7 +315,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { jedis.zadd("foo", 0.1d, "c"); jedis.zadd("foo", 2d, "a"); - int size = jedis.zcard("foo"); + long size = jedis.zcard("foo"); assertEquals(3, size); // Binary @@ -326,7 +324,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { jedis.zadd(bfoo, 0.1d, bc); jedis.zadd(bfoo, 2d, ba); - int bsize = jedis.zcard(bfoo); + long bsize = jedis.zcard(bfoo); assertEquals(3, bsize); } @@ -371,7 +369,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { jedis.zadd("foo", 0.1d, "c"); jedis.zadd("foo", 2d, "a"); - int result = jedis.zcount("foo", 0.01d, 2.1d); + long result = jedis.zcount("foo", 0.01d, 2.1d); assertEquals(2, result); @@ -381,7 +379,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { jedis.zadd(bfoo, 0.1d, bc); jedis.zadd(bfoo, 2d, ba); - int bresult = jedis.zcount(bfoo, 0.01d, 2.1d); + long bresult = jedis.zcount(bfoo, 0.01d, 2.1d); assertEquals(2, bresult); @@ -518,7 +516,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { jedis.zadd("foo", 0.1d, "c"); jedis.zadd("foo", 2d, "a"); - int result = jedis.zremrangeByRank("foo", 0, 0); + long result = jedis.zremrangeByRank("foo", 0, 0); assertEquals(1, result); @@ -534,7 +532,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { jedis.zadd(bfoo, 0.1d, bc); jedis.zadd(bfoo, 2d, ba); - int bresult = jedis.zremrangeByRank(bfoo, 0, 0); + long bresult = jedis.zremrangeByRank(bfoo, 0, 0); assertEquals(1, bresult); @@ -553,7 +551,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { jedis.zadd("foo", 0.1d, "c"); jedis.zadd("foo", 2d, "a"); - int result = jedis.zremrangeByScore("foo", 0, 2); + long result = jedis.zremrangeByScore("foo", 0, 2); assertEquals(2, result); @@ -568,7 +566,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { jedis.zadd(bfoo, 0.1d, bc); jedis.zadd(bfoo, 2d, ba); - int bresult = jedis.zremrangeByScore(bfoo, 0, 2); + long bresult = jedis.zremrangeByScore(bfoo, 0, 2); assertEquals(2, bresult); @@ -585,7 +583,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { jedis.zadd("bar", 2, "a"); jedis.zadd("bar", 2, "b"); - int result = jedis.zunionstore("dst", "foo", "bar"); + long result = jedis.zunionstore("dst", "foo", "bar"); assertEquals(2, result); @@ -601,7 +599,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { jedis.zadd(bbar, 2, ba); jedis.zadd(bbar, 2, bb); - int bresult = jedis.zunionstore(SafeEncoder.encode("dst"), bfoo, bbar); + long bresult = jedis.zunionstore(SafeEncoder.encode("dst"), bfoo, bbar); assertEquals(2, bresult); @@ -623,7 +621,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { ZParams params = new ZParams(); params.weights(2, 2); params.aggregate(ZParams.Aggregate.SUM); - int result = jedis.zunionstore("dst", params, "foo", "bar"); + long result = jedis.zunionstore("dst", params, "foo", "bar"); assertEquals(2, result); @@ -642,7 +640,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { ZParams bparams = new ZParams(); bparams.weights(2, 2); bparams.aggregate(ZParams.Aggregate.SUM); - int bresult = jedis.zunionstore(SafeEncoder.encode("dst"), bparams, + long bresult = jedis.zunionstore(SafeEncoder.encode("dst"), bparams, bfoo, bbar); assertEquals(2, bresult); @@ -661,7 +659,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { jedis.zadd("foo", 2, "b"); jedis.zadd("bar", 2, "a"); - int result = jedis.zinterstore("dst", "foo", "bar"); + long result = jedis.zinterstore("dst", "foo", "bar"); assertEquals(1, result); @@ -675,7 +673,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { jedis.zadd(bfoo, 2, bb); jedis.zadd(bbar, 2, ba); - int bresult = jedis.zinterstore(SafeEncoder.encode("dst"), bfoo, bbar); + long bresult = jedis.zinterstore(SafeEncoder.encode("dst"), bfoo, bbar); assertEquals(1, bresult); @@ -695,7 +693,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { ZParams params = new ZParams(); params.weights(2, 2); params.aggregate(ZParams.Aggregate.SUM); - int result = jedis.zinterstore("dst", params, "foo", "bar"); + long result = jedis.zinterstore("dst", params, "foo", "bar"); assertEquals(1, result); @@ -712,7 +710,7 @@ public class SortedSetCommandsTest extends JedisCommandTestBase { ZParams bparams = new ZParams(); bparams.weights(2, 2); bparams.aggregate(ZParams.Aggregate.SUM); - int bresult = jedis.zinterstore(SafeEncoder.encode("dst"), bparams, + long bresult = jedis.zinterstore(SafeEncoder.encode("dst"), bparams, bfoo, bbar); assertEquals(1, bresult); diff --git a/src/test/java/redis/clients/jedis/tests/commands/SortingCommandsTest.java b/src/test/java/redis/clients/jedis/tests/commands/SortingCommandsTest.java index 437069f..10d8965 100644 --- a/src/test/java/redis/clients/jedis/tests/commands/SortingCommandsTest.java +++ b/src/test/java/redis/clients/jedis/tests/commands/SortingCommandsTest.java @@ -271,7 +271,7 @@ public class SortingCommandsTest extends JedisCommandTestBase { jedis.lpush("foo", "2"); jedis.lpush("foo", "10"); - int result = jedis.sort("foo", "result"); + long result = jedis.sort("foo", "result"); List expected = new ArrayList(); expected.add("1"); @@ -287,7 +287,7 @@ public class SortingCommandsTest extends JedisCommandTestBase { jedis.lpush(bfoo, b10); byte[] bkresult = new byte[] { 0X09, 0x0A, 0x0B, 0x0C }; - int bresult = jedis.sort(bfoo, bkresult); + long bresult = jedis.sort(bfoo, bkresult); List bexpected = new ArrayList(); bexpected.add(b1); diff --git a/src/test/java/redis/clients/jedis/tests/commands/StringValuesCommandsTest.java b/src/test/java/redis/clients/jedis/tests/commands/StringValuesCommandsTest.java index 1f0da09..9533e4a 100644 --- a/src/test/java/redis/clients/jedis/tests/commands/StringValuesCommandsTest.java +++ b/src/test/java/redis/clients/jedis/tests/commands/StringValuesCommandsTest.java @@ -57,7 +57,7 @@ public class StringValuesCommandsTest extends JedisCommandTestBase { @Test public void setnx() { - int status = jedis.setnx("foo", "bar"); + long status = jedis.setnx("foo", "bar"); assertEquals(1, status); assertEquals("bar", jedis.get("foo")); @@ -70,7 +70,7 @@ public class StringValuesCommandsTest extends JedisCommandTestBase { public void setex() { String status = jedis.setex("foo", 20, "bar"); assertEquals("OK", status); - int ttl = jedis.ttl("foo"); + long ttl = jedis.ttl("foo"); assertTrue(ttl > 0 && ttl <= 20); } @@ -84,7 +84,7 @@ public class StringValuesCommandsTest extends JedisCommandTestBase { @Test public void msetnx() { - int status = jedis.msetnx("foo", "bar", "bar", "foo"); + long status = jedis.msetnx("foo", "bar", "bar", "foo"); assertEquals(1, status); assertEquals("bar", jedis.get("foo")); assertEquals("foo", jedis.get("bar")); @@ -103,7 +103,7 @@ public class StringValuesCommandsTest extends JedisCommandTestBase { @Test public void incr() { - int value = jedis.incr("foo"); + long value = jedis.incr("foo"); assertEquals(1, value); value = jedis.incr("foo"); assertEquals(2, value); @@ -117,7 +117,7 @@ public class StringValuesCommandsTest extends JedisCommandTestBase { @Test public void incrBy() { - int value = jedis.incrBy("foo", 2); + long value = jedis.incrBy("foo", 2); assertEquals(2, value); value = jedis.incrBy("foo", 2); assertEquals(4, value); @@ -131,7 +131,7 @@ public class StringValuesCommandsTest extends JedisCommandTestBase { @Test public void decr() { - int value = jedis.decr("foo"); + long value = jedis.decr("foo"); assertEquals(-1, value); value = jedis.decr("foo"); assertEquals(-2, value); @@ -145,7 +145,7 @@ public class StringValuesCommandsTest extends JedisCommandTestBase { @Test public void decrBy() { - int value = jedis.decrBy("foo", 2); + long value = jedis.decrBy("foo", 2); assertEquals(-2, value); value = jedis.decrBy("foo", 2); assertEquals(-4, value); @@ -153,7 +153,7 @@ public class StringValuesCommandsTest extends JedisCommandTestBase { @Test public void append() { - int value = jedis.append("foo", "bar"); + long value = jedis.append("foo", "bar"); assertEquals(3, value); assertEquals("bar", jedis.get("foo")); value = jedis.append("foo", "bar"); diff --git a/src/test/java/redis/clients/jedis/tests/commands/TransactionCommandsTest.java b/src/test/java/redis/clients/jedis/tests/commands/TransactionCommandsTest.java index a99f724..1681f5b 100644 --- a/src/test/java/redis/clients/jedis/tests/commands/TransactionCommandsTest.java +++ b/src/test/java/redis/clients/jedis/tests/commands/TransactionCommandsTest.java @@ -26,7 +26,8 @@ public class TransactionCommandsTest extends JedisCommandTestBase { Jedis nj; - @Before + @Override + @Before public void setUp() throws Exception { super.setUp(); @@ -52,9 +53,9 @@ public class TransactionCommandsTest extends JedisCommandTestBase { List response = trans.exec(); List expected = new ArrayList(); - expected.add(1); - expected.add(1); - expected.add(2); + expected.add(1L); + expected.add(1L); + expected.add(2L); assertEquals(expected, response); // Binary @@ -72,9 +73,9 @@ public class TransactionCommandsTest extends JedisCommandTestBase { response = trans.exec(); expected = new ArrayList(); - expected.add(1); - expected.add(1); - expected.add(2); + expected.add(1L); + expected.add(1L); + expected.add(2L); assertEquals(expected, response); } @@ -82,7 +83,8 @@ public class TransactionCommandsTest extends JedisCommandTestBase { @Test public void multiBlock() { List response = jedis.multi(new TransactionBlock() { - public void execute() { + @Override + public void execute() { String status = sadd("foo", "a"); assertEquals(Keyword.QUEUED.name(), status); @@ -95,14 +97,15 @@ public class TransactionCommandsTest extends JedisCommandTestBase { }); List expected = new ArrayList(); - expected.add(1); - expected.add(1); - expected.add(2); + expected.add(1L); + expected.add(1L); + expected.add(2L); assertEquals(expected, response); // Binary response = jedis.multi(new TransactionBlock() { - public void execute() { + @Override + public void execute() { String status = sadd(bfoo, ba); assertEquals(Keyword.QUEUED.name(), status); @@ -115,9 +118,9 @@ public class TransactionCommandsTest extends JedisCommandTestBase { }); expected = new ArrayList(); - expected.add(1); - expected.add(1); - expected.add(2); + expected.add(1L); + expected.add(1L); + expected.add(2L); assertEquals(expected, response); }