Search in sources :

Example 11 with TestMetaServer

use of com.ctrip.xpipe.redis.meta.server.TestMetaServer in project x-pipe by ctripcorp.

the class ClusterServersApiTest method testUpdateUpstream.

@Test
public void testUpdateUpstream() throws Exception {
    createMetaServers(metaServerCount);
    sleep(waitForMetaServerOkTime);
    logger.info(remarkableMessage("[testUpdateUpstream][begin send upstream update message]"));
    for (TestMetaServer server : getServers()) {
        String path = META_SERVER_SERVICE.UPSTREAM_CHANGE.getRealPath(server.getAddress());
        logger.info("[testClusterChanged]{}", path);
        restTemplate.put(path, null, "cluster1", "shard1", "localhost", 7777);
    }
}
Also used : TestMetaServer(com.ctrip.xpipe.redis.meta.server.TestMetaServer) Test(org.junit.Test)

Example 12 with TestMetaServer

use of com.ctrip.xpipe.redis.meta.server.TestMetaServer in project x-pipe by ctripcorp.

the class ManualTest method testMetaServerGc.

@Test
public void testMetaServerGc() throws Exception {
    for (int i = 0; i < 10000; i++) {
        try {
            TestMetaServer server = createMetaServer(i, 9747, getZkPort());
            server.stop();
            server.dispose();
        } catch (Exception e) {
            logger.error("[testMetaServer]", e);
        }
    }
}
Also used : TestMetaServer(com.ctrip.xpipe.redis.meta.server.TestMetaServer) AbstractMetaServerClusterTest(com.ctrip.xpipe.redis.meta.server.cluster.AbstractMetaServerClusterTest) Test(org.junit.Test)

Example 13 with TestMetaServer

use of com.ctrip.xpipe.redis.meta.server.TestMetaServer in project x-pipe by ctripcorp.

the class ClusterServerShardingTest method simpleTest.

@Test
public void simpleTest() throws Exception {
    createMetaServers(1);
    sleep(sleepForBalance);
    TestMetaServer server = getLeader();
    server.stop();
}
Also used : TestMetaServer(com.ctrip.xpipe.redis.meta.server.TestMetaServer) Test(org.junit.Test)

Example 14 with TestMetaServer

use of com.ctrip.xpipe.redis.meta.server.TestMetaServer in project x-pipe by ctripcorp.

the class ClusterServerShardingTest method testShutdownLeader.

@Test
public void testShutdownLeader() throws Exception {
    createMetaServers(serverCount);
    sleep(sleepForBalance);
    TestMetaServer leader = null;
    for (TestMetaServer server : getServers()) {
        if (server.isLeader()) {
            logger.info(remarkableMessage("[testShutdownLeader][begin]{}"), server);
            leader = server;
            server.stop();
            logger.info(remarkableMessage("[testShutdownLeader][ end ]{}"), server);
            break;
        }
    }
    sleep(TestMetaServer.getZksessiontimeoutmillis() + 1000);
    TestMetaServer newLeader = getLeader();
    logger.info("[testShutdownLeader][new leader]{}", newLeader);
    Assert.assertNotEquals(leader, newLeader);
    SlotManager slotManager = newLeader.getContext().getBean(SlotManager.class);
    slotManager.refresh();
    Assert.assertEquals(serverCount - 1, slotManager.allServers().size());
    AssertBalance(slotManager);
}
Also used : TestMetaServer(com.ctrip.xpipe.redis.meta.server.TestMetaServer) Test(org.junit.Test)

Aggregations

TestMetaServer (com.ctrip.xpipe.redis.meta.server.TestMetaServer)14 Test (org.junit.Test)11 MetaServerConsoleService (com.ctrip.xpipe.redis.core.metaserver.MetaServerConsoleService)3 DefaultMetaServerConsoleService (com.ctrip.xpipe.redis.core.metaserver.impl.DefaultMetaServerConsoleService)3 ClusterMeta (com.ctrip.xpipe.redis.core.entity.ClusterMeta)1 KeeperMeta (com.ctrip.xpipe.redis.core.entity.KeeperMeta)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 DcInfo (com.ctrip.xpipe.redis.integratedtest.DcInfo)1 AbstractMetaServerClusterTest (com.ctrip.xpipe.redis.meta.server.cluster.AbstractMetaServerClusterTest)1 ApplicationContext (org.springframework.context.ApplicationContext)1