use of org.apache.servicecomb.config.center.client.AddressManager in project incubator-servicecomb-java-chassis by apache.
the class ConfigCenterConfigurationSourceImpl method init.
@Override
public void init(Configuration localConfiguration) {
configConverter = new ConfigConverter(ConfigCenterConfig.INSTANCE.getFileSources());
AddressManager kieAddressManager = configKieAddressManager();
HttpTransport httpTransport = createHttpTransport(kieAddressManager, HttpTransportFactory.defaultRequestConfig().build(), localConfiguration);
ConfigCenterClient configCenterClient = new ConfigCenterClient(kieAddressManager, httpTransport);
EventManager.register(this);
QueryConfigurationsRequest queryConfigurationsRequest = firstPull(configCenterClient);
configCenterManager = new ConfigCenterManager(configCenterClient, EventManager.getEventBus(), configConverter);
configCenterManager.setQueryConfigurationsRequest(queryConfigurationsRequest);
configCenterManager.startConfigCenterManager();
}
use of org.apache.servicecomb.config.center.client.AddressManager in project incubator-servicecomb-java-chassis by apache.
the class ConfigCenterConfigurationSourceImplTest method configAddressManagerTest.
@Test
void configAddressManagerTest() {
List<String> addresses = new ArrayList<>();
addresses.add("http://127.0.0.1:30103");
addresses.add("http://127.0.0.2:30103");
AddressManager addressManager = new AddressManager("test", addresses, EventManager.getEventBus());
Assert.assertNotNull(addressManager);
String address = addressManager.address();
Assert.assertEquals("http://127.0.0.2:30103/v3/test", address);
address = addressManager.address();
Assert.assertEquals("http://127.0.0.1:30103/v3/test", address);
addressManager = new AddressManager(null, addresses, EventManager.getEventBus());
address = addressManager.address();
Assert.assertEquals("http://127.0.0.2:30103/v3/default", address);
}
use of org.apache.servicecomb.config.center.client.AddressManager in project java-chassis by ServiceComb.
the class ConfigCenterConfigurationSourceImplTest method onRefreshEndpointEventTest.
@Test
void onRefreshEndpointEventTest() {
List<String> addresses = new ArrayList<>();
addresses.add("http://127.0.0.1:30103");
List<String> addressAZ = new ArrayList<>();
addressAZ.add("rest://127.0.0.1:30100?sslEnabled=true");
Map<String, List<String>> zoneAndRegion = new HashMap<>();
zoneAndRegion.put("sameZone", addressAZ);
zoneAndRegion.put("sameRegion", new ArrayList<>());
RefreshEndpointEvent event = new RefreshEndpointEvent(zoneAndRegion, "CseConfigCenter");
AddressManager addressManager = new AddressManager("test", addresses, EventManager.getEventBus());
addressManager.onRefreshEndpointEvent(event);
List<String> availableAZ = Deencapsulation.getField(addressManager, "availableZone");
Assert.assertEquals("https://127.0.0.1:30100/v3/test", availableAZ.get(0));
}
use of org.apache.servicecomb.config.center.client.AddressManager in project java-chassis by ServiceComb.
the class ConfigCenterConfigurationSourceImplTest method configAddressManagerTest.
@Test
void configAddressManagerTest() {
List<String> addresses = new ArrayList<>();
addresses.add("http://127.0.0.1:30103");
addresses.add("http://127.0.0.2:30103");
AddressManager addressManager = new AddressManager("test", addresses, EventManager.getEventBus());
Assert.assertNotNull(addressManager);
String address = addressManager.address();
Assert.assertEquals("http://127.0.0.2:30103/v3/test", address);
address = addressManager.address();
Assert.assertEquals("http://127.0.0.1:30103/v3/test", address);
addressManager = new AddressManager(null, addresses, EventManager.getEventBus());
address = addressManager.address();
Assert.assertEquals("http://127.0.0.2:30103/v3/default", address);
}
use of org.apache.servicecomb.config.center.client.AddressManager in project java-chassis by ServiceComb.
the class ConfigCenterConfigurationSourceImpl method init.
@Override
public void init(Configuration localConfiguration) {
configConverter = new ConfigConverter(ConfigCenterConfig.INSTANCE.getFileSources());
AddressManager kieAddressManager = configKieAddressManager();
HttpTransport httpTransport = createHttpTransport(kieAddressManager, HttpTransportFactory.defaultRequestConfig().build(), localConfiguration);
ConfigCenterClient configCenterClient = new ConfigCenterClient(kieAddressManager, httpTransport);
EventManager.register(this);
QueryConfigurationsRequest queryConfigurationsRequest = firstPull(configCenterClient);
configCenterManager = new ConfigCenterManager(configCenterClient, EventManager.getEventBus(), configConverter);
configCenterManager.setQueryConfigurationsRequest(queryConfigurationsRequest);
configCenterManager.startConfigCenterManager();
}
Aggregations