Issue 493:bad http syntax deleting cloudsigma resources

This commit is contained in:
Adrian Cole 2011-03-04 15:47:31 -05:00
parent 02af58a198
commit 37f66d6eed
3 changed files with 16 additions and 19 deletions

View File

@ -202,7 +202,7 @@ public interface CloudSigmaAsyncClient {
/**
* @see CloudSigmaClient#destroyServer
*/
@POST
@GET
@Path("/servers/{uuid}/destroy")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
ListenableFuture<Void> destroyServer(@PathParam("uuid") String uuid);
@ -246,7 +246,7 @@ public interface CloudSigmaAsyncClient {
/**
* @see CloudSigmaClient#destroyDrive
*/
@POST
@GET
@Path("/drives/{uuid}/destroy")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
ListenableFuture<Void> destroyDrive(@PathParam("uuid") String uuid);
@ -297,7 +297,7 @@ public interface CloudSigmaAsyncClient {
/**
* @see CloudSigmaClient#destroyVLAN
*/
@POST
@GET
@Path("/resources/vlan/{uuid}/destroy")
@ExceptionParser(ReturnVoidOnNotFoundOr404.class)
ListenableFuture<Void> destroyVLAN(@PathParam("uuid") String uuid);
@ -339,7 +339,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

@ -300,9 +300,12 @@ public class CloudSigmaClientLiveTest {
server = client.createServer(serverRequest);
assertEquals(server.getNics().get(0).getDhcp(), ip.getAddress());
} finally {
client.destroyServer(server.getUuid());
client.destroyDrive(drive.getUuid());
client.destroyStaticIP(id);
if (server != null) {
client.destroyServer(server.getUuid());
client.destroyDrive(drive.getUuid());
}
client.destroyStaticIP(ip.getAddress());
client.destroyStaticIP(ip2.getAddress());
}
}
@ -422,16 +425,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();
}