use of io.servicecomb.serviceregistry.api.registry.Microservice in project java-chassis by ServiceComb.
the class TestServiceRegistryClientImpl method testPrivateMehtodCreateHttpClientOptions.
@Test
public void testPrivateMehtodCreateHttpClientOptions() {
Microservice oInstance = RegistryUtils.getMicroservice();
oClient.registerMicroservice(oInstance);
oClient.registerMicroserviceInstance(RegistryUtils.getMicroserviceInstance());
new MockUp<ServiceRegistryConfig>() {
@Mock
public HttpVersion getHttpVersion() {
return HttpVersion.HTTP_2;
}
@Mock
public boolean isSsl() {
return true;
}
};
try {
oClient.init();
HttpClientOptions httpClientOptions = Deencapsulation.invoke(oClient, "createHttpClientOptions");
Assert.assertNotNull(httpClientOptions);
Assert.assertEquals(80, httpClientOptions.getDefaultPort());
} catch (Exception e) {
Assert.assertNotNull(e);
}
}
use of io.servicecomb.serviceregistry.api.registry.Microservice in project java-chassis by ServiceComb.
the class CseDiscoveryClient method getServices.
@Override
public List<String> getServices() {
ServiceRegistryClient client = RegistryClientFactory.getRegistryClient();
List<Microservice> services = client.getAllMicroservices();
List<String> serviceIDList = new ArrayList<String>();
if (null != services && !services.isEmpty())
for (Microservice service : services) {
serviceIDList.add(service.getServiceName());
}
return serviceIDList;
}
Aggregations