Search in sources :

Example 1 with MetaServerConsoleService

use of com.ctrip.xpipe.redis.core.metaserver.MetaServerConsoleService in project x-pipe by ctripcorp.

the class ClusterServersApiTest method testChangePrimaryDcCheck.

@Test
public void testChangePrimaryDcCheck() throws Exception {
    createMetaServers(metaServerCount);
    sleep(waitForMetaServerOkTime);
    logger.info(remarkableMessage("[testChangePrimaryDcCheck][begin send primary dc check message]"));
    for (TestMetaServer server : getServers()) {
        logger.info("[testChangePrimaryDcCheck]{}", server.getAddress());
        MetaServerConsoleService consoleService = new DefaultMetaServerConsoleService(server.getAddress());
        PrimaryDcCheckMessage message = consoleService.changePrimaryDcCheck(getClusterId(), getShardId(), "newPrimaryDc");
        logger.info("[testChangePrimaryDcCheck]{}, {}", server.getAddress(), message);
    }
}
Also used : TestMetaServer(com.ctrip.xpipe.redis.meta.server.TestMetaServer) PrimaryDcCheckMessage(com.ctrip.xpipe.redis.core.metaserver.MetaServerConsoleService.PrimaryDcCheckMessage) MetaServerConsoleService(com.ctrip.xpipe.redis.core.metaserver.MetaServerConsoleService) DefaultMetaServerConsoleService(com.ctrip.xpipe.redis.core.metaserver.impl.DefaultMetaServerConsoleService) DefaultMetaServerConsoleService(com.ctrip.xpipe.redis.core.metaserver.impl.DefaultMetaServerConsoleService) Test(org.junit.Test)

Example 2 with MetaServerConsoleService

use of com.ctrip.xpipe.redis.core.metaserver.MetaServerConsoleService in project x-pipe by ctripcorp.

the class DefaultMetaServerConsoleServiceTest method test.

@Test
public void test() {
    MetaServerConsoleService consoleService = new DefaultMetaServerConsoleService("http://localhost:9747");
    consoleService.doChangePrimaryDc("cluster1", "shard-0", "oy", null);
}
Also used : MetaServerConsoleService(com.ctrip.xpipe.redis.core.metaserver.MetaServerConsoleService) AbstractRedisTest(com.ctrip.xpipe.redis.core.AbstractRedisTest) Test(org.junit.Test)

Example 3 with MetaServerConsoleService

use of com.ctrip.xpipe.redis.core.metaserver.MetaServerConsoleService in project x-pipe by ctripcorp.

the class ClusterServersApiTest method testMakeMasterReadOnly.

@Test
public void testMakeMasterReadOnly() throws Exception {
    createMetaServers(metaServerCount);
    sleep(waitForMetaServerOkTime);
    logger.info(remarkableMessage("[testMakeMasterReadOnly][begin send make master read only message]"));
    for (TestMetaServer server : getServers()) {
        logger.info("[testChangePrimaryDcCheck]{}", server.getAddress());
        MetaServerConsoleService consoleService = new DefaultMetaServerConsoleService(server.getAddress());
        MetaServerConsoleService.PreviousPrimaryDcMessage message = consoleService.makeMasterReadOnly(getClusterId(), getShardId(), true);
        logger.info("[testMakeMasterReadOnly][true]{}", message);
        message = consoleService.makeMasterReadOnly(getClusterId(), getShardId(), false);
        logger.info("[testMakeMasterReadOnly][false]{}", message);
    }
}
Also used : TestMetaServer(com.ctrip.xpipe.redis.meta.server.TestMetaServer) MetaServerConsoleService(com.ctrip.xpipe.redis.core.metaserver.MetaServerConsoleService) DefaultMetaServerConsoleService(com.ctrip.xpipe.redis.core.metaserver.impl.DefaultMetaServerConsoleService) DefaultMetaServerConsoleService(com.ctrip.xpipe.redis.core.metaserver.impl.DefaultMetaServerConsoleService) Test(org.junit.Test)

Example 4 with MetaServerConsoleService

use of com.ctrip.xpipe.redis.core.metaserver.MetaServerConsoleService in project x-pipe by ctripcorp.

the class ClusterServersApiTest method testDoChangePrimaryDc.

@Test
public void testDoChangePrimaryDc() throws Exception {
    createMetaServers(metaServerCount);
    sleep(waitForMetaServerOkTime);
    logger.info(remarkableMessage("[testDoChangePrimaryDc][begin send change primary dc message]"));
    for (TestMetaServer server : getServers()) {
        logger.info(remarkableMessage("[testDoChangePrimaryDc][jq]"));
        MetaServerConsoleService.PrimaryDcChangeRequest request = new MetaServerConsoleService.PrimaryDcChangeRequest();
        request.setMasterInfo(new MasterInfo(RunidGenerator.DEFAULT.generateRunid(), 100L));
        MetaServerConsoleService consoleService = new DefaultMetaServerConsoleService(server.getAddress());
        PrimaryDcChangeMessage message = consoleService.doChangePrimaryDc(getClusterId(), getShardId(), "jq", request);
        logger.info("{}", message);
        logger.info(remarkableMessage("[testDoChangePrimaryDc][oy]"));
        message = consoleService.doChangePrimaryDc(getClusterId(), getShardId(), "oy", request);
        logger.info("{}", message);
    }
}
Also used : MasterInfo(com.ctrip.xpipe.redis.core.protocal.pojo.MasterInfo) TestMetaServer(com.ctrip.xpipe.redis.meta.server.TestMetaServer) MetaServerConsoleService(com.ctrip.xpipe.redis.core.metaserver.MetaServerConsoleService) DefaultMetaServerConsoleService(com.ctrip.xpipe.redis.core.metaserver.impl.DefaultMetaServerConsoleService) DefaultMetaServerConsoleService(com.ctrip.xpipe.redis.core.metaserver.impl.DefaultMetaServerConsoleService) PrimaryDcChangeMessage(com.ctrip.xpipe.redis.core.metaserver.MetaServerConsoleService.PrimaryDcChangeMessage) Test(org.junit.Test)

Aggregations

MetaServerConsoleService (com.ctrip.xpipe.redis.core.metaserver.MetaServerConsoleService)4 Test (org.junit.Test)4 DefaultMetaServerConsoleService (com.ctrip.xpipe.redis.core.metaserver.impl.DefaultMetaServerConsoleService)3 TestMetaServer (com.ctrip.xpipe.redis.meta.server.TestMetaServer)3 AbstractRedisTest (com.ctrip.xpipe.redis.core.AbstractRedisTest)1 PrimaryDcChangeMessage (com.ctrip.xpipe.redis.core.metaserver.MetaServerConsoleService.PrimaryDcChangeMessage)1 PrimaryDcCheckMessage (com.ctrip.xpipe.redis.core.metaserver.MetaServerConsoleService.PrimaryDcCheckMessage)1 MasterInfo (com.ctrip.xpipe.redis.core.protocal.pojo.MasterInfo)1