Search in sources :

Example 1 with SentinelModel

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

the class SentinelUpdateControllerTest method testConvert2SentinelTbl.

@Test
public void testConvert2SentinelTbl() throws Exception {
    when(dcService.find(anyString())).thenReturn(new DcTbl().setId(1));
    SentinelModel sentinelModel = new SentinelModel().setDcName("JQ").setDesc("test").setSentinels(Arrays.asList(new HostPort("127.0.0.1", 6379), new HostPort("127.0.0.1", 6380), new HostPort("127.0.0.1", 6381)));
    SetinelTbl setinelTbl = controller.convert2SentinelTbl(sentinelModel);
    Assert.assertEquals(1, setinelTbl.getDcId());
    Assert.assertEquals("test", setinelTbl.getSetinelDescription());
    Assert.assertEquals("127.0.0.1:6379,127.0.0.1:6380,127.0.0.1:6381", setinelTbl.getSetinelAddress());
}
Also used : DcTbl(com.ctrip.xpipe.redis.console.model.DcTbl) SentinelModel(com.ctrip.xpipe.redis.console.model.SentinelModel) HostPort(com.ctrip.xpipe.endpoint.HostPort) SetinelTbl(com.ctrip.xpipe.redis.console.model.SetinelTbl) Test(org.junit.Test)

Aggregations

HostPort (com.ctrip.xpipe.endpoint.HostPort)1 DcTbl (com.ctrip.xpipe.redis.console.model.DcTbl)1 SentinelModel (com.ctrip.xpipe.redis.console.model.SentinelModel)1 SetinelTbl (com.ctrip.xpipe.redis.console.model.SetinelTbl)1 Test (org.junit.Test)1