Issue 695: Added removeInternetService and added ListenableFuture to create call

This commit is contained in:
Jason King 2011-12-21 14:23:20 +00:00
parent a352dc89c8
commit 4e90c570be
3 changed files with 41 additions and 2 deletions

View File

@ -73,5 +73,15 @@ public interface InternetServiceAsyncClient {
@Consumes("application/vnd.tmrk.cloud.internetService")
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
InternetService createInternetService(@EndpointParam URI uri, @BinderParam(BindCreateInternetServiceToXmlPayload.class)InternetService data);
ListenableFuture<InternetService> createInternetService(@EndpointParam URI uri, @BinderParam(BindCreateInternetServiceToXmlPayload.class)InternetService data);
/**
* @see org.jclouds.tmrk.enterprisecloud.features.InternetServiceClient#removeInternetService
*/
@DELETE
@Consumes("application/vnd.tmrk.cloud.task")
@JAXBResponseParser
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
ListenableFuture<Task> removeInternetService(@EndpointParam URI uri);
}

View File

@ -40,7 +40,7 @@ public interface InternetServiceClient {
/**
* getInternetService call returns information regarding a specified Internet service defined in an environment.
* The getInternetService call returns information regarding a specified Internet service defined in an environment.
* @param uri the uri of the internet service
* e.g. /cloudapi/ecloud/internetservices/{internet service id}
* @return the internet service
@ -98,4 +98,14 @@ public interface InternetServiceClient {
* @return
*/
InternetService createInternetService(URI uri, InternetService data);
/**
* The removeInternetService call removes an Internet service from an environment.
* If successful, the call returns the task that removed the Internet service.
* Note: The Internet service must have no node services associated to remove.
* @param uri the uri of the call based on the internet service
* e.g. /cloudapi/ecloud/internetServices/{internet service identifier}
* @return
*/
Task removeInternetService(URI uri);
}

View File

@ -113,6 +113,25 @@ public class InternetServiceAsyncClientTest extends BaseTerremarkEnterpriseCloud
checkFilters(httpRequest);
}
public void testRemoveInternetService() throws SecurityException, NoSuchMethodException, IOException, URISyntaxException {
Method method = InternetServiceAsyncClient.class.getMethod("removeInternetService", URI.class);
URI uri = URI.create("/cloudapi/ecloud/internetServices/123");
HttpRequest httpRequest = processor.createRequest(method, uri);
String requestLine = "DELETE https://services-beta.enterprisecloud.terremark.com/cloudapi/ecloud/internetServices/123 HTTP/1.1";
assertRequestLineEquals(httpRequest, requestLine);
assertNonPayloadHeadersEqual(httpRequest,
"Accept: application/vnd.tmrk.cloud.task\nx-tmrk-version: 2011-07-01\n");
assertPayloadEquals(httpRequest, null, null, false);
assertResponseParserClassEquals(method, httpRequest, ParseXMLWithJAXB.class);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
checkFilters(httpRequest);
}
@Override
protected TypeLiteral<RestAnnotationProcessor<InternetServiceAsyncClient>> createTypeLiteral() {