Issue 695: Added getLayoutsInComputePool service call

This commit is contained in:
Jason King 2011-12-15 15:50:03 +00:00
parent 6dca8b62c9
commit f345ef0a4a
4 changed files with 39 additions and 3 deletions

View File

@ -51,4 +51,12 @@ public interface LayoutAsyncClient {
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<DeviceLayout> getLayouts(@EndpointParam URI uri);
/**
* @see LayoutClient#getLayoutsInComputePool
*/
@GET
@Consumes("application/vnd.tmrk.cloud.deviceLayout")
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<DeviceLayout> getLayoutsInComputePool(@EndpointParam URI uri);
}

View File

@ -46,4 +46,14 @@ public interface LayoutClient {
*/
DeviceLayout getLayouts(URI uri);
/**
* The Get Layouts by Compute Pool call returns information regarding the row and group of network hosts
* for a specified compute pool in an environment.
* Rows and groups allow aggregation of servers along logical boundaries defined by the organization.
* @param uri the uri based on the compute pool
* e.g. /cloudapi/ecloud/layout/computePools/{id}
* @return the DeviceLayout
*/
DeviceLayout getLayoutsInComputePool(URI uri);
}

View File

@ -39,10 +39,19 @@ import java.net.URISyntaxException;
public class LayoutAsyncClientTest extends BaseTerremarkEnterpriseCloudAsyncClientTest<LayoutAsyncClient> {
public void testGetLayouts() throws SecurityException, NoSuchMethodException, IOException, URISyntaxException {
Method method = LayoutAsyncClient.class.getMethod("getLayouts", URI.class);
HttpRequest httpRequest = processor.createRequest(method, URI.create("/cloudapi/ecloud/layout/environments/77"));
testCall("getLayouts","/cloudapi/ecloud/layout/environments/77");
}
assertRequestLineEquals(httpRequest, "GET https://services-beta.enterprisecloud.terremark.com/cloudapi/ecloud/layout/environments/77 HTTP/1.1");
public void testGetLayoutsInComputePool() throws SecurityException, NoSuchMethodException, IOException, URISyntaxException {
testCall("getLayoutsInComputePool","/cloudapi/ecloud/layout/computePools/89");
}
private void testCall(String methodName, String uri) throws SecurityException, NoSuchMethodException, IOException, URISyntaxException {
Method method = LayoutAsyncClient.class.getMethod(methodName, URI.class);
HttpRequest httpRequest = processor.createRequest(method, URI.create(uri));
String requestLine = String.format("GET https://services-beta.enterprisecloud.terremark.com%s HTTP/1.1",uri);
assertRequestLineEquals(httpRequest, requestLine);
assertNonPayloadHeadersEqual(httpRequest,
"Accept: application/vnd.tmrk.cloud.deviceLayout\nx-tmrk-version: 2011-07-01\n");
assertPayloadEquals(httpRequest, null, null, false);

View File

@ -50,4 +50,13 @@ public class LayoutClientLiveTest extends BaseTerremarkEnterpriseCloudClientLive
public void testGetMissingLayouts() {
assertNull(client.getLayouts(URI.create("/cloudapi/ecloud/layout/environments/-1")));
}
public void testGetLayoutsInComputePool() throws Exception {
DeviceLayout layout = client.getLayouts(URI.create("/cloudapi/ecloud/layout/computepools/89"));
assertNotNull(layout);
}
public void testGetMissingLayoutsInComputePool() {
assertNull(client.getLayouts(URI.create("/cloudapi/ecloud/layout/computepools/-1")));
}
}