From b3216dce16163c9fb7bfe869137237530dc9d88d Mon Sep 17 00:00:00 2001 From: M Sazzadul Hoque <7600764+sazzad16@users.noreply.github.com> Date: Wed, 3 May 2023 18:19:13 +0600 Subject: [PATCH 1/5] Cleanup deprecations for Jedis 5.0 --- .../redis/clients/jedis/CommandArguments.java | 8 -- .../redis/clients/jedis/CommandObjects.java | 111 +++--------------- .../clients/jedis/ConnectionFactory.java | 9 -- .../jedis/DefaultJedisClientConfig.java | 7 -- src/main/java/redis/clients/jedis/Jedis.java | 106 +---------------- .../clients/jedis/JedisClientConfig.java | 4 - .../redis/clients/jedis/JedisCluster.java | 34 ++++++ .../clients/jedis/JedisClusterInfoCache.java | 11 -- .../redis/clients/jedis/JedisFactory.java | 11 +- .../redis/clients/jedis/JedisSentineled.java | 30 ----- .../clients/jedis/MultiNodePipelineBase.java | 87 -------------- .../java/redis/clients/jedis/Pipeline.java | 87 -------------- .../java/redis/clients/jedis/Protocol.java | 29 ++--- .../redis/clients/jedis/TransactionBase.java | 87 -------------- .../redis/clients/jedis/UnifiedJedis.java | 51 +------- .../jedis/bloom/RedisBloomProtocol.java | 1 - .../bloom/commands/TopKFilterCommands.java | 11 -- .../commands/TopKFilterPipelineCommands.java | 6 - .../jedis/commands/ServerCommands.java | 12 +- .../jedis/commands/StreamBinaryCommands.java | 12 -- .../jedis/commands/StreamCommands.java | 15 --- .../StreamPipelineBinaryCommands.java | 12 -- .../commands/StreamPipelineCommands.java | 15 --- .../jedis/commands/StringBinaryCommands.java | 7 -- .../jedis/commands/StringCommands.java | 17 +-- .../StringPipelineBinaryCommands.java | 7 -- .../commands/StringPipelineCommands.java | 7 -- .../clients/jedis/graph/GraphQueryParams.java | 6 - .../redis/clients/jedis/params/SetParams.java | 16 --- .../clients/jedis/params/XPendingParams.java | 65 ++++------ .../redis/clients/jedis/search/Document.java | 18 +-- .../redis/clients/jedis/search/FieldName.java | 5 - .../jedis/search/FtSearchIteration.java | 4 +- .../clients/jedis/search/IndexDefinition.java | 23 ---- .../redis/clients/jedis/search/Query.java | 38 ------ .../search/RediSearchPipelineCommands.java | 21 ---- .../redis/clients/jedis/search/Schema.java | 10 +- .../clients/jedis/search/SearchProtocol.java | 6 +- .../clients/jedis/search/SearchResult.java | 13 +- .../jedis/search/aggr/AggregationBuilder.java | 16 --- .../jedis/search/aggr/AggregationResult.java | 6 +- .../jedis/timeseries/TSAlterParams.java | 8 -- .../redis/clients/jedis/ACLJedisPoolTest.java | 47 -------- .../redis/clients/jedis/JedisPoolTest.java | 46 -------- .../redis/clients/jedis/JedisPooledTest.java | 18 --- .../clients/jedis/JedisSentinelPoolTest.java | 39 ------ .../clients/jedis/ShardedConnectionTest.java | 64 +++++----- .../jedis/AllKindOfValuesCommandsTest.java | 5 +- .../commands/jedis/StreamsCommandsTest.java | 13 +- .../jedis/StringValuesCommandsTest.java | 79 ------------- .../AllKindOfValuesCommandsTestBase.java | 4 +- .../unified/StringValuesCommandsTestBase.java | 79 ------------- .../modules/RedisModulesPipelineTest.java | 13 +- .../clients/jedis/modules/bloom/TopKTest.java | 2 - .../jedis/modules/search/AggregationTest.java | 14 +-- .../jedis/modules/search/DocumentTest.java | 14 +-- .../jedis/modules/search/JsonSearchTest.java | 7 +- 57 files changed, 181 insertions(+), 1312 deletions(-) diff --git a/src/main/java/redis/clients/jedis/CommandArguments.java b/src/main/java/redis/clients/jedis/CommandArguments.java index c4c4151281..77793fc378 100644 --- a/src/main/java/redis/clients/jedis/CommandArguments.java +++ b/src/main/java/redis/clients/jedis/CommandArguments.java @@ -56,14 +56,6 @@ public CommandArguments addObjects(Collection args) { return this; } - @Deprecated - public CommandArguments addObjects(int[] ints) { - for (int i : ints) { - add(i); - } - return this; - } - public CommandArguments key(Object key) { if (key instanceof Rawable) { Rawable raw = (Rawable) key; diff --git a/src/main/java/redis/clients/jedis/CommandObjects.java b/src/main/java/redis/clients/jedis/CommandObjects.java index 395bcf94de..577b6b745a 100644 --- a/src/main/java/redis/clients/jedis/CommandObjects.java +++ b/src/main/java/redis/clients/jedis/CommandObjects.java @@ -430,6 +430,10 @@ public final CommandObject get(String key) { return new CommandObject<>(commandArguments(Command.GET).key(key), BuilderFactory.STRING); } + public final CommandObject setGet(String key, String value) { + return new CommandObject<>(commandArguments(Command.SET).key(key).add(value).add(Keyword.GET), BuilderFactory.STRING); + } + public final CommandObject setGet(String key, String value, SetParams params) { return new CommandObject<>(commandArguments(Command.SET).key(key).add(value).addParams(params) .add(Keyword.GET), BuilderFactory.STRING); @@ -676,34 +680,6 @@ public final CommandObject bitop(BitOP op, byte[] destKey, byte[]... srcKe return new CommandObject<>(commandArguments(BITOP).add(op).key(destKey).keys((Object[]) srcKeys), BuilderFactory.LONG); } - /** - * @param keyA - * @param keyB - * @param params - * @return - * @deprecated STRALGO LCS command will be removed from Redis 7. - * LCS can be used instead of this method. - */ - @Deprecated - public final CommandObject strAlgoLCSKeys(String keyA, String keyB, StrAlgoLCSParams params) { - return new CommandObject<>(commandArguments(STRALGO).add(Keyword.LCS).add(Keyword.KEYS) - .key(keyA).key(keyB).addParams(params), BuilderFactory.STR_ALGO_LCS_RESULT_BUILDER); - } - - /** - * @param keyA - * @param keyB - * @param params - * @return - * @deprecated STRALGO LCS command will be removed from Redis 7. - * LCS can be used instead of this method. - */ - @Deprecated - public final CommandObject strAlgoLCSKeys(byte[] keyA, byte[] keyB, StrAlgoLCSParams params) { - return new CommandObject<>(commandArguments(STRALGO).add(Keyword.LCS).add(Keyword.KEYS) - .key(keyA).key(keyB).addParams(params), BuilderFactory.STR_ALGO_LCS_RESULT_BUILDER); - } - public final CommandObject lcs(String keyA, String keyB, LCSParams params) { return new CommandObject<>(commandArguments(Command.LCS).key(keyA).key(keyB) .addParams(params), BuilderFactory.STR_ALGO_LCS_RESULT_BUILDER); @@ -2525,25 +2501,6 @@ public final CommandObject xpending(String key, String gro BuilderFactory.STREAM_PENDING_SUMMARY); } - /** - * @param key - * @param groupName - * @param start - * @param end - * @param count - * @param consumerName - * @return - * @deprecated Use {@link CommandObjects#xpending(java.lang.String, java.lang.String, redis.clients.jedis.params.XPendingParams)}. - */ - @Deprecated - public final CommandObject> xpending(String key, String groupName, - StreamEntryID start, StreamEntryID end, int count, String consumerName) { - CommandArguments args = commandArguments(XPENDING).key(key).add(groupName) - .add(start == null ? "-" : start).add(end == null ? "+" : end).add(count); - if (consumerName != null) args.add(consumerName); - return new CommandObject<>(args, BuilderFactory.STREAM_PENDING_ENTRY_LIST); - } - public final CommandObject> xpending(String key, String groupName, XPendingParams params) { return new CommandObject<>(commandArguments(XPENDING).key(key).add(groupName) .addParams(params), BuilderFactory.STREAM_PENDING_ENTRY_LIST); @@ -2554,18 +2511,6 @@ public final CommandObject xpending(byte[] key, byte[] groupName) { BuilderFactory.RAW_OBJECT); } - /** - * @deprecated Use {@link CommandObjects#xpending(byte[], byte[], redis.clients.jedis.params.XPendingParams)}. - */ - @Deprecated - public final CommandObject> xpending(byte[] key, byte[] groupName, - byte[] start, byte[] end, int count, byte[] consumerName) { - CommandArguments args = commandArguments(XPENDING).key(key).add(groupName) - .add(start == null ? "-" : start).add(end == null ? "+" : end).add(count); - if (consumerName != null) args.add(consumerName); - return new CommandObject<>(args, BuilderFactory.RAW_OBJECT_LIST); - } - public final CommandObject> xpending(byte[] key, byte[] groupName, XPendingParams params) { return new CommandObject<>(commandArguments(XPENDING).key(key).add(groupName) .addParams(params), BuilderFactory.RAW_OBJECT_LIST); @@ -2653,20 +2598,10 @@ public final CommandObject xinfoStreamFull(byte[] key) { return new CommandObject<>(commandArguments(XINFO).add(STREAM).key(key).add(FULL), BuilderFactory.RAW_OBJECT); } - @Deprecated - public final CommandObject> xinfoGroup(String key) { - return new CommandObject<>(commandArguments(XINFO).add(GROUPS).key(key), BuilderFactory.STREAM_GROUP_INFO_LIST); - } - public final CommandObject> xinfoGroups(String key) { return new CommandObject<>(commandArguments(XINFO).add(GROUPS).key(key), BuilderFactory.STREAM_GROUP_INFO_LIST); } - @Deprecated - public final CommandObject> xinfoGroup(byte[] key) { - return new CommandObject<>(commandArguments(XINFO).add(GROUPS).key(key), BuilderFactory.RAW_OBJECT_LIST); - } - public final CommandObject> xinfoGroups(byte[] key) { return new CommandObject<>(commandArguments(XINFO).add(GROUPS).key(key), BuilderFactory.RAW_OBJECT_LIST); } @@ -3048,20 +2983,6 @@ public final CommandObject functionRestore(byte[] serializedValue, Funct // Scripting commands // Miscellaneous commands - @Deprecated - public final CommandObject strAlgoLCSStrings(String strA, String strB, StrAlgoLCSParams params) { - return new CommandObject<>(commandArguments(STRALGO).add(Keyword.LCS).add(STRINGS) - .add(strA).add(strB).addParams(params), - BuilderFactory.STR_ALGO_LCS_RESULT_BUILDER); - } - - @Deprecated - public final CommandObject strAlgoLCSStrings(byte[] strA, byte[] strB, StrAlgoLCSParams params) { - return new CommandObject<>(commandArguments(STRALGO).add(Keyword.LCS).add(STRINGS) - .add(strA).add(strB).addParams(params), - BuilderFactory.STR_ALGO_LCS_RESULT_BUILDER); - } - public final CommandObject copy(String srcKey, String dstKey, int dstDB, boolean replace) { CommandArguments args = commandArguments(Command.COPY).key(srcKey).key(dstKey).add(DB).add(dstDB); if (replace) args.add(REPLACE); @@ -3181,6 +3102,14 @@ public final CommandObject publish(String channel, String message) { public final CommandObject publish(byte[] channel, byte[] message) { return new CommandObject<>(commandArguments(PUBLISH).add(channel).add(message), BuilderFactory.LONG); } + + public final CommandObject spublish(String channel, String message) { + return new CommandObject<>(commandArguments(PUBLISH).add(channel).add(message), BuilderFactory.LONG); + } + + public final CommandObject spublish(byte[] channel, byte[] message) { + return new CommandObject<>(commandArguments(PUBLISH).add(channel).add(message), BuilderFactory.LONG); + } // Miscellaneous commands // RediSearch commands @@ -3237,22 +3166,22 @@ public final CommandObject ftAlter(String indexName, Iterable ftSearch(String indexName, String query) { return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.SEARCH), indexName).add(query), - new SearchResultBuilder(true, false, false, true)); + new SearchResultBuilder(true, false, true)); } public final CommandObject ftSearch(String indexName, String query, FTSearchParams params) { return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.SEARCH), indexName) - .add(query).addParams(params), new SearchResultBuilder(!params.getNoContent(), params.getWithScores(), false, true)); + .add(query).addParams(params), new SearchResultBuilder(!params.getNoContent(), params.getWithScores(), true)); } public final CommandObject ftSearch(String indexName, Query query) { return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.SEARCH), indexName).addParams(query), - new SearchResultBuilder(!query.getNoContent(), query.getWithScores(), query.getWithPayloads(), true)); + new SearchResultBuilder(!query.getNoContent(), query.getWithScores(), true)); } public final CommandObject ftSearch(byte[] indexName, Query query) { return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.SEARCH), indexName).addParams(query), - new SearchResultBuilder(!query.getNoContent(), query.getWithScores(), query.getWithPayloads(), false)); + new SearchResultBuilder(!query.getNoContent(), query.getWithScores(), false)); } public final CommandObject ftExplain(String indexName, Query query) { @@ -3296,7 +3225,7 @@ public final CommandObject>> ftProfi return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.PROFILE), indexName) .add(SearchKeyword.SEARCH).addParams(profileParams).add(SearchKeyword.QUERY) .addParams(query), new SearchProfileResponseBuilder<>(new SearchResultBuilder( - !query.getNoContent(), query.getWithScores(), query.getWithPayloads(), true))); + !query.getNoContent(), query.getWithScores(), true))); } public final CommandObject>> ftProfileSearch( @@ -3304,7 +3233,7 @@ public final CommandObject>> ftProfi return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.PROFILE), indexName) .add(SearchKeyword.SEARCH).addParams(profileParams).add(SearchKeyword.QUERY).add(query) .addParams(searchParams), new SearchProfileResponseBuilder<>(new SearchResultBuilder( - !searchParams.getNoContent(), searchParams.getWithScores(), false, true))); + !searchParams.getNoContent(), searchParams.getWithScores(), true))); } public final CommandObject ftDropIndex(String indexName) { @@ -4076,10 +4005,6 @@ public final CommandObject> topkQuery(String key, String... items) return new CommandObject<>(commandArguments(TopKCommand.QUERY).key(key).addObjects((Object[]) items), BuilderFactory.BOOLEAN_LIST); } - public final CommandObject> topkCount(String key, String... items) { - return new CommandObject<>(commandArguments(TopKCommand.COUNT).key(key).addObjects((Object[]) items), BuilderFactory.LONG_LIST); - } - public final CommandObject> topkList(String key) { return new CommandObject<>(commandArguments(TopKCommand.LIST).key(key), BuilderFactory.STRING_LIST); } diff --git a/src/main/java/redis/clients/jedis/ConnectionFactory.java b/src/main/java/redis/clients/jedis/ConnectionFactory.java index 471d33b5aa..d286462347 100644 --- a/src/main/java/redis/clients/jedis/ConnectionFactory.java +++ b/src/main/java/redis/clients/jedis/ConnectionFactory.java @@ -35,15 +35,6 @@ public ConnectionFactory(final JedisSocketFactory jedisSocketFactory, final Jedi this.jedisSocketFactory = jedisSocketFactory; } - /** - * @deprecated Use {@link RedisCredentialsProvider} through - * {@link JedisClientConfig#getCredentialsProvider()}. - */ - @Deprecated - public void setPassword(final String password) { - this.clientConfig.updatePassword(password); - } - @Override public void activateObject(PooledObject pooledConnection) throws Exception { // what to do ?? diff --git a/src/main/java/redis/clients/jedis/DefaultJedisClientConfig.java b/src/main/java/redis/clients/jedis/DefaultJedisClientConfig.java index b9d591f288..5f0b4866f1 100644 --- a/src/main/java/redis/clients/jedis/DefaultJedisClientConfig.java +++ b/src/main/java/redis/clients/jedis/DefaultJedisClientConfig.java @@ -78,13 +78,6 @@ public Supplier getCredentialsProvider() { return credentialsProvider; } - @Override - @Deprecated - public synchronized void updatePassword(String password) { - ((DefaultRedisCredentialsProvider) this.credentialsProvider) - .setCredentials(new DefaultRedisCredentials(getUser(), password)); - } - @Override public int getDatabase() { return database; diff --git a/src/main/java/redis/clients/jedis/Jedis.java b/src/main/java/redis/clients/jedis/Jedis.java index 284b558a2d..df46b6922a 100644 --- a/src/main/java/redis/clients/jedis/Jedis.java +++ b/src/main/java/redis/clients/jedis/Jedis.java @@ -3385,21 +3385,6 @@ public void shutdown() throws JedisException { } } - /** - * @deprecated Use {@link Jedis#shutdown(redis.clients.jedis.params.ShutdownParams)}. - */ - @Override - @Deprecated - public void shutdown(final SaveMode saveMode) throws JedisException { - connection.sendCommand(SHUTDOWN, saveMode.getRaw()); - try { - throw new JedisException(connection.getStatusCodeReply()); - } catch (JedisConnectionException jce) { - // expected - connection.setBroken(); - } - } - @Override public void shutdown(ShutdownParams shutdownParams) throws JedisException { connection.sendCommand(new CommandArguments(SHUTDOWN).addParams(shutdownParams)); @@ -3677,26 +3662,6 @@ public long strlen(final byte[] key) { return connection.executeCommand(commandObjects.strlen(key)); } - /** - * @deprecated STRALGO LCS command will be removed from Redis 7. - * {@link Jedis#lcs(byte[], byte[], LCSParams) LCS} can be used instead of this method. - */ - @Override - @Deprecated - public LCSMatchResult strAlgoLCSKeys(final byte[] keyA, final byte[] keyB, final StrAlgoLCSParams params) { - checkIsInMultiOrPipeline(); - return connection.executeCommand(commandObjects.strAlgoLCSKeys(keyA, keyB, params)); - } - - /** - * @deprecated STRALGO LCS command will be removed from Redis 7. - */ - @Deprecated - public LCSMatchResult strAlgoLCSStrings(final byte[] strA, final byte[] strB, final StrAlgoLCSParams params) { - checkIsInMultiOrPipeline(); - return connection.executeCommand(commandObjects.strAlgoLCSStrings(strA, strB, params)); - } - @Override public LCSMatchResult lcs(final byte[] keyA, final byte[] keyB, final LCSParams params) { checkIsInMultiOrPipeline(); @@ -4759,17 +4724,6 @@ public long xtrim(byte[] key, XTrimParams params) { return connection.executeCommand(commandObjects.xtrim(key, params)); } - /** - * @deprecated Use {@link Jedis#xpending(byte[], byte[], redis.clients.jedis.params.XPendingParams)}. - */ - @Override - @Deprecated - public List xpending(byte[] key, byte[] groupName, byte[] start, byte[] end, int count, - byte[] consumerName) { - checkIsInMultiOrPipeline(); - return connection.executeCommand(commandObjects.xpending(key, groupName, start, end, count, consumerName)); - } - @Override public Object xpending(final byte[] key, final byte[] groupName) { checkIsInMultiOrPipeline(); @@ -4828,13 +4782,6 @@ public Object xinfoStreamFull(byte[] key, int count) { return connection.executeCommand(commandObjects.xinfoStreamFull(key, count)); } - @Override - @Deprecated - public List xinfoGroup(byte[] key) { - checkIsInMultiOrPipeline(); - return connection.executeCommand(commandObjects.xinfoGroup(key)); - } - @Override public List xinfoGroups(byte[] key) { checkIsInMultiOrPipeline(); @@ -4954,6 +4901,12 @@ public String get(final String key) { return connection.executeCommand(commandObjects.get(key)); } + @Override + public String setGet(final String key, final String value) { + checkIsInMultiOrPipeline(); + return connection.executeCommand(commandObjects.setGet(key, value)); + } + @Override public String setGet(final String key, final String value, final SetParams params) { checkIsInMultiOrPipeline(); @@ -7728,36 +7681,6 @@ public long strlen(final String key) { return connection.executeCommand(commandObjects.strlen(key)); } - /** - * Calculate the longest common subsequence of keyA and keyB. - * @deprecated STRALGO LCS command will be removed from Redis 7. - * {@link Jedis#lcs(String, String, LCSParams) LCS} can be used instead of this method. - * @param keyA - * @param keyB - * @param params - * @return According to StrAlgoLCSParams to decide to return content to fill LCSMatchResult. - */ - @Override - @Deprecated - public LCSMatchResult strAlgoLCSKeys(final String keyA, final String keyB, final StrAlgoLCSParams params) { - checkIsInMultiOrPipeline(); - return connection.executeCommand(commandObjects.strAlgoLCSKeys(keyA, keyB, params)); - } - - /** - * Calculate the longest common subsequence of strA and strB. - * @deprecated STRALGO LCS command will be removed from Redis 7. - * @param strA - * @param strB - * @param params - * @return According to StrAlgoLCSParams to decide to return content to fill LCSMatchResult. - */ - @Deprecated - public LCSMatchResult strAlgoLCSStrings(final String strA, final String strB, final StrAlgoLCSParams params) { - checkIsInMultiOrPipeline(); - return connection.executeCommand(commandObjects.strAlgoLCSStrings(strA, strB, params)); - } - /** * Calculate the longest common subsequence of keyA and keyB. * @param keyA @@ -9429,17 +9352,6 @@ public StreamPendingSummary xpending(final String key, final String groupName) { return connection.executeCommand(commandObjects.xpending(key, groupName)); } - /** - * @deprecated Use {@link Jedis#xpending(java.lang.String, java.lang.String, redis.clients.jedis.params.XPendingParams)}. - */ - @Override - @Deprecated - public List xpending(final String key, final String groupName, - final StreamEntryID start, final StreamEntryID end, final int count, final String consumerName) { - checkIsInMultiOrPipeline(); - return connection.executeCommand(commandObjects.xpending(key, groupName, start, end, count, consumerName)); - } - @Override public List xpending(final String key, final String groupName, final XPendingParams params) { checkIsInMultiOrPipeline(); @@ -9491,12 +9403,6 @@ public StreamFullInfo xinfoStreamFull(String key, int count) { return connection.executeCommand(commandObjects.xinfoStreamFull(key, count)); } - @Override - @Deprecated - public List xinfoGroup(String key) { - return connection.executeCommand(commandObjects.xinfoGroup(key)); - } - @Override public List xinfoGroups(String key) { return connection.executeCommand(commandObjects.xinfoGroups(key)); diff --git a/src/main/java/redis/clients/jedis/JedisClientConfig.java b/src/main/java/redis/clients/jedis/JedisClientConfig.java index 5b22fdb356..beb0eabba6 100644 --- a/src/main/java/redis/clients/jedis/JedisClientConfig.java +++ b/src/main/java/redis/clients/jedis/JedisClientConfig.java @@ -44,10 +44,6 @@ default String getPassword() { return null; } - @Deprecated - default void updatePassword(String password) { - } - default Supplier getCredentialsProvider() { return new DefaultRedisCredentialsProvider( new DefaultRedisCredentials(getUser(), getPassword())); diff --git a/src/main/java/redis/clients/jedis/JedisCluster.java b/src/main/java/redis/clients/jedis/JedisCluster.java index 97537f5b68..31879f0e0e 100644 --- a/src/main/java/redis/clients/jedis/JedisCluster.java +++ b/src/main/java/redis/clients/jedis/JedisCluster.java @@ -205,6 +205,40 @@ public Connection getConnectionFromSlot(int slot) { return ((ClusterConnectionProvider) provider).getConnectionFromSlot(slot); } + // commands + public long publish(String channel, String message) { + return executeCommand(commandObjects.publish(channel, message)); + } + + public long publish(byte[] channel, byte[] message) { + return executeCommand(commandObjects.publish(channel, message)); + } + + public void subscribe(final JedisPubSub jedisPubSub, final String... channels) { + try (Connection connection = this.provider.getConnection()) { + jedisPubSub.proceed(connection, channels); + } + } + + public void psubscribe(final JedisPubSub jedisPubSub, final String... patterns) { + try (Connection connection = this.provider.getConnection()) { + jedisPubSub.proceedWithPatterns(connection, patterns); + } + } + + public void subscribe(BinaryJedisPubSub jedisPubSub, final byte[]... channels) { + try (Connection connection = this.provider.getConnection()) { + jedisPubSub.proceed(connection, channels); + } + } + + public void psubscribe(BinaryJedisPubSub jedisPubSub, final byte[]... patterns) { + try (Connection connection = this.provider.getConnection()) { + jedisPubSub.proceedWithPatterns(connection, patterns); + } + } + // commands + @Override public ClusterPipeline pipelined() { return new ClusterPipeline((ClusterConnectionProvider) provider, (ClusterCommandObjects) commandObjects); diff --git a/src/main/java/redis/clients/jedis/JedisClusterInfoCache.java b/src/main/java/redis/clients/jedis/JedisClusterInfoCache.java index 4bd9408ae8..a4cc2d1d63 100644 --- a/src/main/java/redis/clients/jedis/JedisClusterInfoCache.java +++ b/src/main/java/redis/clients/jedis/JedisClusterInfoCache.java @@ -36,17 +36,6 @@ public class JedisClusterInfoCache { private static final int MASTER_NODE_INDEX = 2; - @Deprecated - public JedisClusterInfoCache(final JedisClientConfig clientConfig) { - this(clientConfig, new GenericObjectPoolConfig()); - } - - @Deprecated - public JedisClusterInfoCache(final JedisClientConfig clientConfig, - final GenericObjectPoolConfig poolConfig) { - this(clientConfig, poolConfig, null); - } - public JedisClusterInfoCache(final JedisClientConfig clientConfig, final Set startNodes) { this(clientConfig, null, startNodes); } diff --git a/src/main/java/redis/clients/jedis/JedisFactory.java b/src/main/java/redis/clients/jedis/JedisFactory.java index 8276a94c55..52c9b5d8cb 100644 --- a/src/main/java/redis/clients/jedis/JedisFactory.java +++ b/src/main/java/redis/clients/jedis/JedisFactory.java @@ -101,7 +101,7 @@ protected JedisFactory(final JedisSocketFactory jedisSocketFactory, final JedisC } /** - * {@link #setHostAndPort(redis.clients.jedis.HostAndPort) setHostAndPort} must be called later. + * {@link JedisFactory#setHostAndPort(redis.clients.jedis.HostAndPort) setHostAndPort} must be called later. */ JedisFactory(final JedisClientConfig clientConfig) { this.clientConfig = clientConfig; @@ -142,15 +142,6 @@ void setHostAndPort(final HostAndPort hostAndPort) { ((DefaultJedisSocketFactory) jedisSocketFactory).updateHostAndPort(hostAndPort); } - /** - * @deprecated Use {@link RedisCredentialsProvider} through - * {@link JedisClientConfig#getCredentialsProvider()}. - */ - @Deprecated - public void setPassword(final String password) { - this.clientConfig.updatePassword(password); - } - @Override public void activateObject(PooledObject pooledJedis) throws Exception { final Jedis jedis = pooledJedis.getObject(); diff --git a/src/main/java/redis/clients/jedis/JedisSentineled.java b/src/main/java/redis/clients/jedis/JedisSentineled.java index 6d449e8d76..7a6c0cc5c0 100644 --- a/src/main/java/redis/clients/jedis/JedisSentineled.java +++ b/src/main/java/redis/clients/jedis/JedisSentineled.java @@ -6,41 +6,11 @@ public class JedisSentineled extends UnifiedJedis { - /** - * This constructor is here for easier transition from {@link JedisSentinelPool#JedisSentinelPool( - * java.lang.String, java.util.Set, redis.clients.jedis.JedisClientConfig, redis.clients.jedis.JedisClientConfig)}. - * - * @deprecated Use {@link #JedisSentineled(java.lang.String, redis.clients.jedis.JedisClientConfig, - * java.util.Set, redis.clients.jedis.JedisClientConfig)}. - */ - @Deprecated - // Legacy - public JedisSentineled(String masterName, Set sentinels, - final JedisClientConfig masterClientConfig, final JedisClientConfig sentinelClientConfig) { - this(masterName, masterClientConfig, sentinels, sentinelClientConfig); - } - public JedisSentineled(String masterName, final JedisClientConfig masterClientConfig, Set sentinels, final JedisClientConfig sentinelClientConfig) { this(new SentineledConnectionProvider(masterName, masterClientConfig, sentinels, sentinelClientConfig)); } - /** - * This constructor is here for easier transition from {@link JedisSentinelPool#JedisSentinelPool( - * java.lang.String, java.util.Set, org.apache.commons.pool2.impl.GenericObjectPoolConfig, - * redis.clients.jedis.JedisClientConfig, redis.clients.jedis.JedisClientConfig)}. - * - * @deprecated Use {@link #JedisSentineled(java.lang.String, redis.clients.jedis.JedisClientConfig, - * org.apache.commons.pool2.impl.GenericObjectPoolConfig, java.util.Set, redis.clients.jedis.JedisClientConfig)}. - */ - @Deprecated - // Legacy - public JedisSentineled(String masterName, Set sentinels, - final GenericObjectPoolConfig poolConfig, final JedisClientConfig masterClientConfig, - final JedisClientConfig sentinelClientConfig) { - this(masterName, masterClientConfig, poolConfig, sentinels, sentinelClientConfig); - } - public JedisSentineled(String masterName, final JedisClientConfig masterClientConfig, final GenericObjectPoolConfig poolConfig, Set sentinels, final JedisClientConfig sentinelClientConfig) { diff --git a/src/main/java/redis/clients/jedis/MultiNodePipelineBase.java b/src/main/java/redis/clients/jedis/MultiNodePipelineBase.java index 6c979b9f09..6c84321d96 100644 --- a/src/main/java/redis/clients/jedis/MultiNodePipelineBase.java +++ b/src/main/java/redis/clients/jedis/MultiNodePipelineBase.java @@ -541,11 +541,6 @@ public Response bitop(BitOP op, String destKey, String... srcKeys) { return appendCommand(commandObjects.bitop(op, destKey, srcKeys)); } - @Override - public Response strAlgoLCSKeys(String keyA, String keyB, StrAlgoLCSParams params) { - return appendCommand(commandObjects.strAlgoLCSKeys(keyA, keyB, params)); - } - @Override public Response lcs(String keyA, String keyB, LCSParams params) { return appendCommand(commandObjects.lcs(keyA, keyB, params)); @@ -1557,11 +1552,6 @@ public Response xpending(String key, String groupName) { return appendCommand(commandObjects.xpending(key, groupName)); } - @Override - public Response> xpending(String key, String groupName, StreamEntryID start, StreamEntryID end, int count, String consumerName) { - return appendCommand(commandObjects.xpending(key, groupName, start, end, count, consumerName)); - } - @Override public Response> xpending(String key, String groupName, XPendingParams params) { return appendCommand(commandObjects.xpending(key, groupName, params)); @@ -1617,12 +1607,6 @@ public Response xinfoStreamFull(String key, int count) { return appendCommand(commandObjects.xinfoStreamFull(key, count)); } - @Override - @Deprecated - public Response> xinfoGroup(String key) { - return appendCommand(commandObjects.xinfoGroup(key)); - } - @Override public Response> xinfoGroups(String key) { return appendCommand(commandObjects.xinfoGroups(key)); @@ -1857,10 +1841,6 @@ public Response publish(String channel, String message) { return appendCommand(commandObjects.publish(channel, message)); } - public Response strAlgoLCSStrings(String strA, String strB, StrAlgoLCSParams params) { - return appendCommand(commandObjects.strAlgoLCSStrings(strA, strB, params)); - } - @Override public Response geoadd(byte[] key, double longitude, double latitude, byte[] member) { return appendCommand(commandObjects.geoadd(key, longitude, latitude, member)); @@ -2500,10 +2480,6 @@ public Response publish(byte[] channel, byte[] message) { return appendCommand(commandObjects.publish(channel, message)); } - public Response strAlgoLCSStrings(byte[] strA, byte[] strB, StrAlgoLCSParams params) { - return appendCommand(commandObjects.strAlgoLCSStrings(strA, strB, params)); - } - @Override public Response waitReplicas(byte[] sampleKey, int replicas, long timeout) { return appendCommand(commandObjects.waitReplicas(sampleKey, replicas, timeout)); @@ -3144,11 +3120,6 @@ public Response xpending(byte[] key, byte[] groupName) { return appendCommand(commandObjects.xpending(key, groupName)); } - @Override - public Response> xpending(byte[] key, byte[] groupName, byte[] start, byte[] end, int count, byte[] consumerName) { - return appendCommand(commandObjects.xpending(key, groupName, start, end, count, consumerName)); - } - @Override public Response> xpending(byte[] key, byte[] groupName, XPendingParams params) { return appendCommand(commandObjects.xpending(key, groupName, params)); @@ -3189,12 +3160,6 @@ public Response xinfoStreamFull(byte[] key, int count) { return appendCommand(commandObjects.xinfoStreamFull(key, count)); } - @Override - @Deprecated - public Response> xinfoGroup(byte[] key) { - return appendCommand(commandObjects.xinfoGroup(key)); - } - @Override public Response> xinfoGroups(byte[] key) { return appendCommand(commandObjects.xinfoGroups(key)); @@ -3380,11 +3345,6 @@ public Response bitop(BitOP op, byte[] destKey, byte[]... srcKeys) { return appendCommand(commandObjects.bitop(op, destKey, srcKeys)); } - @Override - public Response strAlgoLCSKeys(byte[] keyA, byte[] keyB, StrAlgoLCSParams params) { - return appendCommand(commandObjects.strAlgoLCSKeys(keyA, keyB, params)); - } - // RediSearch commands @Override public Response ftCreate(String indexName, IndexOptions indexOptions, Schema schema) { @@ -3441,30 +3401,6 @@ public Response ftAggregate(String indexName, AggregationBuil return appendCommand(commandObjects.ftAggregate(indexName, aggr)); } - @Override - @Deprecated - public Response ftCursorRead(String indexName, long cursorId, int count) { - return appendCommand(commandObjects.ftCursorRead(indexName, cursorId, count)); - } - - @Override - @Deprecated - public Response ftCursorDel(String indexName, long cursorId) { - return appendCommand(commandObjects.ftCursorDel(indexName, cursorId)); - } - - @Override - @Deprecated - public Response ftDropIndex(String indexName) { - return appendCommand(commandObjects.ftDropIndex(indexName)); - } - - @Override - @Deprecated - public Response ftDropIndexDD(String indexName) { - return appendCommand(commandObjects.ftDropIndexDD(indexName)); - } - @Override public Response ftSynUpdate(String indexName, String synonymGroupId, String... terms) { return appendCommand(commandObjects.ftSynUpdate(indexName, synonymGroupId, terms)); @@ -3525,24 +3461,6 @@ public Response> ftTagVals(String indexName, String fieldName) { return appendCommand(commandObjects.ftTagVals(indexName, fieldName)); } - @Override - @Deprecated - public Response ftAliasAdd(String aliasName, String indexName) { - return appendCommand(commandObjects.ftAliasAdd(aliasName, indexName)); - } - - @Override - @Deprecated - public Response ftAliasUpdate(String aliasName, String indexName) { - return appendCommand(commandObjects.ftAliasUpdate(aliasName, indexName)); - } - - @Override - @Deprecated - public Response ftAliasDel(String aliasName) { - return appendCommand(commandObjects.ftAliasDel(aliasName)); - } - @Override public Response> ftConfigGet(String option) { return appendCommand(commandObjects.ftConfigGet(option)); @@ -4209,11 +4127,6 @@ public Response> topkQuery(String key, String... items) { return appendCommand(commandObjects.topkQuery(key, items)); } - @Override - public Response> topkCount(String key, String... items) { - return appendCommand(commandObjects.topkCount(key, items)); - } - @Override public Response> topkList(String key) { return appendCommand(commandObjects.topkList(key)); diff --git a/src/main/java/redis/clients/jedis/Pipeline.java b/src/main/java/redis/clients/jedis/Pipeline.java index e7f45f09fd..a7fcd33e5f 100644 --- a/src/main/java/redis/clients/jedis/Pipeline.java +++ b/src/main/java/redis/clients/jedis/Pipeline.java @@ -494,11 +494,6 @@ public Response bitop(BitOP op, String destKey, String... srcKeys) { return appendCommand(commandObjects.bitop(op, destKey, srcKeys)); } - @Override - public Response strAlgoLCSKeys(String keyA, String keyB, StrAlgoLCSParams params) { - return appendCommand(commandObjects.strAlgoLCSKeys(keyA, keyB, params)); - } - @Override public Response lcs(String keyA, String keyB, LCSParams params) { return appendCommand(commandObjects.lcs(keyA, keyB, params)); @@ -1510,11 +1505,6 @@ public Response xpending(String key, String groupName) { return appendCommand(commandObjects.xpending(key, groupName)); } - @Override - public Response> xpending(String key, String groupName, StreamEntryID start, StreamEntryID end, int count, String consumerName) { - return appendCommand(commandObjects.xpending(key, groupName, start, end, count, consumerName)); - } - @Override public Response> xpending(String key, String groupName, XPendingParams params) { return appendCommand(commandObjects.xpending(key, groupName, params)); @@ -1570,12 +1560,6 @@ public Response xinfoStreamFull(String key, int count) { return appendCommand(commandObjects.xinfoStreamFull(key, count)); } - @Override - @Deprecated - public Response> xinfoGroup(String key) { - return appendCommand(commandObjects.xinfoGroup(key)); - } - @Override public Response> xinfoGroups(String key) { return appendCommand(commandObjects.xinfoGroups(key)); @@ -1810,10 +1794,6 @@ public Response publish(String channel, String message) { return appendCommand(commandObjects.publish(channel, message)); } - public Response strAlgoLCSStrings(String strA, String strB, StrAlgoLCSParams params) { - return appendCommand(commandObjects.strAlgoLCSStrings(strA, strB, params)); - } - @Override public Response geoadd(byte[] key, double longitude, double latitude, byte[] member) { return appendCommand(commandObjects.geoadd(key, longitude, latitude, member)); @@ -2453,10 +2433,6 @@ public Response publish(byte[] channel, byte[] message) { return appendCommand(commandObjects.publish(channel, message)); } - public Response strAlgoLCSStrings(byte[] strA, byte[] strB, StrAlgoLCSParams params) { - return appendCommand(commandObjects.strAlgoLCSStrings(strA, strB, params)); - } - @Override public Response waitReplicas(byte[] sampleKey, int replicas, long timeout) { return appendCommand(commandObjects.waitReplicas(sampleKey, replicas, timeout)); @@ -3097,11 +3073,6 @@ public Response xpending(byte[] key, byte[] groupName) { return appendCommand(commandObjects.xpending(key, groupName)); } - @Override - public Response> xpending(byte[] key, byte[] groupName, byte[] start, byte[] end, int count, byte[] consumerName) { - return appendCommand(commandObjects.xpending(key, groupName, start, end, count, consumerName)); - } - @Override public Response> xpending(byte[] key, byte[] groupName, XPendingParams params) { return appendCommand(commandObjects.xpending(key, groupName, params)); @@ -3142,12 +3113,6 @@ public Response xinfoStreamFull(byte[] key, int count) { return appendCommand(commandObjects.xinfoStreamFull(key, count)); } - @Override - @Deprecated - public Response> xinfoGroup(byte[] key) { - return appendCommand(commandObjects.xinfoGroup(key)); - } - @Override public Response> xinfoGroups(byte[] key) { return appendCommand(commandObjects.xinfoGroups(key)); @@ -3333,11 +3298,6 @@ public Response bitop(BitOP op, byte[] destKey, byte[]... srcKeys) { return appendCommand(commandObjects.bitop(op, destKey, srcKeys)); } - @Override - public Response strAlgoLCSKeys(byte[] keyA, byte[] keyB, StrAlgoLCSParams params) { - return appendCommand(commandObjects.strAlgoLCSKeys(keyA, keyB, params)); - } - // RediSearch commands @Override public Response ftCreate(String indexName, IndexOptions indexOptions, Schema schema) { @@ -3394,30 +3354,6 @@ public Response ftAggregate(String indexName, AggregationBuil return appendCommand(commandObjects.ftAggregate(indexName, aggr)); } - @Override - @Deprecated - public Response ftCursorRead(String indexName, long cursorId, int count) { - return appendCommand(commandObjects.ftCursorRead(indexName, cursorId, count)); - } - - @Override - @Deprecated - public Response ftCursorDel(String indexName, long cursorId) { - return appendCommand(commandObjects.ftCursorDel(indexName, cursorId)); - } - - @Override - @Deprecated - public Response ftDropIndex(String indexName) { - return appendCommand(commandObjects.ftDropIndex(indexName)); - } - - @Override - @Deprecated - public Response ftDropIndexDD(String indexName) { - return appendCommand(commandObjects.ftDropIndexDD(indexName)); - } - @Override public Response ftSynUpdate(String indexName, String synonymGroupId, String... terms) { return appendCommand(commandObjects.ftSynUpdate(indexName, synonymGroupId, terms)); @@ -3478,24 +3414,6 @@ public Response> ftTagVals(String indexName, String fieldName) { return appendCommand(commandObjects.ftTagVals(indexName, fieldName)); } - @Override - @Deprecated - public Response ftAliasAdd(String aliasName, String indexName) { - return appendCommand(commandObjects.ftAliasAdd(aliasName, indexName)); - } - - @Override - @Deprecated - public Response ftAliasUpdate(String aliasName, String indexName) { - return appendCommand(commandObjects.ftAliasUpdate(aliasName, indexName)); - } - - @Override - @Deprecated - public Response ftAliasDel(String aliasName) { - return appendCommand(commandObjects.ftAliasDel(aliasName)); - } - @Override public Response> ftConfigGet(String option) { return appendCommand(commandObjects.ftConfigGet(option)); @@ -4162,11 +4080,6 @@ public Response> topkQuery(String key, String... items) { return appendCommand(commandObjects.topkQuery(key, items)); } - @Override - public Response> topkCount(String key, String... items) { - return appendCommand(commandObjects.topkCount(key, items)); - } - @Override public Response> topkList(String key) { return appendCommand(commandObjects.topkList(key)); diff --git a/src/main/java/redis/clients/jedis/Protocol.java b/src/main/java/redis/clients/jedis/Protocol.java index 0303f2996c..9d33713a21 100644 --- a/src/main/java/redis/clients/jedis/Protocol.java +++ b/src/main/java/redis/clients/jedis/Protocol.java @@ -238,32 +238,34 @@ public static final byte[] toByteArray(final double value) { public static enum Command implements ProtocolCommand { - PING, AUTH, HELLO, SET, GET, GETDEL, GETEX, EXISTS, DEL, UNLINK, TYPE, FLUSHDB, FLUSHALL, - KEYS, RANDOMKEY, MOVE, RENAME, RENAMENX, DBSIZE, EXPIRE, EXPIREAT, TTL, SELECT, GETSET, MGET, - SETNX, SETEX, MSET, MSETNX, DECRBY, DECR, INCRBY, INCR, STRLEN, APPEND, SUBSTR, MIGRATE, ECHO, // + PING, AUTH, HELLO, SET, GET, GETDEL, GETEX, EXISTS, DEL, UNLINK, TYPE, FLUSHDB, FLUSHALL, MOVE, + KEYS, RANDOMKEY, RENAME, RENAMENX, DBSIZE, EXPIRE, EXPIREAT, PEXPIRE, PEXPIREAT, TTL, PTTL, + SELECT, MIGRATE, ECHO, + MULTI, DISCARD, EXEC, WATCH, UNWATCH, SORT, SORT_RO, INFO, SHUTDOWN, MONITOR, CONFIG, LCS, // + GETSET, MGET, SETNX, SETEX, MSET, MSETNX, DECRBY, DECR, INCRBY, INCR, STRLEN, APPEND, SUBSTR, // <-- string + SETBIT, GETBIT, BITPOS, SETRANGE, GETRANGE, BITCOUNT, BITOP, BITFIELD, // <-- bit (string) + SUBSCRIBE, UNSUBSCRIBE, PSUBSCRIBE, PUNSUBSCRIBE, PUBLISH, PUBSUB, + SSUBSCRIBE, SUNSUBSCRIBE, SPUBLISH, // <-- pub sub HSET, HGET, HSETNX, HMSET, HMGET, HINCRBY, HEXISTS, HDEL, HLEN, HKEYS, HVALS, HGETALL, HSTRLEN, HRANDFIELD, HINCRBYFLOAT, // <-- hash RPUSH, LPUSH, LLEN, LRANGE, LTRIM, LINDEX, LSET, LREM, LPOP, RPOP, BLPOP, BRPOP, LINSERT, LPOS, - RPOPLPUSH, BRPOPLPUSH, BLMOVE, LMOVE, LMPOP, BLMPOP, // <-- list + RPOPLPUSH, BRPOPLPUSH, BLMOVE, LMOVE, LMPOP, BLMPOP, LPUSHX, RPUSHX, // <-- list SADD, SMEMBERS, SREM, SPOP, SMOVE, SCARD, SRANDMEMBER, SINTER, SINTERSTORE, SUNION, SUNIONSTORE, SDIFF, SDIFFSTORE, SISMEMBER, SMISMEMBER, SINTERCARD, // <-- set - MULTI, DISCARD, EXEC, WATCH, UNWATCH, SORT, SORT_RO, INFO, SHUTDOWN, MONITOR, CONFIG, LCS, - SUBSCRIBE, PUBLISH, UNSUBSCRIBE, PSUBSCRIBE, PUNSUBSCRIBE, PUBSUB, LPUSHX, RPUSHX, // ZADD, ZDIFF, ZDIFFSTORE, ZRANGE, ZREM, ZINCRBY, ZRANK, ZREVRANK, ZREVRANGE, ZRANDMEMBER, ZCARD, ZSCORE, ZPOPMAX, ZPOPMIN, ZCOUNT, ZUNION, ZUNIONSTORE, ZINTER, ZINTERSTORE, ZRANGEBYSCORE, ZREVRANGEBYSCORE, ZREMRANGEBYRANK, ZREMRANGEBYSCORE, ZLEXCOUNT, ZRANGEBYLEX, ZREVRANGEBYLEX, - ZREMRANGEBYLEX, ZMSCORE, ZRANGESTORE, ZINTERCARD, ZMPOP, BZMPOP, // <-- zset + ZREMRANGEBYLEX, ZMSCORE, ZRANGESTORE, ZINTERCARD, ZMPOP, BZMPOP, BZPOPMIN, BZPOPMAX, // <-- zset GEOADD, GEODIST, GEOHASH, GEOPOS, GEORADIUS, GEORADIUS_RO, GEOSEARCH, GEOSEARCHSTORE, GEORADIUSBYMEMBER, GEORADIUSBYMEMBER_RO, // <-- geo XADD, XLEN, XDEL, XTRIM, XRANGE, XREVRANGE, XREAD, XACK, XGROUP, XREADGROUP, XPENDING, XCLAIM, XAUTOCLAIM, XINFO, // <-- stream SAVE, BGSAVE, BGREWRITEAOF, LASTSAVE, PERSIST, BITFIELD_RO, ROLE, FAILOVER, EVAL_RO, EVALSHA_RO, - SETBIT, GETBIT, BITPOS, SETRANGE, GETRANGE, EVAL, EVALSHA, SCRIPT, SLOWLOG, OBJECT, BITCOUNT, - BITOP, SENTINEL, DUMP, RESTORE, PEXPIRE, PEXPIREAT, PTTL, INCRBYFLOAT, PSETEX, CLIENT, TIME, + EVAL, EVALSHA, SCRIPT, SLOWLOG, OBJECT, + SENTINEL, DUMP, RESTORE, INCRBYFLOAT, PSETEX, CLIENT, TIME, SCAN, HSCAN, SSCAN, ZSCAN, WAIT, CLUSTER, ASKING, READONLY, READWRITE, SLAVEOF, REPLICAOF, COPY, - PFADD, PFCOUNT, PFMERGE, MODULE, ACL, BITFIELD, TOUCH, SWAPDB, MEMORY, BZPOPMIN, BZPOPMAX, - LOLWUT, EXPIRETIME, PEXPIRETIME, FUNCTION, FCALL, FCALL_RO, COMMAND, LATENCY, - @Deprecated QUIT, @Deprecated STRALGO; + PFADD, PFCOUNT, PFMERGE, MODULE, ACL, TOUCH, SWAPDB, MEMORY, + LOLWUT, EXPIRETIME, PEXPIRETIME, FUNCTION, FCALL, FCALL_RO, COMMAND, LATENCY; private final byte[] raw; @@ -289,8 +291,7 @@ public static enum Keyword implements Rawable { WITHCOORD, WITHDIST, WITHHASH, ANY, FROMMEMBER, FROMLONLAT, BYRADIUS, BYBOX, BYLEX, BYSCORE, STOREDIST, TO, FORCE, TIMEOUT, DB, UNLOAD, ABORT, IDX, MINMATCHLEN, WITHMATCHLEN, FULL, DELETE, LIBRARYNAME, WITHCODE, DESCRIPTION, GETKEYS, GETKEYSANDFLAGS, DOCS, FILTERBY, DUMP, - MODULE, ACLCAT, PATTERN, DOCTOR, USAGE, SAMPLES, PURGE, STATS, LOADEX, CONFIG, ARGS, - @Deprecated ASC, @Deprecated DESC, @Deprecated LCS, @Deprecated STRINGS; + MODULE, ACLCAT, PATTERN, DOCTOR, USAGE, SAMPLES, PURGE, STATS, LOADEX, CONFIG, ARGS; private final byte[] raw; diff --git a/src/main/java/redis/clients/jedis/TransactionBase.java b/src/main/java/redis/clients/jedis/TransactionBase.java index 51d23fc7a9..b6007d3a31 100644 --- a/src/main/java/redis/clients/jedis/TransactionBase.java +++ b/src/main/java/redis/clients/jedis/TransactionBase.java @@ -589,11 +589,6 @@ public Response bitop(BitOP op, String destKey, String... srcKeys) { return appendCommand(commandObjects.bitop(op, destKey, srcKeys)); } - @Override - public Response strAlgoLCSKeys(String keyA, String keyB, StrAlgoLCSParams params) { - return appendCommand(commandObjects.strAlgoLCSKeys(keyA, keyB, params)); - } - @Override public Response lcs(String keyA, String keyB, LCSParams params) { return appendCommand(commandObjects.lcs(keyA, keyB, params)); @@ -1606,11 +1601,6 @@ public Response xpending(String key, String groupName) { return appendCommand(commandObjects.xpending(key, groupName)); } - @Override - public Response> xpending(String key, String groupName, StreamEntryID start, StreamEntryID end, int count, String consumerName) { - return appendCommand(commandObjects.xpending(key, groupName, start, end, count, consumerName)); - } - @Override public Response> xpending(String key, String groupName, XPendingParams params) { return appendCommand(commandObjects.xpending(key, groupName, params)); @@ -1666,12 +1656,6 @@ public Response xinfoStreamFull(String key, int count) { return appendCommand(commandObjects.xinfoStreamFull(key, count)); } - @Override - @Deprecated - public Response> xinfoGroup(String key) { - return appendCommand(commandObjects.xinfoGroup(key)); - } - @Override public Response> xinfoGroups(String key) { return appendCommand(commandObjects.xinfoGroups(key)); @@ -1907,10 +1891,6 @@ public Response publish(String channel, String message) { return appendCommand(commandObjects.publish(channel, message)); } - public Response strAlgoLCSStrings(String strA, String strB, StrAlgoLCSParams params) { - return appendCommand(commandObjects.strAlgoLCSStrings(strA, strB, params)); - } - @Override public Response geoadd(byte[] key, double longitude, double latitude, byte[] member) { return appendCommand(commandObjects.geoadd(key, longitude, latitude, member)); @@ -2550,10 +2530,6 @@ public Response publish(byte[] channel, byte[] message) { return appendCommand(commandObjects.publish(channel, message)); } - public Response strAlgoLCSStrings(byte[] strA, byte[] strB, StrAlgoLCSParams params) { - return appendCommand(commandObjects.strAlgoLCSStrings(strA, strB, params)); - } - @Override public Response waitReplicas(byte[] sampleKey, int replicas, long timeout) { return appendCommand(commandObjects.waitReplicas(sampleKey, replicas, timeout)); @@ -3194,11 +3170,6 @@ public Response xpending(byte[] key, byte[] groupName) { return appendCommand(commandObjects.xpending(key, groupName)); } - @Override - public Response> xpending(byte[] key, byte[] groupName, byte[] start, byte[] end, int count, byte[] consumerName) { - return appendCommand(commandObjects.xpending(key, groupName, start, end, count, consumerName)); - } - @Override public Response> xpending(byte[] key, byte[] groupName, XPendingParams params) { return appendCommand(commandObjects.xpending(key, groupName, params)); @@ -3239,12 +3210,6 @@ public Response xinfoStreamFull(byte[] key, int count) { return appendCommand(commandObjects.xinfoStreamFull(key, count)); } - @Override - @Deprecated - public Response> xinfoGroup(byte[] key) { - return appendCommand(commandObjects.xinfoGroup(key)); - } - @Override public Response> xinfoGroups(byte[] key) { return appendCommand(commandObjects.xinfoGroups(key)); @@ -3430,11 +3395,6 @@ public Response bitop(BitOP op, byte[] destKey, byte[]... srcKeys) { return appendCommand(commandObjects.bitop(op, destKey, srcKeys)); } - @Override - public Response strAlgoLCSKeys(byte[] keyA, byte[] keyB, StrAlgoLCSParams params) { - return appendCommand(commandObjects.strAlgoLCSKeys(keyA, keyB, params)); - } - // RediSearch commands @Override public Response ftCreate(String indexName, IndexOptions indexOptions, Schema schema) { @@ -3491,30 +3451,6 @@ public Response ftAggregate(String indexName, AggregationBuil return appendCommand(commandObjects.ftAggregate(indexName, aggr)); } - @Override - @Deprecated - public Response ftCursorRead(String indexName, long cursorId, int count) { - return appendCommand(commandObjects.ftCursorRead(indexName, cursorId, count)); - } - - @Override - @Deprecated - public Response ftCursorDel(String indexName, long cursorId) { - return appendCommand(commandObjects.ftCursorDel(indexName, cursorId)); - } - - @Override - @Deprecated - public Response ftDropIndex(String indexName) { - return appendCommand(commandObjects.ftDropIndex(indexName)); - } - - @Override - @Deprecated - public Response ftDropIndexDD(String indexName) { - return appendCommand(commandObjects.ftDropIndexDD(indexName)); - } - @Override public Response ftSynUpdate(String indexName, String synonymGroupId, String... terms) { return appendCommand(commandObjects.ftSynUpdate(indexName, synonymGroupId, terms)); @@ -3575,24 +3511,6 @@ public Response> ftTagVals(String indexName, String fieldName) { return appendCommand(commandObjects.ftTagVals(indexName, fieldName)); } - @Override - @Deprecated - public Response ftAliasAdd(String aliasName, String indexName) { - return appendCommand(commandObjects.ftAliasAdd(aliasName, indexName)); - } - - @Override - @Deprecated - public Response ftAliasUpdate(String aliasName, String indexName) { - return appendCommand(commandObjects.ftAliasUpdate(aliasName, indexName)); - } - - @Override - @Deprecated - public Response ftAliasDel(String aliasName) { - return appendCommand(commandObjects.ftAliasDel(aliasName)); - } - @Override public Response> ftConfigGet(String option) { return appendCommand(commandObjects.ftConfigGet(option)); @@ -4260,11 +4178,6 @@ public Response> topkQuery(String key, String... items) { return appendCommand(commandObjects.topkQuery(key, items)); } - @Override - public Response> topkCount(String key, String... items) { - return appendCommand(commandObjects.topkCount(key, items)); - } - @Override public Response> topkList(String key) { return appendCommand(commandObjects.topkList(key)); diff --git a/src/main/java/redis/clients/jedis/UnifiedJedis.java b/src/main/java/redis/clients/jedis/UnifiedJedis.java index ae20d7a461..0df2facb09 100644 --- a/src/main/java/redis/clients/jedis/UnifiedJedis.java +++ b/src/main/java/redis/clients/jedis/UnifiedJedis.java @@ -705,6 +705,11 @@ public String get(String key) { return executeCommand(commandObjects.get(key)); } + @Override + public String setGet(String key, String value) { + return executeCommand(commandObjects.setGet(key, value)); + } + @Override public String setGet(String key, String value, SetParams params) { return executeCommand(commandObjects.setGet(key, value, params)); @@ -1020,16 +1025,6 @@ public long bitop(BitOP op, byte[] destKey, byte[]... srcKeys) { return executeCommand(commandObjects.bitop(op, destKey, srcKeys)); } - @Override - public LCSMatchResult strAlgoLCSKeys(String keyA, String keyB, StrAlgoLCSParams params) { - return executeCommand(commandObjects.strAlgoLCSKeys(keyA, keyB, params)); - } - - @Override - public LCSMatchResult strAlgoLCSKeys(byte[] keyA, byte[] keyB, StrAlgoLCSParams params) { - return executeCommand(commandObjects.strAlgoLCSKeys(keyA, keyB, params)); - } - @Override public LCSMatchResult lcs(String keyA, String keyB, LCSParams params) { return executeCommand(commandObjects.lcs(keyA, keyB, params)); @@ -2934,11 +2929,6 @@ public StreamPendingSummary xpending(String key, String groupName) { return executeCommand(commandObjects.xpending(key, groupName)); } - @Override - public List xpending(String key, String groupName, StreamEntryID start, StreamEntryID end, int count, String consumerName) { - return executeCommand(commandObjects.xpending(key, groupName, start, end, count, consumerName)); - } - @Override public List xpending(String key, String groupName, XPendingParams params) { return executeCommand(commandObjects.xpending(key, groupName, params)); @@ -2994,12 +2984,6 @@ public StreamFullInfo xinfoStreamFull(String key, int count) { return executeCommand(commandObjects.xinfoStreamFull(key, count)); } - @Override - @Deprecated - public List xinfoGroup(String key) { - return executeCommand(commandObjects.xinfoGroup(key)); - } - @Override public List xinfoGroups(String key) { return executeCommand(commandObjects.xinfoGroups(key)); @@ -3101,11 +3085,6 @@ public Object xpending(byte[] key, byte[] groupName) { return executeCommand(commandObjects.xpending(key, groupName)); } - @Override - public List xpending(byte[] key, byte[] groupName, byte[] start, byte[] end, int count, byte[] consumerName) { - return executeCommand(commandObjects.xpending(key, groupName, start, end, count, consumerName)); - } - @Override public List xpending(byte[] key, byte[] groupName, XPendingParams params) { return executeCommand(commandObjects.xpending(key, groupName, params)); @@ -3146,12 +3125,6 @@ public Object xinfoStreamFull(byte[] key, int count) { return executeCommand(commandObjects.xinfoStreamFull(key, count)); } - @Override - @Deprecated - public List xinfoGroup(byte[] key) { - return executeCommand(commandObjects.xinfoGroup(key)); - } - @Override public List xinfoGroups(byte[] key) { return executeCommand(commandObjects.xinfoGroups(key)); @@ -3591,14 +3564,6 @@ public void psubscribe(BinaryJedisPubSub jedisPubSub, final byte[]... patterns) jedisPubSub.proceedWithPatterns(connection, patterns); } } - - public LCSMatchResult strAlgoLCSStrings(final String strA, final String strB, final StrAlgoLCSParams params) { - return executeCommand(commandObjects.strAlgoLCSStrings(strA, strB, params)); - } - - public LCSMatchResult strAlgoLCSStrings(byte[] strA, byte[] strB, StrAlgoLCSParams params) { - return executeCommand(commandObjects.strAlgoLCSStrings(strA, strB, params)); - } // Random node commands // RediSearch commands @@ -4554,12 +4519,6 @@ public List topkQuery(String key, String... items) { return executeCommand(commandObjects.topkQuery(key, items)); } - @Deprecated - @Override - public List topkCount(String key, String... items) { - return executeCommand(commandObjects.topkCount(key, items)); - } - @Override public List topkList(String key) { return executeCommand(commandObjects.topkList(key)); diff --git a/src/main/java/redis/clients/jedis/bloom/RedisBloomProtocol.java b/src/main/java/redis/clients/jedis/bloom/RedisBloomProtocol.java index 7b103e867a..7e7bb810f2 100644 --- a/src/main/java/redis/clients/jedis/bloom/RedisBloomProtocol.java +++ b/src/main/java/redis/clients/jedis/bloom/RedisBloomProtocol.java @@ -85,7 +85,6 @@ public enum TopKCommand implements ProtocolCommand { ADD("TOPK.ADD"), INCRBY("TOPK.INCRBY"), QUERY("TOPK.QUERY"), - COUNT("TOPK.COUNT"), LIST("TOPK.LIST"), INFO("TOPK.INFO"); diff --git a/src/main/java/redis/clients/jedis/bloom/commands/TopKFilterCommands.java b/src/main/java/redis/clients/jedis/bloom/commands/TopKFilterCommands.java index e4ff6bd43a..6cc2f47b43 100644 --- a/src/main/java/redis/clients/jedis/bloom/commands/TopKFilterCommands.java +++ b/src/main/java/redis/clients/jedis/bloom/commands/TopKFilterCommands.java @@ -53,17 +53,6 @@ public interface TopKFilterCommands { */ List topkQuery(String key, String... items); - /** - * {@code TOPK.COUNT {key} {item ...}} - * - * @param key - * @param items - * @return count for item - * @deprecated As of RedisBloom 2.4, this command is regarded as deprecated. - */ - @Deprecated - List topkCount(String key, String... items); - /** * {@code TOPK.LIST {key}} * diff --git a/src/main/java/redis/clients/jedis/bloom/commands/TopKFilterPipelineCommands.java b/src/main/java/redis/clients/jedis/bloom/commands/TopKFilterPipelineCommands.java index 5d96489c77..692e02d3c9 100644 --- a/src/main/java/redis/clients/jedis/bloom/commands/TopKFilterPipelineCommands.java +++ b/src/main/java/redis/clients/jedis/bloom/commands/TopKFilterPipelineCommands.java @@ -16,12 +16,6 @@ public interface TopKFilterPipelineCommands { Response> topkQuery(String key, String... items); - /** - * @deprecated As of RedisBloom 2.4, this command is regarded as deprecated. - */ - @Deprecated - Response> topkCount(String key, String... items); - Response> topkList(String key); Response> topkInfo(String key); diff --git a/src/main/java/redis/clients/jedis/commands/ServerCommands.java b/src/main/java/redis/clients/jedis/commands/ServerCommands.java index c85dc3a6b7..31bc94d1ff 100644 --- a/src/main/java/redis/clients/jedis/commands/ServerCommands.java +++ b/src/main/java/redis/clients/jedis/commands/ServerCommands.java @@ -115,15 +115,9 @@ public interface ServerCommands { */ void shutdown() throws JedisException; - /** - * @see SaveMode - * @param saveMode modifier to alter the data save behavior of SHUTDOWN. {@code null} would - * trigger the default behavior. - * @throws JedisException - * @deprecated Use {@link ServerCommands#shutdown(redis.clients.jedis.params.ShutdownParams)}. - */ - @Deprecated - void shutdown(SaveMode saveMode) throws JedisException; + default void shutdown(SaveMode saveMode) throws JedisException { + shutdown(ShutdownParams.shutdownParams().saveMode(saveMode)); + } /** * @see SaveMode diff --git a/src/main/java/redis/clients/jedis/commands/StreamBinaryCommands.java b/src/main/java/redis/clients/jedis/commands/StreamBinaryCommands.java index 4d7ca6ba13..0b43ebbcc3 100644 --- a/src/main/java/redis/clients/jedis/commands/StreamBinaryCommands.java +++ b/src/main/java/redis/clients/jedis/commands/StreamBinaryCommands.java @@ -43,12 +43,6 @@ default byte[] xadd(byte[] key, Map hash, XAddParams params) { Object xpending(byte[] key, byte[] groupName); - /** - * @deprecated Use {@link StreamBinaryCommands#xpending(byte[], byte[], redis.clients.jedis.params.XPendingParams)}. - */ - @Deprecated - List xpending(byte[] key, byte[] groupName, byte[] start, byte[] end, int count, byte[] consumerName); - List xpending(byte[] key, byte[] groupName, XPendingParams params); List xclaim(byte[] key, byte[] group, byte[] consumerName, long minIdleTime, XClaimParams params, byte[]... ids); @@ -76,12 +70,6 @@ List xautoclaimJustId(byte[] key, byte[] groupName, byte[] consumerName, */ Object xinfoStreamFull(byte[] key, int count); - /** - * @deprecated Use {@link StreamBinaryCommands#xinfoGroups(byte[])}. - */ - @Deprecated - List xinfoGroup(byte[] key); - List xinfoGroups(byte[] key); List xinfoConsumers(byte[] key, byte[] group); diff --git a/src/main/java/redis/clients/jedis/commands/StreamCommands.java b/src/main/java/redis/clients/jedis/commands/StreamCommands.java index 4d7caf0bc5..0fb66b21d8 100644 --- a/src/main/java/redis/clients/jedis/commands/StreamCommands.java +++ b/src/main/java/redis/clients/jedis/commands/StreamCommands.java @@ -128,15 +128,6 @@ default StreamEntryID xadd(String key, Map hash, XAddParams para */ StreamPendingSummary xpending(String key, String groupName); - /** - * XPENDING key group [start end count] [consumer] - * - * @deprecated Use {@link StreamCommands#xpending(java.lang.String, java.lang.String, redis.clients.jedis.params.XPendingParams)}. - */ - @Deprecated - List xpending(String key, String groupName, StreamEntryID start, - StreamEntryID end, int count, String consumerName); - /** * XPENDING key group [[IDLE min-idle-time] start end count [consumer]] */ @@ -223,12 +214,6 @@ Map.Entry> xautoclaimJustId(String key, Strin */ StreamFullInfo xinfoStreamFull(String key, int count); - /** - * @deprecated Use {@link StreamCommands#xinfoGroups(java.lang.String)}. - */ - @Deprecated - List xinfoGroup(String key); - /** * Introspection command used in order to retrieve different information about groups in the stream * @param key Stream name diff --git a/src/main/java/redis/clients/jedis/commands/StreamPipelineBinaryCommands.java b/src/main/java/redis/clients/jedis/commands/StreamPipelineBinaryCommands.java index d1cade2533..fe6fc4d034 100644 --- a/src/main/java/redis/clients/jedis/commands/StreamPipelineBinaryCommands.java +++ b/src/main/java/redis/clients/jedis/commands/StreamPipelineBinaryCommands.java @@ -46,12 +46,6 @@ default Response xadd(byte[] key, Map hash, XAddParams p Response xpending(byte[] key, byte[] groupName); - /** - * @deprecated Use {@link StreamPipelineBinaryCommands#xpending(byte[], byte[], redis.clients.jedis.params.XPendingParams)}. - */ - @Deprecated - Response> xpending(byte[] key, byte[] groupName, byte[] start, byte[] end, int count, byte[] consumerName); - Response> xpending(byte[] key, byte[] groupName, XPendingParams params); Response> xclaim(byte[] key, byte[] group, byte[] consumerName, long minIdleTime, XClaimParams params, byte[]... ids); @@ -79,12 +73,6 @@ Response> xautoclaimJustId(byte[] key, byte[] groupName, byte[] con */ Response xinfoStreamFull(byte[] key, int count); - /** - * @deprecated Use {@link StreamPipelineBinaryCommands#xinfoGroups(byte[])}. - */ - @Deprecated - Response> xinfoGroup(byte[] key); - Response> xinfoGroups(byte[] key); Response> xinfoConsumers(byte[] key, byte[] group); diff --git a/src/main/java/redis/clients/jedis/commands/StreamPipelineCommands.java b/src/main/java/redis/clients/jedis/commands/StreamPipelineCommands.java index dc745c6f56..9c443c2d1a 100644 --- a/src/main/java/redis/clients/jedis/commands/StreamPipelineCommands.java +++ b/src/main/java/redis/clients/jedis/commands/StreamPipelineCommands.java @@ -121,15 +121,6 @@ default Response xadd(String key, Map hash, XAddP */ Response xpending(String key, String groupName); - /** - * XPENDING key group [start end count] [consumer] - * - * @deprecated Use {@link StreamPipelineCommands#xpending(java.lang.String, java.lang.String, redis.clients.jedis.params.XPendingParams)}. - */ - @Deprecated - Response> xpending(String key, String groupName, StreamEntryID start, - StreamEntryID end, int count, String consumerName); - /** * XPENDING key group [[IDLE min-idle-time] start end count [consumer]] */ @@ -216,12 +207,6 @@ Response>> xautoclaimJustId(String */ Response xinfoStreamFull(String key, int count); - /** - * @deprecated Use {@link StreamPipelineCommands#xinfoGroups(java.lang.String)}. - */ - @Deprecated - Response> xinfoGroup(String key); - /** * Introspection command used in order to retrieve different information about groups in the stream * @param key Stream name diff --git a/src/main/java/redis/clients/jedis/commands/StringBinaryCommands.java b/src/main/java/redis/clients/jedis/commands/StringBinaryCommands.java index c64f3701fa..48f6f99fd7 100644 --- a/src/main/java/redis/clients/jedis/commands/StringBinaryCommands.java +++ b/src/main/java/redis/clients/jedis/commands/StringBinaryCommands.java @@ -59,13 +59,6 @@ public interface StringBinaryCommands extends BitBinaryCommands { long strlen(byte[] key); - /** - * @deprecated STRALGO LCS command will be removed from Redis 7. - * {@link StringBinaryCommands#lcs(byte[], byte[], LCSParams) LCS} can be used instead of this method. - */ - @Deprecated - LCSMatchResult strAlgoLCSKeys(byte[] keyA, byte[] keyB, StrAlgoLCSParams params); - /** * Calculate the longest common subsequence of keyA and keyB. * @param keyA diff --git a/src/main/java/redis/clients/jedis/commands/StringCommands.java b/src/main/java/redis/clients/jedis/commands/StringCommands.java index 62627db710..44689fb9ef 100644 --- a/src/main/java/redis/clients/jedis/commands/StringCommands.java +++ b/src/main/java/redis/clients/jedis/commands/StringCommands.java @@ -47,9 +47,8 @@ public interface StringCommands extends BitCommands { */ String get(String key); - /** - * WARNING: {@link SetParams#get()} MUST NOT be used with this method. - */ + String setGet(String key, String value); + String setGet(String key, String value, SetParams params); /** @@ -341,18 +340,6 @@ public interface StringCommands extends BitCommands { */ long strlen(String key); - /** - * Calculate the longest common subsequence of keyA and keyB. - * @deprecated STRALGO LCS command will be removed from Redis 7. - * {@link StringCommands#lcs(String, String, LCSParams) LCS} can be used instead of this method. - * @param keyA - * @param keyB - * @param params - * @return According to StrAlgoLCSParams to decide to return content to fill LCSMatchResult. - */ - @Deprecated - LCSMatchResult strAlgoLCSKeys(String keyA, String keyB, StrAlgoLCSParams params); - /** * Calculate the longest common subsequence of keyA and keyB. * @param keyA diff --git a/src/main/java/redis/clients/jedis/commands/StringPipelineBinaryCommands.java b/src/main/java/redis/clients/jedis/commands/StringPipelineBinaryCommands.java index 35c2965c64..f00cd834dc 100644 --- a/src/main/java/redis/clients/jedis/commands/StringPipelineBinaryCommands.java +++ b/src/main/java/redis/clients/jedis/commands/StringPipelineBinaryCommands.java @@ -60,12 +60,5 @@ public interface StringPipelineBinaryCommands extends BitPipelineBinaryCommands Response strlen(byte[] key); - /** - * @deprecated STRALGO LCS command will be removed from Redis 7. - * {@link StringPipelineBinaryCommands#lcs(byte[], byte[], LCSParams) LCS} can be used instead of this method. - */ - @Deprecated - Response strAlgoLCSKeys(byte[] keyA, byte[] keyB, StrAlgoLCSParams params); - Response lcs(byte[] keyA, byte[] keyB, LCSParams params); } diff --git a/src/main/java/redis/clients/jedis/commands/StringPipelineCommands.java b/src/main/java/redis/clients/jedis/commands/StringPipelineCommands.java index f02299711e..e51caf7133 100644 --- a/src/main/java/redis/clients/jedis/commands/StringPipelineCommands.java +++ b/src/main/java/redis/clients/jedis/commands/StringPipelineCommands.java @@ -60,12 +60,5 @@ public interface StringPipelineCommands extends BitPipelineCommands { Response strlen(String key); - /** - * @deprecated STRALGO LCS command will be removed from Redis 7. - * {@link StringPipelineCommands#lcs(String, String, LCSParams) LCS} can be used instead of this method. - */ - @Deprecated - Response strAlgoLCSKeys(String keyA, String keyB, StrAlgoLCSParams params); - Response lcs(String keyA, String keyB, LCSParams params); } diff --git a/src/main/java/redis/clients/jedis/graph/GraphQueryParams.java b/src/main/java/redis/clients/jedis/graph/GraphQueryParams.java index 24c34f6c31..82738d2485 100644 --- a/src/main/java/redis/clients/jedis/graph/GraphQueryParams.java +++ b/src/main/java/redis/clients/jedis/graph/GraphQueryParams.java @@ -89,10 +89,4 @@ public void addParams(CommandArguments args) { public boolean isReadonly() { return readonly; } - - @Deprecated - public CommandArguments getArguments(String graphName) { - return new CommandArguments(!readonly ? GraphCommand.QUERY : GraphCommand.RO_QUERY) - .key(graphName).addParams(this); - } } diff --git a/src/main/java/redis/clients/jedis/params/SetParams.java b/src/main/java/redis/clients/jedis/params/SetParams.java index 080c47f019..de8529cadf 100644 --- a/src/main/java/redis/clients/jedis/params/SetParams.java +++ b/src/main/java/redis/clients/jedis/params/SetParams.java @@ -13,7 +13,6 @@ public class SetParams extends Params implements IParams { private static final String EXAT = "exat"; private static final String PXAT = "pxat"; private static final String KEEPTTL = "keepttl"; - private static final String GET = "get"; public SetParams() { } @@ -89,17 +88,6 @@ public SetParams keepttl() { return this; } - /** - * Return the old value stored at key, or nil when key did not exist. - * @return SetParams - * @deprecated Use {@code setGet} method (without setting {@link SetParams#get()}. - */ - @Deprecated - public SetParams get() { - addParam(GET); - return this; - } - @Override public void addParams(CommandArguments args) { if (contains(NX)) { @@ -128,10 +116,6 @@ public void addParams(CommandArguments args) { if (contains(KEEPTTL)) { args.add(Keyword.KEEPTTL); } - - if (contains(GET)) { - args.add(Keyword.GET); - } } } diff --git a/src/main/java/redis/clients/jedis/params/XPendingParams.java b/src/main/java/redis/clients/jedis/params/XPendingParams.java index 7ce3e687fd..ec384595d0 100644 --- a/src/main/java/redis/clients/jedis/params/XPendingParams.java +++ b/src/main/java/redis/clients/jedis/params/XPendingParams.java @@ -10,28 +10,12 @@ public class XPendingParams implements IParams { - private boolean legacy = true; private Long idle; - private Rawable start; // TODO: final - private Rawable end; // TODO: final - private int count = Integer.MIN_VALUE; // TODO: final + private Rawable start; + private Rawable end; + private Integer count; private Rawable consumer; - /** - * @deprecated Use {@link XPendingParams#XPendingParams(redis.clients.jedis.StreamEntryID, redis.clients.jedis.StreamEntryID, int)}. - */ - @Deprecated - public XPendingParams() { - } - - /** - * @deprecated Use {@link XPendingParams#xPendingParams(redis.clients.jedis.StreamEntryID, redis.clients.jedis.StreamEntryID, int)}. - */ - @Deprecated - public static XPendingParams xPendingParams() { - return new XPendingParams(); - } - public XPendingParams(StreamEntryID start, StreamEntryID end, int count) { this(start.toString(), end.toString(), count); } @@ -44,13 +28,18 @@ public XPendingParams(byte[] start, byte[] end, int count) { this(from(start), from(end), count); } - private XPendingParams(Rawable start, Rawable end, int count) { - this.legacy = false; + private XPendingParams(Rawable start, Rawable end, Integer count) { this.start = start; this.end = end; this.count = count; } + public XPendingParams() { + this.start = null; + this.end = null; + this.count = null; + } + public static XPendingParams xPendingParams(StreamEntryID start, StreamEntryID end, int count) { return new XPendingParams(start, end, count); } @@ -63,24 +52,29 @@ public static XPendingParams xPendingParams(byte[] start, byte[] end, int count) return new XPendingParams(start, end, count); } + public static XPendingParams xPendingParams() { + return new XPendingParams(); + } + public XPendingParams idle(long idle) { this.idle = idle; return this; } - @Deprecated public XPendingParams start(StreamEntryID start) { + if (this.start != null) throw new IllegalStateException("'start' is already set."); this.start = from(start.toString()); return this; } - @Deprecated public XPendingParams end(StreamEntryID end) { + if (this.end != null) throw new IllegalStateException("'end' is already set."); this.end = from(end.toString()); return this; } public XPendingParams count(int count) { + if (this.count != null) throw new IllegalStateException("'count' is already set."); this.count = count; return this; } @@ -97,30 +91,17 @@ public XPendingParams consumer(byte[] consumer) { @Override public void addParams(CommandArguments args) { + if (count == null) { + throw new IllegalStateException("start, end and count must be set."); + } + if (start == null) start = from("-"); + if (end == null) end = from("+"); if (idle != null) { args.add(IDLE).add(toByteArray(idle)); } - if (legacy) { - if (start == null) { - args.add("-"); - } else { - args.add(start); - } - - if (end == null) { - args.add("+"); - } else { - args.add(end); - } - - if (count != Integer.MIN_VALUE) { - args.add(toByteArray(count)); - } - } else { - args.add(start).add(end).add(toByteArray(count)); - } + args.add(start).add(end).add(toByteArray(count)); if (consumer != null) { args.add(consumer); diff --git a/src/main/java/redis/clients/jedis/search/Document.java b/src/main/java/redis/clients/jedis/search/Document.java index b9a8904348..9e126b948b 100644 --- a/src/main/java/redis/clients/jedis/search/Document.java +++ b/src/main/java/redis/clients/jedis/search/Document.java @@ -16,7 +16,6 @@ public class Document implements Serializable { private final String id; private double score; - private byte[] payload; private final Map properties; public Document(String id, double score) { @@ -32,14 +31,9 @@ public Document(String id, Map fields) { } public Document(String id, Map fields, double score) { - this(id, fields, score, null); - } - - public Document(String id, Map fields, double score, byte[] payload) { this.id = id; - this.properties = new HashMap<>(fields); + this.properties = fields; this.score = score; - this.payload = payload; } public Iterable> getProperties() { @@ -47,12 +41,11 @@ public Iterable> getProperties() { } public static Document load(String id, double score, byte[] payload, List fields) { - return Document.load(id, score, payload, fields, true); + return Document.load(id, score, fields, true); } - public static Document load(String id, double score, byte[] payload, List fields, boolean decode) { + public static Document load(String id, double score, List fields, boolean decode) { Document ret = new Document(id, score); - ret.payload = payload; if (fields != null) { for (int i = 0; i < fields.size(); i += 2) { byte[] rawKey = fields.get(i); @@ -103,10 +96,6 @@ public double getScore() { return score; } - public byte[] getPayload() { - return payload; - } - /** * Set the document's score * @@ -132,7 +121,6 @@ public boolean hasProperty(String key) { @Override public String toString() { return "id:" + this.getId() + ", score: " + this.getScore() + - ", payload:" + (this.getPayload() == null ? "null" : SafeEncoder.encode(this.getPayload())) + ", properties:" + this.getProperties(); } } diff --git a/src/main/java/redis/clients/jedis/search/FieldName.java b/src/main/java/redis/clients/jedis/search/FieldName.java index 3e83faa8b4..f4b8b3ffb2 100644 --- a/src/main/java/redis/clients/jedis/search/FieldName.java +++ b/src/main/java/redis/clients/jedis/search/FieldName.java @@ -73,11 +73,6 @@ public void addParams(CommandArguments args) { addCommandArguments(args); } - @Deprecated // TODO: remove? - String getName() { - return name; - } - @Override public String toString() { return attribute == null ? name : (name + " AS " + attribute); diff --git a/src/main/java/redis/clients/jedis/search/FtSearchIteration.java b/src/main/java/redis/clients/jedis/search/FtSearchIteration.java index ea29826e73..d8686e2186 100644 --- a/src/main/java/redis/clients/jedis/search/FtSearchIteration.java +++ b/src/main/java/redis/clients/jedis/search/FtSearchIteration.java @@ -18,7 +18,7 @@ public class FtSearchIteration extends JedisCommandIterationBase new CommandArguments(SearchProtocol.SearchCommand.SEARCH) .add(indexName).add(query).addParams(params.limit(limitFirst, this.batchSize)); @@ -28,7 +28,7 @@ public FtSearchIteration(ConnectionProvider connectionProvider, int batchSize, S * {@link Query#limit(java.lang.Integer, java.lang.Integer)} will be ignored. */ public FtSearchIteration(ConnectionProvider connectionProvider, int batchSize, String indexName, Query query) { - super(connectionProvider, new SearchResultBuilder(!query.getNoContent(), query.getWithScores(), query.getWithPayloads(), true)); + super(connectionProvider, new SearchResultBuilder(!query.getNoContent(), query.getWithScores(), true)); this.batchSize = batchSize; this.args = (limitFirst) -> new CommandArguments(SearchProtocol.SearchCommand.SEARCH) .add(indexName).addParams(query.limit(limitFirst, this.batchSize)); diff --git a/src/main/java/redis/clients/jedis/search/IndexDefinition.java b/src/main/java/redis/clients/jedis/search/IndexDefinition.java index c652453da5..19aebb0a21 100644 --- a/src/main/java/redis/clients/jedis/search/IndexDefinition.java +++ b/src/main/java/redis/clients/jedis/search/IndexDefinition.java @@ -23,7 +23,6 @@ public enum Type { private String language; private String scoreFiled; private double score = 1.0; // Default score when score isn't defined - private String payloadField; public IndexDefinition() { this(null); @@ -100,19 +99,6 @@ public IndexDefinition setScore(double score) { return this; } - public String getPayloadField() { - return payloadField; - } - - /** - * @deprecated Since RediSearch 2.0.0, PAYLOAD_FIELD option is deprecated. - */ - @Deprecated - public IndexDefinition setPayloadField(String payloadField) { - this.payloadField = payloadField; - return this; - } - @Override public void addParams(CommandArguments args) { @@ -121,10 +107,6 @@ public void addParams(CommandArguments args) { args.add(type.name()); } - if (async) { - args.add(SearchKeyword.ASYNC.name()); - } - if (prefixes != null && prefixes.length > 0) { args.add(SearchKeyword.PREFIX.name()); args.add(Integer.toString(prefixes.length)); @@ -155,10 +137,5 @@ public void addParams(CommandArguments args) { args.add(SearchKeyword.SCORE.name()); args.add(Double.toString(score)); } - - if (payloadField != null) { - args.add(SearchKeyword.PAYLOAD_FIELD.name()); - args.add(payloadField); - } } } diff --git a/src/main/java/redis/clients/jedis/search/Query.java b/src/main/java/redis/clients/jedis/search/Query.java index 06b2339523..d251697a76 100644 --- a/src/main/java/redis/clients/jedis/search/Query.java +++ b/src/main/java/redis/clients/jedis/search/Query.java @@ -138,7 +138,6 @@ public HighlightTags(String open, String close) { private boolean _noContent = false; private boolean _noStopwords = false; private boolean _withScores = false; - private boolean _withPayloads = false; private String _language = null; private String[] _fields = null; private String[] _keys = null; @@ -150,7 +149,6 @@ public HighlightTags(String open, String close) { private String summarizeSeparator = null; private int summarizeNumFragments = -1; private int summarizeFragmentLen = -1; - private byte[] _payload = null; private String _sortBy = null; private boolean _sortAsc = true; private boolean wantsHighlight = false; @@ -192,9 +190,6 @@ public void addParams(CommandArguments args) { if (_withScores) { args.add(SearchKeyword.WITHSCORES.getRaw()); } - if (_withPayloads) { - args.add(SearchKeyword.WITHPAYLOADS.getRaw()); - } if (_language != null) { args.add(SearchKeyword.LANGUAGE.getRaw()); args.add(SafeEncoder.encode(_language)); @@ -219,11 +214,6 @@ public void addParams(CommandArguments args) { args.add((_sortAsc ? SearchKeyword.ASC : SearchKeyword.DESC).getRaw()); } - if (_payload != null) { - args.add(SearchKeyword.PAYLOAD.getRaw()); - args.add(_payload); - } - if (_paging.offset != 0 || _paging.num != 10) { args.add(SearchKeyword.LIMIT.getRaw()).add(Protocol.toByteArray(_paging.offset)).add(Protocol.toByteArray(_paging.num)); } @@ -357,18 +347,6 @@ public Query addFilter(Filter f) { return this; } - /** - * Set the query payload to be evaluated by the scoring function - * - * @return the query object itself - * @deprecated Since RediSearch 2.0.0, PAYLOAD option is deprecated. - */ - @Deprecated - public Query setPayload(byte[] payload) { - _payload = payload; - return this; - } - /** * Set the query to verbatim mode, disabling stemming and query expansion * @@ -418,22 +396,6 @@ public Query setWithScores() { return this; } - public boolean getWithPayloads() { - return _withPayloads; - } - - /** - * Set the query to return object payloads, if any were given - * - * @return the query object itself - * @deprecated Since RediSearch 2.0.0, WITHPAYLOADS option is deprecated. - */ - @Deprecated - public Query setWithPayload() { - this._withPayloads = true; - return this; - } - /** * Set the query language, for stemming purposes *

diff --git a/src/main/java/redis/clients/jedis/search/RediSearchPipelineCommands.java b/src/main/java/redis/clients/jedis/search/RediSearchPipelineCommands.java index e78155f697..87a4954a4f 100644 --- a/src/main/java/redis/clients/jedis/search/RediSearchPipelineCommands.java +++ b/src/main/java/redis/clients/jedis/search/RediSearchPipelineCommands.java @@ -59,18 +59,6 @@ default Response ftSearch(String indexName) { Response ftAggregate(String indexName, AggregationBuilder aggr); - @Deprecated - Response ftCursorRead(String indexName, long cursorId, int count); - - @Deprecated - Response ftCursorDel(String indexName, long cursorId); - - @Deprecated - Response ftDropIndex(String indexName); - - @Deprecated - Response ftDropIndexDD(String indexName); - Response ftSynUpdate(String indexName, String synonymGroupId, String... terms); Response>> ftSynDump(String indexName); @@ -96,15 +84,6 @@ Response>> ftSpellCheck(String index, String que Response> ftTagVals(String indexName, String fieldName); - @Deprecated - Response ftAliasAdd(String aliasName, String indexName); - - @Deprecated - Response ftAliasUpdate(String aliasName, String indexName); - - @Deprecated - Response ftAliasDel(String aliasName); - Response> ftConfigGet(String option); Response> ftConfigGet(String indexName, String option); diff --git a/src/main/java/redis/clients/jedis/search/Schema.java b/src/main/java/redis/clients/jedis/search/Schema.java index d9fa1c73e5..17f01cc9de 100644 --- a/src/main/java/redis/clients/jedis/search/Schema.java +++ b/src/main/java/redis/clients/jedis/search/Schema.java @@ -21,7 +21,7 @@ public enum FieldType { VECTOR } - @Deprecated // TODO: this should be private + // public for CommandObjects public final List fields; public Schema() { @@ -161,10 +161,9 @@ public String toString() { public static class Field implements IParams { protected final FieldName fieldName; - @Deprecated public final String name; - @Deprecated public final FieldType type; - @Deprecated public final boolean sortable; - @Deprecated public final boolean noIndex; + protected final FieldType type; + protected final boolean sortable; + protected final boolean noIndex; public Field(String name, FieldType type) { this(name, type, false, false); @@ -184,7 +183,6 @@ public Field(FieldName name, FieldType type) { public Field(FieldName name, FieldType type, boolean sortable, boolean noIndex) { this.fieldName = name; - this.name = this.fieldName.getName(); this.type = type; this.sortable = sortable; this.noIndex = noIndex; diff --git a/src/main/java/redis/clients/jedis/search/SearchProtocol.java b/src/main/java/redis/clients/jedis/search/SearchProtocol.java index 9812a203e2..8b8d0875d6 100644 --- a/src/main/java/redis/clients/jedis/search/SearchProtocol.java +++ b/src/main/java/redis/clients/jedis/search/SearchProtocol.java @@ -54,11 +54,9 @@ public enum SearchKeyword implements Rawable { INKEYS, RETURN, FILTER, GEOFILTER, ADD, INCR, MAX, FUZZY, READ, DEL, DD, TEMPORARY, STOPWORDS, NOFREQS, NOFIELDS, NOOFFSETS, NOHL, SET, GET, ON, SORTABLE, UNF, PREFIX, LANGUAGE_FIELD, SCORE, SCORE_FIELD, SCORER, PARAMS, AS, DIALECT, SLOP, TIMEOUT, INORDER, EXPANDER, MAXTEXTFIELDS, - SKIPINITIALSCAN, WITHSUFFIXTRIE, NOSTEM, NOINDEX, PHONETIC, WEIGHT, CASESENSITIVE, /*EXPLAINSCORE,*/ + SKIPINITIALSCAN, WITHSUFFIXTRIE, NOSTEM, NOINDEX, PHONETIC, WEIGHT, CASESENSITIVE, LOAD, APPLY, GROUPBY, MAXIDLE, WITHCURSOR, DISTANCE, TERMS, INCLUDE, EXCLUDE, - SEARCH, AGGREGATE, QUERY, LIMITED, - @Deprecated ASYNC, @Deprecated PAYLOAD_FIELD, @Deprecated WITHPAYLOADS, @Deprecated PAYLOAD, - @Deprecated COUNT; + SEARCH, AGGREGATE, QUERY, LIMITED, COUNT; private final byte[] raw; diff --git a/src/main/java/redis/clients/jedis/search/SearchResult.java b/src/main/java/redis/clients/jedis/search/SearchResult.java index 9d1bef2536..e756a54e6a 100644 --- a/src/main/java/redis/clients/jedis/search/SearchResult.java +++ b/src/main/java/redis/clients/jedis/search/SearchResult.java @@ -32,13 +32,11 @@ public static class SearchResultBuilder extends Builder { private final boolean hasContent; private final boolean hasScores; - private final boolean hasPayloads; private final boolean decode; - public SearchResultBuilder(boolean hasContent, boolean hasScores, boolean hasPayloads, boolean decode) { + public SearchResultBuilder(boolean hasContent, boolean hasScores, boolean decode) { this.hasContent = hasContent; this.hasScores = hasScores; - this.hasPayloads = hasPayloads; this.decode = decode; } @@ -49,7 +47,6 @@ public SearchResult build(Object data) { int step = 1; int scoreOffset = 0; int contentOffset = 1; - int payloadOffset = 0; if (hasScores) { step += 1; scoreOffset = 1; @@ -57,11 +54,6 @@ public SearchResult build(Object data) { } if (hasContent) { step += 1; - if (hasPayloads) { - payloadOffset = scoreOffset + 1; - step += 1; - contentOffset += 1; - } } // the first element is always the number of results @@ -72,10 +64,9 @@ public SearchResult build(Object data) { String id = BuilderFactory.STRING.build(resp.get(i)); double score = hasScores ? BuilderFactory.DOUBLE.build(resp.get(i + scoreOffset)) : 1.0; - byte[] payload = hasPayloads ? (byte[]) resp.get(i + payloadOffset) : null; List fields = hasContent ? (List) resp.get(i + contentOffset) : null; - documents.add(Document.load(id, score, payload, fields, decode)); + documents.add(Document.load(id, score, fields, decode)); } return new SearchResult(totalResults, documents); diff --git a/src/main/java/redis/clients/jedis/search/aggr/AggregationBuilder.java b/src/main/java/redis/clients/jedis/search/aggr/AggregationBuilder.java index e6ac439549..d7b40d47fd 100644 --- a/src/main/java/redis/clients/jedis/search/aggr/AggregationBuilder.java +++ b/src/main/java/redis/clients/jedis/search/aggr/AggregationBuilder.java @@ -171,22 +171,6 @@ public List getArgs() { return Collections.unmodifiableList(args); } - @Deprecated - public void serializeRedisArgs(List redisArgs) { - for (String s : getArgs()) { - redisArgs.add(SafeEncoder.encode(s)); - } - } - - @Deprecated - public String getArgsString() { - StringJoiner sj = new StringJoiner(" "); - for (String s : getArgs()) { - sj.add(s); - } - return sj.toString(); - } - public boolean isWithCursor() { return isWithCursor; } diff --git a/src/main/java/redis/clients/jedis/search/aggr/AggregationResult.java b/src/main/java/redis/clients/jedis/search/aggr/AggregationResult.java index fdfa4e23cd..67133c5f18 100644 --- a/src/main/java/redis/clients/jedis/search/aggr/AggregationResult.java +++ b/src/main/java/redis/clients/jedis/search/aggr/AggregationResult.java @@ -11,11 +11,7 @@ public class AggregationResult { - /** - * @deprecated Use {@link AggregationResult#getTotalResults()}. - */ - @Deprecated - public final long totalResults; + private final long totalResults; private final List> results; diff --git a/src/main/java/redis/clients/jedis/timeseries/TSAlterParams.java b/src/main/java/redis/clients/jedis/timeseries/TSAlterParams.java index c972f167bc..4576a1b6b7 100644 --- a/src/main/java/redis/clients/jedis/timeseries/TSAlterParams.java +++ b/src/main/java/redis/clients/jedis/timeseries/TSAlterParams.java @@ -26,14 +26,6 @@ public static TSAlterParams alterParams() { return new TSAlterParams(); } - /** - * @deprecated Use {@link TSAlterParams#retention(long)}. - */ - @Deprecated - public TSAlterParams retentionTime(long retentionTime) { - return retention(retentionTime); - } - public TSAlterParams retention(long retentionPeriod) { this.retentionPeriod = retentionPeriod; return this; diff --git a/src/test/java/redis/clients/jedis/ACLJedisPoolTest.java b/src/test/java/redis/clients/jedis/ACLJedisPoolTest.java index 5c9681fe4b..61f2737cf6 100644 --- a/src/test/java/redis/clients/jedis/ACLJedisPoolTest.java +++ b/src/test/java/redis/clients/jedis/ACLJedisPoolTest.java @@ -2,7 +2,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -270,50 +269,4 @@ public void testCloseConnectionOnMakeObject() { private int getClientCount(final String clientList) { return clientList.split("\n").length; } - - @Test - public void testResetInvalidPassword() { - JedisFactory factory = new JedisFactory(hnp.getHost(), hnp.getPort(), 2000, 2000, - "acljedis", "fizzbuzz", 0, "my_shiny_client_name") { }; - - try (JedisPool pool = new JedisPool(new JedisPoolConfig(), factory)) { - Jedis obj1_ref; - try (Jedis obj1_1 = pool.getResource()) { - obj1_ref = obj1_1; - obj1_1.set("foo", "bar"); - assertEquals("bar", obj1_1.get("foo")); - assertEquals(1, pool.getNumActive()); - } - assertEquals(0, pool.getNumActive()); - try (Jedis obj1_2 = pool.getResource()) { - assertSame(obj1_ref, obj1_2); - assertEquals(1, pool.getNumActive()); - factory.setPassword("wrong password"); - try (Jedis obj2 = pool.getResource()) { - fail("Should not get resource from pool"); - } catch (JedisException e) { } - assertEquals(1, pool.getNumActive()); - } - assertEquals(0, pool.getNumActive()); - } - } - - @Test - public void testResetValidPassword() { - JedisFactory factory = new JedisFactory(hnp.getHost(), hnp.getPort(), 2000, 2000, - "acljedis", "bad password", 0, "my_shiny_client_name") { }; - - try (JedisPool pool = new JedisPool(new JedisPoolConfig(), factory)) { - try (Jedis obj1 = pool.getResource()) { - fail("Should not get resource from pool"); - } catch (JedisException e) { } - assertEquals(0, pool.getNumActive()); - - factory.setPassword("fizzbuzz"); - try (Jedis obj2 = pool.getResource()) { - obj2.set("foo", "bar"); - assertEquals("bar", obj2.get("foo")); - } - } - } } diff --git a/src/test/java/redis/clients/jedis/JedisPoolTest.java b/src/test/java/redis/clients/jedis/JedisPoolTest.java index 9c0af0249b..ab05ba8b4b 100644 --- a/src/test/java/redis/clients/jedis/JedisPoolTest.java +++ b/src/test/java/redis/clients/jedis/JedisPoolTest.java @@ -392,52 +392,6 @@ private int getClientCount(final String clientList) { return clientList.split("\n").length; } - @Test - public void testResetInvalidPassword() { - JedisFactory factory = new JedisFactory(hnp.getHost(), hnp.getPort(), 2000, 2000, - "foobared", 0, "my_shiny_client_name") { }; - - try (JedisPool pool = new JedisPool(new JedisPoolConfig(), factory)) { - Jedis obj1_ref; - try (Jedis obj1_1 = pool.getResource()) { - obj1_ref = obj1_1; - obj1_1.set("foo", "bar"); - assertEquals("bar", obj1_1.get("foo")); - assertEquals(1, pool.getNumActive()); - } - assertEquals(0, pool.getNumActive()); - try (Jedis obj1_2 = pool.getResource()) { - assertSame(obj1_ref, obj1_2); - assertEquals(1, pool.getNumActive()); - factory.setPassword("wrong password"); - try (Jedis obj2 = pool.getResource()) { - fail("Should not get resource from pool"); - } catch (JedisException e) { } - assertEquals(1, pool.getNumActive()); - } - assertEquals(0, pool.getNumActive()); - } - } - - @Test - public void testResetValidPassword() { - JedisFactory factory = new JedisFactory(hnp.getHost(), hnp.getPort(), 2000, 2000, - "bad password", 0, "my_shiny_client_name") { }; - - try (JedisPool pool = new JedisPool(new JedisPoolConfig(), factory)) { - try (Jedis obj1 = pool.getResource()) { - fail("Should not get resource from pool"); - } catch (JedisException e) { } - assertEquals(0, pool.getNumActive()); - - factory.setPassword("foobared"); - try (Jedis obj2 = pool.getResource()) { - obj2.set("foo", "bar"); - assertEquals("bar", obj2.get("foo")); - } - } - } - @Test public void testResetInvalidCredentials() { DefaultRedisCredentialsProvider credentialsProvider diff --git a/src/test/java/redis/clients/jedis/JedisPooledTest.java b/src/test/java/redis/clients/jedis/JedisPooledTest.java index e44c02fa4d..612d6db57e 100644 --- a/src/test/java/redis/clients/jedis/JedisPooledTest.java +++ b/src/test/java/redis/clients/jedis/JedisPooledTest.java @@ -159,24 +159,6 @@ public void closeBrokenResourceTwice() { } } - @Test - public void testResetValidPassword() { - ConnectionFactory factory = new ConnectionFactory(HostAndPorts.getRedisServers().get(0), - DefaultJedisClientConfig.builder().password("bad password") - .clientName("my_shiny_client_name").build()); - - try (JedisPooled pool = new JedisPooled(new ConnectionPoolConfig(), factory)) { - try { - pool.get("foo"); - fail("Should not get resource from pool"); - } catch (JedisException e) { } - assertEquals(0, pool.getPool().getNumActive()); - - factory.setPassword("foobared"); - assertNull(pool.get("foo")); - } - } - @Test public void testResetValidCredentials() { DefaultRedisCredentialsProvider credentialsProvider = diff --git a/src/test/java/redis/clients/jedis/JedisSentinelPoolTest.java b/src/test/java/redis/clients/jedis/JedisSentinelPoolTest.java index 1d52d14784..d00da82447 100644 --- a/src/test/java/redis/clients/jedis/JedisSentinelPoolTest.java +++ b/src/test/java/redis/clients/jedis/JedisSentinelPoolTest.java @@ -3,7 +3,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertSame; -import static org.junit.Assert.fail; import java.util.HashSet; import java.util.Set; @@ -145,42 +144,4 @@ public void customClientName() { assertTrue(pool.isClosed()); } - - @Test - public void testResetInvalidPassword() { - JedisFactory factory = new JedisFactory(null, 0, 2000, 2000, "foobared", 0, "my_shiny_client_name") { }; - - try (JedisSentinelPool pool = new JedisSentinelPool(MASTER_NAME, sentinels, new JedisPoolConfig(), factory)) { - Jedis obj1_ref; - try (Jedis obj1_1 = pool.getResource()) { - obj1_ref = obj1_1; - obj1_1.set("foo", "bar"); - assertEquals("bar", obj1_1.get("foo")); - } - try (Jedis obj1_2 = pool.getResource()) { - assertSame(obj1_ref, obj1_2); - factory.setPassword("wrong password"); - try (Jedis obj2 = pool.getResource()) { - fail("Should not get resource from pool"); - } catch (JedisException e) { } - } - } - } - - @Test - public void testResetValidPassword() { - JedisFactory factory = new JedisFactory(null, 0, 2000, 2000, "wrong password", 0, "my_shiny_client_name") { }; - - try (JedisSentinelPool pool = new JedisSentinelPool(MASTER_NAME, sentinels, new JedisPoolConfig(), factory)) { - try (Jedis obj1 = pool.getResource()) { - fail("Should not get resource from pool"); - } catch (JedisException e) { } - - factory.setPassword("foobared"); - try (Jedis obj2 = pool.getResource()) { - obj2.set("foo", "bar"); - assertEquals("bar", obj2.get("foo")); - } - } - } } diff --git a/src/test/java/redis/clients/jedis/ShardedConnectionTest.java b/src/test/java/redis/clients/jedis/ShardedConnectionTest.java index e26acd6cdf..2318b7b3d2 100644 --- a/src/test/java/redis/clients/jedis/ShardedConnectionTest.java +++ b/src/test/java/redis/clients/jedis/ShardedConnectionTest.java @@ -43,38 +43,38 @@ public void checkConnections() { } } - @Test - public void checkPoolWhenJedisIsBroken() { - GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig<>(); - poolConfig.setMaxTotal(1); - try (JedisSharding jedis = new JedisSharding(shards, clientConfig, poolConfig)) { - jedis.sendCommand(Protocol.Command.QUIT); - jedis.incr("foo"); - } catch (JedisConnectionException jce) { - } - } - - @Test - public void checkPoolTestOnBorrowWhenJedisIsBroken() { - GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig<>(); - poolConfig.setMaxTotal(1); - poolConfig.setTestOnBorrow(true); - try (JedisSharding jedis = new JedisSharding(shards, clientConfig, poolConfig)) { - jedis.sendCommand(Protocol.Command.QUIT); - jedis.incr("foo"); - } - } - - @Test - public void checkPoolTestOnReturnWhenJedisIsBroken() { - GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig<>(); - poolConfig.setMaxTotal(1); - poolConfig.setTestOnReturn(true); - try (JedisSharding jedis = new JedisSharding(shards, clientConfig, poolConfig)) { - jedis.sendCommand(Protocol.Command.QUIT); - jedis.incr("foo"); - } - } +// @Test +// public void checkPoolWhenJedisIsBroken() { +// GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig<>(); +// poolConfig.setMaxTotal(1); +// try (JedisSharding jedis = new JedisSharding(shards, clientConfig, poolConfig)) { +// jedis.sendCommand(Protocol.Command.QUIT); +// jedis.incr("foo"); +// } catch (JedisConnectionException jce) { +// } +// } +// +// @Test +// public void checkPoolTestOnBorrowWhenJedisIsBroken() { +// GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig<>(); +// poolConfig.setMaxTotal(1); +// poolConfig.setTestOnBorrow(true); +// try (JedisSharding jedis = new JedisSharding(shards, clientConfig, poolConfig)) { +// jedis.sendCommand(Protocol.Command.QUIT); +// jedis.incr("foo"); +// } +// } +// +// @Test +// public void checkPoolTestOnReturnWhenJedisIsBroken() { +// GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig<>(); +// poolConfig.setMaxTotal(1); +// poolConfig.setTestOnReturn(true); +// try (JedisSharding jedis = new JedisSharding(shards, clientConfig, poolConfig)) { +// jedis.sendCommand(Protocol.Command.QUIT); +// jedis.incr("foo"); +// } +// } @Test public void checkFailedJedisServer() { diff --git a/src/test/java/redis/clients/jedis/commands/jedis/AllKindOfValuesCommandsTest.java b/src/test/java/redis/clients/jedis/commands/jedis/AllKindOfValuesCommandsTest.java index 8c7bfa684c..13de6e4902 100644 --- a/src/test/java/redis/clients/jedis/commands/jedis/AllKindOfValuesCommandsTest.java +++ b/src/test/java/redis/clients/jedis/commands/jedis/AllKindOfValuesCommandsTest.java @@ -56,6 +56,7 @@ public class AllKindOfValuesCommandsTest extends JedisCommandsTestBase { final byte[] bnx = { 0x6E, 0x78 }; final byte[] bex = { 0x65, 0x78 }; final int expireSeconds = 2; + private static final HostAndPort lfuHnp = HostAndPorts.getRedisServers().get(7); @Test @@ -944,12 +945,12 @@ public void setGetOptionTest() { assertEquals("OK", jedis.set("hello", "world")); // GET old value - assertEquals("world", jedis.set("hello", "jedis", setParams().get())); + assertEquals("world", jedis.setGet("hello", "jedis")); assertEquals("jedis", jedis.get("hello")); // GET null value - assertNull(jedis.set("key", "value", setParams().get())); + assertNull(jedis.setGet("key", "value")); } @Test diff --git a/src/test/java/redis/clients/jedis/commands/jedis/StreamsCommandsTest.java b/src/test/java/redis/clients/jedis/commands/jedis/StreamsCommandsTest.java index e42c55a4f7..d73094882f 100644 --- a/src/test/java/redis/clients/jedis/commands/jedis/StreamsCommandsTest.java +++ b/src/test/java/redis/clients/jedis/commands/jedis/StreamsCommandsTest.java @@ -604,7 +604,8 @@ public void xclaimWithParams() { // Get the pending event List pendingRange = jedis.xpending("xpendeing-stream", "xpendeing-group", - null, null, 3, "xpendeing-consumer"); + XPendingParams.xPendingParams().count(3).consumer("xpendeing-consumer")); + // Sleep for 100ms so we can claim events pending for more than 50ms try { Thread.sleep(100); @@ -634,7 +635,7 @@ public void xclaimJustId() { // Get the pending event List pendingRange = jedis.xpending("xpendeing-stream", "xpendeing-group", - null, null, 3, "xpendeing-consumer"); + XPendingParams.xPendingParams().count(3).consumer("xpendeing-consumer")); // Sleep for 100ms so we can claim events pending for more than 50ms try { Thread.sleep(100); @@ -663,7 +664,7 @@ public void xautoclaim() { // Get the pending event List pendingRange = jedis.xpending("xpending-stream", "xpending-group", - null, null, 3, "xpending-consumer"); + XPendingParams.xPendingParams().count(3).consumer("xpending-consumer")); // Sleep for 100ms so we can auto claim events pending for more than 50ms try { Thread.sleep(100); @@ -693,7 +694,7 @@ public void xautoclaimBinary() { // Get the pending event List pendingRange = jedis.xpending("xpending-stream", "xpending-group", - null, null, 3, "xpending-consumer"); + XPendingParams.xPendingParams().count(3).consumer("xpending-consumer")); // Sleep for 100ms so we can auto claim events pending for more than 50ms try { Thread.sleep(100); @@ -725,7 +726,7 @@ public void xautoclaimJustId() { // Get the pending event List pendingRange = jedis.xpending("xpending-stream", "xpending-group", - null, null, 3, "xpending-consumer"); + XPendingParams.xPendingParams().count(3).consumer("xpending-consumer")); // Sleep for 100ms so we can auto claim events pending for more than 50ms try { Thread.sleep(100); @@ -755,7 +756,7 @@ public void xautoclaimJustIdBinary() { // Get the pending event List pendingRange = jedis.xpending("xpending-stream", "xpending-group", - null, null, 3, "xpending-consumer"); + XPendingParams.xPendingParams().count(3).consumer("xpending-consumer")); // Sleep for 100ms so we can auto claim events pending for more than 50ms try { Thread.sleep(100); diff --git a/src/test/java/redis/clients/jedis/commands/jedis/StringValuesCommandsTest.java b/src/test/java/redis/clients/jedis/commands/jedis/StringValuesCommandsTest.java index bf203be0ac..fb58569e82 100644 --- a/src/test/java/redis/clients/jedis/commands/jedis/StringValuesCommandsTest.java +++ b/src/test/java/redis/clients/jedis/commands/jedis/StringValuesCommandsTest.java @@ -3,20 +3,15 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertNull; -import static org.junit.Assume.assumeFalse; -import static redis.clients.jedis.util.RedisVersionUtil.checkRedisMajorVersionNumber; import java.util.ArrayList; import java.util.List; - import org.junit.Test; import redis.clients.jedis.params.LCSParams; import redis.clients.jedis.resps.LCSMatchResult; -import redis.clients.jedis.resps.LCSMatchResult.MatchedPosition; import redis.clients.jedis.exceptions.JedisDataException; import redis.clients.jedis.params.GetExParams; -import redis.clients.jedis.params.StrAlgoLCSParams; public class StringValuesCommandsTest extends JedisCommandsTestBase { @Test @@ -242,80 +237,6 @@ public void psetex() { assertTrue(ttl > 0 && ttl <= 20000); } - @Test - public void strAlgoLcsWithLen() { - assumeFalse(checkRedisMajorVersionNumber(7)); - LCSMatchResult stringMatchResult = jedis.strAlgoLCSStrings("ohmytext", "mynewtext", - StrAlgoLCSParams.StrAlgoLCSParams().len()); - assertEquals(stringMatchResult.getLen(), 6); - } - - @Test - public void strAlgoLcs() { - assumeFalse(checkRedisMajorVersionNumber(7)); - LCSMatchResult stringMatchResult = jedis.strAlgoLCSStrings("ohmytext", "mynewtext", - StrAlgoLCSParams.StrAlgoLCSParams()); - assertEquals(stringMatchResult.getMatchString(), "mytext"); - } - - @Test - public void strAlgoLcsWithIdx() { - assumeFalse(checkRedisMajorVersionNumber(7)); - LCSMatchResult stringMatchResult = jedis.strAlgoLCSStrings("ohmytext", "mynewtext", - StrAlgoLCSParams.StrAlgoLCSParams().idx().withMatchLen()); - assertEquals(stringMatchResult.getLen(), 6); - assertEquals(2, stringMatchResult.getMatches().size()); - - MatchedPosition position0 = stringMatchResult.getMatches().get(0); - assertEquals(position0.getA().getStart(), 4); - assertEquals(position0.getA().getEnd(), 7); - assertEquals(position0.getB().getStart(), 5); - assertEquals(position0.getB().getEnd(), 8); - assertEquals(position0.getMatchLen(), 4); - - MatchedPosition position1 = stringMatchResult.getMatches().get(1); - assertEquals(position1.getA().getStart(), 2); - assertEquals(position1.getA().getEnd(), 3); - assertEquals(position1.getB().getStart(), 0); - assertEquals(position1.getB().getEnd(), 1); - assertEquals(position1.getMatchLen(), 2); - } - - @Test - public void strAlgoLcsWithKey() { - assumeFalse(checkRedisMajorVersionNumber(7)); - jedis.mset("key1", "ohmytext", "key2", "mynewtext"); - - LCSMatchResult stringMatchResult = jedis.strAlgoLCSKeys("key1", "key2", - StrAlgoLCSParams.StrAlgoLCSParams()); - assertEquals("mytext", stringMatchResult.getMatchString()); - } - - @Test - public void strAlgoLcsWithKeyAndIdx() { - assumeFalse(checkRedisMajorVersionNumber(7)); - jedis.mset("key1", "ohmytext", "key2", "mynewtext"); - - LCSMatchResult stringMatchResult = jedis.strAlgoLCSKeys( "key1", "key2", - StrAlgoLCSParams.StrAlgoLCSParams().idx().withMatchLen()); - assertEquals(stringMatchResult.getLen(), 6); - assertEquals(2, stringMatchResult.getMatches().size()); - - MatchedPosition position0 = stringMatchResult.getMatches().get(0); - assertEquals(position0.getA().getStart(), 4); - assertEquals(position0.getA().getEnd(), 7); - assertEquals(position0.getB().getStart(), 5); - assertEquals(position0.getB().getEnd(), 8); - assertEquals(position0.getMatchLen(), 4); - - MatchedPosition position1 = stringMatchResult.getMatches().get(1); - assertEquals(position1.getA().getStart(), 2); - assertEquals(position1.getA().getEnd(), 3); - assertEquals(position1.getB().getStart(), 0); - assertEquals(position1.getB().getEnd(), 1); - assertEquals(position1.getMatchLen(), 2); - } - @Test public void lcs() { jedis.mset("key1", "ohmytext", "key2", "mynewtext"); diff --git a/src/test/java/redis/clients/jedis/commands/unified/AllKindOfValuesCommandsTestBase.java b/src/test/java/redis/clients/jedis/commands/unified/AllKindOfValuesCommandsTestBase.java index f34e5dfa65..8c167c99c5 100644 --- a/src/test/java/redis/clients/jedis/commands/unified/AllKindOfValuesCommandsTestBase.java +++ b/src/test/java/redis/clients/jedis/commands/unified/AllKindOfValuesCommandsTestBase.java @@ -739,12 +739,12 @@ public void setGetOptionTest() { assertEquals("OK", jedis.set("hello", "world")); // GET old value - assertEquals("world", jedis.set("hello", "jedis", setParams().get())); + assertEquals("world", jedis.setGet("hello", "jedis")); assertEquals("jedis", jedis.get("hello")); // GET null value - assertNull(jedis.set("key", "value", setParams().get())); + assertNull(jedis.setGet("key", "value")); } @Test diff --git a/src/test/java/redis/clients/jedis/commands/unified/StringValuesCommandsTestBase.java b/src/test/java/redis/clients/jedis/commands/unified/StringValuesCommandsTestBase.java index 6f27cc03ef..a666671a15 100644 --- a/src/test/java/redis/clients/jedis/commands/unified/StringValuesCommandsTestBase.java +++ b/src/test/java/redis/clients/jedis/commands/unified/StringValuesCommandsTestBase.java @@ -3,20 +3,15 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertNull; -import static org.junit.Assume.assumeFalse; -import static redis.clients.jedis.util.RedisVersionUtil.checkRedisMajorVersionNumber; import java.util.ArrayList; import java.util.List; - import org.junit.Test; import redis.clients.jedis.params.LCSParams; import redis.clients.jedis.resps.LCSMatchResult; -import redis.clients.jedis.resps.LCSMatchResult.MatchedPosition; import redis.clients.jedis.exceptions.JedisDataException; import redis.clients.jedis.params.GetExParams; -import redis.clients.jedis.params.StrAlgoLCSParams; public abstract class StringValuesCommandsTestBase extends UnifiedJedisCommandsTestBase { @Test @@ -242,80 +237,6 @@ public void psetex() { assertTrue(ttl > 0 && ttl <= 20000); } - @Test - public void strAlgoLcsWithLen() { - assumeFalse(checkRedisMajorVersionNumber(7)); - LCSMatchResult stringMatchResult = jedis.strAlgoLCSStrings("ohmytext", "mynewtext", - StrAlgoLCSParams.StrAlgoLCSParams().len()); - assertEquals(stringMatchResult.getLen(), 6); - } - - @Test - public void strAlgoLcs() { - assumeFalse(checkRedisMajorVersionNumber(7)); - LCSMatchResult stringMatchResult = jedis.strAlgoLCSStrings("ohmytext", "mynewtext", - StrAlgoLCSParams.StrAlgoLCSParams()); - assertEquals(stringMatchResult.getMatchString(), "mytext"); - } - - @Test - public void strAlgoLcsWithIdx() { - assumeFalse(checkRedisMajorVersionNumber(7)); - LCSMatchResult stringMatchResult = jedis.strAlgoLCSStrings("ohmytext", "mynewtext", - StrAlgoLCSParams.StrAlgoLCSParams().idx().withMatchLen()); - assertEquals(stringMatchResult.getLen(), 6); - assertEquals(2, stringMatchResult.getMatches().size()); - - MatchedPosition position0 = stringMatchResult.getMatches().get(0); - assertEquals(position0.getA().getStart(), 4); - assertEquals(position0.getA().getEnd(), 7); - assertEquals(position0.getB().getStart(), 5); - assertEquals(position0.getB().getEnd(), 8); - assertEquals(position0.getMatchLen(), 4); - - MatchedPosition position1 = stringMatchResult.getMatches().get(1); - assertEquals(position1.getA().getStart(), 2); - assertEquals(position1.getA().getEnd(), 3); - assertEquals(position1.getB().getStart(), 0); - assertEquals(position1.getB().getEnd(), 1); - assertEquals(position1.getMatchLen(), 2); - } - - @Test - public void strAlgoLcsWithKey() { - assumeFalse(checkRedisMajorVersionNumber(7)); - jedis.mset("key1", "ohmytext", "key2", "mynewtext"); - - LCSMatchResult stringMatchResult = jedis.strAlgoLCSKeys("key1", "key2", - StrAlgoLCSParams.StrAlgoLCSParams()); - assertEquals("mytext", stringMatchResult.getMatchString()); - } - - @Test - public void strAlgoLcsWithKeyAndIdx() { - assumeFalse(checkRedisMajorVersionNumber(7)); - jedis.mset("key1", "ohmytext", "key2", "mynewtext"); - - LCSMatchResult stringMatchResult = jedis.strAlgoLCSKeys( "key1", "key2", - StrAlgoLCSParams.StrAlgoLCSParams().idx().withMatchLen()); - assertEquals(stringMatchResult.getLen(), 6); - assertEquals(2, stringMatchResult.getMatches().size()); - - MatchedPosition position0 = stringMatchResult.getMatches().get(0); - assertEquals(position0.getA().getStart(), 4); - assertEquals(position0.getA().getEnd(), 7); - assertEquals(position0.getB().getStart(), 5); - assertEquals(position0.getB().getEnd(), 8); - assertEquals(position0.getMatchLen(), 4); - - MatchedPosition position1 = stringMatchResult.getMatches().get(1); - assertEquals(position1.getA().getStart(), 2); - assertEquals(position1.getA().getEnd(), 3); - assertEquals(position1.getB().getStart(), 0); - assertEquals(position1.getB().getEnd(), 1); - assertEquals(position1.getMatchLen(), 2); - } - @Test public void lcs() { jedis.mset("key1", "ohmytext", "key2", "mynewtext"); diff --git a/src/test/java/redis/clients/jedis/modules/RedisModulesPipelineTest.java b/src/test/java/redis/clients/jedis/modules/RedisModulesPipelineTest.java index 446329488e..7985434f71 100644 --- a/src/test/java/redis/clients/jedis/modules/RedisModulesPipelineTest.java +++ b/src/test/java/redis/clients/jedis/modules/RedisModulesPipelineTest.java @@ -57,18 +57,12 @@ public void search() { Response explain = p.ftExplain(index, new Query("@title:title_val")); Response> explainCLI = p.ftExplainCLI(index, new Query("@title:title_val")); Response> info = p.ftInfo(index); - Response aliasAdd = p.ftAliasAdd("ALIAS1", index); - Response aliasUpdate = p.ftAliasUpdate("ALIAS2", index); - Response aliasDel = p.ftAliasDel("ALIAS2"); Response configSet = p.ftConfigSet("timeout", "100"); Response> configGet = p.ftConfigGet("*"); Response configSetIndex = p.ftConfigSet(index, "timeout", "100"); Response> configGetIndex = p.ftConfigGet(index, "*"); Response synUpdate = p.ftSynUpdate(index, "foo", "bar"); Response>> synDump = p.ftSynDump(index); - Response dropIndex = p.ftDropIndex(index); - p.ftCreate(index, IndexOptions.defaultOptions(), sc); - Response dropIndexDD = p.ftDropIndexDD(index); p.sync(); c.close(); @@ -78,20 +72,15 @@ public void search() { assertEquals("OK", alter.get()); assertEquals(2, searchResult.get().getTotalResults()); assertEquals(2, searchBytesResult.get().getTotalResults()); - assertEquals(1, aggregateResult.get().totalResults); + assertEquals(1, aggregateResult.get().getTotalResults()); assertNotNull(explain.get()); assertNotNull(explainCLI.get().get(0)); assertEquals(index, info.get().get("index_name")); - assertEquals("OK", aliasAdd.get()); - assertEquals("OK", aliasUpdate.get()); - assertEquals("OK", aliasDel.get()); assertEquals("OK", configSet.get()); assertEquals("100", configGet.get().get("TIMEOUT")); assertEquals("OK", configSetIndex.get()); assertEquals("100", configGetIndex.get().get("TIMEOUT")); assertEquals("OK", synUpdate.get()); - assertEquals("OK", dropIndex.get()); - assertEquals("OK", dropIndexDD.get()); Map> expected = new HashMap<>(); expected.put("bar", Collections.singletonList("foo")); assertEquals(expected, synDump.get()); diff --git a/src/test/java/redis/clients/jedis/modules/bloom/TopKTest.java b/src/test/java/redis/clients/jedis/modules/bloom/TopKTest.java index 4b54d4f7f8..1e6a38ed43 100644 --- a/src/test/java/redis/clients/jedis/modules/bloom/TopKTest.java +++ b/src/test/java/redis/clients/jedis/modules/bloom/TopKTest.java @@ -30,8 +30,6 @@ public void createTopKFilter() { assertEquals(Arrays.asList(true, false, true), client.topkQuery("aaa", "bb", "gg", "cc")); - assertEquals(Arrays.asList(1L, 0L, 1L), client.topkCount("aaa", "bb", "gg", "cc")); - assertEquals(new TreeSet<>(Arrays.asList("bb", "cc")), new TreeSet<>(client.topkList("aaa"))); // assertEquals(null, client.topkIncrBy("aaa", "ff", 10)); diff --git a/src/test/java/redis/clients/jedis/modules/search/AggregationTest.java b/src/test/java/redis/clients/jedis/modules/search/AggregationTest.java index 76b41b55d2..14f210ae8a 100644 --- a/src/test/java/redis/clients/jedis/modules/search/AggregationTest.java +++ b/src/test/java/redis/clients/jedis/modules/search/AggregationTest.java @@ -77,7 +77,7 @@ public void testAggregations() { // actual search AggregationResult res = client.ftAggregate(index, r); - assertEquals(2, res.totalResults); + assertEquals(2, res.getTotalResults()); Row r1 = res.getRow(0); assertNotNull(r1); @@ -133,13 +133,13 @@ public void testAggregationBuilderVerbatim() { AggregationBuilder r = new AggregationBuilder("kitti"); AggregationResult res = client.ftAggregate(index, r); - assertEquals(1, res.totalResults); + assertEquals(1, res.getTotalResults()); r = new AggregationBuilder("kitti") .verbatim(); res = client.ftAggregate(index, r); - assertEquals(0, res.totalResults); + assertEquals(0, res.getTotalResults()); } @Test @@ -157,7 +157,7 @@ public void testAggregationBuilderTimeout() { .timeout(5000); AggregationResult res = client.ftAggregate(index, r); - assertEquals(2, res.totalResults); + assertEquals(2, res.getTotalResults()); } @Test @@ -179,7 +179,7 @@ public void testAggregationBuilderParamsDialect() { .dialect(2); // From documentation - To use PARAMS, DIALECT must be set to 2 AggregationResult res = client.ftAggregate(index, r); - assertEquals(1, res.totalResults); + assertEquals(1, res.getTotalResults()); Row r1 = res.getRow(0); assertNotNull(r1); @@ -214,7 +214,7 @@ public void testApplyAndFilterAggregations() { // actual search AggregationResult res = client.ftAggregate(index, r); - assertEquals(3, res.totalResults); + assertEquals(3, res.getTotalResults()); Row r1 = res.getRow(0); assertNotNull(r1); @@ -287,7 +287,7 @@ public void cursor() { // actual search AggregationResult res = client.ftAggregate(index, r); - assertEquals(2, res.totalResults); + assertEquals(2, res.getTotalResults()); Row row = res.getRow(0); assertNotNull(row); diff --git a/src/test/java/redis/clients/jedis/modules/search/DocumentTest.java b/src/test/java/redis/clients/jedis/modules/search/DocumentTest.java index d80ff079ce..7e73ef324f 100644 --- a/src/test/java/redis/clients/jedis/modules/search/DocumentTest.java +++ b/src/test/java/redis/clients/jedis/modules/search/DocumentTest.java @@ -25,8 +25,7 @@ public void serialize() throws IOException, ClassNotFoundException { Map map = new HashMap<>(); map.put("string", "c"); map.put("float", 12d); - byte[] payload = "1a".getBytes(); - Document document = new Document(id, map, score, payload); + Document document = new Document(id, map, score); ByteArrayOutputStream aos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(aos); @@ -41,11 +40,9 @@ public void serialize() throws IOException, ClassNotFoundException { assertEquals(id, read.getId()); assertEquals(score, read.getScore(), 0d); - assertArrayEquals(payload, read.getPayload()); // use english language to make sure the decimal separator is the same as the toString - String exp = String.format(Locale.ENGLISH, "id:%s, score: %.1f, payload:%s, properties:%s", id, - score, SafeEncoder.encode(payload), "[string=c, float=12.0]"); + String exp = String.format(Locale.ENGLISH, "id:%s, score: %.1f, properties:%s", id, score, "[string=c, float=12.0]"); assertEquals(exp, read.toString()); assertEquals("c", read.getString("string")); assertEquals(Double.valueOf(12d), read.get("float")); @@ -58,12 +55,11 @@ public void toStringTest() { Map map = new HashMap<>(); map.put("string", "c"); map.put("float", 12d); - byte[] payload = "1a".getBytes(); - Document document = new Document(id, map, score, payload); + Document document = new Document(id, map, score); // use english language to make sure the decimal separator is the same as the toString - String expected = String.format(Locale.ENGLISH, "id:%s, score: %.1f, payload:%s, properties:%s", - id, score, SafeEncoder.encode(payload), "[string=c, float=12.0]"); + String expected = String.format(Locale.ENGLISH, "id:%s, score: %.1f, properties:%s", + id, score, "[string=c, float=12.0]"); assertEquals(expected, document.toString()); } diff --git a/src/test/java/redis/clients/jedis/modules/search/JsonSearchTest.java b/src/test/java/redis/clients/jedis/modules/search/JsonSearchTest.java index e426a0e40e..79485634d7 100644 --- a/src/test/java/redis/clients/jedis/modules/search/JsonSearchTest.java +++ b/src/test/java/redis/clients/jedis/modules/search/JsonSearchTest.java @@ -142,23 +142,22 @@ public void parseJson() { setJson(id, json); // query - SearchResult sr = client.ftSearch(index, new Query().setWithScores().setWithPayload()); + SearchResult sr = client.ftSearch(index, new Query().setWithScores()); assertEquals(1, sr.getTotalResults()); Document doc = sr.getDocuments().get(0); assertEquals(1.0, doc.getScore(), 0); - assertNull(doc.getPayload()); assertEquals(json.toString(), doc.get(JSON_ROOT)); // query repeat - sr = client.ftSearch(index, new Query().setWithScores().setWithPayload()); + sr = client.ftSearch(index, new Query().setWithScores()); doc = sr.getDocuments().get(0); JSONObject jsonRead = new JSONObject((String) doc.get(JSON_ROOT)); assertEquals(json.toString(), jsonRead.toString()); // query repeat - sr = client.ftSearch(index, new Query().setWithScores().setWithPayload()); + sr = client.ftSearch(index, new Query().setWithScores()); doc = sr.getDocuments().get(0); jsonRead = new JSONObject(doc.getString(JSON_ROOT)); From fb40cbacd2e883f7705c7d1de384196fea521058 Mon Sep 17 00:00:00 2001 From: M Sazzadul Hoque <7600764+sazzad16@users.noreply.github.com> Date: Wed, 3 May 2023 20:12:20 +0600 Subject: [PATCH 2/5] fix javadoc --- .../redis/clients/jedis/CommandObjects.java | 12 +++---- src/main/java/redis/clients/jedis/Jedis.java | 6 ++++ .../redis/clients/jedis/JedisCluster.java | 34 ------------------- .../redis/clients/jedis/UnifiedJedis.java | 5 +++ .../StreamPipelineBinaryCommands.java | 2 -- .../jedis/commands/StringBinaryCommands.java | 6 ++-- .../jedis/commands/StringCommands.java | 1 - .../StringPipelineBinaryCommands.java | 4 --- .../commands/StringPipelineCommands.java | 4 --- .../jedis/BinaryValuesCommandsTest.java | 4 +-- .../unified/BinaryValuesCommandsTestBase.java | 4 +-- 11 files changed, 21 insertions(+), 61 deletions(-) diff --git a/src/main/java/redis/clients/jedis/CommandObjects.java b/src/main/java/redis/clients/jedis/CommandObjects.java index 577b6b745a..ba49d8c7b6 100644 --- a/src/main/java/redis/clients/jedis/CommandObjects.java +++ b/src/main/java/redis/clients/jedis/CommandObjects.java @@ -451,6 +451,10 @@ public final CommandObject get(byte[] key) { return new CommandObject<>(commandArguments(Command.GET).key(key), BuilderFactory.BINARY); } + public final CommandObject setGet(byte[] key, byte[] value) { + return new CommandObject<>(commandArguments(Command.SET).key(key).add(value).add(Keyword.GET), BuilderFactory.BINARY); + } + public final CommandObject setGet(byte[] key, byte[] value, SetParams params) { return new CommandObject<>(commandArguments(Command.SET).key(key).add(value).addParams(params) .add(Keyword.GET), BuilderFactory.BINARY); @@ -3102,14 +3106,6 @@ public final CommandObject publish(String channel, String message) { public final CommandObject publish(byte[] channel, byte[] message) { return new CommandObject<>(commandArguments(PUBLISH).add(channel).add(message), BuilderFactory.LONG); } - - public final CommandObject spublish(String channel, String message) { - return new CommandObject<>(commandArguments(PUBLISH).add(channel).add(message), BuilderFactory.LONG); - } - - public final CommandObject spublish(byte[] channel, byte[] message) { - return new CommandObject<>(commandArguments(PUBLISH).add(channel).add(message), BuilderFactory.LONG); - } // Miscellaneous commands // RediSearch commands diff --git a/src/main/java/redis/clients/jedis/Jedis.java b/src/main/java/redis/clients/jedis/Jedis.java index df46b6922a..6d62dddec2 100644 --- a/src/main/java/redis/clients/jedis/Jedis.java +++ b/src/main/java/redis/clients/jedis/Jedis.java @@ -490,6 +490,12 @@ public byte[] get(final byte[] key) { return connection.executeCommand(commandObjects.get(key)); } + @Override + public byte[] setGet(final byte[] key, final byte[] value) { + checkIsInMultiOrPipeline(); + return connection.executeCommand(commandObjects.setGet(key, value)); + } + @Override public byte[] setGet(final byte[] key, final byte[] value, final SetParams params) { checkIsInMultiOrPipeline(); diff --git a/src/main/java/redis/clients/jedis/JedisCluster.java b/src/main/java/redis/clients/jedis/JedisCluster.java index 31879f0e0e..97537f5b68 100644 --- a/src/main/java/redis/clients/jedis/JedisCluster.java +++ b/src/main/java/redis/clients/jedis/JedisCluster.java @@ -205,40 +205,6 @@ public Connection getConnectionFromSlot(int slot) { return ((ClusterConnectionProvider) provider).getConnectionFromSlot(slot); } - // commands - public long publish(String channel, String message) { - return executeCommand(commandObjects.publish(channel, message)); - } - - public long publish(byte[] channel, byte[] message) { - return executeCommand(commandObjects.publish(channel, message)); - } - - public void subscribe(final JedisPubSub jedisPubSub, final String... channels) { - try (Connection connection = this.provider.getConnection()) { - jedisPubSub.proceed(connection, channels); - } - } - - public void psubscribe(final JedisPubSub jedisPubSub, final String... patterns) { - try (Connection connection = this.provider.getConnection()) { - jedisPubSub.proceedWithPatterns(connection, patterns); - } - } - - public void subscribe(BinaryJedisPubSub jedisPubSub, final byte[]... channels) { - try (Connection connection = this.provider.getConnection()) { - jedisPubSub.proceed(connection, channels); - } - } - - public void psubscribe(BinaryJedisPubSub jedisPubSub, final byte[]... patterns) { - try (Connection connection = this.provider.getConnection()) { - jedisPubSub.proceedWithPatterns(connection, patterns); - } - } - // commands - @Override public ClusterPipeline pipelined() { return new ClusterPipeline((ClusterConnectionProvider) provider, (ClusterCommandObjects) commandObjects); diff --git a/src/main/java/redis/clients/jedis/UnifiedJedis.java b/src/main/java/redis/clients/jedis/UnifiedJedis.java index 0df2facb09..d9e862ef41 100644 --- a/src/main/java/redis/clients/jedis/UnifiedJedis.java +++ b/src/main/java/redis/clients/jedis/UnifiedJedis.java @@ -740,6 +740,11 @@ public byte[] get(byte[] key) { return executeCommand(commandObjects.get(key)); } + @Override + public byte[] setGet(byte[] key, byte[] value) { + return executeCommand(commandObjects.setGet(key, value)); + } + @Override public byte[] setGet(byte[] key, byte[] value, SetParams params) { return executeCommand(commandObjects.setGet(key, value, params)); diff --git a/src/main/java/redis/clients/jedis/commands/StreamPipelineBinaryCommands.java b/src/main/java/redis/clients/jedis/commands/StreamPipelineBinaryCommands.java index fe6fc4d034..8acb88a049 100644 --- a/src/main/java/redis/clients/jedis/commands/StreamPipelineBinaryCommands.java +++ b/src/main/java/redis/clients/jedis/commands/StreamPipelineBinaryCommands.java @@ -7,8 +7,6 @@ import redis.clients.jedis.params.*; public interface StreamPipelineBinaryCommands { -// -// byte[] xadd(byte[] key, byte[] id, Map hash, long maxLen, boolean approximateLength); default Response xadd(byte[] key, Map hash, XAddParams params) { return xadd(key, params, hash); diff --git a/src/main/java/redis/clients/jedis/commands/StringBinaryCommands.java b/src/main/java/redis/clients/jedis/commands/StringBinaryCommands.java index 48f6f99fd7..ca51b1a1af 100644 --- a/src/main/java/redis/clients/jedis/commands/StringBinaryCommands.java +++ b/src/main/java/redis/clients/jedis/commands/StringBinaryCommands.java @@ -4,7 +4,6 @@ import redis.clients.jedis.params.GetExParams; import redis.clients.jedis.params.SetParams; -import redis.clients.jedis.params.StrAlgoLCSParams; import redis.clients.jedis.params.LCSParams; import redis.clients.jedis.resps.LCSMatchResult; @@ -16,9 +15,8 @@ public interface StringBinaryCommands extends BitBinaryCommands { byte[] get(byte[] key); - /** - * WARNING: {@link SetParams#get()} MUST NOT be used with this method. - */ + byte[] setGet(byte[] key, byte[] value); + byte[] setGet(byte[] key, byte[] value, SetParams params); byte[] getDel(byte[] key); diff --git a/src/main/java/redis/clients/jedis/commands/StringCommands.java b/src/main/java/redis/clients/jedis/commands/StringCommands.java index 44689fb9ef..9e30e8489d 100644 --- a/src/main/java/redis/clients/jedis/commands/StringCommands.java +++ b/src/main/java/redis/clients/jedis/commands/StringCommands.java @@ -4,7 +4,6 @@ import redis.clients.jedis.params.GetExParams; import redis.clients.jedis.params.SetParams; -import redis.clients.jedis.params.StrAlgoLCSParams; import redis.clients.jedis.params.LCSParams; import redis.clients.jedis.resps.LCSMatchResult; diff --git a/src/main/java/redis/clients/jedis/commands/StringPipelineBinaryCommands.java b/src/main/java/redis/clients/jedis/commands/StringPipelineBinaryCommands.java index f00cd834dc..b4a114d565 100644 --- a/src/main/java/redis/clients/jedis/commands/StringPipelineBinaryCommands.java +++ b/src/main/java/redis/clients/jedis/commands/StringPipelineBinaryCommands.java @@ -5,7 +5,6 @@ import redis.clients.jedis.Response; import redis.clients.jedis.params.GetExParams; import redis.clients.jedis.params.SetParams; -import redis.clients.jedis.params.StrAlgoLCSParams; import redis.clients.jedis.params.LCSParams; import redis.clients.jedis.resps.LCSMatchResult; @@ -17,9 +16,6 @@ public interface StringPipelineBinaryCommands extends BitPipelineBinaryCommands Response get(byte[] key); - /** - * WARNING: {@link SetParams#get()} MUST NOT be used with this method. - */ Response setGet(byte[] key, byte[] value, SetParams params); Response getDel(byte[] key); diff --git a/src/main/java/redis/clients/jedis/commands/StringPipelineCommands.java b/src/main/java/redis/clients/jedis/commands/StringPipelineCommands.java index e51caf7133..6af9968ebe 100644 --- a/src/main/java/redis/clients/jedis/commands/StringPipelineCommands.java +++ b/src/main/java/redis/clients/jedis/commands/StringPipelineCommands.java @@ -3,7 +3,6 @@ import redis.clients.jedis.Response; import redis.clients.jedis.params.GetExParams; import redis.clients.jedis.params.SetParams; -import redis.clients.jedis.params.StrAlgoLCSParams; import redis.clients.jedis.params.LCSParams; import redis.clients.jedis.resps.LCSMatchResult; @@ -17,9 +16,6 @@ public interface StringPipelineCommands extends BitPipelineCommands { Response get(String key); - /** - * WARNING: {@link SetParams#get()} MUST NOT be used with this method. - */ Response setGet(String key, String value, SetParams params); Response getDel(String key); diff --git a/src/test/java/redis/clients/jedis/commands/jedis/BinaryValuesCommandsTest.java b/src/test/java/redis/clients/jedis/commands/jedis/BinaryValuesCommandsTest.java index 02ed41187d..f4ab71418a 100644 --- a/src/test/java/redis/clients/jedis/commands/jedis/BinaryValuesCommandsTest.java +++ b/src/test/java/redis/clients/jedis/commands/jedis/BinaryValuesCommandsTest.java @@ -328,12 +328,12 @@ public void setGet() { assertEquals("OK", jedis.set(bfoo, bbar)); // GET old value - assertArrayEquals(bbar, jedis.setGet(bfoo, binaryValue, setParams())); + assertArrayEquals(bbar, jedis.setGet(bfoo, binaryValue)); assertArrayEquals(binaryValue, jedis.get(bfoo)); // GET null value - assertNull(jedis.setGet(bbar, bfoo, setParams())); + assertNull(jedis.setGet(bbar, bfoo)); } @Test diff --git a/src/test/java/redis/clients/jedis/commands/unified/BinaryValuesCommandsTestBase.java b/src/test/java/redis/clients/jedis/commands/unified/BinaryValuesCommandsTestBase.java index 2735c31845..241de282d3 100644 --- a/src/test/java/redis/clients/jedis/commands/unified/BinaryValuesCommandsTestBase.java +++ b/src/test/java/redis/clients/jedis/commands/unified/BinaryValuesCommandsTestBase.java @@ -329,12 +329,12 @@ public void setGet() { assertEquals("OK", jedis.set(bfoo, bbar)); // GET old value - assertArrayEquals(bbar, jedis.setGet(bfoo, binaryValue, setParams())); + assertArrayEquals(bbar, jedis.setGet(bfoo, binaryValue)); assertArrayEquals(binaryValue, jedis.get(bfoo)); // GET null value - assertNull(jedis.setGet(bbar, bfoo, setParams())); + assertNull(jedis.setGet(bbar, bfoo)); } @Test From 3d7e33d99fdea51c87050c0b7c25f57fd3df879e Mon Sep 17 00:00:00 2001 From: M Sazzadul Hoque <7600764+sazzad16@users.noreply.github.com> Date: Wed, 3 May 2023 20:28:36 +0600 Subject: [PATCH 3/5] delete file --- .../jedis/params/StrAlgoLCSParams.java | 75 ------------------- 1 file changed, 75 deletions(-) delete mode 100644 src/main/java/redis/clients/jedis/params/StrAlgoLCSParams.java diff --git a/src/main/java/redis/clients/jedis/params/StrAlgoLCSParams.java b/src/main/java/redis/clients/jedis/params/StrAlgoLCSParams.java deleted file mode 100644 index ad24a87bd3..0000000000 --- a/src/main/java/redis/clients/jedis/params/StrAlgoLCSParams.java +++ /dev/null @@ -1,75 +0,0 @@ -package redis.clients.jedis.params; - -import redis.clients.jedis.CommandArguments; -import redis.clients.jedis.Protocol; - -public class StrAlgoLCSParams extends Params implements IParams { - - private static final String IDX = "idx"; - private static final String LEN = "len"; - private static final String WITHMATCHLEN = "withmatchlen"; - private static final String MINMATCHLEN = "minmatchlen"; - - public StrAlgoLCSParams() { - } - - public static StrAlgoLCSParams StrAlgoLCSParams() { - return new StrAlgoLCSParams(); - } - - /** - * When IDX is given the command returns an array with the LCS length - * and all the ranges in both the strings, start and end offset for - * each string, where there are matches. - * @return StrAlgoParams - */ - public StrAlgoLCSParams idx() { - addParam(IDX); - return this; - } - - /** - * When LEN is given the command returns the length of the longest common substring. - * @return StrAlgoParams - */ - public StrAlgoLCSParams len() { - addParam(LEN); - return this; - } - - /** - * When WITHMATCHLEN is given each array representing a match will also have the length of the match. - * @return StrAlgoParams - */ - public StrAlgoLCSParams withMatchLen() { - addParam(WITHMATCHLEN); - return this; - } - - /** - * Specify the minimum match length. - * @return StrAlgoParams - */ - public StrAlgoLCSParams minMatchLen(long minMatchLen) { - addParam(MINMATCHLEN, minMatchLen); - return this; - } - - @Override - public void addParams(CommandArguments args) { - if (contains(IDX)) { - args.add(IDX); - } - if (contains(LEN)) { - args.add(LEN); - } - if (contains(WITHMATCHLEN)) { - args.add(WITHMATCHLEN); - } - - if (contains(MINMATCHLEN)) { - args.add(MINMATCHLEN); - args.add(Protocol.toByteArray((long) getParam(MINMATCHLEN))); - } - } -} From d61421705cf1912ef912ec3574bdf315b5099466 Mon Sep 17 00:00:00 2001 From: M Sazzadul Hoque <7600764+sazzad16@users.noreply.github.com> Date: Wed, 3 May 2023 20:28:43 +0600 Subject: [PATCH 4/5] format --- .../jedis/commands/jedis/StreamsCommandsTest.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/test/java/redis/clients/jedis/commands/jedis/StreamsCommandsTest.java b/src/test/java/redis/clients/jedis/commands/jedis/StreamsCommandsTest.java index d73094882f..a49976a5e2 100644 --- a/src/test/java/redis/clients/jedis/commands/jedis/StreamsCommandsTest.java +++ b/src/test/java/redis/clients/jedis/commands/jedis/StreamsCommandsTest.java @@ -7,6 +7,7 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; + import static redis.clients.jedis.resps.StreamGroupInfo.*; import static redis.clients.jedis.resps.StreamInfo.*; import static redis.clients.jedis.resps.StreamConsumersInfo.IDLE; @@ -664,7 +665,7 @@ public void xautoclaim() { // Get the pending event List pendingRange = jedis.xpending("xpending-stream", "xpending-group", - XPendingParams.xPendingParams().count(3).consumer("xpending-consumer")); + XPendingParams.xPendingParams().count(3).consumer("xpending-consumer")); // Sleep for 100ms so we can auto claim events pending for more than 50ms try { Thread.sleep(100); @@ -694,7 +695,7 @@ public void xautoclaimBinary() { // Get the pending event List pendingRange = jedis.xpending("xpending-stream", "xpending-group", - XPendingParams.xPendingParams().count(3).consumer("xpending-consumer")); + XPendingParams.xPendingParams().count(3).consumer("xpending-consumer")); // Sleep for 100ms so we can auto claim events pending for more than 50ms try { Thread.sleep(100); @@ -726,7 +727,7 @@ public void xautoclaimJustId() { // Get the pending event List pendingRange = jedis.xpending("xpending-stream", "xpending-group", - XPendingParams.xPendingParams().count(3).consumer("xpending-consumer")); + XPendingParams.xPendingParams().count(3).consumer("xpending-consumer")); // Sleep for 100ms so we can auto claim events pending for more than 50ms try { Thread.sleep(100); @@ -756,7 +757,7 @@ public void xautoclaimJustIdBinary() { // Get the pending event List pendingRange = jedis.xpending("xpending-stream", "xpending-group", - XPendingParams.xPendingParams().count(3).consumer("xpending-consumer")); + XPendingParams.xPendingParams().count(3).consumer("xpending-consumer")); // Sleep for 100ms so we can auto claim events pending for more than 50ms try { Thread.sleep(100); From 2c5ec012aed7b605b01b05eed98cfb9223a5c289 Mon Sep 17 00:00:00 2001 From: M Sazzadul Hoque <7600764+sazzad16@users.noreply.github.com> Date: Wed, 3 May 2023 20:44:22 +0600 Subject: [PATCH 5/5] fix test --- .../jedis/modules/search/DocumentTest.java | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/test/java/redis/clients/jedis/modules/search/DocumentTest.java b/src/test/java/redis/clients/jedis/modules/search/DocumentTest.java index 7e73ef324f..490837ebd4 100644 --- a/src/test/java/redis/clients/jedis/modules/search/DocumentTest.java +++ b/src/test/java/redis/clients/jedis/modules/search/DocumentTest.java @@ -1,6 +1,5 @@ package redis.clients.jedis.modules.search; -import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import java.io.ByteArrayInputStream; @@ -14,7 +13,6 @@ import org.junit.Test; import redis.clients.jedis.search.Document; -import redis.clients.jedis.util.SafeEncoder; public class DocumentTest { @@ -42,7 +40,8 @@ public void serialize() throws IOException, ClassNotFoundException { assertEquals(score, read.getScore(), 0d); // use english language to make sure the decimal separator is the same as the toString - String exp = String.format(Locale.ENGLISH, "id:%s, score: %.1f, properties:%s", id, score, "[string=c, float=12.0]"); + String exp = String.format(Locale.ENGLISH, "id:%s, score: %.1f, properties:%s", + id, score, "[string=c, float=12.0]"); assertEquals(exp, read.toString()); assertEquals("c", read.getString("string")); assertEquals(Double.valueOf(12d), read.get("float")); @@ -62,19 +61,4 @@ public void toStringTest() { id, score, "[string=c, float=12.0]"); assertEquals(expected, document.toString()); } - - @Test - public void toStringWithoutPayload() { - String id = "9f"; - double score = 10d; - Map map = new HashMap<>(); - map.put("string", "c"); - map.put("float", 12d); - Document document = new Document(id, map, score); - - // use english language to make sure the decimal separator is the same as the toString - String expected = String.format(Locale.ENGLISH, "id:%s, score: %.1f, payload:%s, properties:%s", - id, score, null, "[string=c, float=12.0]"); - assertEquals(expected, document.toString()); - } }