use of com.ctrip.xpipe.redis.core.entity.SentinelMeta in project x-pipe by ctripcorp.
the class MetaServiceTest method testSetinelMetaService.
@Test
public void testSetinelMetaService() {
SentinelMeta expect = new SentinelMeta().setId(1L).setAddress("1").setParent(null);
SetinelTbl setinelTbl = new SetinelTbl().setSetinelId(1L).setSetinelAddress("1");
assertEquals(expect, new SentinelMetaServiceImpl().encodeSetinelMeta(setinelTbl, null));
}
use of com.ctrip.xpipe.redis.core.entity.SentinelMeta in project x-pipe by ctripcorp.
the class DefaultXpipeMetaManagerTest method testGetSentinel.
@Test
public void testGetSentinel() {
SentinelMeta sentinelMeta = metaManager.getSentinel(dc, clusterId, shardId);
Assert.assertEquals("127.0.0.1:17171,127.0.0.1:17171", sentinelMeta.getAddress());
}
use of com.ctrip.xpipe.redis.core.entity.SentinelMeta in project x-pipe by ctripcorp.
the class AbstractSentinelMonitorsCheck method doCheck.
@Override
public void doCheck() {
logger.info("[doCheck] check sentinel monitors");
Collection<DcMeta> dcMetas = metaCache.getXpipeMeta().getDcs().values();
for (DcMeta dcMeta : dcMetas) {
Collection<SentinelMeta> sentinelMetas = dcMeta.getSentinels().values();
for (SentinelMeta sentinelMeta : sentinelMetas) {
List<HostPort> sentinels = IpUtils.parseAsHostPorts(sentinelMeta.getAddress());
for (HostPort hostPort : sentinels) {
checkSentinel(sentinelMeta, hostPort);
}
}
}
}
use of com.ctrip.xpipe.redis.core.entity.SentinelMeta in project x-pipe by ctripcorp.
the class SentinelMetaServiceImpl method encodeSetinelMeta.
@Override
public SentinelMeta encodeSetinelMeta(SetinelTbl sentinel, DcMeta dcMeta) {
SentinelMeta sentinelMeta = new SentinelMeta();
if (null != sentinel) {
sentinelMeta.setId(sentinel.getSetinelId());
sentinelMeta.setAddress(sentinel.getSetinelAddress());
sentinelMeta.setParent(dcMeta);
}
return sentinelMeta;
}
use of com.ctrip.xpipe.redis.core.entity.SentinelMeta in project x-pipe by ctripcorp.
the class DefaultSentinelManagerTest method beforeDefaultSentinelManagerTest.
@Before
public void beforeDefaultSentinelManagerTest() throws Exception {
sentinelManager = new DefaultSentinelManager(dcMetaCache, getXpipeNettyClientKeyedObjectPool());
executionLog = new ExecutionLog(currentTestName());
redisMaster = new RedisMeta().setIp("127.0.0.1").setPort(port);
when(dcMetaCache.getSentinelMonitorName(getClusterId(), getShardId())).thenReturn(sentinelMonitorName);
when(dcMetaCache.getSentinel(getClusterId(), getShardId())).thenReturn(new SentinelMeta().setAddress(allSentinels));
}
Aggregations