Search in sources :

Example 1 with IpPortManager

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());
}
Also used : IpPort(org.apache.servicecomb.foundation.common.net.IpPort) IpPortManager(org.apache.servicecomb.serviceregistry.client.IpPortManager) Test(org.junit.Test)

Example 2 with IpPortManager

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);
}
Also used : IpPortManager(org.apache.servicecomb.serviceregistry.client.IpPortManager)

Example 3 with IpPortManager

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());
}
Also used : IpPort(org.apache.servicecomb.foundation.common.net.IpPort) IpPortManager(org.apache.servicecomb.serviceregistry.client.IpPortManager) Test(org.junit.Test)

Aggregations

IpPortManager (org.apache.servicecomb.serviceregistry.client.IpPortManager)3 IpPort (org.apache.servicecomb.foundation.common.net.IpPort)2 Test (org.junit.Test)2