DATAREDIS-869 - Adapt to nomenclature change about Master/Replica.
We now renamed RedisStaticMasterSlaveConfiguration and StaticMasterSlaveConnectionProvider to RedisStaticMasterReplicaConfiguration respective StaticMasterReplicaConnectionProvider to reflect changes in Redis nomenclature regarding replication. Original Pull Request: #355
This commit is contained in:
committed by
Christoph Strobl
parent
a7352f5612
commit
169b1bd174
@@ -20,7 +20,7 @@ import static org.assertj.core.api.Assertions.*;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link RedisStaticMasterSlaveConfiguration}.
|
||||
* Unit tests for {@link RedisStaticMasterReplicaConfiguration}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@@ -29,7 +29,7 @@ public class RedisElastiCacheConfigurationUnitTests {
|
||||
@Test // DATAREDIS-762
|
||||
public void shouldCreateSingleHostConfiguration() {
|
||||
|
||||
RedisStaticMasterSlaveConfiguration singleHost = new RedisStaticMasterSlaveConfiguration("localhost");
|
||||
RedisStaticMasterReplicaConfiguration singleHost = new RedisStaticMasterReplicaConfiguration("localhost");
|
||||
|
||||
assertThat(singleHost.getNodes()).hasSize(1);
|
||||
|
||||
@@ -42,7 +42,7 @@ public class RedisElastiCacheConfigurationUnitTests {
|
||||
@Test // DATAREDIS-762
|
||||
public void shouldCreateMultiHostConfiguration() {
|
||||
|
||||
RedisStaticMasterSlaveConfiguration multiHost = new RedisStaticMasterSlaveConfiguration("localhost");
|
||||
RedisStaticMasterReplicaConfiguration multiHost = new RedisStaticMasterReplicaConfiguration("localhost");
|
||||
multiHost.node("other-host", 6479);
|
||||
|
||||
assertThat(multiHost.getNodes()).hasSize(2);
|
||||
@@ -61,7 +61,7 @@ public class RedisElastiCacheConfigurationUnitTests {
|
||||
@Test // DATAREDIS-762
|
||||
public void shouldApplyPasswordToNodes() {
|
||||
|
||||
RedisStaticMasterSlaveConfiguration multiHost = new RedisStaticMasterSlaveConfiguration("localhost").node("other-host", 6479);
|
||||
RedisStaticMasterReplicaConfiguration multiHost = new RedisStaticMasterReplicaConfiguration("localhost").node("other-host", 6479);
|
||||
|
||||
multiHost.setPassword(RedisPassword.of("foobar"));
|
||||
multiHost.node("third", 1234);
|
||||
@@ -73,7 +73,7 @@ public class RedisElastiCacheConfigurationUnitTests {
|
||||
@Test // DATAREDIS-762
|
||||
public void shouldApplyDatabaseToNodes() {
|
||||
|
||||
RedisStaticMasterSlaveConfiguration multiHost = new RedisStaticMasterSlaveConfiguration("localhost").node("other-host", 6479);
|
||||
RedisStaticMasterReplicaConfiguration multiHost = new RedisStaticMasterReplicaConfiguration("localhost").node("other-host", 6479);
|
||||
|
||||
multiHost.setDatabase(4);
|
||||
multiHost.node("third", 1234);
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.springframework.data.redis.RedisSystemException;
|
||||
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.RedisStaticMasterSlaveConfiguration;
|
||||
import org.springframework.data.redis.connection.RedisStaticMasterReplicaConfiguration;
|
||||
import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
|
||||
import org.springframework.data.redis.connection.StringRedisConnection;
|
||||
|
||||
@@ -385,8 +385,8 @@ public class LettuceConnectionFactoryTests {
|
||||
factory.destroy();
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-762
|
||||
public void factoryUsesElastiCacheMasterSlaveConnections() {
|
||||
@Test // DATAREDIS-762, DATAREDIS-869
|
||||
public void factoryUsesElastiCacheMasterReplicaConnections() {
|
||||
|
||||
assumeThat(String.format("No slaves connected to %s:%s.", SettingsUtils.getHost(), SettingsUtils.getPort()),
|
||||
connection.info("replication").getProperty("connected_slaves", "0").compareTo("0") > 0, is(true));
|
||||
@@ -394,7 +394,7 @@ public class LettuceConnectionFactoryTests {
|
||||
LettuceClientConfiguration configuration = LettuceTestClientConfiguration.builder().readFrom(ReadFrom.SLAVE)
|
||||
.build();
|
||||
|
||||
RedisStaticMasterSlaveConfiguration elastiCache = new RedisStaticMasterSlaveConfiguration(SettingsUtils.getHost())
|
||||
RedisStaticMasterReplicaConfiguration elastiCache = new RedisStaticMasterReplicaConfiguration(SettingsUtils.getHost())
|
||||
.node(SettingsUtils.getHost(), SettingsUtils.getPort() + 1);
|
||||
|
||||
LettuceConnectionFactory factory = new LettuceConnectionFactory(elastiCache,
|
||||
@@ -413,16 +413,16 @@ public class LettuceConnectionFactoryTests {
|
||||
factory.destroy();
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-762
|
||||
@Test // DATAREDIS-762, DATAREDIS-869
|
||||
public void factoryUsesElastiCacheMasterWithoutMaster() {
|
||||
|
||||
assumeThat(String.format("No slaves connected to %s:%s.", SettingsUtils.getHost(), SettingsUtils.getPort()),
|
||||
assumeThat(String.format("No replicas connected to %s:%s.", SettingsUtils.getHost(), SettingsUtils.getPort()),
|
||||
connection.info("replication").getProperty("connected_slaves", "0").compareTo("0") > 0, is(true));
|
||||
|
||||
LettuceClientConfiguration configuration = LettuceTestClientConfiguration.builder().readFrom(ReadFrom.MASTER)
|
||||
.build();
|
||||
|
||||
RedisStaticMasterSlaveConfiguration elastiCache = new RedisStaticMasterSlaveConfiguration(SettingsUtils.getHost(),
|
||||
RedisStaticMasterReplicaConfiguration elastiCache = new RedisStaticMasterReplicaConfiguration(SettingsUtils.getHost(),
|
||||
SettingsUtils.getPort() + 1);
|
||||
|
||||
LettuceConnectionFactory factory = new LettuceConnectionFactory(elastiCache, configuration);
|
||||
@@ -444,10 +444,10 @@ public class LettuceConnectionFactoryTests {
|
||||
factory.destroy();
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-580
|
||||
public void factoryUsesMasterSlaveConnections() {
|
||||
@Test // DATAREDIS-580, DATAREDIS-869
|
||||
public void factoryUsesMasterReplicaConnections() {
|
||||
|
||||
assumeThat(String.format("No slaves connected to %s:%s.", SettingsUtils.getHost(), SettingsUtils.getPort()),
|
||||
assumeThat(String.format("No replicas connected to %s:%s.", SettingsUtils.getHost(), SettingsUtils.getPort()),
|
||||
connection.info("replication").getProperty("connected_slaves", "0").compareTo("0") > 0, is(true));
|
||||
|
||||
LettuceClientConfiguration configuration = LettuceTestClientConfiguration.builder().readFrom(ReadFrom.SLAVE)
|
||||
|
||||
Reference in New Issue
Block a user