Search in sources :

Example 6 with Endpoint

use of com.hazelcast.kubernetes.KubernetesClient.Endpoint in project hazelcast by hazelcast.

the class KubernetesApiProviderTest method parseEndpointsList.

@Test
public void parseEndpointsList() {
    JsonObject endpointsListJson = Json.parse(getEndpointsListResponse()).asObject();
    List<Endpoint> endpoints = provider.parseEndpointsList(endpointsListJson);
    assertThat(format(endpoints), containsInAnyOrder(ready("192.168.0.25", 5702), ready("172.17.0.5", 5702), notReady("172.17.0.6", 5702)));
}
Also used : Endpoint(com.hazelcast.kubernetes.KubernetesClient.Endpoint) JsonObject(com.hazelcast.internal.json.JsonObject) Test(org.junit.Test)

Example 7 with Endpoint

use of com.hazelcast.kubernetes.KubernetesClient.Endpoint in project hazelcast by hazelcast.

the class KubernetesApiProviderTest method parseEndpoints.

@Test
public void parseEndpoints() {
    JsonObject endpointsListJson = Json.parse(getEndpointsResponse()).asObject();
    List<Endpoint> endpoints = provider.parseEndpoints(endpointsListJson);
    assertThat(format(endpoints), containsInAnyOrder(ready("192.168.0.25", 5701), ready("172.17.0.5", 5701)));
}
Also used : Endpoint(com.hazelcast.kubernetes.KubernetesClient.Endpoint) JsonObject(com.hazelcast.internal.json.JsonObject) Test(org.junit.Test)

Example 8 with Endpoint

use of com.hazelcast.kubernetes.KubernetesClient.Endpoint in project hazelcast by hazelcast.

the class KubernetesClientTest method formatPublic.

private static List<String> formatPublic(List<Endpoint> addresses) {
    List<String> result = new ArrayList<String>();
    for (Endpoint address : addresses) {
        String ip = address.getPublicAddress().getIp();
        Integer port = address.getPublicAddress().getPort();
        boolean isReady = address.isReady();
        result.add(toString(ip, port, isReady));
    }
    return result;
}
Also used : Endpoint(com.hazelcast.kubernetes.KubernetesClient.Endpoint) ArrayList(java.util.ArrayList)

Example 9 with Endpoint

use of com.hazelcast.kubernetes.KubernetesClient.Endpoint in project hazelcast by hazelcast.

the class KubernetesClientTest method format.

private static List<String> format(List<Endpoint> addresses) {
    List<String> result = new ArrayList<String>();
    for (Endpoint address : addresses) {
        String ip = address.getPrivateAddress().getIp();
        Integer port = address.getPrivateAddress().getPort();
        boolean isReady = address.isReady();
        result.add(toString(ip, port, isReady));
    }
    return result;
}
Also used : Endpoint(com.hazelcast.kubernetes.KubernetesClient.Endpoint) ArrayList(java.util.ArrayList)

Aggregations

Endpoint (com.hazelcast.kubernetes.KubernetesClient.Endpoint)9 KubernetesApiProvider.convertToString (com.hazelcast.kubernetes.KubernetesApiProvider.convertToString)4 EndpointAddress (com.hazelcast.kubernetes.KubernetesClient.EndpointAddress)4 ArrayList (java.util.ArrayList)4 JsonValue (com.hazelcast.internal.json.JsonValue)3 JsonObject (com.hazelcast.internal.json.JsonObject)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Test (org.junit.Test)2