Search in sources :

Example 1 with NodeBuilder

use of io.fabric8.kubernetes.api.model.NodeBuilder in project flink by apache.

the class KubernetesClientTestBase method mockExpectedNodesFromServerSide.

protected void mockExpectedNodesFromServerSide(List<String> addresses) {
    final List<Node> nodes = new ArrayList<>();
    Collections.shuffle(addresses);
    for (String address : addresses) {
        final String[] parts = address.split(":");
        Preconditions.checkState(parts.length == 2, "Address should be in format \"<type>:<ip>\".");
        nodes.add(new NodeBuilder().withStatus(new NodeStatusBuilder().withAddresses(new NodeAddressBuilder().withType(parts[0]).withAddress(parts[1]).build()).build()).build());
    }
    server.expect().get().withPath("/api/v1/nodes").andReturn(200, new NodeListBuilder().withItems(nodes).build()).always();
}
Also used : NodeAddressBuilder(io.fabric8.kubernetes.api.model.NodeAddressBuilder) Node(io.fabric8.kubernetes.api.model.Node) ArrayList(java.util.ArrayList) NodeListBuilder(io.fabric8.kubernetes.api.model.NodeListBuilder) NodeBuilder(io.fabric8.kubernetes.api.model.NodeBuilder) NodeStatusBuilder(io.fabric8.kubernetes.api.model.NodeStatusBuilder)

Aggregations

Node (io.fabric8.kubernetes.api.model.Node)1 NodeAddressBuilder (io.fabric8.kubernetes.api.model.NodeAddressBuilder)1 NodeBuilder (io.fabric8.kubernetes.api.model.NodeBuilder)1 NodeListBuilder (io.fabric8.kubernetes.api.model.NodeListBuilder)1 NodeStatusBuilder (io.fabric8.kubernetes.api.model.NodeStatusBuilder)1 ArrayList (java.util.ArrayList)1