DefaultMetaServerConsoleService extends AbstractMetaService implements MetaServerConsoleService { @Override public PrimaryDcChangeMessage doChangePrimaryDc(String clusterId, String shardId, String newPrimaryDc, PrimaryDcChangeRequest request) { HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_UTF8_VALUE); HttpEntity<Object> entity = new HttpEntity<Object>(request, httpHeaders); return restTemplate.exchange(changePrimaryDcPath, HttpMethod.PUT, entity, PrimaryDcChangeMessage.class, clusterId, shardId, newPrimaryDc).getBody(); } protected  DefaultMetaServerConsoleService(String metaServerAddress, int retryTimes, int retryIntervalMilli, int connectTimeout, int soTimout);  DefaultMetaServerConsoleService(String metaServerAddress); @Override void clusterAdded(String clusterId, ClusterMeta clusterMeta); @Override void clusterModified(String clusterId, ClusterMeta clusterMeta); @Override void clusterDeleted(String clusterId); @Override DcMeta getDynamicInfo(); @Override PrimaryDcCheckMessage changePrimaryDcCheck(String clusterId, String shardId, String newPrimaryDc); @Override PreviousPrimaryDcMessage makeMasterReadOnly(String clusterId, String shardId, boolean readOnly); @Override PrimaryDcChangeMessage doChangePrimaryDc(String clusterId, String shardId, String newPrimaryDc, PrimaryDcChangeRequest request); @Override RedisMeta getCurrentMaster(String clusterId, String shardId);  }
@Test public void test(){ try { logger.info("[begin]"); MetaServerConsoleService consoleService = new DefaultMetaServerConsoleService("http: consoleService.doChangePrimaryDc("cluster1", "shard-0", "oy", null); }catch (Exception e){ logger.error("[Exception]", e); } }
@Test public void testTimeout(){ try { logger.info("[begin]"); MetaServerConsoleService consoleService = new DefaultMetaServerConsoleService("http: consoleService.doChangePrimaryDc("cluster1", "shard-0", "oy", null); }catch (Exception e){ logger.error("[Exception]", e); } }