mirror of https://github.com/apache/jclouds.git
Issue 695: Added getLayoutsInComputePool service call
This commit is contained in:
parent
6dca8b62c9
commit
f345ef0a4a
|
@ -51,4 +51,12 @@ public interface LayoutAsyncClient {
|
||||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
ListenableFuture<DeviceLayout> getLayouts(@EndpointParam URI uri);
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,4 +46,14 @@ public interface LayoutClient {
|
||||||
*/
|
*/
|
||||||
DeviceLayout getLayouts(URI uri);
|
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,10 +39,19 @@ import java.net.URISyntaxException;
|
||||||
public class LayoutAsyncClientTest extends BaseTerremarkEnterpriseCloudAsyncClientTest<LayoutAsyncClient> {
|
public class LayoutAsyncClientTest extends BaseTerremarkEnterpriseCloudAsyncClientTest<LayoutAsyncClient> {
|
||||||
|
|
||||||
public void testGetLayouts() throws SecurityException, NoSuchMethodException, IOException, URISyntaxException {
|
public void testGetLayouts() throws SecurityException, NoSuchMethodException, IOException, URISyntaxException {
|
||||||
Method method = LayoutAsyncClient.class.getMethod("getLayouts", URI.class);
|
testCall("getLayouts","/cloudapi/ecloud/layout/environments/77");
|
||||||
HttpRequest httpRequest = processor.createRequest(method, URI.create("/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,
|
assertNonPayloadHeadersEqual(httpRequest,
|
||||||
"Accept: application/vnd.tmrk.cloud.deviceLayout\nx-tmrk-version: 2011-07-01\n");
|
"Accept: application/vnd.tmrk.cloud.deviceLayout\nx-tmrk-version: 2011-07-01\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
|
@ -50,4 +50,13 @@ public class LayoutClientLiveTest extends BaseTerremarkEnterpriseCloudClientLive
|
||||||
public void testGetMissingLayouts() {
|
public void testGetMissingLayouts() {
|
||||||
assertNull(client.getLayouts(URI.create("/cloudapi/ecloud/layout/environments/-1")));
|
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")));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue