use of com.ctrip.xpipe.codec.JsonCodec in project x-pipe by ctripcorp.
the class SentinelUpdateControllerTest method testJsonShow.
@Test
public void testJsonShow() {
SentinelUsageModel usageModel1 = new SentinelUsageModel("SHAJQ", 2).addSentinelUsage("127.0.0.1:6379,127.0.0.1:6380", 100).addSentinelUsage("192.168.0.1:6379,192.168.0.1:6380", 200);
SentinelUsageModel usageModel2 = new SentinelUsageModel("SHAOY", 2).addSentinelUsage("127.0.0.2:6381,127.0.0.1:6382", 150).addSentinelUsage("192.168.0.2:6381,192.168.0.1:6382", 150);
Map<String, SentinelUsageModel> map = Maps.newHashMapWithExpectedSize(2);
map.put("SHAJQ", usageModel1);
map.put("SHAOY", usageModel2);
JsonCodec jsonTool = new JsonCodec(true, true);
System.out.println(jsonTool.encode(map));
}
use of com.ctrip.xpipe.codec.JsonCodec in project x-pipe by ctripcorp.
the class DcMetaTest method test.
@Test
public void test() {
DcMeta dcMeta = getDcMeta("jq");
Codec codec = new JsonCodec(true);
String dcMetaStr = codec.encode(dcMeta);
logger.info("{}", dcMetaStr);
DcMeta dcMetaDe = codec.decode(dcMetaStr, DcMeta.class);
logger.info("[test]{}", dcMeta.getClusters().get("cluster1").parent());
logger.info("[test]{}", dcMetaDe.getClusters().get("cluster1").parent());
}
use of com.ctrip.xpipe.codec.JsonCodec in project x-pipe by ctripcorp.
the class DcMetaTest method testKeeper.
@Test
public void testKeeper() {
KeeperMeta keeperMeta = new KeeperMeta().setIp("127.0.0.1").setPort(6379);
Codec codec = new JsonCodec(true);
String keeperMetaDesc = codec.encode(keeperMeta);
logger.info("{}", keeperMetaDesc);
KeeperMeta keeperMetaDec = codec.decode(keeperMetaDesc, KeeperMeta.class);
logger.info("{}", keeperMetaDec);
}
use of com.ctrip.xpipe.codec.JsonCodec in project x-pipe by ctripcorp.
the class CRedisServiceTest method testGetClusterInfo.
@Test
public void testGetClusterInfo() throws Exception {
JsonCodec jsonCodec = new JsonCodec(true);
logger.info("{}", outerClientService.getClusterInfo("Members.OfflineLogin"));
logger.info("{}", jsonCodec.encode(outerClientService.getClusterInfo("cluster_shyin")));
logger.info("{}", outerClientService.getClusterInfo("Members.OfflineLogin"));
logger.info("{}", jsonCodec.encode(outerClientService.getClusterInfo("cluster_shyin_1")));
}
use of com.ctrip.xpipe.codec.JsonCodec in project x-pipe by ctripcorp.
the class DefaultCurrentMetaManager method getCurrentMetaDesc.
@Override
public String getCurrentMetaDesc() {
Map<String, Object> desc = new HashMap<>();
desc.put("meta", currentMeta);
desc.put("currentSlots", currentSlots);
JsonCodec codec = new JsonCodec(true, true);
return codec.encode(desc);
}
Aggregations