DATAREDIS-624 - Upgrade to Lettuce 5.0.0.BUILD-SNAPSHOT.
Upgrade to Lettuce using Reactor 3.1.0.BUILD-SNAPSHOT, requires change to io.lettuce:lettuce-core, so we also needed to change imports from com.lambdaworks.redis to io.lettuce.core. Original pull request: #245.
This commit is contained in:
committed by
Mark Paluch
parent
2c14460643
commit
87d6aa2042
13
pom.xml
13
pom.xml
@@ -21,7 +21,7 @@
|
||||
<beanutils>1.9.2</beanutils>
|
||||
<xstream>1.4.8</xstream>
|
||||
<pool>2.2</pool>
|
||||
<lettuce>5.0.0.Beta1</lettuce>
|
||||
<lettuce>5.0.0.BUILD-SNAPSHOT</lettuce>
|
||||
<jedis>2.9.0</jedis>
|
||||
<multithreadedtc>1.01</multithreadedtc>
|
||||
</properties>
|
||||
@@ -78,8 +78,8 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>biz.paluch.redis</groupId>
|
||||
<artifactId>lettuce</artifactId>
|
||||
<groupId>io.lettuce</groupId>
|
||||
<artifactId>lettuce-core</artifactId>
|
||||
<version>${lettuce}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
@@ -253,6 +253,13 @@
|
||||
<id>spring-libs-snapshot</id>
|
||||
<url>https://repo.spring.io/libs-snapshot</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>oss-sonatype-snapsho</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,12 +15,11 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import com.lambdaworks.redis.RedisClient;
|
||||
import com.lambdaworks.redis.RedisURI;
|
||||
import com.lambdaworks.redis.api.StatefulRedisConnection;
|
||||
import com.lambdaworks.redis.api.async.RedisAsyncCommands;
|
||||
import com.lambdaworks.redis.codec.RedisCodec;
|
||||
import com.lambdaworks.redis.pubsub.StatefulRedisPubSubConnection;
|
||||
import io.lettuce.core.RedisClient;
|
||||
import io.lettuce.core.RedisURI;
|
||||
import io.lettuce.core.api.StatefulRedisConnection;
|
||||
import io.lettuce.core.codec.RedisCodec;
|
||||
import io.lettuce.core.pubsub.StatefulRedisPubSubConnection;
|
||||
|
||||
/**
|
||||
* Extension of {@link RedisClient} that calls auth on all new connections using the supplied credentials
|
||||
@@ -43,7 +42,7 @@ public class AuthenticatingRedisClient extends RedisClient {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.lambdaworks.redis.RedisClient#connect(com.lambdaworks.redis.codec.RedisCodec)
|
||||
* @see io.lettuce.core.RedisClient#connect(io.lettuce.core.codec.RedisCodec)
|
||||
*/
|
||||
@Override
|
||||
public <K, V> StatefulRedisConnection<K, V> connect(RedisCodec<K, V> codec) {
|
||||
@@ -52,7 +51,7 @@ public class AuthenticatingRedisClient extends RedisClient {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.lambdaworks.redis.RedisClient#connectPubSub(com.lambdaworks.redis.codec.RedisCodec)
|
||||
* @see io.lettuce.core.RedisClient#connectPubSub(io.lettuce.core.codec.RedisCodec)
|
||||
*/
|
||||
@Override
|
||||
public <K, V> StatefulRedisPubSubConnection<K, V> connectPubSub(RedisCodec<K, V> codec) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,12 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import io.lettuce.core.RedisClient;
|
||||
import io.lettuce.core.RedisURI;
|
||||
import io.lettuce.core.api.StatefulConnection;
|
||||
import io.lettuce.core.api.StatefulRedisConnection;
|
||||
import io.lettuce.core.resource.ClientResources;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.commons.pool2.BasePooledObjectFactory;
|
||||
@@ -28,12 +34,6 @@ import org.springframework.data.redis.connection.RedisSentinelConfiguration;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.lambdaworks.redis.RedisClient;
|
||||
import com.lambdaworks.redis.RedisURI;
|
||||
import com.lambdaworks.redis.api.StatefulConnection;
|
||||
import com.lambdaworks.redis.api.StatefulRedisConnection;
|
||||
import com.lambdaworks.redis.resource.ClientResources;
|
||||
|
||||
/**
|
||||
* Default implementation of {@link LettucePool}.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,17 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import io.lettuce.core.KeyValue;
|
||||
import io.lettuce.core.RedisException;
|
||||
import io.lettuce.core.api.StatefulConnection;
|
||||
import io.lettuce.core.cluster.RedisClusterClient;
|
||||
import io.lettuce.core.cluster.SlotHash;
|
||||
import io.lettuce.core.cluster.api.StatefulRedisClusterConnection;
|
||||
import io.lettuce.core.cluster.api.sync.RedisClusterCommands;
|
||||
import io.lettuce.core.cluster.models.partitions.Partitions;
|
||||
import io.lettuce.core.codec.ByteArrayCodec;
|
||||
import io.lettuce.core.codec.RedisCodec;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -56,17 +67,6 @@ import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import com.lambdaworks.redis.KeyValue;
|
||||
import com.lambdaworks.redis.RedisException;
|
||||
import com.lambdaworks.redis.api.StatefulConnection;
|
||||
import com.lambdaworks.redis.cluster.RedisClusterClient;
|
||||
import com.lambdaworks.redis.cluster.SlotHash;
|
||||
import com.lambdaworks.redis.cluster.api.StatefulRedisClusterConnection;
|
||||
import com.lambdaworks.redis.cluster.api.sync.RedisClusterCommands;
|
||||
import com.lambdaworks.redis.cluster.models.partitions.Partitions;
|
||||
import com.lambdaworks.redis.codec.ByteArrayCodec;
|
||||
import com.lambdaworks.redis.codec.RedisCodec;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2016 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,11 +15,70 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import static com.lambdaworks.redis.protocol.CommandType.*;
|
||||
import static io.lettuce.core.protocol.CommandType.*;
|
||||
|
||||
import io.lettuce.core.AbstractRedisClient;
|
||||
import io.lettuce.core.GeoArgs;
|
||||
import io.lettuce.core.GeoCoordinates;
|
||||
import io.lettuce.core.GeoWithin;
|
||||
import io.lettuce.core.KeyScanCursor;
|
||||
import io.lettuce.core.LettuceFutures;
|
||||
import io.lettuce.core.MapScanCursor;
|
||||
import io.lettuce.core.RedisClient;
|
||||
import io.lettuce.core.RedisException;
|
||||
import io.lettuce.core.RedisFuture;
|
||||
import io.lettuce.core.RedisURI;
|
||||
import io.lettuce.core.ScanArgs;
|
||||
import io.lettuce.core.ScoredValue;
|
||||
import io.lettuce.core.ScoredValueScanCursor;
|
||||
import io.lettuce.core.SortArgs;
|
||||
import io.lettuce.core.TransactionResult;
|
||||
import io.lettuce.core.ValueScanCursor;
|
||||
import io.lettuce.core.ZStoreArgs;
|
||||
import io.lettuce.core.api.StatefulConnection;
|
||||
import io.lettuce.core.api.StatefulRedisConnection;
|
||||
import io.lettuce.core.api.async.RedisAsyncCommands;
|
||||
import io.lettuce.core.api.async.RedisHLLAsyncCommands;
|
||||
import io.lettuce.core.api.sync.RedisCommands;
|
||||
import io.lettuce.core.api.sync.RedisHLLCommands;
|
||||
import io.lettuce.core.cluster.api.StatefulRedisClusterConnection;
|
||||
import io.lettuce.core.cluster.api.async.RedisClusterAsyncCommands;
|
||||
import io.lettuce.core.cluster.api.sync.RedisClusterCommands;
|
||||
import io.lettuce.core.codec.ByteArrayCodec;
|
||||
import io.lettuce.core.codec.RedisCodec;
|
||||
import io.lettuce.core.output.BooleanOutput;
|
||||
import io.lettuce.core.output.ByteArrayOutput;
|
||||
import io.lettuce.core.output.CommandOutput;
|
||||
import io.lettuce.core.output.DateOutput;
|
||||
import io.lettuce.core.output.DoubleOutput;
|
||||
import io.lettuce.core.output.IntegerOutput;
|
||||
import io.lettuce.core.output.KeyListOutput;
|
||||
import io.lettuce.core.output.KeyValueOutput;
|
||||
import io.lettuce.core.output.MapOutput;
|
||||
import io.lettuce.core.output.MultiOutput;
|
||||
import io.lettuce.core.output.StatusOutput;
|
||||
import io.lettuce.core.output.ValueListOutput;
|
||||
import io.lettuce.core.output.ValueOutput;
|
||||
import io.lettuce.core.output.ValueSetOutput;
|
||||
import io.lettuce.core.protocol.Command;
|
||||
import io.lettuce.core.protocol.CommandArgs;
|
||||
import io.lettuce.core.protocol.CommandType;
|
||||
import io.lettuce.core.pubsub.StatefulRedisPubSubConnection;
|
||||
import io.lettuce.core.sentinel.api.StatefulRedisSentinelConnection;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Properties;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -38,7 +97,17 @@ import org.springframework.data.geo.Point;
|
||||
import org.springframework.data.redis.ExceptionTranslationStrategy;
|
||||
import org.springframework.data.redis.FallbackExceptionTranslationStrategy;
|
||||
import org.springframework.data.redis.RedisConnectionFailureException;
|
||||
import org.springframework.data.redis.connection.*;
|
||||
import org.springframework.data.redis.connection.AbstractRedisConnection;
|
||||
import org.springframework.data.redis.connection.DataType;
|
||||
import org.springframework.data.redis.connection.FutureResult;
|
||||
import org.springframework.data.redis.connection.MessageListener;
|
||||
import org.springframework.data.redis.connection.RedisNode;
|
||||
import org.springframework.data.redis.connection.RedisPipelineException;
|
||||
import org.springframework.data.redis.connection.RedisSentinelConnection;
|
||||
import org.springframework.data.redis.connection.RedisSubscribedConnectionException;
|
||||
import org.springframework.data.redis.connection.ReturnType;
|
||||
import org.springframework.data.redis.connection.SortParameters;
|
||||
import org.springframework.data.redis.connection.Subscription;
|
||||
import org.springframework.data.redis.connection.convert.Converters;
|
||||
import org.springframework.data.redis.connection.convert.ListConverter;
|
||||
import org.springframework.data.redis.connection.convert.TransactionResultConverter;
|
||||
@@ -54,25 +123,6 @@ import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import com.lambdaworks.redis.*;
|
||||
import com.lambdaworks.redis.api.StatefulConnection;
|
||||
import com.lambdaworks.redis.api.StatefulRedisConnection;
|
||||
import com.lambdaworks.redis.api.async.RedisAsyncCommands;
|
||||
import com.lambdaworks.redis.api.async.RedisHLLAsyncCommands;
|
||||
import com.lambdaworks.redis.api.sync.RedisCommands;
|
||||
import com.lambdaworks.redis.api.sync.RedisHLLCommands;
|
||||
import com.lambdaworks.redis.cluster.api.StatefulRedisClusterConnection;
|
||||
import com.lambdaworks.redis.cluster.api.async.RedisClusterAsyncCommands;
|
||||
import com.lambdaworks.redis.cluster.api.sync.RedisClusterCommands;
|
||||
import com.lambdaworks.redis.codec.ByteArrayCodec;
|
||||
import com.lambdaworks.redis.codec.RedisCodec;
|
||||
import com.lambdaworks.redis.output.*;
|
||||
import com.lambdaworks.redis.protocol.Command;
|
||||
import com.lambdaworks.redis.protocol.CommandArgs;
|
||||
import com.lambdaworks.redis.protocol.CommandType;
|
||||
import com.lambdaworks.redis.pubsub.StatefulRedisPubSubConnection;
|
||||
import com.lambdaworks.redis.sentinel.api.StatefulRedisSentinelConnection;
|
||||
|
||||
/**
|
||||
* {@code RedisConnection} implementation on top of <a href="https://github.com/mp911de/lettuce">Lettuce</a> Redis
|
||||
* client.
|
||||
@@ -115,13 +165,13 @@ public class LettuceConnection extends AbstractRedisConnection {
|
||||
private boolean convertPipelineAndTxResults = true;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private class LettuceResult extends FutureResult<com.lambdaworks.redis.protocol.RedisCommand<?, ?, ?>> {
|
||||
private class LettuceResult extends FutureResult<io.lettuce.core.protocol.RedisCommand<?, ?, ?>> {
|
||||
public <T> LettuceResult(Future<T> resultHolder, Converter<T, ?> converter) {
|
||||
super((com.lambdaworks.redis.protocol.RedisCommand) resultHolder, converter);
|
||||
super((io.lettuce.core.protocol.RedisCommand) resultHolder, converter);
|
||||
}
|
||||
|
||||
public LettuceResult(Future resultHolder) {
|
||||
super((com.lambdaworks.redis.protocol.RedisCommand) resultHolder);
|
||||
super((io.lettuce.core.protocol.RedisCommand) resultHolder);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -414,7 +464,7 @@ public class LettuceConnection extends AbstractRedisConnection {
|
||||
|
||||
if (isPipelined) {
|
||||
isPipelined = false;
|
||||
List<com.lambdaworks.redis.protocol.RedisCommand<?, ?, ?>> futures = new ArrayList<com.lambdaworks.redis.protocol.RedisCommand<?, ?, ?>>();
|
||||
List<io.lettuce.core.protocol.RedisCommand<?, ?, ?>> futures = new ArrayList<io.lettuce.core.protocol.RedisCommand<?, ?, ?>>();
|
||||
for (LettuceResult result : ppline) {
|
||||
futures.add(result.getResultHolder());
|
||||
}
|
||||
@@ -3666,7 +3716,7 @@ public class LettuceConnection extends AbstractRedisConnection {
|
||||
throw new UnsupportedOperationException("'SCAN' cannot be called in pipeline / transaction mode.");
|
||||
}
|
||||
|
||||
com.lambdaworks.redis.ScanCursor scanCursor = getScanCursor(cursorId);
|
||||
io.lettuce.core.ScanCursor scanCursor = getScanCursor(cursorId);
|
||||
ScanArgs scanArgs = getScanArgs(options);
|
||||
|
||||
KeyScanCursor<byte[]> keyScanCursor = getConnection().scan(scanCursor, scanArgs);
|
||||
@@ -3711,7 +3761,7 @@ public class LettuceConnection extends AbstractRedisConnection {
|
||||
throw new UnsupportedOperationException("'HSCAN' cannot be called in pipeline / transaction mode.");
|
||||
}
|
||||
|
||||
com.lambdaworks.redis.ScanCursor scanCursor = getScanCursor(cursorId);
|
||||
io.lettuce.core.ScanCursor scanCursor = getScanCursor(cursorId);
|
||||
ScanArgs scanArgs = getScanArgs(options);
|
||||
|
||||
MapScanCursor<byte[], byte[]> mapScanCursor = getConnection().hscan(key, scanCursor, scanArgs);
|
||||
@@ -3755,7 +3805,7 @@ public class LettuceConnection extends AbstractRedisConnection {
|
||||
throw new UnsupportedOperationException("'SSCAN' cannot be called in pipeline / transaction mode.");
|
||||
}
|
||||
|
||||
com.lambdaworks.redis.ScanCursor scanCursor = getScanCursor(cursorId);
|
||||
io.lettuce.core.ScanCursor scanCursor = getScanCursor(cursorId);
|
||||
ScanArgs scanArgs = getScanArgs(options);
|
||||
|
||||
ValueScanCursor<byte[]> valueScanCursor = getConnection().sscan(key, scanCursor, scanArgs);
|
||||
@@ -3799,7 +3849,7 @@ public class LettuceConnection extends AbstractRedisConnection {
|
||||
throw new UnsupportedOperationException("'ZSCAN' cannot be called in pipeline / transaction mode.");
|
||||
}
|
||||
|
||||
com.lambdaworks.redis.ScanCursor scanCursor = getScanCursor(cursorId);
|
||||
io.lettuce.core.ScanCursor scanCursor = getScanCursor(cursorId);
|
||||
ScanArgs scanArgs = getScanArgs(options);
|
||||
|
||||
ScoredValueScanCursor<byte[]> scoredValueScanCursor = getConnection().zscan(key, scanCursor, scanArgs);
|
||||
@@ -4004,8 +4054,8 @@ public class LettuceConnection extends AbstractRedisConnection {
|
||||
return new byte[0][0];
|
||||
}
|
||||
|
||||
private com.lambdaworks.redis.ScanCursor getScanCursor(long cursorId) {
|
||||
return com.lambdaworks.redis.ScanCursor.of(Long.toString(cursorId));
|
||||
private io.lettuce.core.ScanCursor getScanCursor(long cursorId) {
|
||||
return io.lettuce.core.ScanCursor.of(Long.toString(cursorId));
|
||||
}
|
||||
|
||||
private ScanArgs getScanArgs(ScanOptions options) {
|
||||
|
||||
@@ -15,6 +15,14 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import io.lettuce.core.AbstractRedisClient;
|
||||
import io.lettuce.core.RedisClient;
|
||||
import io.lettuce.core.RedisException;
|
||||
import io.lettuce.core.RedisURI;
|
||||
import io.lettuce.core.api.StatefulRedisConnection;
|
||||
import io.lettuce.core.cluster.RedisClusterClient;
|
||||
import io.lettuce.core.resource.ClientResources;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -29,19 +37,20 @@ import org.springframework.dao.InvalidDataAccessResourceUsageException;
|
||||
import org.springframework.data.redis.ExceptionTranslationStrategy;
|
||||
import org.springframework.data.redis.PassThroughExceptionTranslationStrategy;
|
||||
import org.springframework.data.redis.RedisConnectionFailureException;
|
||||
import org.springframework.data.redis.connection.*;
|
||||
import org.springframework.data.redis.connection.ClusterCommandExecutor;
|
||||
import org.springframework.data.redis.connection.Pool;
|
||||
import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.RedisClusterConfiguration;
|
||||
import org.springframework.data.redis.connection.RedisClusterConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.RedisNode;
|
||||
import org.springframework.data.redis.connection.RedisSentinelConfiguration;
|
||||
import org.springframework.data.redis.connection.RedisSentinelConnection;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.lambdaworks.redis.AbstractRedisClient;
|
||||
import com.lambdaworks.redis.RedisClient;
|
||||
import com.lambdaworks.redis.RedisException;
|
||||
import com.lambdaworks.redis.RedisURI;
|
||||
import com.lambdaworks.redis.api.StatefulRedisConnection;
|
||||
import com.lambdaworks.redis.cluster.RedisClusterClient;
|
||||
import com.lambdaworks.redis.resource.ClientResources;
|
||||
|
||||
/**
|
||||
* Connection factory creating <a href="http://github.com/mp911de/lettuce">Lettuce</a>-based connections.
|
||||
* <p>
|
||||
@@ -211,11 +220,11 @@ public class LettuceConnectionFactory
|
||||
*/
|
||||
@Override
|
||||
public LettuceReactiveRedisClusterConnection getReactiveClusterConnection() {
|
||||
if(!isClusterAware()) {
|
||||
if (!isClusterAware()) {
|
||||
throw new InvalidDataAccessApiUsageException("Cluster is not configured!");
|
||||
}
|
||||
|
||||
return new LettuceReactiveRedisClusterConnection((RedisClusterClient)client);
|
||||
return new LettuceReactiveRedisClusterConnection((RedisClusterClient) client);
|
||||
}
|
||||
|
||||
public void initConnection() {
|
||||
|
||||
@@ -15,8 +15,34 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import io.lettuce.core.GeoArgs;
|
||||
import io.lettuce.core.GeoCoordinates;
|
||||
import io.lettuce.core.GeoWithin;
|
||||
import io.lettuce.core.KeyValue;
|
||||
import io.lettuce.core.Limit;
|
||||
import io.lettuce.core.Range;
|
||||
import io.lettuce.core.RedisURI;
|
||||
import io.lettuce.core.ScoredValue;
|
||||
import io.lettuce.core.ScriptOutputType;
|
||||
import io.lettuce.core.SetArgs;
|
||||
import io.lettuce.core.SortArgs;
|
||||
import io.lettuce.core.TransactionResult;
|
||||
import io.lettuce.core.cluster.models.partitions.Partitions;
|
||||
import io.lettuce.core.cluster.models.partitions.RedisClusterNode.NodeFlag;
|
||||
import io.lettuce.core.protocol.LettuceCharsets;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -60,11 +86,6 @@ import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.lambdaworks.redis.*;
|
||||
import com.lambdaworks.redis.cluster.models.partitions.Partitions;
|
||||
import com.lambdaworks.redis.cluster.models.partitions.RedisClusterNode.NodeFlag;
|
||||
import com.lambdaworks.redis.protocol.LettuceCharsets;
|
||||
|
||||
/**
|
||||
* Lettuce type converters
|
||||
*
|
||||
@@ -92,7 +113,7 @@ abstract public class LettuceConverters extends Converters {
|
||||
private static final Converter<List<byte[]>, List<Tuple>> BYTES_LIST_TO_TUPLE_LIST_CONVERTER;
|
||||
private static final Converter<String[], List<RedisClientInfo>> STRING_TO_LIST_OF_CLIENT_INFO = new StringToRedisClientInfoConverter();
|
||||
private static final Converter<Partitions, List<RedisClusterNode>> PARTITIONS_TO_CLUSTER_NODES;
|
||||
private static Converter<com.lambdaworks.redis.cluster.models.partitions.RedisClusterNode, RedisClusterNode> CLUSTER_NODE_TO_CLUSTER_NODE_CONVERTER;
|
||||
private static Converter<io.lettuce.core.cluster.models.partitions.RedisClusterNode, RedisClusterNode> CLUSTER_NODE_TO_CLUSTER_NODE_CONVERTER;
|
||||
private static final Converter<List<byte[]>, Long> BYTES_LIST_TO_TIME_CONVERTER;
|
||||
private static final Converter<GeoCoordinates, Point> GEO_COORDINATE_TO_POINT_CONVERTER;
|
||||
private static final ListConverter<GeoCoordinates, Point> GEO_COORDINATE_LIST_TO_POINT_LIST_CONVERTER;
|
||||
@@ -237,7 +258,7 @@ abstract public class LettuceConverters extends Converters {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<RedisClusterNode> nodes = new ArrayList<RedisClusterNode>();
|
||||
for (com.lambdaworks.redis.cluster.models.partitions.RedisClusterNode node : source.getPartitions()) {
|
||||
for (io.lettuce.core.cluster.models.partitions.RedisClusterNode node : source.getPartitions()) {
|
||||
nodes.add(CLUSTER_NODE_TO_CLUSTER_NODE_CONVERTER.convert(node));
|
||||
}
|
||||
|
||||
@@ -246,10 +267,10 @@ abstract public class LettuceConverters extends Converters {
|
||||
|
||||
};
|
||||
|
||||
CLUSTER_NODE_TO_CLUSTER_NODE_CONVERTER = new Converter<com.lambdaworks.redis.cluster.models.partitions.RedisClusterNode, RedisClusterNode>() {
|
||||
CLUSTER_NODE_TO_CLUSTER_NODE_CONVERTER = new Converter<io.lettuce.core.cluster.models.partitions.RedisClusterNode, RedisClusterNode>() {
|
||||
|
||||
@Override
|
||||
public RedisClusterNode convert(com.lambdaworks.redis.cluster.models.partitions.RedisClusterNode source) {
|
||||
public RedisClusterNode convert(io.lettuce.core.cluster.models.partitions.RedisClusterNode source) {
|
||||
|
||||
Set<Flag> flags = parseFlags(source.getFlags());
|
||||
|
||||
@@ -314,10 +335,11 @@ abstract public class LettuceConverters extends Converters {
|
||||
}
|
||||
};
|
||||
|
||||
GEO_COORDINATE_TO_POINT_CONVERTER = new Converter<com.lambdaworks.redis.GeoCoordinates, Point>() {
|
||||
GEO_COORDINATE_TO_POINT_CONVERTER = new Converter<io.lettuce.core.GeoCoordinates, Point>() {
|
||||
@Override
|
||||
public Point convert(com.lambdaworks.redis.GeoCoordinates geoCoordinate) {
|
||||
return geoCoordinate != null ? new Point(geoCoordinate.getX().doubleValue(), geoCoordinate.getY().doubleValue()) : null;
|
||||
public Point convert(io.lettuce.core.GeoCoordinates geoCoordinate) {
|
||||
return geoCoordinate != null ? new Point(geoCoordinate.getX().doubleValue(), geoCoordinate.getY().doubleValue())
|
||||
: null;
|
||||
}
|
||||
};
|
||||
GEO_COORDINATE_LIST_TO_POINT_LIST_CONVERTER = new ListConverter<GeoCoordinates, Point>(
|
||||
@@ -547,13 +569,14 @@ abstract public class LettuceConverters extends Converters {
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a {@link org.springframework.data.redis.connection.RedisZSetCommands.Limit} to a lettuce {@link com.lambdaworks.redis.Limit}.
|
||||
* Convert a {@link org.springframework.data.redis.connection.RedisZSetCommands.Limit} to a lettuce
|
||||
* {@link io.lettuce.core.Limit}.
|
||||
*
|
||||
* @param limit
|
||||
* @return a lettuce {@link com.lambdaworks.redis.Limit}.
|
||||
* @return a lettuce {@link io.lettuce.core.Limit}.
|
||||
* @since 2.0
|
||||
*/
|
||||
public static com.lambdaworks.redis.Limit toLimit(RedisZSetCommands.Limit limit){
|
||||
public static io.lettuce.core.Limit toLimit(RedisZSetCommands.Limit limit) {
|
||||
return Limit.create(limit.getOffset(), limit.getCount());
|
||||
}
|
||||
|
||||
@@ -565,7 +588,7 @@ abstract public class LettuceConverters extends Converters {
|
||||
* @since 2.0
|
||||
*/
|
||||
public static <T> Range<T> toRange(org.springframework.data.redis.connection.RedisZSetCommands.Range range) {
|
||||
return Range.from(lowerBoundaryOf(range), upperBoundaryOf(range));
|
||||
return Range.from(lowerBoundaryOf(range), upperBoundaryOf(range));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -581,12 +604,14 @@ abstract public class LettuceConverters extends Converters {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <T> Range.Boundary<T> lowerBoundaryOf(org.springframework.data.redis.connection.RedisZSetCommands.Range range) {
|
||||
private static <T> Range.Boundary<T> lowerBoundaryOf(
|
||||
org.springframework.data.redis.connection.RedisZSetCommands.Range range) {
|
||||
return (Range.Boundary<T>) rangeToBoundaryArgumentConverter(false).convert(range);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <T> Range.Boundary<T> upperBoundaryOf(org.springframework.data.redis.connection.RedisZSetCommands.Range range) {
|
||||
private static <T> Range.Boundary<T> upperBoundaryOf(
|
||||
org.springframework.data.redis.connection.RedisZSetCommands.Range range) {
|
||||
return (Range.Boundary<T>) rangeToBoundaryArgumentConverter(true).convert(range);
|
||||
}
|
||||
|
||||
@@ -752,8 +777,7 @@ abstract public class LettuceConverters extends Converters {
|
||||
* @return
|
||||
* @since 1.7
|
||||
*/
|
||||
public static RedisClusterNode toRedisClusterNode(
|
||||
com.lambdaworks.redis.cluster.models.partitions.RedisClusterNode source) {
|
||||
public static RedisClusterNode toRedisClusterNode(io.lettuce.core.cluster.models.partitions.RedisClusterNode source) {
|
||||
return CLUSTER_NODE_TO_CLUSTER_NODE_CONVERTER.convert(source);
|
||||
}
|
||||
|
||||
@@ -867,7 +891,7 @@ abstract public class LettuceConverters extends Converters {
|
||||
public GeoResults<GeoLocation<byte[]>> convert(Set<byte[]> source) {
|
||||
|
||||
if (CollectionUtils.isEmpty(source)) {
|
||||
return new GeoResults<GeoLocation<byte[]>>(Collections.<GeoResult<GeoLocation<byte[]>>>emptyList());
|
||||
return new GeoResults<GeoLocation<byte[]>>(Collections.<GeoResult<GeoLocation<byte[]>>> emptyList());
|
||||
}
|
||||
|
||||
List<GeoResult<GeoLocation<byte[]>>> results = new ArrayList<GeoResult<GeoLocation<byte[]>>>(source.size());
|
||||
@@ -896,7 +920,7 @@ abstract public class LettuceConverters extends Converters {
|
||||
* @return
|
||||
* @since 1.8
|
||||
*/
|
||||
public static ListConverter<com.lambdaworks.redis.GeoCoordinates, Point> geoCoordinatesToPointConverter() {
|
||||
public static ListConverter<io.lettuce.core.GeoCoordinates, Point> geoCoordinatesToPointConverter() {
|
||||
return GEO_COORDINATE_LIST_TO_POINT_LIST_CONVERTER;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,13 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import io.lettuce.core.RedisCommandExecutionException;
|
||||
import io.lettuce.core.RedisCommandInterruptedException;
|
||||
import io.lettuce.core.RedisCommandTimeoutException;
|
||||
import io.lettuce.core.RedisConnectionException;
|
||||
import io.lettuce.core.RedisException;
|
||||
import io.netty.channel.ChannelException;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
@@ -24,14 +31,6 @@ import org.springframework.dao.QueryTimeoutException;
|
||||
import org.springframework.data.redis.RedisConnectionFailureException;
|
||||
import org.springframework.data.redis.RedisSystemException;
|
||||
|
||||
import com.lambdaworks.redis.RedisCommandExecutionException;
|
||||
import com.lambdaworks.redis.RedisCommandInterruptedException;
|
||||
import com.lambdaworks.redis.RedisCommandTimeoutException;
|
||||
import com.lambdaworks.redis.RedisConnectionException;
|
||||
import com.lambdaworks.redis.RedisException;
|
||||
|
||||
import io.netty.channel.ChannelException;
|
||||
|
||||
/**
|
||||
* Converts Lettuce Exceptions to {@link DataAccessException}s
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2013 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import io.lettuce.core.pubsub.RedisPubSubListener;
|
||||
|
||||
import org.springframework.data.redis.connection.DefaultMessage;
|
||||
import org.springframework.data.redis.connection.MessageListener;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.lambdaworks.redis.pubsub.RedisPubSubListener;
|
||||
|
||||
/**
|
||||
* MessageListener wrapper around Lettuce {@link RedisPubSubListener}.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,10 +16,10 @@
|
||||
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import org.springframework.data.redis.connection.Pool;
|
||||
import io.lettuce.core.AbstractRedisClient;
|
||||
import io.lettuce.core.api.StatefulConnection;
|
||||
|
||||
import com.lambdaworks.redis.AbstractRedisClient;
|
||||
import com.lambdaworks.redis.api.StatefulConnection;
|
||||
import org.springframework.data.redis.connection.Pool;
|
||||
|
||||
/**
|
||||
* Pool of Lettuce {@link StatefulConnection}s
|
||||
|
||||
@@ -13,9 +13,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import io.lettuce.core.RedisException;
|
||||
import io.lettuce.core.api.reactive.RedisKeyReactiveCommands;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@@ -30,9 +31,6 @@ import org.springframework.data.redis.connection.ReactiveRedisConnection.Boolean
|
||||
import org.springframework.data.redis.connection.RedisClusterNode;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.lambdaworks.redis.RedisException;
|
||||
import com.lambdaworks.redis.api.reactive.RedisKeyReactiveCommands;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,13 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import io.lettuce.core.GeoArgs;
|
||||
import io.lettuce.core.GeoCoordinates;
|
||||
import io.lettuce.core.GeoWithin;
|
||||
import io.lettuce.core.Value;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -35,14 +42,6 @@ import org.springframework.data.redis.connection.RedisGeoCommands;
|
||||
import org.springframework.data.redis.connection.RedisGeoCommands.GeoLocation;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.lambdaworks.redis.GeoArgs;
|
||||
import com.lambdaworks.redis.GeoCoordinates;
|
||||
import com.lambdaworks.redis.GeoWithin;
|
||||
import com.lambdaworks.redis.Value;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
* @since 2.0
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import io.lettuce.core.KeyValue;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -32,11 +36,6 @@ import org.springframework.data.redis.connection.ReactiveRedisConnection.Numeric
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import com.lambdaworks.redis.KeyValue;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import io.lettuce.core.api.reactive.RedisKeyReactiveCommands;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@@ -32,8 +33,6 @@ import org.springframework.data.redis.connection.ReactiveRedisConnection.MultiVa
|
||||
import org.springframework.data.redis.connection.ReactiveRedisConnection.NumericResponse;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.lambdaworks.redis.api.reactive.RedisKeyReactiveCommands;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
|
||||
@@ -15,6 +15,12 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import io.lettuce.core.api.reactive.RedisReactiveCommands;
|
||||
import io.lettuce.core.cluster.RedisClusterClient;
|
||||
import io.lettuce.core.cluster.api.StatefulRedisClusterConnection;
|
||||
import io.lettuce.core.cluster.api.reactive.RedisClusterReactiveCommands;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.springframework.data.redis.connection.ReactiveRedisClusterConnection;
|
||||
@@ -22,13 +28,6 @@ import org.springframework.data.redis.connection.RedisNode;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.lambdaworks.redis.api.reactive.RedisReactiveCommands;
|
||||
import com.lambdaworks.redis.cluster.RedisClusterClient;
|
||||
import com.lambdaworks.redis.cluster.api.StatefulRedisClusterConnection;
|
||||
import com.lambdaworks.redis.cluster.api.reactive.RedisClusterReactiveCommands;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,26 +15,34 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import io.lettuce.core.AbstractRedisClient;
|
||||
import io.lettuce.core.RedisClient;
|
||||
import io.lettuce.core.api.StatefulConnection;
|
||||
import io.lettuce.core.api.StatefulRedisConnection;
|
||||
import io.lettuce.core.cluster.RedisClusterClient;
|
||||
import io.lettuce.core.cluster.api.StatefulRedisClusterConnection;
|
||||
import io.lettuce.core.cluster.api.reactive.RedisClusterReactiveCommands;
|
||||
import io.lettuce.core.codec.RedisCodec;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.reactivestreams.Publisher;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.dao.InvalidDataAccessResourceUsageException;
|
||||
import org.springframework.data.redis.connection.*;
|
||||
import org.springframework.data.redis.connection.ReactiveGeoCommands;
|
||||
import org.springframework.data.redis.connection.ReactiveHashCommands;
|
||||
import org.springframework.data.redis.connection.ReactiveHyperLogLogCommands;
|
||||
import org.springframework.data.redis.connection.ReactiveKeyCommands;
|
||||
import org.springframework.data.redis.connection.ReactiveListCommands;
|
||||
import org.springframework.data.redis.connection.ReactiveNumberCommands;
|
||||
import org.springframework.data.redis.connection.ReactiveRedisConnection;
|
||||
import org.springframework.data.redis.connection.ReactiveSetCommands;
|
||||
import org.springframework.data.redis.connection.ReactiveStringCommands;
|
||||
import org.springframework.data.redis.connection.ReactiveZSetCommands;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.lambdaworks.redis.AbstractRedisClient;
|
||||
import com.lambdaworks.redis.RedisClient;
|
||||
import com.lambdaworks.redis.api.StatefulConnection;
|
||||
import com.lambdaworks.redis.api.StatefulRedisConnection;
|
||||
import com.lambdaworks.redis.cluster.RedisClusterClient;
|
||||
import com.lambdaworks.redis.cluster.api.StatefulRedisClusterConnection;
|
||||
import com.lambdaworks.redis.cluster.api.reactive.RedisClusterReactiveCommands;
|
||||
import com.lambdaworks.redis.codec.RedisCodec;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
* @since 2.0
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import io.lettuce.core.SetArgs;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.List;
|
||||
|
||||
@@ -29,11 +33,6 @@ import org.springframework.data.redis.connection.ReactiveRedisConnection.RangeCo
|
||||
import org.springframework.data.redis.connection.ReactiveStringCommands;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.lambdaworks.redis.SetArgs;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
|
||||
@@ -15,6 +15,13 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import io.lettuce.core.Range;
|
||||
import io.lettuce.core.Range.Boundary;
|
||||
import io.lettuce.core.ScoredValue;
|
||||
import io.lettuce.core.ZAddArgs;
|
||||
import io.lettuce.core.ZStoreArgs;
|
||||
import io.lettuce.core.codec.StringCodec;
|
||||
import io.lettuce.core.protocol.LettuceCharsets;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@@ -37,14 +44,6 @@ import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.lambdaworks.redis.Range;
|
||||
import com.lambdaworks.redis.Range.Boundary;
|
||||
import com.lambdaworks.redis.ScoredValue;
|
||||
import com.lambdaworks.redis.ZAddArgs;
|
||||
import com.lambdaworks.redis.ZStoreArgs;
|
||||
import com.lambdaworks.redis.codec.StringCodec;
|
||||
import com.lambdaworks.redis.protocol.LettuceCharsets;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,12 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import io.lettuce.core.RedisClient;
|
||||
import io.lettuce.core.RedisURI.Builder;
|
||||
import io.lettuce.core.resource.ClientResources;
|
||||
import io.lettuce.core.sentinel.api.StatefulRedisSentinelConnection;
|
||||
import io.lettuce.core.sentinel.api.sync.RedisSentinelCommands;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
@@ -26,12 +32,6 @@ import org.springframework.data.redis.connection.RedisSentinelConnection;
|
||||
import org.springframework.data.redis.connection.RedisServer;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.lambdaworks.redis.RedisClient;
|
||||
import com.lambdaworks.redis.RedisURI.Builder;
|
||||
import com.lambdaworks.redis.resource.ClientResources;
|
||||
import com.lambdaworks.redis.sentinel.api.StatefulRedisSentinelConnection;
|
||||
import com.lambdaworks.redis.sentinel.api.sync.RedisSentinelCommands;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2013 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,11 +16,11 @@
|
||||
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import io.lettuce.core.pubsub.StatefulRedisPubSubConnection;
|
||||
|
||||
import org.springframework.data.redis.connection.MessageListener;
|
||||
import org.springframework.data.redis.connection.util.AbstractSubscription;
|
||||
|
||||
import com.lambdaworks.redis.pubsub.StatefulRedisPubSubConnection;
|
||||
|
||||
/**
|
||||
* Message subscription on top of Lettuce.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,16 +15,16 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import io.lettuce.core.RedisClient;
|
||||
import io.lettuce.core.RedisException;
|
||||
import io.lettuce.core.api.StatefulRedisConnection;
|
||||
import io.lettuce.core.pubsub.StatefulRedisPubSubConnection;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.lambdaworks.redis.RedisClient;
|
||||
import com.lambdaworks.redis.RedisException;
|
||||
import com.lambdaworks.redis.api.StatefulRedisConnection;
|
||||
import com.lambdaworks.redis.pubsub.StatefulRedisPubSubConnection;
|
||||
|
||||
/**
|
||||
* Integration test of {@link AuthenticatingRedisClient}. Enable requirepass and comment out the @Ignore to run.
|
||||
*
|
||||
|
||||
@@ -19,6 +19,10 @@ import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.springframework.test.util.ReflectionTestUtils.*;
|
||||
|
||||
import io.lettuce.core.RedisException;
|
||||
import io.lettuce.core.RedisURI;
|
||||
import io.lettuce.core.api.StatefulRedisConnection;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -30,10 +34,6 @@ import org.springframework.data.redis.SettingsUtils;
|
||||
import org.springframework.data.redis.connection.PoolException;
|
||||
import org.springframework.data.redis.connection.RedisSentinelConfiguration;
|
||||
|
||||
import com.lambdaworks.redis.RedisException;
|
||||
import com.lambdaworks.redis.RedisURI;
|
||||
import com.lambdaworks.redis.api.StatefulRedisConnection;
|
||||
|
||||
/**
|
||||
* Unit test of {@link DefaultLettucePool}
|
||||
*
|
||||
|
||||
@@ -26,6 +26,11 @@ import static org.springframework.data.redis.connection.RedisGeoCommands.Distanc
|
||||
import static org.springframework.data.redis.connection.RedisGeoCommands.GeoRadiusCommandArgs.*;
|
||||
import static org.springframework.data.redis.core.ScanOptions.*;
|
||||
|
||||
import io.lettuce.core.RedisURI.Builder;
|
||||
import io.lettuce.core.api.sync.RedisHLLCommands;
|
||||
import io.lettuce.core.cluster.RedisClusterClient;
|
||||
import io.lettuce.core.cluster.api.sync.RedisAdvancedClusterCommands;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -70,11 +75,6 @@ import org.springframework.data.redis.test.util.MinimumRedisVersionRule;
|
||||
import org.springframework.data.redis.test.util.RedisClusterRule;
|
||||
import org.springframework.test.annotation.IfProfileValue;
|
||||
|
||||
import com.lambdaworks.redis.RedisURI.Builder;
|
||||
import com.lambdaworks.redis.api.sync.RedisHLLCommands;
|
||||
import com.lambdaworks.redis.cluster.RedisClusterClient;
|
||||
import com.lambdaworks.redis.cluster.api.sync.RedisAdvancedClusterCommands;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
|
||||
@@ -23,6 +23,13 @@ import static org.mockito.Mockito.*;
|
||||
import static org.springframework.data.redis.connection.ClusterTestVariables.*;
|
||||
import static org.springframework.data.redis.test.util.MockitoUtils.*;
|
||||
|
||||
import io.lettuce.core.RedisURI;
|
||||
import io.lettuce.core.cluster.RedisClusterClient;
|
||||
import io.lettuce.core.cluster.api.async.RedisClusterAsyncCommands;
|
||||
import io.lettuce.core.cluster.api.sync.RedisClusterCommands;
|
||||
import io.lettuce.core.cluster.models.partitions.Partitions;
|
||||
import io.lettuce.core.cluster.models.partitions.RedisClusterNode.NodeFlag;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@@ -38,13 +45,6 @@ import org.springframework.data.redis.connection.ClusterNodeResourceProvider;
|
||||
import org.springframework.data.redis.connection.RedisClusterCommands.AddSlots;
|
||||
import org.springframework.data.redis.connection.RedisClusterNode;
|
||||
|
||||
import com.lambdaworks.redis.RedisURI;
|
||||
import com.lambdaworks.redis.cluster.RedisClusterClient;
|
||||
import com.lambdaworks.redis.cluster.api.async.RedisClusterAsyncCommands;
|
||||
import com.lambdaworks.redis.cluster.api.sync.RedisClusterCommands;
|
||||
import com.lambdaworks.redis.cluster.models.partitions.Partitions;
|
||||
import com.lambdaworks.redis.cluster.models.partitions.RedisClusterNode.NodeFlag;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
@@ -75,19 +75,19 @@ public class LettuceClusterConnectionUnitTests {
|
||||
|
||||
Partitions partitions = new Partitions();
|
||||
|
||||
com.lambdaworks.redis.cluster.models.partitions.RedisClusterNode partition1 = new com.lambdaworks.redis.cluster.models.partitions.RedisClusterNode();
|
||||
io.lettuce.core.cluster.models.partitions.RedisClusterNode partition1 = new io.lettuce.core.cluster.models.partitions.RedisClusterNode();
|
||||
partition1.setNodeId(CLUSTER_NODE_1.getId());
|
||||
partition1.setConnected(true);
|
||||
partition1.setFlags(Collections.singleton(NodeFlag.MASTER));
|
||||
partition1.setUri(RedisURI.create("redis://" + CLUSTER_HOST + ":" + MASTER_NODE_1_PORT));
|
||||
|
||||
com.lambdaworks.redis.cluster.models.partitions.RedisClusterNode partition2 = new com.lambdaworks.redis.cluster.models.partitions.RedisClusterNode();
|
||||
io.lettuce.core.cluster.models.partitions.RedisClusterNode partition2 = new io.lettuce.core.cluster.models.partitions.RedisClusterNode();
|
||||
partition2.setNodeId(CLUSTER_NODE_2.getId());
|
||||
partition2.setConnected(true);
|
||||
partition2.setFlags(Collections.singleton(NodeFlag.MASTER));
|
||||
partition2.setUri(RedisURI.create("redis://" + CLUSTER_HOST + ":" + MASTER_NODE_2_PORT));
|
||||
|
||||
com.lambdaworks.redis.cluster.models.partitions.RedisClusterNode partition3 = new com.lambdaworks.redis.cluster.models.partitions.RedisClusterNode();
|
||||
io.lettuce.core.cluster.models.partitions.RedisClusterNode partition3 = new io.lettuce.core.cluster.models.partitions.RedisClusterNode();
|
||||
partition3.setNodeId(CLUSTER_NODE_3.getId());
|
||||
partition3.setConnected(true);
|
||||
partition3.setFlags(Collections.singleton(NodeFlag.MASTER));
|
||||
@@ -184,9 +184,9 @@ public class LettuceClusterConnectionUnitTests {
|
||||
@Test // DATAREDIS-315
|
||||
public void keysShouldBeRunOnAllClusterNodes() {
|
||||
|
||||
when(clusterConnection1Mock.keys(any(byte[].class))).thenReturn(Collections.<byte[]>emptyList());
|
||||
when(clusterConnection2Mock.keys(any(byte[].class))).thenReturn(Collections.<byte[]>emptyList());
|
||||
when(clusterConnection3Mock.keys(any(byte[].class))).thenReturn(Collections.<byte[]>emptyList());
|
||||
when(clusterConnection1Mock.keys(any(byte[].class))).thenReturn(Collections.<byte[]> emptyList());
|
||||
when(clusterConnection2Mock.keys(any(byte[].class))).thenReturn(Collections.<byte[]> emptyList());
|
||||
when(clusterConnection3Mock.keys(any(byte[].class))).thenReturn(Collections.<byte[]> emptyList());
|
||||
|
||||
byte[] pattern = LettuceConverters.toBytes("*");
|
||||
|
||||
@@ -200,7 +200,7 @@ public class LettuceClusterConnectionUnitTests {
|
||||
@Test // DATAREDIS-315
|
||||
public void keysShouldOnlyBeRunOnDedicatedNodeWhenPinned() {
|
||||
|
||||
when(clusterConnection2Mock.keys(any(byte[].class))).thenReturn(Collections.<byte[]>emptyList());
|
||||
when(clusterConnection2Mock.keys(any(byte[].class))).thenReturn(Collections.<byte[]> emptyList());
|
||||
|
||||
byte[] pattern = LettuceConverters.toBytes("*");
|
||||
|
||||
|
||||
@@ -20,7 +20,10 @@ import static org.hamcrest.core.IsEqual.*;
|
||||
import static org.hamcrest.core.IsNull.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import com.lambdaworks.redis.api.reactive.BaseRedisReactiveCommands;
|
||||
import io.lettuce.core.RedisException;
|
||||
import io.lettuce.core.api.async.RedisAsyncCommands;
|
||||
import io.lettuce.core.api.reactive.BaseRedisReactiveCommands;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
@@ -33,10 +36,6 @@ import org.springframework.data.redis.SettingsUtils;
|
||||
import org.springframework.data.redis.connection.DefaultStringRedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.StringRedisConnection;
|
||||
import org.springframework.data.repository.util.QueryExecutionConverters;
|
||||
|
||||
import com.lambdaworks.redis.RedisException;
|
||||
import com.lambdaworks.redis.api.async.RedisAsyncCommands;
|
||||
|
||||
/**
|
||||
* Integration test of {@link LettuceConnectionFactory}
|
||||
@@ -330,8 +329,6 @@ public class LettuceConnectionFactoryTests {
|
||||
|
||||
ConnectionFactoryTracker.add(factory);
|
||||
|
||||
assertThat(factory.getReactiveConnection()
|
||||
.execute(BaseRedisReactiveCommands::ping)
|
||||
.blockFirst(), is("PONG"));
|
||||
assertThat(factory.getReactiveConnection().execute(BaseRedisReactiveCommands::ping).blockFirst(), is("PONG"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,11 @@ import static org.springframework.data.redis.connection.ClusterTestVariables.*;
|
||||
import static org.springframework.data.redis.connection.lettuce.LettuceTestClientResources.*;
|
||||
import static org.springframework.test.util.ReflectionTestUtils.*;
|
||||
|
||||
import io.lettuce.core.AbstractRedisClient;
|
||||
import io.lettuce.core.RedisClient;
|
||||
import io.lettuce.core.RedisURI;
|
||||
import io.lettuce.core.cluster.RedisClusterClient;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -33,11 +38,6 @@ import org.springframework.data.redis.ConnectionFactoryTracker;
|
||||
import org.springframework.data.redis.connection.RedisClusterConfiguration;
|
||||
import org.springframework.data.redis.connection.RedisSentinelConfiguration;
|
||||
|
||||
import com.lambdaworks.redis.AbstractRedisClient;
|
||||
import com.lambdaworks.redis.RedisClient;
|
||||
import com.lambdaworks.redis.RedisURI;
|
||||
import com.lambdaworks.redis.cluster.RedisClusterClient;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
|
||||
@@ -21,6 +21,8 @@ import static org.junit.Assert.*;
|
||||
import static org.junit.Assume.*;
|
||||
import static org.springframework.data.redis.SpinBarrier.*;
|
||||
|
||||
import io.lettuce.core.api.async.RedisAsyncCommands;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -49,8 +51,6 @@ import org.springframework.data.redis.test.util.RequiresRedisSentinel;
|
||||
import org.springframework.test.annotation.IfProfileValue;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
import com.lambdaworks.redis.api.async.RedisAsyncCommands;
|
||||
|
||||
/**
|
||||
* Integration test of {@link LettuceConnection}
|
||||
*
|
||||
|
||||
@@ -17,6 +17,12 @@ package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import io.lettuce.core.RedisClient;
|
||||
import io.lettuce.core.api.StatefulRedisConnection;
|
||||
import io.lettuce.core.api.async.RedisAsyncCommands;
|
||||
import io.lettuce.core.api.sync.RedisCommands;
|
||||
import io.lettuce.core.codec.RedisCodec;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -29,12 +35,6 @@ import org.springframework.data.redis.connection.RedisServerCommands.ShutdownOpt
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionUnitTestSuite.LettuceConnectionUnitTests;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionUnitTestSuite.LettucePipelineConnectionUnitTests;
|
||||
|
||||
import com.lambdaworks.redis.RedisClient;
|
||||
import com.lambdaworks.redis.api.StatefulRedisConnection;
|
||||
import com.lambdaworks.redis.api.async.RedisAsyncCommands;
|
||||
import com.lambdaworks.redis.api.sync.RedisCommands;
|
||||
import com.lambdaworks.redis.codec.RedisCodec;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
|
||||
@@ -23,6 +23,11 @@ import static org.junit.Assert.*;
|
||||
import static org.springframework.data.redis.connection.ClusterTestVariables.*;
|
||||
import static org.springframework.test.util.ReflectionTestUtils.*;
|
||||
|
||||
import io.lettuce.core.RedisURI;
|
||||
import io.lettuce.core.SetArgs;
|
||||
import io.lettuce.core.cluster.models.partitions.Partitions;
|
||||
import io.lettuce.core.cluster.models.partitions.RedisClusterNode.NodeFlag;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
@@ -36,11 +41,6 @@ import org.springframework.data.redis.connection.RedisStringCommands.SetOption;
|
||||
import org.springframework.data.redis.core.types.Expiration;
|
||||
import org.springframework.data.redis.core.types.RedisClientInfo;
|
||||
|
||||
import com.lambdaworks.redis.RedisURI;
|
||||
import com.lambdaworks.redis.SetArgs;
|
||||
import com.lambdaworks.redis.cluster.models.partitions.Partitions;
|
||||
import com.lambdaworks.redis.cluster.models.partitions.RedisClusterNode.NodeFlag;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
*/
|
||||
@@ -50,13 +50,14 @@ public class LettuceConvertersUnitTests {
|
||||
|
||||
@Test // DATAREDIS-268
|
||||
public void convertingEmptyStringToListOfRedisClientInfoShouldReturnEmptyList() {
|
||||
assertThat(LettuceConverters.toListOfRedisClientInformation(""), equalTo(Collections.<RedisClientInfo>emptyList()));
|
||||
assertThat(LettuceConverters.toListOfRedisClientInformation(""),
|
||||
equalTo(Collections.<RedisClientInfo> emptyList()));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-268
|
||||
public void convertingNullToListOfRedisClientInfoShouldReturnEmptyList() {
|
||||
assertThat(LettuceConverters.toListOfRedisClientInformation(null),
|
||||
equalTo(Collections.<RedisClientInfo>emptyList()));
|
||||
equalTo(Collections.<RedisClientInfo> emptyList()));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-268
|
||||
@@ -80,12 +81,12 @@ public class LettuceConvertersUnitTests {
|
||||
|
||||
Partitions partitions = new Partitions();
|
||||
|
||||
com.lambdaworks.redis.cluster.models.partitions.RedisClusterNode partition = new com.lambdaworks.redis.cluster.models.partitions.RedisClusterNode();
|
||||
io.lettuce.core.cluster.models.partitions.RedisClusterNode partition = new io.lettuce.core.cluster.models.partitions.RedisClusterNode();
|
||||
partition.setNodeId(CLUSTER_NODE_1.getId());
|
||||
partition.setConnected(true);
|
||||
partition.setFlags(new HashSet<NodeFlag>(Arrays.asList(NodeFlag.MASTER, NodeFlag.MYSELF)));
|
||||
partition.setUri(RedisURI.create("redis://" + CLUSTER_HOST + ":" + MASTER_NODE_1_PORT));
|
||||
partition.setSlots(Arrays.<Integer>asList(1, 2, 3, 4, 5));
|
||||
partition.setSlots(Arrays.<Integer> asList(1, 2, 3, 4, 5));
|
||||
|
||||
partitions.addPartition(partition);
|
||||
|
||||
|
||||
@@ -18,15 +18,15 @@ package org.springframework.data.redis.connection.lettuce;
|
||||
import static org.hamcrest.core.Is.*;
|
||||
import static org.junit.Assume.*;
|
||||
|
||||
import io.lettuce.core.api.sync.RedisCommands;
|
||||
import io.lettuce.core.cluster.api.sync.RedisAdvancedClusterCommands;
|
||||
import io.lettuce.core.cluster.api.sync.RedisClusterCommands;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.ClassRule;
|
||||
import org.springframework.data.redis.test.util.LettuceRedisClusterClientProvider;
|
||||
|
||||
import com.lambdaworks.redis.api.sync.RedisCommands;
|
||||
import com.lambdaworks.redis.cluster.api.sync.RedisAdvancedClusterCommands;
|
||||
import com.lambdaworks.redis.cluster.api.sync.RedisClusterCommands;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,13 @@ package org.springframework.data.redis.connection.lettuce;
|
||||
import static org.hamcrest.core.Is.*;
|
||||
import static org.junit.Assume.*;
|
||||
|
||||
import io.lettuce.core.AbstractRedisClient;
|
||||
import io.lettuce.core.RedisClient;
|
||||
import io.lettuce.core.api.sync.RedisCommands;
|
||||
import io.lettuce.core.cluster.RedisClusterClient;
|
||||
import io.lettuce.core.cluster.api.sync.RedisAdvancedClusterCommands;
|
||||
import io.lettuce.core.cluster.api.sync.RedisClusterCommands;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Arrays;
|
||||
@@ -30,13 +37,6 @@ import org.junit.runners.Parameterized;
|
||||
import org.springframework.data.redis.test.util.LettuceRedisClientProvider;
|
||||
import org.springframework.data.redis.test.util.LettuceRedisClusterClientProvider;
|
||||
|
||||
import com.lambdaworks.redis.AbstractRedisClient;
|
||||
import com.lambdaworks.redis.RedisClient;
|
||||
import com.lambdaworks.redis.api.sync.RedisCommands;
|
||||
import com.lambdaworks.redis.cluster.RedisClusterClient;
|
||||
import com.lambdaworks.redis.cluster.api.sync.RedisAdvancedClusterCommands;
|
||||
import com.lambdaworks.redis.cluster.api.sync.RedisClusterCommands;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
*/
|
||||
|
||||
@@ -19,6 +19,7 @@ import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assume.*;
|
||||
|
||||
import io.lettuce.core.SetArgs;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.test.StepVerifier;
|
||||
@@ -35,8 +36,6 @@ import org.springframework.data.redis.connection.DataType;
|
||||
import org.springframework.data.redis.connection.ReactiveRedisConnection.KeyCommand;
|
||||
import org.springframework.data.redis.connection.ReactiveRedisConnection.NumericResponse;
|
||||
|
||||
import com.lambdaworks.redis.SetArgs;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link LettuceReactiveKeyCommands}.
|
||||
*
|
||||
|
||||
@@ -17,6 +17,11 @@ package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import io.lettuce.core.RedisClient;
|
||||
import io.lettuce.core.RedisFuture;
|
||||
import io.lettuce.core.sentinel.api.StatefulRedisSentinelConnection;
|
||||
import io.lettuce.core.sentinel.api.sync.RedisSentinelCommands;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -30,11 +35,6 @@ import org.springframework.data.redis.connection.RedisNode;
|
||||
import org.springframework.data.redis.connection.RedisNode.RedisNodeBuilder;
|
||||
import org.springframework.data.redis.connection.RedisServer;
|
||||
|
||||
import com.lambdaworks.redis.RedisClient;
|
||||
import com.lambdaworks.redis.RedisFuture;
|
||||
import com.lambdaworks.redis.sentinel.api.StatefulRedisSentinelConnection;
|
||||
import com.lambdaworks.redis.sentinel.api.sync.RedisSentinelCommands;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
@@ -86,7 +86,7 @@ public class LettuceSentinelConnectionUnitTests {
|
||||
@Test // DATAREDIS-348
|
||||
public void mastersShouldReadMastersCorrectly() {
|
||||
|
||||
when(sentinelCommandsMock.masters()).thenReturn(Collections.<Map<String, String>>emptyList());
|
||||
when(sentinelCommandsMock.masters()).thenReturn(Collections.<Map<String, String>> emptyList());
|
||||
connection.masters();
|
||||
verify(sentinelCommandsMock, times(1)).masters();
|
||||
}
|
||||
@@ -94,7 +94,7 @@ public class LettuceSentinelConnectionUnitTests {
|
||||
@Test // DATAREDIS-348
|
||||
public void shouldReadSlavesCorrectly() {
|
||||
|
||||
when(sentinelCommandsMock.slaves(MASTER_ID)).thenReturn(Collections.<Map<String, String>>emptyList());
|
||||
when(sentinelCommandsMock.slaves(MASTER_ID)).thenReturn(Collections.<Map<String, String>> emptyList());
|
||||
connection.slaves(MASTER_ID);
|
||||
verify(sentinelCommandsMock, times(1)).slaves(eq(MASTER_ID));
|
||||
}
|
||||
@@ -102,7 +102,7 @@ public class LettuceSentinelConnectionUnitTests {
|
||||
@Test // DATAREDIS-348
|
||||
public void shouldReadSlavesCorrectlyWhenGivenNamedNode() {
|
||||
|
||||
when(sentinelCommandsMock.slaves(MASTER_ID)).thenReturn(Collections.<Map<String, String>>emptyList());
|
||||
when(sentinelCommandsMock.slaves(MASTER_ID)).thenReturn(Collections.<Map<String, String>> emptyList());
|
||||
connection.slaves(new RedisNodeBuilder().withName(MASTER_ID).build());
|
||||
verify(sentinelCommandsMock, times(1)).slaves(eq(MASTER_ID));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2016 the original author or authors.
|
||||
* Copyright 2011-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,9 @@ package org.springframework.data.redis.connection.lettuce;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import io.lettuce.core.pubsub.StatefulRedisPubSubConnection;
|
||||
import io.lettuce.core.pubsub.api.sync.RedisPubSubCommands;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -26,9 +29,6 @@ import org.mockito.Mockito;
|
||||
import org.springframework.data.redis.connection.MessageListener;
|
||||
import org.springframework.data.redis.connection.RedisInvalidSubscriptionException;
|
||||
|
||||
import com.lambdaworks.redis.pubsub.StatefulRedisPubSubConnection;
|
||||
import com.lambdaworks.redis.pubsub.api.sync.RedisPubSubCommands;
|
||||
|
||||
/**
|
||||
* Unit test of {@link LettuceSubscription}
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -13,13 +13,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import io.lettuce.core.resource.ClientResources;
|
||||
import io.lettuce.core.resource.DefaultClientResources;
|
||||
|
||||
import com.lambdaworks.redis.resource.ClientResources;
|
||||
import com.lambdaworks.redis.resource.DefaultClientResources;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Client-Resources suitable for testing. Uses {@link TestEventLoopGroupProvider} to preserve the event loop groups
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -13,20 +13,18 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.lambdaworks.redis.resource.DefaultEventLoopGroupProvider;
|
||||
|
||||
import io.lettuce.core.resource.DefaultEventLoopGroupProvider;
|
||||
import io.netty.util.concurrent.DefaultPromise;
|
||||
import io.netty.util.concurrent.EventExecutorGroup;
|
||||
import io.netty.util.concurrent.ImmediateEventExecutor;
|
||||
import io.netty.util.concurrent.Promise;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* A {@link com.lambdaworks.redis.resource.EventLoopGroupProvider} suitable for testing. Preserves the event loop groups
|
||||
* A {@link io.lettuce.core.resource.EventLoopGroupProvider} suitable for testing. Preserves the event loop groups
|
||||
* between tests. Every time a new {@link TestEventLoopGroupProvider} instance is created, a
|
||||
* {@link Runtime#addShutdownHook(Thread) shutdown hook} is added to close the resources.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.redis.test.util;
|
||||
|
||||
import org.junit.rules.ExternalResource;
|
||||
import io.lettuce.core.RedisClient;
|
||||
import io.lettuce.core.RedisURI;
|
||||
|
||||
import com.lambdaworks.redis.RedisClient;
|
||||
import com.lambdaworks.redis.RedisURI;
|
||||
import org.junit.rules.ExternalResource;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceTestClientResources;
|
||||
|
||||
/**
|
||||
@@ -32,7 +32,7 @@ public class LettuceRedisClientProvider extends ExternalResource {
|
||||
RedisClient client;
|
||||
|
||||
@Override
|
||||
protected void before() {
|
||||
protected void before() {
|
||||
|
||||
try {
|
||||
super.before();
|
||||
@@ -40,7 +40,8 @@ public class LettuceRedisClientProvider extends ExternalResource {
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
|
||||
client = RedisClient.create(LettuceTestClientResources.getSharedClientResources(), RedisURI.builder().withHost(host).withPort(port).build());
|
||||
client = RedisClient.create(LettuceTestClientResources.getSharedClientResources(),
|
||||
RedisURI.builder().withHost(host).withPort(port).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -50,7 +51,7 @@ public class LettuceRedisClientProvider extends ExternalResource {
|
||||
}
|
||||
|
||||
public RedisClient getClient() {
|
||||
if(client == null) {
|
||||
if (client == null) {
|
||||
before();
|
||||
}
|
||||
return client;
|
||||
@@ -58,7 +59,7 @@ public class LettuceRedisClientProvider extends ExternalResource {
|
||||
|
||||
public void destroy() {
|
||||
|
||||
if(client != null) {
|
||||
if (client != null) {
|
||||
after();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016. the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -34,9 +18,9 @@ package org.springframework.data.redis.test.util;
|
||||
import org.junit.rules.ExternalResource;
|
||||
import org.springframework.data.redis.connection.lettuce.LettuceTestClientResources;
|
||||
|
||||
import com.lambdaworks.redis.RedisURI;
|
||||
import com.lambdaworks.redis.cluster.RedisClusterClient;
|
||||
import com.lambdaworks.redis.cluster.api.StatefulRedisClusterConnection;
|
||||
import io.lettuce.core.RedisURI;
|
||||
import io.lettuce.core.cluster.RedisClusterClient;
|
||||
import io.lettuce.core.cluster.api.StatefulRedisClusterConnection;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
|
||||
Reference in New Issue
Block a user