use of com.ctrip.xpipe.endpoint.HostPort in project x-pipe by ctripcorp.
the class DefaultSentinelMonitorsCheckTest method checkSentinel2.
@Test
public void checkSentinel2() throws Exception {
when(metaCache.findClusterShardBySentinelMonitor(any())).thenReturn(new Pair<>("cluster", "shard"));
checker.checkSentinel(new SentinelMeta().setAddress("127.0.0.1:5000,127.0.0.1:5001,127.0.0.1:5002"), new HostPort("127.0.0.1", 5000));
verify(alertManager, never()).alert(eq(null), eq(null), eq(null), eq(ALERT_TYPE.SENTINEL_MONITOR_INCONSIS), anyString());
verify(sentinelManager, never()).removeSentinelMonitor(any(), any());
}
use of com.ctrip.xpipe.endpoint.HostPort in project x-pipe by ctripcorp.
the class DefaultShardMigrationResultTest method testEncodeDecode.
@Test
public void testEncodeDecode() {
DefaultShardMigrationResult result = new DefaultShardMigrationResult();
for (ShardMigrationStep step : ShardMigrationStep.values()) {
result.updateStepResult(step, true, randomString(10));
}
result.setNewMaster(new HostPort("127.0.0.1", randomPort()));
String encode = result.encode();
ShardMigrationResult decode = DefaultShardMigrationResult.fromEncodeStr(encode);
logger.info("{}", decode);
Assert.assertEquals(result, decode);
}
use of com.ctrip.xpipe.endpoint.HostPort in project x-pipe by ctripcorp.
the class DefaultDelayServiceTest method testPingService.
@Test
@DirtiesContext
public void testPingService() throws IOException {
Executors.newScheduledThreadPool(1).scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
System.out.println(delayService.getDelay(new HostPort("127.0.0.1", 6379)));
System.out.println(delayService.getDelay(new HostPort("127.0.0.1", 6389)));
System.out.println(delayService.getDelay(new HostPort("127.0.0.1", 6369)));
System.out.println(delayService.getDelay(new HostPort("127.0.0.1", 6359)));
}
}, 0, 2, TimeUnit.SECONDS);
waitForAnyKeyToExit();
}
use of com.ctrip.xpipe.endpoint.HostPort in project x-pipe by ctripcorp.
the class AbstractMigrationPublishState method getNewMasters.
public List<InetSocketAddress> getNewMasters() {
List<InetSocketAddress> result = new LinkedList<>();
for (MigrationShard migrationShard : getHolder().getMigrationShards()) {
HostPort newMasterAddress = migrationShard.getNewMasterAddress();
if (newMasterAddress == null) {
// may force publish
logger.warn("[getNewMasters][null master]{}", migrationShard.shardName());
continue;
}
result.add(InetSocketAddress.createUnresolved(newMasterAddress.getHost(), newMasterAddress.getPort()));
}
return result;
}
use of com.ctrip.xpipe.endpoint.HostPort in project x-pipe by ctripcorp.
the class AllKeyMode method test.
@Override
public void test() throws Exception {
if (slaves.size() > 1) {
throw new IllegalStateException("all key mode support only one slave!!!");
}
HostPort slave = slaves.get(0);
if (startValueCheck) {
logger.info("[test][addValueCheck]");
JedisPool slavePool = getJedisPool(slave.getHost(), slave.getPort(), valueCheckThreadNum * 2, valueCheckThreadNum);
valueCheck = new DefaultValueCheck(valueCheckThreadNum, slavePool, metricLog);
} else {
logger.info("[test][NullValueCheck]");
valueCheck = new NullValueCheck();
}
valueCheck.start();
super.test();
}
Aggregations