DATAREDIS-676 - Polishing.
Set disposal state in LettuceClusterConnection only once. Close resources after tests. Typos, formatting. Original pull request: #266.
This commit is contained in:
@@ -133,9 +133,8 @@ public class LettuceClusterConnection extends LettuceConnection
|
||||
Assert.notNull(executor, "ClusterCommandExecutor must not be null.");
|
||||
|
||||
this.clusterClient = clusterClient;
|
||||
topologyProvider = new LettuceClusterTopologyProvider(clusterClient);
|
||||
clusterCommandExecutor = executor;
|
||||
disposeClusterCommandExecutorOnClose = false;
|
||||
this.topologyProvider = new LettuceClusterTopologyProvider(clusterClient);
|
||||
this.clusterCommandExecutor = executor;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -144,7 +143,7 @@ public class LettuceClusterConnection extends LettuceConnection
|
||||
*/
|
||||
@Override
|
||||
public Cursor<byte[]> scan(long cursorId, ScanOptions options) {
|
||||
throw new InvalidDataAccessApiUsageException("Scan is not supported accros multiple nodes within a cluster.");
|
||||
throw new InvalidDataAccessApiUsageException("Scan is not supported across multiple nodes within a cluster.");
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.redis.ConnectionFactoryTracker;
|
||||
import org.springframework.data.redis.connection.RedisClusterConfiguration;
|
||||
import org.springframework.data.redis.connection.RedisClusterConnection;
|
||||
import org.springframework.data.redis.connection.RedisSentinelConfiguration;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
@@ -313,13 +314,18 @@ public class LettuceConnectionFactoryUnitTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-676
|
||||
@Test // DATAREDIS-676
|
||||
public void timeoutShouldBePassedOnToClusterConnection() {
|
||||
|
||||
LettuceConnectionFactory connectionFactory = new LettuceConnectionFactory(clusterConfig);
|
||||
connectionFactory.setShutdownTimeout(0);
|
||||
connectionFactory.setTimeout(2000);
|
||||
connectionFactory.afterPropertiesSet();
|
||||
ConnectionFactoryTracker.add(connectionFactory);
|
||||
|
||||
assertThat((Long) ReflectionTestUtils.getField(connectionFactory.getClusterConnection(), "timeout"), is(equalTo(2000L)));
|
||||
RedisClusterConnection clusterConnection = connectionFactory.getClusterConnection();
|
||||
assertThat((Long) ReflectionTestUtils.getField(clusterConnection, "timeout"), is(equalTo(2000L)));
|
||||
|
||||
clusterConnection.close();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user