Search in sources :

Example 6 with AddressManager

use of org.apache.servicecomb.config.center.client.AddressManager in project incubator-servicecomb-java-chassis by apache.

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));
}
Also used : AddressManager(org.apache.servicecomb.config.center.client.AddressManager) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) RefreshEndpointEvent(org.apache.servicecomb.http.client.event.RefreshEndpointEvent) List(java.util.List) ArrayList(java.util.ArrayList) Test(org.junit.jupiter.api.Test)

Aggregations

AddressManager (org.apache.servicecomb.config.center.client.AddressManager)6 ArrayList (java.util.ArrayList)4 Test (org.junit.jupiter.api.Test)4 HashMap (java.util.HashMap)2 List (java.util.List)2 ConfigCenterClient (org.apache.servicecomb.config.center.client.ConfigCenterClient)2 ConfigCenterManager (org.apache.servicecomb.config.center.client.ConfigCenterManager)2 QueryConfigurationsRequest (org.apache.servicecomb.config.center.client.model.QueryConfigurationsRequest)2 ConfigConverter (org.apache.servicecomb.config.common.ConfigConverter)2 HttpTransport (org.apache.servicecomb.http.client.common.HttpTransport)2 RefreshEndpointEvent (org.apache.servicecomb.http.client.event.RefreshEndpointEvent)2