Search in sources :

Example 6 with SetinelTbl

use of com.ctrip.xpipe.redis.console.model.SetinelTbl in project x-pipe by ctripcorp.

the class SetinelServiceTest method testMetasService.

@Test
public void testMetasService() {
    SetinelTbl target_setinel = new SetinelTbl().setSetinelId(1).setSetinelAddress("11111");
    assertEquals(setinelService.findAllByDcName("NTGXH").get(0).getSetinelAddress(), target_setinel.getSetinelAddress());
}
Also used : SetinelTbl(com.ctrip.xpipe.redis.console.model.SetinelTbl) Test(org.junit.Test) AbstractConsoleTest(com.ctrip.xpipe.redis.console.AbstractConsoleTest)

Example 7 with SetinelTbl

use of com.ctrip.xpipe.redis.console.model.SetinelTbl in project x-pipe by ctripcorp.

the class SentinelServiceImplTest method testRandom.

@Test
public void testRandom() {
    int testCount = 1 << 20;
    Set<Long> all = new HashSet<>();
    for (int i = 0; i < testCount; i++) {
        SetinelTbl random = sentinelService.random(sentinels);
        all.add(random.getSetinelId());
    }
    Assert.assertEquals(sentinels.size(), all.size());
}
Also used : SetinelTbl(com.ctrip.xpipe.redis.console.model.SetinelTbl) Test(org.junit.Test)

Aggregations

SetinelTbl (com.ctrip.xpipe.redis.console.model.SetinelTbl)7 Test (org.junit.Test)4 HostPort (com.ctrip.xpipe.endpoint.HostPort)2 ShardTbl (com.ctrip.xpipe.redis.console.model.ShardTbl)2 ShardDeleteEvent (com.ctrip.xpipe.redis.console.notifier.shard.ShardDeleteEvent)2 AbstractConsoleTest (com.ctrip.xpipe.redis.console.AbstractConsoleTest)1 DcTbl (com.ctrip.xpipe.redis.console.model.DcTbl)1 SentinelModel (com.ctrip.xpipe.redis.console.model.SentinelModel)1 ShardEvent (com.ctrip.xpipe.redis.console.notifier.shard.ShardEvent)1 VisibleForTesting (com.ctrip.xpipe.utils.VisibleForTesting)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1