diff --git a/redisson/src/main/java/org/redisson/client/protocol/RedisCommands.java b/redisson/src/main/java/org/redisson/client/protocol/RedisCommands.java index f1c7b3fe0..be3dbfc2a 100644 --- a/redisson/src/main/java/org/redisson/client/protocol/RedisCommands.java +++ b/redisson/src/main/java/org/redisson/client/protocol/RedisCommands.java @@ -143,7 +143,7 @@ public interface RedisCommands { RedisCommand> EXEC = new RedisCommand>("EXEC", new ObjectListReplayDecoder()); RedisCommand SADD_BOOL = new RedisCommand("SADD", new BooleanAmountReplayConvertor(), 2, ValueType.OBJECTS); - RedisStrictCommand SADD = new RedisStrictCommand("SADD", 2, ValueType.OBJECTS); + RedisCommand SADD = new RedisCommand("SADD", new IntegerReplayConvertor(), 2, ValueType.OBJECTS); RedisCommand> SPOP = new RedisCommand>("SPOP", new ObjectSetReplayDecoder()); RedisCommand SPOP_SINGLE = new RedisCommand("SPOP"); RedisCommand SADD_SINGLE = new RedisCommand("SADD", new BooleanReplayConvertor(), 2); @@ -200,12 +200,12 @@ public interface RedisCommands { RedisCommand SORT_TO = new RedisCommand("SORT", new IntegerReplayConvertor()); RedisStrictCommand RPOP = new RedisStrictCommand("RPOP"); - RedisStrictCommand LPUSH = new RedisStrictCommand("LPUSH", 2, ValueType.OBJECTS); + RedisCommand LPUSH = new RedisCommand("LPUSH", new IntegerReplayConvertor(), 2, ValueType.OBJECTS); RedisCommand LPUSH_BOOLEAN = new RedisCommand("LPUSH", new TrueReplayConvertor(), 2, ValueType.OBJECTS); RedisStrictCommand LPUSH_VOID = new RedisStrictCommand("LPUSH", new VoidReplayConvertor(), 2); RedisCommand> LRANGE = new RedisCommand>("LRANGE", new ObjectListReplayDecoder()); RedisCommand> LRANGE_SET = new RedisCommand>("LRANGE", new ObjectSetReplayDecoder()); - RedisCommand RPUSH = new RedisCommand("RPUSH", 2, ValueType.OBJECTS); + RedisCommand RPUSH = new RedisCommand("RPUSH", new IntegerReplayConvertor(), 2, ValueType.OBJECTS); RedisCommand RPUSH_BOOLEAN = new RedisCommand("RPUSH", new TrueReplayConvertor(), 2, ValueType.OBJECTS); RedisCommand RPUSH_VOID = new RedisCommand("RPUSH", new VoidReplayConvertor(), 2, ValueType.OBJECTS); diff --git a/redisson/src/main/java/org/redisson/reactive/RedissonListReactive.java b/redisson/src/main/java/org/redisson/reactive/RedissonListReactive.java index 040f494ea..bd6a70a71 100644 --- a/redisson/src/main/java/org/redisson/reactive/RedissonListReactive.java +++ b/redisson/src/main/java/org/redisson/reactive/RedissonListReactive.java @@ -35,6 +35,7 @@ import org.redisson.client.codec.Codec; import org.redisson.client.protocol.RedisCommand; import org.redisson.client.protocol.RedisCommand.ValueType; import org.redisson.client.protocol.RedisCommands; +import org.redisson.client.protocol.convertor.IntegerReplayConvertor; import org.redisson.client.protocol.convertor.LongReplayConvertor; import org.redisson.command.CommandReactiveExecutor; @@ -68,7 +69,7 @@ public class RedissonListReactive extends RedissonExpirableReactive implement @Override public Publisher size() { - return commandExecutor.readReactive(getName(), codec, LLEN, getName()); + return commandExecutor.readReactive(getName(), codec, RedisCommands.LLEN_INT, getName()); } @Override @@ -220,7 +221,7 @@ public class RedissonListReactive extends RedissonExpirableReactive implement List args = new ArrayList(coll.size() + 1); args.add(index); args.addAll(coll); - return commandExecutor.evalWriteReactive(getName(), codec, new RedisCommand("EVAL", new LongReplayConvertor(), 5, ValueType.OBJECTS), + return commandExecutor.evalWriteReactive(getName(), codec, new RedisCommand("EVAL", new IntegerReplayConvertor(), 5, ValueType.OBJECTS), "local ind = table.remove(ARGV, 1); " + // index is the first parameter "local size = redis.call('llen', KEYS[1]); " + "assert(tonumber(ind) <= size, 'index: ' .. ind .. ' but current size: ' .. size); " + @@ -332,8 +333,8 @@ public class RedissonListReactive extends RedissonExpirableReactive implement } }).count().next().poll(); - boolean res = count.equals(Streams.wrap(size()).next().poll()); - res &= count.equals(Streams.wrap(((RedissonListReactive) o).size()).next().poll()); + boolean res = count.intValue() == Streams.wrap(size()).next().poll(); + res &= count.intValue() == Streams.wrap(((RedissonListReactive) o).size()).next().poll(); return res; } diff --git a/redisson/src/main/java/org/redisson/reactive/RedissonSetCacheReactive.java b/redisson/src/main/java/org/redisson/reactive/RedissonSetCacheReactive.java index c4882f69f..1a6765ac4 100644 --- a/redisson/src/main/java/org/redisson/reactive/RedissonSetCacheReactive.java +++ b/redisson/src/main/java/org/redisson/reactive/RedissonSetCacheReactive.java @@ -71,7 +71,7 @@ public class RedissonSetCacheReactive extends RedissonExpirableReactive imple @Override public Publisher size() { - return commandExecutor.readReactive(getName(), codec, RedisCommands.ZCARD, getName()); + return commandExecutor.readReactive(getName(), codec, RedisCommands.ZCARD_INT, getName()); } @Override @@ -116,7 +116,7 @@ public class RedissonSetCacheReactive extends RedissonExpirableReactive imple @Override public Publisher add(V value) { long timeoutDate = 92233720368547758L; - return commandExecutor.evalWriteReactive(getName(), codec, RedisCommands.EVAL_LONG, + return commandExecutor.evalWriteReactive(getName(), codec, RedisCommands.EVAL_INTEGER, "local expireDateScore = redis.call('zscore', KEYS[1], ARGV[3]); " + "if expireDateScore ~= false and tonumber(expireDateScore) > tonumber(ARGV[1]) then " + "return 0;" diff --git a/redisson/src/main/java/org/redisson/reactive/RedissonSetReactive.java b/redisson/src/main/java/org/redisson/reactive/RedissonSetReactive.java index 647cdb2fb..54d8e4f25 100644 --- a/redisson/src/main/java/org/redisson/reactive/RedissonSetReactive.java +++ b/redisson/src/main/java/org/redisson/reactive/RedissonSetReactive.java @@ -63,7 +63,7 @@ public class RedissonSetReactive extends RedissonExpirableReactive implements @Override public Publisher size() { - return commandExecutor.readReactive(getName(), codec, RedisCommands.SCARD, getName()); + return commandExecutor.readReactive(getName(), codec, RedisCommands.SCARD_INT, getName()); } @Override diff --git a/redisson/src/test/java/org/redisson/CommandHandlersTest.java b/redisson/src/test/java/org/redisson/CommandHandlersTest.java index 98099ac94..111d1f890 100644 --- a/redisson/src/test/java/org/redisson/CommandHandlersTest.java +++ b/redisson/src/test/java/org/redisson/CommandHandlersTest.java @@ -7,7 +7,7 @@ import org.redisson.config.Config; public class CommandHandlersTest extends BaseTest { - @Test(expected = RedisException.class) + @Test(expected = RuntimeException.class) public void testEncoder() throws InterruptedException { Config config = createConfig(); config.setCodec(new ErrorsCodec()); @@ -17,7 +17,7 @@ public class CommandHandlersTest extends BaseTest { redisson.getBucket("1234").set("1234"); } - @Test(expected = RedisException.class) + @Test(expected = RuntimeException.class) public void testDecoder() { redisson.getBucket("1234").set("1234");