use of com.ctrip.xpipe.redis.core.meta.ShardStatus in project x-pipe by ctripcorp.
the class RedisKeeperServerStateBackupTest method beforeRedisKeeperServerStateTest.
@Before
public void beforeRedisKeeperServerStateTest() throws Exception {
activeKeeperMeta = createKeeperMeta();
activeKeeperMeta.setPort(redisKeeperServer.getCurrentKeeperMeta().getPort() + 1);
ShardStatus shardStatus = createShardStatus(activeKeeperMeta, null, redisMasterMeta);
backup = new RedisKeeperServerStateBackup(redisKeeperServer);
backup.setShardStatus(shardStatus);
}
use of com.ctrip.xpipe.redis.core.meta.ShardStatus in project x-pipe by ctripcorp.
the class RedisKeeperServerStateActiveTest method beforeRedisKeeperServerStateTest.
@Before
public void beforeRedisKeeperServerStateTest() throws Exception {
ShardStatus shardStatus = createShardStatus(redisKeeperServer.getCurrentKeeperMeta(), null, redisMasterMeta);
active = new RedisKeeperServerStateActive(redisKeeperServer);
active.setShardStatus(shardStatus);
}
use of com.ctrip.xpipe.redis.core.meta.ShardStatus in project x-pipe by ctripcorp.
the class RedisKeeperServerStateUnknownTest method testActive.
@Test
public void testActive() throws IOException {
// active
KeeperMeta keeperMeta = redisKeeperServer.getCurrentKeeperMeta();
ShardStatus shardStatus = createShardStatus(keeperMeta, null, redisMasterMeta);
unknown.setShardStatus(shardStatus);
RedisKeeperServerState newState = redisKeeperServer.getRedisKeeperServerState();
Assert.assertTrue(newState instanceof RedisKeeperServerStateActive);
Assert.assertEquals(new InetSocketAddress(redisMasterMeta.getIp(), redisMasterMeta.getPort()), newState.getMaster().getSocketAddress());
}
use of com.ctrip.xpipe.redis.core.meta.ShardStatus in project x-pipe by ctripcorp.
the class RedisKeeperServerStateUnknownTest method testBackup.
@Test
public void testBackup() throws IOException {
// active
KeeperMeta keeperMeta = SerializationUtils.clone(redisKeeperServer.getCurrentKeeperMeta());
keeperMeta.setPort(keeperMeta.getPort() + 1);
ShardStatus shardStatus = createShardStatus(keeperMeta, null, redisMasterMeta);
unknown.setShardStatus(shardStatus);
RedisKeeperServerState newState = redisKeeperServer.getRedisKeeperServerState();
Assert.assertTrue(newState instanceof RedisKeeperServerStateBackup);
Assert.assertEquals(new InetSocketAddress(keeperMeta.getIp(), keeperMeta.getPort()), newState.getMaster().getSocketAddress());
}
use of com.ctrip.xpipe.redis.core.meta.ShardStatus in project x-pipe by ctripcorp.
the class RedisKeeperServerStateActiveTest method getMaster.
@Test
public void getMaster() throws IOException, SAXException {
Assert.assertEquals(new InetSocketAddress(redisMasterMeta.getIp(), redisMasterMeta.getPort()), active.getMaster().getSocketAddress());
KeeperMeta upstreamKeeper = createKeeperMeta();
upstreamKeeper.setPort(redisMasterMeta.getPort() + 1);
ShardStatus newStatus = createShardStatus(redisKeeperServer.getCurrentKeeperMeta(), upstreamKeeper, null);
active.setShardStatus(newStatus);
Assert.assertEquals(new InetSocketAddress(upstreamKeeper.getIp(), upstreamKeeper.getPort()), active.getMaster().getSocketAddress());
}
Aggregations