Search in sources :

Example 11 with RetMessage

use of com.ctrip.xpipe.redis.console.controller.api.RetMessage in project x-pipe by ctripcorp.

the class MetaUpdateTest3 method createShard6.

@Test
public void createShard6() throws Exception {
    int taskNum = 3;
    ThreadPoolExecutor executorService = new ThreadPoolExecutor(taskNum, taskNum, 1L, TimeUnit.SECONDS, new SynchronousQueue<>());
    executorService.prestartAllCoreThreads();
    executorService.allowsCoreThreadTimeOut();
    for (int i = 0; i < taskNum; i++) {
        executorService.execute(new Runnable() {

            @Override
            public void run() {
                ShardCreateInfo shardCreateInfo = new ShardCreateInfo();
                shardCreateInfo.setShardMonitorName(shardName);
                shardCreateInfo.setShardName(shardName);
                RetMessage result = metaUpdate.createShards(clusterName, Lists.newArrayList(shardCreateInfo));
                logger.info("{}", result);
            }
        });
    }
    waitConditionUntilTimeOut(() -> executorService.getCompletedTaskCount() == taskNum, 2000);
    System.out.println("=========================");
    List<ShardTbl> shards = shardService.findAllByClusterName(clusterName);
    logger.info("{}", shards);
    Assert.assertEquals(1, shards.size());
}
Also used : ShardTbl(com.ctrip.xpipe.redis.console.model.ShardTbl) ShardCreateInfo(com.ctrip.xpipe.redis.console.controller.api.data.meta.ShardCreateInfo) RetMessage(com.ctrip.xpipe.redis.console.controller.api.RetMessage) AbstractConsoleIntegrationTest(com.ctrip.xpipe.redis.console.AbstractConsoleIntegrationTest) Test(org.junit.Test)

Example 12 with RetMessage

use of com.ctrip.xpipe.redis.console.controller.api.RetMessage in project x-pipe by ctripcorp.

the class SentinelUpdateControllerTest method reBalanceSentinels1.

@Test
public void reBalanceSentinels1() throws Exception {
    RetMessage message = RetMessage.createSuccessMessage("clusters: " + JSON.toJSONString(Collections.emptyList()));
    Assert.assertEquals(message.getMessage(), controller.reBalanceSentinels(null).getMessage());
}
Also used : RetMessage(com.ctrip.xpipe.redis.console.controller.api.RetMessage) Test(org.junit.Test)

Example 13 with RetMessage

use of com.ctrip.xpipe.redis.console.controller.api.RetMessage in project x-pipe by ctripcorp.

the class SentinelUpdateControllerTest method testReBalanceSentinels.

@Test
public void testReBalanceSentinels() throws Exception {
    RetMessage message = RetMessage.createSuccessMessage("clusters: " + JSON.toJSONString(Arrays.asList(clusters)));
    Assert.assertEquals(message.getMessage(), controller.reBalanceSentinels(3).getMessage());
}
Also used : RetMessage(com.ctrip.xpipe.redis.console.controller.api.RetMessage) Test(org.junit.Test)

Aggregations

RetMessage (com.ctrip.xpipe.redis.console.controller.api.RetMessage)13 Test (org.junit.Test)13 AbstractConsoleIntegrationTest (com.ctrip.xpipe.redis.console.AbstractConsoleIntegrationTest)10 ClusterCreateInfo (com.ctrip.xpipe.redis.console.controller.api.data.meta.ClusterCreateInfo)4 ShardCreateInfo (com.ctrip.xpipe.redis.console.controller.api.data.meta.ShardCreateInfo)4 RedisCreateInfo (com.ctrip.xpipe.redis.console.controller.api.data.meta.RedisCreateInfo)3 ClusterTbl (com.ctrip.xpipe.redis.console.model.ClusterTbl)3 ConfigModel (com.ctrip.xpipe.redis.console.model.ConfigModel)2 ShardTbl (com.ctrip.xpipe.redis.console.model.ShardTbl)1 Matchers.anyString (org.mockito.Matchers.anyString)1