mirror of
https://github.com/apache/jclouds.git
synced 2025-02-17 23:46:13 +00:00
naming + correct parameter/return type for addNodes
This commit is contained in:
parent
f851271ae3
commit
d44bf5d23e
@ -171,7 +171,7 @@ public class Node extends BaseNode<Node> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("[id=%s, address=%s, condition=%s, port=%s, weight=%s,status=%s]", id, address, condition,
|
return String.format("[id=%s, address=%s, condition=%s, port=%s, weight=%s, status=%s]", id, address, condition,
|
||||||
port, weight, status);
|
port, weight, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,15 +62,15 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||||||
public interface NodeAsyncClient {
|
public interface NodeAsyncClient {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see NodeClient#createNode
|
* @see NodeClient#addNodes
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@ResponseParser(UnwrapNode.class)
|
@ResponseParser(UnwrapNodes.class)
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
@Path("/loadbalancers/{lbid}/nodes")
|
@Path("/loadbalancers/{lbid}/nodes")
|
||||||
ListenableFuture<Node> createNode(@PathParam("lbid") int lbid,
|
ListenableFuture<Set<Node>> addNodes(@PathParam("lbid") int lbid,
|
||||||
@WrapWith("node") NodeRequest n);
|
@WrapWith("nodes") Set<NodeRequest> nodes);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see NodeClient#modifyNode
|
* @see NodeClient#modifyNode
|
||||||
|
@ -52,14 +52,14 @@ public interface NodeClient {
|
|||||||
* @param lbid
|
* @param lbid
|
||||||
* loadbalancer on which to create the node
|
* loadbalancer on which to create the node
|
||||||
* @param n
|
* @param n
|
||||||
* configuration to create
|
* configurations to create
|
||||||
* @return
|
* @return created nodes
|
||||||
* @throws HttpResponseException
|
* @throws HttpResponseException
|
||||||
* If the corresponding request cannot be fulfilled due to insufficient or invalid
|
* If the corresponding request cannot be fulfilled due to insufficient or invalid
|
||||||
* data
|
* data
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Node createNode(int lbid, NodeRequest n);
|
Set<Node> addNodes(int lbid, Set<NodeRequest> nodes);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -107,22 +107,24 @@ public class NodeClientLiveTest extends BaseCloudLoadBalancersClientLiveTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreateNode() throws Exception {
|
public void testAddNodes() throws Exception {
|
||||||
for (LoadBalancer lb : nodes.keySet()) {
|
for (LoadBalancer lb : nodes.keySet()) {
|
||||||
String region = lb.getRegion();
|
String region = lb.getRegion();
|
||||||
Logger.getAnonymousLogger().info("starting node on loadbalancer "+lb.getId()+" in region "+region);
|
Logger.getAnonymousLogger().info("starting node on loadbalancer "+lb.getId()+" in region "+region);
|
||||||
Node n = client.getNodeClient(region).createNode(lb.getId(),
|
Set<Node> newNodes = client.getNodeClient(region).addNodes(lb.getId(), Collections.<NodeRequest>singleton(
|
||||||
NodeRequest.builder().address("192.168.1.1").port(8080).build());
|
NodeRequest.builder().address("192.168.1.2").port(8080).build()));
|
||||||
assertEquals(lb.getStatus(), Node.Status.ONLINE);
|
|
||||||
nodes.get(lb).add(n);
|
for (Node n : newNodes) {
|
||||||
assertEquals(client.getNodeClient(region).getNode(lb.getId(), n.getId()).getStatus(), Node.Status.ONLINE);
|
assertEquals(n.getStatus(), Node.Status.ONLINE);
|
||||||
|
nodes.get(lb).add(n);
|
||||||
Node newNode = client.getNodeClient(region).getNode(lb.getId(), n.getId());
|
assertEquals(client.getNodeClient(region).getNode(lb.getId(), n.getId()).getStatus(), Node.Status.ONLINE);
|
||||||
assertEquals(newNode.getStatus(), Node.Status.ONLINE);
|
}
|
||||||
|
|
||||||
|
assert loadBalancerActive.apply(lb) : lb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = "testCreateNode")
|
@Test(dependsOnMethods = "testAddNodes")
|
||||||
public void testModifyNode() throws Exception {
|
public void testModifyNode() throws Exception {
|
||||||
for (Entry<LoadBalancer, Set<Node>> entry : nodes.entrySet()) {
|
for (Entry<LoadBalancer, Set<Node>> entry : nodes.entrySet()) {
|
||||||
for (Node n : entry.getValue()) {
|
for (Node n : entry.getValue()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user