use of org.apache.servicecomb.serviceregistry.api.registry.ServiceCenterInfo in project incubator-servicecomb-java-chassis by apache.
the class LocalServiceRegistryClientImpl method getServiceCenterInfo.
@Override
public ServiceCenterInfo getServiceCenterInfo() {
ServiceCenterInfo info = new ServiceCenterInfo();
info.setVersion("1.0.0");
info.setBuildTag("20180312");
info.setRunMode("dev");
info.setApiVersion("4.0.0");
info.setConfig(new ServiceCenterConfig());
return info;
}
use of org.apache.servicecomb.serviceregistry.api.registry.ServiceCenterInfo in project java-chassis by ServiceComb.
the class TestServiceRegistryClientImpl method testGetServiceCenterInfoSuccess.
@Test
public void testGetServiceCenterInfoSuccess() {
ServiceCenterInfo serviceCenterInfo = new ServiceCenterInfo();
serviceCenterInfo.setVersion("x.x.x");
serviceCenterInfo.setBuildTag("xxx");
serviceCenterInfo.setRunMode("dev");
serviceCenterInfo.setApiVersion("x.x.x");
serviceCenterInfo.setConfig(new ServiceCenterConfig());
new MockUp<RestClientUtil>() {
@Mock
void httpDo(RequestContext requestContext, Handler<RestResponse> responseHandler) {
Holder<ServiceCenterInfo> holder = Deencapsulation.getField(responseHandler, "arg$4");
holder.value = serviceCenterInfo;
}
};
ServiceCenterInfo info = oClient.getServiceCenterInfo();
Assert.assertEquals("x.x.x", info.getVersion());
Assert.assertEquals("xxx", info.getBuildTag());
Assert.assertEquals("dev", info.getRunMode());
Assert.assertNotNull(info.getConfig());
}
use of org.apache.servicecomb.serviceregistry.api.registry.ServiceCenterInfo in project java-chassis by ServiceComb.
the class ServiceCenterDeploy method ensureReady.
public void ensureReady() throws Throwable {
// {"version":"1.0.0","buildTag":"20180608145515.1.0.0.b913a2d","runMode":"dev","apiVersion":"3.0.0"}
try {
String address = "http://localhost:30100/version";
ServiceCenterInfo serviceCenterInfo = new RestTemplate().getForObject(address, ServiceCenterInfo.class);
if (serviceCenterInfo != null && serviceCenterInfo.getVersion() != null) {
LOGGER.info("{} already started, {}.", deployDefinition.getDisplayName(), Json.pretty(serviceCenterInfo));
return;
}
} catch (Throwable e) {
LOGGER.info("failed to get ServiceCenter version, message={}", e.getMessage());
}
initServiceCenterCmd();
LOGGER.info("definition of {} is: {}", deployDefinition.getDeployName(), deployDefinition);
deploy();
waitStartComplete();
}
use of org.apache.servicecomb.serviceregistry.api.registry.ServiceCenterInfo in project java-chassis by ServiceComb.
the class ServiceRegistryClientImpl method getServiceCenterInfo.
@Override
public ServiceCenterInfo getServiceCenterInfo() {
Holder<ServiceCenterInfo> holder = new Holder<>();
IpPort ipPort = ipPortManager.getAvailableAddress();
CountDownLatch countDownLatch = new CountDownLatch(1);
restClientUtil.get(ipPort, Const.REGISTRY_API.SERVICECENTER_VERSION, new RequestParam(), syncHandler(countDownLatch, ServiceCenterInfo.class, holder));
try {
countDownLatch.await();
if (holder.value != null) {
return holder.value;
}
} catch (Exception e) {
LOGGER.error("query servicecenter version info failed.", e);
}
return null;
}
Aggregations