Issue 493:bad http syntax deleting cloudsigma resources

This commit is contained in:
Adrian Cole 2011-03-04 15:47:31 -05:00
parent c1637ba740
commit 6543f3af7a
3 changed files with 12 additions and 28 deletions

View File

@ -203,7 +203,7 @@ public interface CloudSigmaAsyncClient {
/**
* @see CloudSigmaClient#destroyServer
*/
@POST
@GET
@Path("/servers/{uuid}/destroy")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
ListenableFuture<Void> destroyServer(@PathParam("uuid") String uuid);
@ -247,7 +247,7 @@ public interface CloudSigmaAsyncClient {
/**
* @see CloudSigmaClient#destroyDrive
*/
@POST
@GET
@Path("/drives/{uuid}/destroy")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
ListenableFuture<Void> destroyDrive(@PathParam("uuid") String uuid);
@ -301,7 +301,7 @@ public interface CloudSigmaAsyncClient {
/**
* @see CloudSigmaClient#destroyVLAN
*/
@POST
@GET
@Path("/resources/vlan/{uuid}/destroy")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
ListenableFuture<Void> destroyVLAN(@PathParam("uuid") String uuid);
@ -343,7 +343,7 @@ public interface CloudSigmaAsyncClient {
/**
* @see CloudSigmaClient#destroyStaticIP
*/
@POST
@GET
@Path("/resources/ip/{uuid}/destroy")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
ListenableFuture<Void> destroyStaticIP(@PathParam("uuid") String uuid);

View File

@ -323,7 +323,7 @@ public class CloudSigmaAsyncClientTest extends RestClientTest<CloudSigmaAsyncCli
Method method = CloudSigmaAsyncClient.class.getMethod("destroyServer", String.class);
HttpRequest httpRequest = processor.createRequest(method, "uuid");
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/uuid/destroy HTTP/1.1");
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/servers/uuid/destroy HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
assertPayloadEquals(httpRequest, null, null, false);
@ -430,7 +430,7 @@ public class CloudSigmaAsyncClientTest extends RestClientTest<CloudSigmaAsyncCli
Method method = CloudSigmaAsyncClient.class.getMethod("destroyDrive", String.class);
HttpRequest httpRequest = processor.createRequest(method, "uuid");
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/drives/uuid/destroy HTTP/1.1");
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/uuid/destroy HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
assertPayloadEquals(httpRequest, null, null, false);
@ -536,7 +536,7 @@ public class CloudSigmaAsyncClientTest extends RestClientTest<CloudSigmaAsyncCli
Method method = CloudSigmaAsyncClient.class.getMethod("destroyVLAN", String.class);
HttpRequest httpRequest = processor.createRequest(method, "uuid");
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/resources/vlan/uuid/destroy HTTP/1.1");
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/vlan/uuid/destroy HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
assertPayloadEquals(httpRequest, null, null, false);
@ -626,7 +626,7 @@ public class CloudSigmaAsyncClientTest extends RestClientTest<CloudSigmaAsyncCli
Method method = CloudSigmaAsyncClient.class.getMethod("destroyStaticIP", String.class);
HttpRequest httpRequest = processor.createRequest(method, "uuid");
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/resources/ip/uuid/destroy HTTP/1.1");
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/ip/uuid/destroy HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
assertPayloadEquals(httpRequest, null, null, false);

View File

@ -308,18 +308,8 @@ public class CloudSigmaClientLiveTest {
client.destroyServer(server.getUuid());
client.destroyDrive(drive.getUuid());
}
try {
client.destroyStaticIP(ip.getAddress());
} catch (IllegalArgumentException e) {
// this shouldn't happen
assertEquals(e.getMessage(), "resource_exception:Missing resource");
}
try {
client.destroyStaticIP(ip2.getAddress());
} catch (IllegalArgumentException e) {
// this shouldn't happen
assertEquals(e.getMessage(), "resource_exception:Missing resource");
}
}
}
@ -439,16 +429,10 @@ public class CloudSigmaClientLiveTest {
@AfterGroups(groups = "live")
protected void tearDown() {
try {
if (server != null)
client.destroyServer(server.getUuid());
} catch (Exception e) {
// no need to check null or anything as we swallow all
}
try {
if (server != null)
client.destroyDrive(drive.getUuid());
} catch (Exception e) {
}
if (context != null)
context.close();
}