Remove usage of oppressive language.
The API exposes now the renamed command terminology (replica) only and no longer the deprecated one. Closes: #2195 See: #2274 Original Pull Request: #2276
This commit is contained in:
committed by
Christoph Strobl
parent
69205c56bb
commit
f1d528ffef
@@ -62,10 +62,10 @@ public interface ClusterConnectionTests {
|
||||
void clientListShouldGetInfosForAllClients();
|
||||
|
||||
// DATAREDIS-315
|
||||
void clusterGetMasterSlaveMapShouldListMastersAndSlavesCorrectly();
|
||||
void clusterGetMasterReplicaMapShouldListMastersAndReplicasCorrectly();
|
||||
|
||||
// DATAREDIS-315
|
||||
void clusterGetSlavesShouldReturnSlaveCorrectly();
|
||||
void clusterGetReplicasShouldReturnReplicaCorrectly();
|
||||
|
||||
// DATAREDIS-315
|
||||
void countKeysShouldReturnNumberOfKeysInSlot();
|
||||
|
||||
@@ -38,12 +38,12 @@ public abstract class ClusterTestVariables {
|
||||
public static final int MASTER_NODE_1_PORT = 7379;
|
||||
public static final int MASTER_NODE_2_PORT = 7380;
|
||||
public static final int MASTER_NODE_3_PORT = 7381;
|
||||
public static final int SLAVEOF_NODE_1_PORT = 7382;
|
||||
public static final int REPLICAOF_NODE_1_PORT = 7382;
|
||||
|
||||
public static final String MASTER_NODE_1_ID = "ef570f86c7b1a953846668debc177a3a16733420";
|
||||
public static final String MASTER_NODE_2_ID = "0f2ee5df45d18c50aca07228cc18b1da96fd5e84";
|
||||
public static final String MASTER_NODE_3_ID = "3b9b8192a874fa8f1f09dbc0ee20afab5738eee7";
|
||||
public static final String SLAVEOF_NODE_1_ID = "b8b5ee73b1d1997abff694b3fe8b2397d2138b6d";
|
||||
public static final String REPLICAOF_NODE_1_ID = "b8b5ee73b1d1997abff694b3fe8b2397d2138b6d";
|
||||
|
||||
public static final RedisClusterNode CLUSTER_NODE_1 = RedisClusterNode.newRedisClusterNode()
|
||||
.listeningAt(CLUSTER_HOST, MASTER_NODE_1_PORT).withId(MASTER_NODE_1_ID).promotedAs(NodeType.MASTER).build();
|
||||
@@ -51,8 +51,9 @@ public abstract class ClusterTestVariables {
|
||||
.listeningAt(CLUSTER_HOST, MASTER_NODE_2_PORT).withId(MASTER_NODE_2_ID).promotedAs(NodeType.MASTER).build();
|
||||
public static final RedisClusterNode CLUSTER_NODE_3 = RedisClusterNode.newRedisClusterNode()
|
||||
.listeningAt(CLUSTER_HOST, MASTER_NODE_3_PORT).withId(MASTER_NODE_3_ID).promotedAs(NodeType.MASTER).build();
|
||||
public static final RedisClusterNode SLAVE_OF_NODE_1 = RedisClusterNode.newRedisClusterNode()
|
||||
.listeningAt(CLUSTER_HOST, SLAVEOF_NODE_1_PORT).withId(SLAVEOF_NODE_1_ID).promotedAs(NodeType.SLAVE).build();
|
||||
public static final RedisClusterNode REPLICA_OF_NODE_1 = RedisClusterNode.newRedisClusterNode()
|
||||
.listeningAt(CLUSTER_HOST, REPLICAOF_NODE_1_PORT).withId(REPLICAOF_NODE_1_ID).promotedAs(NodeType.REPLICA)
|
||||
.build();
|
||||
|
||||
public static final RedisClusterNode UNKNOWN_CLUSTER_NODE = new RedisClusterNode("8.8.8.8", 6379);
|
||||
|
||||
|
||||
@@ -778,8 +778,8 @@ class RedisConnectionUnitTests {
|
||||
return delegate.getBit(key, offset);
|
||||
}
|
||||
|
||||
public void slaveOf(String host, int port) {
|
||||
delegate.slaveOf(host, port);
|
||||
public void replicaOf(String host, int port) {
|
||||
delegate.replicaOf(host, port);
|
||||
}
|
||||
|
||||
public byte[] rPopLPush(byte[] srcKey, byte[] dstKey) {
|
||||
@@ -798,8 +798,8 @@ class RedisConnectionUnitTests {
|
||||
return delegate.setBit(key, offset, value);
|
||||
}
|
||||
|
||||
public void slaveOfNoOne() {
|
||||
delegate.slaveOfNoOne();
|
||||
public void replicaOfNoOne() {
|
||||
delegate.replicaOfNoOne();
|
||||
}
|
||||
|
||||
public void restore(byte[] key, long ttlInMillis, byte[] serializedValue, boolean replace) {
|
||||
|
||||
@@ -103,10 +103,10 @@ class ConvertersUnitTests {
|
||||
assertThat(node.getId()).isEqualTo("8cad73f63eb996fedba89f041636f17d88cda075");
|
||||
assertThat(node.getHost()).isEqualTo("127.0.0.1");
|
||||
assertThat(node.getPort()).isEqualTo(7369);
|
||||
assertThat(node.getType()).isEqualTo(NodeType.SLAVE);
|
||||
assertThat(node.getType()).isEqualTo(NodeType.REPLICA);
|
||||
assertThat(node.getMasterId()).isEqualTo("ef570f86c7b1a953846668debc177a3a16733420");
|
||||
assertThat(node.getSlotRange()).isNotNull();
|
||||
assertThat(node.getFlags()).contains(Flag.SLAVE);
|
||||
assertThat(node.getFlags()).contains(Flag.REPLICA);
|
||||
assertThat(node.getLinkState()).isEqualTo(LinkState.CONNECTED);
|
||||
}
|
||||
|
||||
@@ -153,10 +153,10 @@ class ConvertersUnitTests {
|
||||
assertThat(node.getId()).isEqualTo("8cad73f63eb996fedba89f041636f17d88cda075");
|
||||
assertThat(node.getHost()).isEqualTo("127.0.0.1");
|
||||
assertThat(node.getPort()).isEqualTo(7369);
|
||||
assertThat(node.getType()).isEqualTo(NodeType.SLAVE);
|
||||
assertThat(node.getType()).isEqualTo(NodeType.REPLICA);
|
||||
assertThat(node.getMasterId()).isEqualTo("ef570f86c7b1a953846668debc177a3a16733420");
|
||||
assertThat(node.getSlotRange()).isNotNull();
|
||||
assertThat(node.getFlags()).contains(Flag.SLAVE);
|
||||
assertThat(node.getFlags()).contains(Flag.REPLICA);
|
||||
assertThat(node.getLinkState()).isEqualTo(LinkState.CONNECTED);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,6 @@ import org.springframework.data.redis.connection.RedisStringCommands.BitOperatio
|
||||
import org.springframework.data.redis.connection.RedisStringCommands.SetOption;
|
||||
import org.springframework.data.redis.connection.ReturnType;
|
||||
import org.springframework.data.redis.connection.ValueEncoding.RedisValueEncoding;
|
||||
import org.springframework.data.redis.connection.RedisListCommands.*;
|
||||
import org.springframework.data.redis.core.Cursor;
|
||||
import org.springframework.data.redis.core.ScanOptions;
|
||||
import org.springframework.data.redis.core.script.DigestUtils;
|
||||
@@ -124,7 +123,7 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
|
||||
try (Jedis jedis = pool.getResource()) {
|
||||
jedis.flushAll();
|
||||
} catch (Exception e) {
|
||||
// ignore this one since we cannot remove data from slaves
|
||||
// ignore this one since we cannot remove data from replicas
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -236,26 +235,27 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
public void clusterGetMasterSlaveMapShouldListMastersAndSlavesCorrectly() {
|
||||
public void clusterGetMasterReplicaMapShouldListMastersAndReplicasCorrectly() {
|
||||
|
||||
Map<RedisClusterNode, Collection<RedisClusterNode>> masterSlaveMap = clusterConnection.clusterGetMasterSlaveMap();
|
||||
Map<RedisClusterNode, Collection<RedisClusterNode>> masterReplicaMap = clusterConnection
|
||||
.clusterGetMasterReplicaMap();
|
||||
|
||||
assertThat(masterSlaveMap).isNotNull();
|
||||
assertThat(masterSlaveMap.size()).isEqualTo(3);
|
||||
assertThat(masterSlaveMap.get(new RedisClusterNode(CLUSTER_HOST, MASTER_NODE_1_PORT)))
|
||||
.contains(new RedisClusterNode(CLUSTER_HOST, SLAVEOF_NODE_1_PORT));
|
||||
assertThat(masterSlaveMap.get(new RedisClusterNode(CLUSTER_HOST, MASTER_NODE_2_PORT)).isEmpty()).isTrue();
|
||||
assertThat(masterSlaveMap.get(new RedisClusterNode(CLUSTER_HOST, MASTER_NODE_3_PORT)).isEmpty()).isTrue();
|
||||
assertThat(masterReplicaMap).isNotNull();
|
||||
assertThat(masterReplicaMap.size()).isEqualTo(3);
|
||||
assertThat(masterReplicaMap.get(new RedisClusterNode(CLUSTER_HOST, MASTER_NODE_1_PORT)))
|
||||
.contains(new RedisClusterNode(CLUSTER_HOST, REPLICAOF_NODE_1_PORT));
|
||||
assertThat(masterReplicaMap.get(new RedisClusterNode(CLUSTER_HOST, MASTER_NODE_2_PORT)).isEmpty()).isTrue();
|
||||
assertThat(masterReplicaMap.get(new RedisClusterNode(CLUSTER_HOST, MASTER_NODE_3_PORT)).isEmpty()).isTrue();
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
public void clusterGetSlavesShouldReturnSlaveCorrectly() {
|
||||
public void clusterGetReplicasShouldReturnReplicaCorrectly() {
|
||||
|
||||
Set<RedisClusterNode> slaves = clusterConnection
|
||||
.clusterGetSlaves(new RedisClusterNode(CLUSTER_HOST, MASTER_NODE_1_PORT));
|
||||
Set<RedisClusterNode> replicas = clusterConnection
|
||||
.clusterGetReplicas(new RedisClusterNode(CLUSTER_HOST, MASTER_NODE_1_PORT));
|
||||
|
||||
assertThat(slaves.size()).isEqualTo(1);
|
||||
assertThat(slaves).contains(new RedisClusterNode(CLUSTER_HOST, SLAVEOF_NODE_1_PORT));
|
||||
assertThat(replicas.size()).isEqualTo(1);
|
||||
assertThat(replicas).contains(new RedisClusterNode(CLUSTER_HOST, REPLICAOF_NODE_1_PORT));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -790,7 +790,7 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
|
||||
@Test // DATAREDIS-315, DATAREDIS-661
|
||||
public void getConfigShouldLoadConfigurationOfSpecificNode() {
|
||||
|
||||
Properties result = clusterConnection.getConfig(new RedisClusterNode(CLUSTER_HOST, SLAVEOF_NODE_1_PORT), "*");
|
||||
Properties result = clusterConnection.getConfig(new RedisClusterNode(CLUSTER_HOST, REPLICAOF_NODE_1_PORT), "*");
|
||||
|
||||
assertThat(result.getProperty("slaveof")).endsWith("7379");
|
||||
}
|
||||
|
||||
@@ -257,10 +257,10 @@ class JedisClusterConnectionUnitTests {
|
||||
void shouldFailWithUnknownNode() {
|
||||
|
||||
try {
|
||||
connection.serverCommands().dbSize(new RedisClusterNode(CLUSTER_HOST, SLAVEOF_NODE_1_PORT));
|
||||
connection.serverCommands().dbSize(new RedisClusterNode(CLUSTER_HOST, REPLICAOF_NODE_1_PORT));
|
||||
} catch (IllegalArgumentException e) {
|
||||
assertThat(e.getMessage())
|
||||
.contains("Node " + CLUSTER_HOST + ":" + SLAVEOF_NODE_1_PORT + " is unknown to cluster");
|
||||
.contains("Node " + CLUSTER_HOST + ":" + REPLICAOF_NODE_1_PORT + " is unknown to cluster");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -103,21 +103,21 @@ class JedisConnectionUnitTests {
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-277
|
||||
void slaveOfShouldThrowExectpionWhenCalledForNullHost() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.slaveOf(null, 0));
|
||||
void replicaOfShouldThrowExectpionWhenCalledForNullHost() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.replicaOf(null, 0));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-277
|
||||
public void slaveOfShouldBeSentCorrectly() {
|
||||
public void replicaOfShouldBeSentCorrectly() {
|
||||
|
||||
connection.slaveOf("127.0.0.1", 1001);
|
||||
connection.replicaOf("127.0.0.1", 1001);
|
||||
verifyNativeConnectionInvocation().slaveof(eq("127.0.0.1"), eq(1001));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-277
|
||||
public void slaveOfNoOneShouldBeSentCorrectly() {
|
||||
public void replicaOfNoOneShouldBeSentCorrectly() {
|
||||
|
||||
connection.slaveOfNoOne();
|
||||
connection.replicaOfNoOne();
|
||||
verifyNativeConnectionInvocation().slaveofNoOne();
|
||||
}
|
||||
|
||||
@@ -296,15 +296,15 @@ class JedisConnectionUnitTests {
|
||||
@Test
|
||||
@Override
|
||||
// DATAREDIS-277
|
||||
public void slaveOfShouldBeSentCorrectly() {
|
||||
public void replicaOfShouldBeSentCorrectly() {
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class)
|
||||
.isThrownBy(() -> super.slaveOfShouldBeSentCorrectly());
|
||||
.isThrownBy(() -> super.replicaOfShouldBeSentCorrectly());
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-277
|
||||
public void slaveOfNoOneShouldBeSentCorrectly() {
|
||||
public void replicaOfNoOneShouldBeSentCorrectly() {
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class)
|
||||
.isThrownBy(() -> super.slaveOfNoOneShouldBeSentCorrectly());
|
||||
.isThrownBy(() -> super.replicaOfNoOneShouldBeSentCorrectly());
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-531
|
||||
|
||||
@@ -87,32 +87,32 @@ class JedisSentinelConnectionUnitTests {
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-330
|
||||
void shouldReadSlavesCorrectly() {
|
||||
void shouldReadReplicasCorrectly() {
|
||||
|
||||
connection.slaves("mymaster");
|
||||
verify(jedisMock, times(1)).sentinelSlaves(eq("mymaster"));
|
||||
connection.replicas("mymaster");
|
||||
verify(jedisMock, times(1)).sentinelReplicas(eq("mymaster"));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-330
|
||||
void shouldReadSlavesCorrectlyWhenGivenNamedNode() {
|
||||
void shouldReadReplicasCorrectlyWhenGivenNamedNode() {
|
||||
|
||||
connection.slaves(new RedisNodeBuilder().withName("mymaster").build());
|
||||
verify(jedisMock, times(1)).sentinelSlaves(eq("mymaster"));
|
||||
connection.replicas(new RedisNodeBuilder().withName("mymaster").build());
|
||||
verify(jedisMock, times(1)).sentinelReplicas(eq("mymaster"));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-330
|
||||
void readSlavesShouldThrowExceptionWhenGivenEmptyMasterName() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.slaves(""));
|
||||
void readReplicasShouldThrowExceptionWhenGivenEmptyMasterName() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.replicas(""));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-330
|
||||
void readSlavesShouldThrowExceptionWhenGivenNull() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.slaves((RedisNode) null));
|
||||
void readReplicasShouldThrowExceptionWhenGivenNull() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.replicas((RedisNode) null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-330
|
||||
void readSlavesShouldThrowExceptionWhenNodeWithoutName() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.slaves(new RedisNodeBuilder().build()));
|
||||
void readReplicasShouldThrowExceptionWhenNodeWithoutName() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.replicas(new RedisNodeBuilder().build()));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-330
|
||||
|
||||
@@ -46,8 +46,8 @@ import org.springframework.test.util.ReflectionTestUtils;
|
||||
@EnabledOnRedisSentinelAvailable
|
||||
public class JedisSentinelIntegrationTests extends AbstractConnectionIntegrationTests {
|
||||
|
||||
private static final RedisServer SLAVE_0 = new RedisServer("127.0.0.1", 6380);
|
||||
private static final RedisServer SLAVE_1 = new RedisServer("127.0.0.1", 6381);
|
||||
private static final RedisServer REPLICA_0 = new RedisServer("127.0.0.1", 6380);
|
||||
private static final RedisServer REPLICA_1 = new RedisServer("127.0.0.1", 6381);
|
||||
|
||||
public JedisSentinelIntegrationTests(@RedisSentinel JedisConnectionFactory connectionFactory) {
|
||||
this.connectionFactory = connectionFactory;
|
||||
@@ -70,15 +70,15 @@ public class JedisSentinelIntegrationTests extends AbstractConnectionIntegration
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-330
|
||||
void shouldReadSlavesOfMastersCorrectly() {
|
||||
void shouldReadReplicaOfMastersCorrectly() {
|
||||
|
||||
RedisSentinelConnection sentinelConnection = connectionFactory.getSentinelConnection();
|
||||
|
||||
List<RedisServer> servers = (List<RedisServer>) sentinelConnection.masters();
|
||||
assertThat(servers).hasSize(1);
|
||||
|
||||
Collection<RedisServer> slaves = sentinelConnection.slaves(servers.get(0));
|
||||
assertThat(slaves).hasSize(2).contains(SLAVE_0, SLAVE_1);
|
||||
Collection<RedisServer> replicas = sentinelConnection.replicas(servers.get(0));
|
||||
assertThat(replicas).hasSize(2).contains(REPLICA_0, REPLICA_1);
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-552
|
||||
|
||||
@@ -287,26 +287,27 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
public void clusterGetMasterSlaveMapShouldListMastersAndSlavesCorrectly() {
|
||||
public void clusterGetMasterReplicaMapShouldListMastersAndReplicasCorrectly() {
|
||||
|
||||
Map<RedisClusterNode, Collection<RedisClusterNode>> masterSlaveMap = clusterConnection.clusterGetMasterSlaveMap();
|
||||
Map<RedisClusterNode, Collection<RedisClusterNode>> masterReplicaMap = clusterConnection
|
||||
.clusterGetMasterReplicaMap();
|
||||
|
||||
assertThat(masterSlaveMap).isNotNull();
|
||||
assertThat(masterSlaveMap).hasSize(3);
|
||||
assertThat(masterSlaveMap.get(new RedisClusterNode(CLUSTER_HOST, MASTER_NODE_1_PORT)))
|
||||
.contains(new RedisClusterNode(CLUSTER_HOST, SLAVEOF_NODE_1_PORT));
|
||||
assertThat(masterSlaveMap.get(new RedisClusterNode(CLUSTER_HOST, MASTER_NODE_2_PORT)).isEmpty()).isTrue();
|
||||
assertThat(masterSlaveMap.get(new RedisClusterNode(CLUSTER_HOST, MASTER_NODE_3_PORT)).isEmpty()).isTrue();
|
||||
assertThat(masterReplicaMap).isNotNull();
|
||||
assertThat(masterReplicaMap).hasSize(3);
|
||||
assertThat(masterReplicaMap.get(new RedisClusterNode(CLUSTER_HOST, MASTER_NODE_1_PORT)))
|
||||
.contains(new RedisClusterNode(CLUSTER_HOST, REPLICAOF_NODE_1_PORT));
|
||||
assertThat(masterReplicaMap.get(new RedisClusterNode(CLUSTER_HOST, MASTER_NODE_2_PORT)).isEmpty()).isTrue();
|
||||
assertThat(masterReplicaMap.get(new RedisClusterNode(CLUSTER_HOST, MASTER_NODE_3_PORT)).isEmpty()).isTrue();
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
public void clusterGetSlavesShouldReturnSlaveCorrectly() {
|
||||
public void clusterGetReplicasShouldReturnReplicaCorrectly() {
|
||||
|
||||
Set<RedisClusterNode> slaves = clusterConnection
|
||||
.clusterGetSlaves(new RedisClusterNode(CLUSTER_HOST, MASTER_NODE_1_PORT));
|
||||
Set<RedisClusterNode> replicas = clusterConnection
|
||||
.clusterGetReplicas(new RedisClusterNode(CLUSTER_HOST, MASTER_NODE_1_PORT));
|
||||
|
||||
assertThat(slaves).hasSize(1);
|
||||
assertThat(slaves).contains(new RedisClusterNode(CLUSTER_HOST, SLAVEOF_NODE_1_PORT));
|
||||
assertThat(replicas).hasSize(1);
|
||||
assertThat(replicas).contains(new RedisClusterNode(CLUSTER_HOST, REPLICAOF_NODE_1_PORT));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -821,7 +822,7 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
|
||||
@Test // DATAREDIS-315, DATAREDIS-661
|
||||
public void getConfigShouldLoadConfigurationOfSpecificNode() {
|
||||
|
||||
Properties result = clusterConnection.getConfig(new RedisClusterNode(CLUSTER_HOST, SLAVEOF_NODE_1_PORT), "*");
|
||||
Properties result = clusterConnection.getConfig(new RedisClusterNode(CLUSTER_HOST, REPLICAOF_NODE_1_PORT), "*");
|
||||
|
||||
assertThat(result.getProperty("slaveof")).endsWith("7379");
|
||||
}
|
||||
|
||||
@@ -426,7 +426,7 @@ class LettuceConnectionFactoryTests {
|
||||
assumeTrue(String.format("No replicas connected to %s:%s.", SettingsUtils.getHost(), SettingsUtils.getPort()),
|
||||
connection.info("replication").getProperty("connected_slaves", "0").compareTo("0") > 0);
|
||||
|
||||
LettuceClientConfiguration configuration = LettuceTestClientConfiguration.builder().readFrom(ReadFrom.SLAVE)
|
||||
LettuceClientConfiguration configuration = LettuceTestClientConfiguration.builder().readFrom(ReadFrom.REPLICA)
|
||||
.clientResources(LettuceTestClientResources.getSharedClientResources()).build();
|
||||
|
||||
RedisStaticMasterReplicaConfiguration elastiCache = new RedisStaticMasterReplicaConfiguration(
|
||||
|
||||
@@ -116,21 +116,21 @@ public class LettuceConnectionUnitTests {
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-277
|
||||
void slaveOfShouldThrowExectpionWhenCalledForNullHost() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.slaveOf(null, 0));
|
||||
void replicaOfShouldThrowExectpionWhenCalledForNullHost() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.replicaOf(null, 0));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-277
|
||||
public void slaveOfShouldBeSentCorrectly() {
|
||||
public void replicaOfShouldBeSentCorrectly() {
|
||||
|
||||
connection.slaveOf("127.0.0.1", 1001);
|
||||
connection.replicaOf("127.0.0.1", 1001);
|
||||
verify(syncCommandsMock, times(1)).slaveof(eq("127.0.0.1"), eq(1001));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-277
|
||||
public void slaveOfNoOneShouldBeSentCorrectly() {
|
||||
public void replicaOfNoOneShouldBeSentCorrectly() {
|
||||
|
||||
connection.slaveOfNoOne();
|
||||
connection.replicaOfNoOne();
|
||||
verify(syncCommandsMock, times(1)).slaveofNoOne();
|
||||
}
|
||||
|
||||
@@ -280,9 +280,9 @@ public class LettuceConnectionUnitTests {
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-528
|
||||
public void slaveOfShouldBeSentCorrectly() {
|
||||
public void replicaOfShouldBeSentCorrectly() {
|
||||
|
||||
connection.slaveOf("127.0.0.1", 1001);
|
||||
connection.replicaOf("127.0.0.1", 1001);
|
||||
verify(asyncCommandsMock, times(1)).slaveof(eq("127.0.0.1"), eq(1001));
|
||||
}
|
||||
|
||||
@@ -302,9 +302,9 @@ public class LettuceConnectionUnitTests {
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-528
|
||||
public void slaveOfNoOneShouldBeSentCorrectly() {
|
||||
public void replicaOfNoOneShouldBeSentCorrectly() {
|
||||
|
||||
connection.slaveOfNoOne();
|
||||
connection.replicaOfNoOne();
|
||||
verify(asyncCommandsMock, times(1)).slaveofNoOne();
|
||||
}
|
||||
|
||||
|
||||
@@ -60,11 +60,11 @@ class LettuceReactiveClusterCommandsIntegrationTests extends LettuceReactiveClus
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-1150
|
||||
void clusterGetSlavesShouldReturnNodes() {
|
||||
void clusterGetReplicasShouldReturnNodes() {
|
||||
|
||||
connection.clusterGetNodes().filter(RedisClusterNode::isMaster)
|
||||
.filter(node -> (node.getPort() == 7379 || node.getPort() == 7382))
|
||||
.flatMap(it -> connection.clusterGetSlaves(it)) //
|
||||
.flatMap(it -> connection.clusterGetReplicas(it)) //
|
||||
.collectList() //
|
||||
.as(StepVerifier::create) //
|
||||
.consumeNextWith(actual -> {
|
||||
@@ -74,9 +74,9 @@ class LettuceReactiveClusterCommandsIntegrationTests extends LettuceReactiveClus
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-1150
|
||||
void clusterGetMasterSlaveMapShouldReportTopology() {
|
||||
void clusterGetMasterReplicaMapShouldReportTopology() {
|
||||
|
||||
connection.clusterGetMasterSlaveMap() //
|
||||
connection.clusterGetMasterReplicaMap() //
|
||||
.as(StepVerifier::create) //
|
||||
.consumeNextWith(actual -> {
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ class LettuceSentinelConnectionUnitTests {
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-348
|
||||
void shouldReadSlavesCorrectly() {
|
||||
void shouldReadReplicasCorrectly() {
|
||||
|
||||
when(sentinelCommandsMock.slaves(MASTER_ID)).thenReturn(Collections.<Map<String, String>> emptyList());
|
||||
connection.slaves(MASTER_ID);
|
||||
@@ -105,26 +105,26 @@ class LettuceSentinelConnectionUnitTests {
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-348
|
||||
void shouldReadSlavesCorrectlyWhenGivenNamedNode() {
|
||||
void shouldReadReplicasCorrectlyWhenGivenNamedNode() {
|
||||
|
||||
when(sentinelCommandsMock.slaves(MASTER_ID)).thenReturn(Collections.<Map<String, String>> emptyList());
|
||||
connection.slaves(new RedisNodeBuilder().withName(MASTER_ID).build());
|
||||
connection.replicas(new RedisNodeBuilder().withName(MASTER_ID).build());
|
||||
verify(sentinelCommandsMock, times(1)).slaves(eq(MASTER_ID));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-348
|
||||
void readSlavesShouldThrowExceptionWhenGivenEmptyMasterName() {
|
||||
void readReplicasShouldThrowExceptionWhenGivenEmptyMasterName() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.slaves(""));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-348
|
||||
void readSlavesShouldThrowExceptionWhenGivenNull() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.slaves((RedisNode) null));
|
||||
void readReplicasShouldThrowExceptionWhenGivenNull() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.replicas((RedisNode) null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-348
|
||||
void readSlavesShouldThrowExceptionWhenNodeWithoutName() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.slaves(new RedisNodeBuilder().build()));
|
||||
void readReplicasShouldThrowExceptionWhenNodeWithoutName() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.replicas(new RedisNodeBuilder().build()));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-348
|
||||
|
||||
@@ -56,8 +56,8 @@ public class LettuceSentinelIntegrationTests extends AbstractConnectionIntegrati
|
||||
private static final RedisServer SENTINEL_0 = new RedisServer("127.0.0.1", 26379);
|
||||
private static final RedisServer SENTINEL_1 = new RedisServer("127.0.0.1", 26380);
|
||||
|
||||
private static final RedisServer SLAVE_0 = new RedisServer("127.0.0.1", 6380);
|
||||
private static final RedisServer SLAVE_1 = new RedisServer("127.0.0.1", 6381);
|
||||
private static final RedisServer REPLICA_0 = new RedisServer("127.0.0.1", 6380);
|
||||
private static final RedisServer REPLICA_1 = new RedisServer("127.0.0.1", 6381);
|
||||
|
||||
private static final RedisSentinelConfiguration SENTINEL_CONFIG;
|
||||
static {
|
||||
@@ -159,15 +159,15 @@ public class LettuceSentinelIntegrationTests extends AbstractConnectionIntegrati
|
||||
|
||||
@Test
|
||||
// DATAREDIS-348
|
||||
void shouldReadSlavesOfMastersCorrectly() {
|
||||
void shouldReadReplicasOfMastersCorrectly() {
|
||||
|
||||
RedisSentinelConnection sentinelConnection = connectionFactory.getSentinelConnection();
|
||||
|
||||
List<RedisServer> servers = (List<RedisServer>) sentinelConnection.masters();
|
||||
assertThat(servers.size()).isEqualTo(1);
|
||||
|
||||
Collection<RedisServer> slaves = sentinelConnection.slaves(servers.get(0));
|
||||
assertThat(slaves).containsAnyOf(SLAVE_0, SLAVE_1);
|
||||
Collection<RedisServer> replicas = sentinelConnection.replicas(servers.get(0));
|
||||
assertThat(replicas).containsAnyOf(REPLICA_0, REPLICA_1);
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-462
|
||||
@@ -228,10 +228,10 @@ public class LettuceSentinelIntegrationTests extends AbstractConnectionIntegrati
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-580
|
||||
void factoryWithReadFromSlaveSettings() {
|
||||
void factoryWithReadFromReplicaSettings() {
|
||||
|
||||
LettuceConnectionFactory factory = new LettuceConnectionFactory(SENTINEL_CONFIG,
|
||||
LettuceTestClientConfiguration.builder().readFrom(ReadFrom.SLAVE).build());
|
||||
LettuceTestClientConfiguration.builder().readFrom(ReadFrom.REPLICA).build());
|
||||
factory.afterPropertiesSet();
|
||||
|
||||
ConnectionFactoryTracker.add(factory);
|
||||
@@ -247,7 +247,7 @@ public class LettuceSentinelIntegrationTests extends AbstractConnectionIntegrati
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-580
|
||||
void factoryUsesMasterSlaveConnections() {
|
||||
void factoryUsesMasterReplicaConnections() {
|
||||
|
||||
LettuceClientConfiguration configuration = LettuceTestClientConfiguration.builder().readFrom(ReadFrom.SLAVE)
|
||||
.build();
|
||||
|
||||
@@ -232,16 +232,16 @@ class DefaultClusterOperationsUnitTests {
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
void getSlavesShouldDelegateToConnection() {
|
||||
void getReplicasShouldDelegateToConnection() {
|
||||
|
||||
clusterOps.getSlaves(NODE_1);
|
||||
clusterOps.getReplicas(NODE_1);
|
||||
|
||||
verify(connection, times(1)).clusterGetSlaves(eq(NODE_1));
|
||||
verify(connection, times(1)).clusterGetReplicas(eq(NODE_1));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
void getSlavesShouldThrowExceptionWhenNodeIsNull() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> clusterOps.getSlaves(null));
|
||||
void getReplicasShouldThrowExceptionWhenNodeIsNull() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> clusterOps.getReplicas(null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
|
||||
@@ -60,17 +60,17 @@ class RedisTemplateUnitTests {
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-277
|
||||
void slaveOfIsDelegatedToConnectionCorrectly() {
|
||||
void replicaOfIsDelegatedToConnectionCorrectly() {
|
||||
|
||||
template.slaveOf("127.0.0.1", 1001);
|
||||
verify(redisConnectionMock, times(1)).slaveOf(eq("127.0.0.1"), eq(1001));
|
||||
template.replicaOf("127.0.0.1", 1001);
|
||||
verify(redisConnectionMock, times(1)).replicaOf(eq("127.0.0.1"), eq(1001));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-277
|
||||
void slaveOfNoOneIsDelegatedToConnectionCorrectly() {
|
||||
void replicaOfNoOneIsDelegatedToConnectionCorrectly() {
|
||||
|
||||
template.slaveOfNoOne();
|
||||
verify(redisConnectionMock, times(1)).slaveOfNoOne();
|
||||
template.replicaOfNoOne();
|
||||
verify(redisConnectionMock, times(1)).replicaOfNoOne();
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-501
|
||||
|
||||
Reference in New Issue
Block a user