From 95935f861c9b892b4f604b42d1cfce8b79c3662f Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Wed, 15 Feb 2012 00:40:51 +0100 Subject: [PATCH] glesys now returns server state in create response --- .../functions/ServerDetailsToNodeMetadata.java | 2 +- .../ServerDetailsToNodeMetadataTest.java | 15 +-------------- .../glesys/features/ServerClientExpectTest.java | 2 +- .../glesys/src/test/resources/server_details.json | 2 +- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/labs/glesys/src/main/java/org/jclouds/glesys/compute/functions/ServerDetailsToNodeMetadata.java b/labs/glesys/src/main/java/org/jclouds/glesys/compute/functions/ServerDetailsToNodeMetadata.java index 1077796769..a52e052e9d 100644 --- a/labs/glesys/src/main/java/org/jclouds/glesys/compute/functions/ServerDetailsToNodeMetadata.java +++ b/labs/glesys/src/main/java/org/jclouds/glesys/compute/functions/ServerDetailsToNodeMetadata.java @@ -109,7 +109,7 @@ public class ServerDetailsToNodeMetadata implements Function of(new VolumeImpl((float) from.getDiskSizeGB(), true, true))) .hypervisor(from.getPlatform()).build()); - builder.state(from.getState() != null ? serverStateToNodeState.get(from.getState()) : NodeState.PENDING); + builder.state(serverStateToNodeState.get(from.getState())); Iterable addresses = Iterables.filter(Iterables.transform(from.getIps(), new Function() { @Override diff --git a/labs/glesys/src/test/java/org/jclouds/glesys/compute/functions/ServerDetailsToNodeMetadataTest.java b/labs/glesys/src/test/java/org/jclouds/glesys/compute/functions/ServerDetailsToNodeMetadataTest.java index d51519ed06..c48ed8c28f 100644 --- a/labs/glesys/src/test/java/org/jclouds/glesys/compute/functions/ServerDetailsToNodeMetadataTest.java +++ b/labs/glesys/src/test/java/org/jclouds/glesys/compute/functions/ServerDetailsToNodeMetadataTest.java @@ -68,20 +68,7 @@ public class ServerDetailsToNodeMetadataTest extends BaseGleSYSComputeServiceExp HttpResponse .builder() .statusCode(200) - .payload( - payloadFromString("{\"response\":{\"status\":{\"code\":200,\"timestamp\":\"2012-02-10T11:28:50+01:00\",\"text\":\"OK\"},\"server\":{\"state\":\"running\"},\"debug\":{\"input\":{\"serverid\":\"xm3276891\",\"statustype\":\"state\"}}}}")) - .build()) - .put(HttpRequest - .builder() - .method("POST") - .endpoint(URI.create("https://api.glesys.com/server/status/format/json")) - .headers( - ImmutableMultimap. builder().put("Accept", "application/json") - .put("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==").build()) - .payload( - newUrlEncodedFormPayload(ImmutableMultimap. builder() - .put("serverid", "xm3276891").put("statustype", "state").build())).build(), - HttpResponse.builder().statusCode(206).payload(payloadFromResource("/server_status.json")) + .payload(payloadFromResource("/server_details.json")) .build()).build() ).getInstance(ServerDetailsToNodeMetadata.class); diff --git a/labs/glesys/src/test/java/org/jclouds/glesys/features/ServerClientExpectTest.java b/labs/glesys/src/test/java/org/jclouds/glesys/features/ServerClientExpectTest.java index b6e0360991..d381f08314 100644 --- a/labs/glesys/src/test/java/org/jclouds/glesys/features/ServerClientExpectTest.java +++ b/labs/glesys/src/test/java/org/jclouds/glesys/features/ServerClientExpectTest.java @@ -159,7 +159,7 @@ public class ServerClientExpectTest extends BaseRestClientExpectTest