use of org.apache.servicecomb.serviceregistry.client.IpPortManager in project incubator-servicecomb-java-chassis by apache.
the class TestClientHttp method testIpPortManager.
@Test
public void testIpPortManager(@Mocked InstanceCacheManager instanceCacheManager) throws Exception {
IpPortManager oManager = new IpPortManager(ServiceRegistryConfig.INSTANCE, instanceCacheManager);
IpPort oIPPort = oManager.getNextAvailableAddress(new IpPort("", 33));
Assert.assertEquals(oIPPort.getHostOrIp(), oManager.getAvailableAddress().getHostOrIp());
}
use of org.apache.servicecomb.serviceregistry.client.IpPortManager in project incubator-servicecomb-java-chassis by apache.
the class AbstractServiceRegistry method init.
@Override
public void init() {
try {
initAppManager();
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
throw new IllegalStateException("Failed to init appManager.", e);
}
initCacheManager();
ipPortManager = new IpPortManager(serviceRegistryConfig, instanceCacheManager);
if (srClient == null) {
srClient = createServiceRegistryClient();
}
serviceCenterInfo = srClient.getServiceCenterInfo();
createServiceCenterTask();
eventBus.register(this);
}
use of org.apache.servicecomb.serviceregistry.client.IpPortManager in project java-chassis by ServiceComb.
the class TestClientHttp method testIpPortManager.
@Test
public void testIpPortManager() {
IpPortManager oManager = new IpPortManager(ServiceRegistryConfig.INSTANCE);
IpPort oIPPort = oManager.getAvailableAddress();
Assert.assertEquals(oIPPort.getHostOrIp(), oManager.getAvailableAddress().getHostOrIp());
}
Aggregations