Search in sources :

Example 6 with Role

use of com.ctrip.xpipe.redis.core.protocal.pojo.Role in project x-pipe by ctripcorp.

the class RoleCommandTest method test.

@Test
public void test() throws Exception {
    SlaveRole role = new SlaveRole(SERVER_ROLE.KEEPER, "localhost", randomPort(), MASTER_STATE.REDIS_REPL_CONNECT, 0L);
    Server server = startServer(ByteBufUtils.readToString(role.format()));
    RoleCommand roleCommand = new RoleCommand("localhost", server.getPort(), scheduled);
    Role real = roleCommand.execute().get();
    logger.info("[test]{}", real);
    Assert.assertEquals(role, real);
}
Also used : SlaveRole(com.ctrip.xpipe.redis.core.protocal.pojo.SlaveRole) Role(com.ctrip.xpipe.redis.core.protocal.pojo.Role) SlaveRole(com.ctrip.xpipe.redis.core.protocal.pojo.SlaveRole) Server(com.ctrip.xpipe.simpleserver.Server) AbstractRedisTest(com.ctrip.xpipe.redis.core.AbstractRedisTest) Test(org.junit.Test)

Aggregations

Role (com.ctrip.xpipe.redis.core.protocal.pojo.Role)6 RoleCommand (com.ctrip.xpipe.redis.core.protocal.cmd.RoleCommand)4 SlaveRole (com.ctrip.xpipe.redis.core.protocal.pojo.SlaveRole)4 Server (com.ctrip.xpipe.simpleserver.Server)3 InetSocketAddress (java.net.InetSocketAddress)3 NettyClient (com.ctrip.xpipe.netty.commands.NettyClient)2 Test (org.junit.Test)2 AbstractRedisTest (com.ctrip.xpipe.redis.core.AbstractRedisTest)1 RedisMeta (com.ctrip.xpipe.redis.core.entity.RedisMeta)1 MasterRole (com.ctrip.xpipe.redis.core.protocal.pojo.MasterRole)1 LinkedList (java.util.LinkedList)1 ExecutionException (java.util.concurrent.ExecutionException)1 TimeoutException (java.util.concurrent.TimeoutException)1