From ef66989727f3aebeab15035f0eccf6e5aad6f0cb Mon Sep 17 00:00:00 2001 From: Andrew Donald Kennedy Date: Wed, 11 Apr 2012 01:00:02 +0100 Subject: [PATCH] Corrections to fix expect and live test errors, including JAXB type naming for enumerations --- .../vcloud/director/v1_5/domain/AbstractVAppType.java | 2 -- .../vcloud/director/v1_5/domain/CaptureVAppParams.java | 2 -- .../vcloud/director/v1_5/domain/InstantiationParams.java | 2 -- .../vcloud/director/v1_5/domain/ResourceEntityType.java | 8 +++----- .../org/jclouds/vcloud/director/v1_5/domain/Task.java | 9 ++++----- .../vcloud/director/v1_5/domain/VAppTemplate.java | 2 -- .../director/v1_5/features/TaskClientExpectTest.java | 4 ++-- .../vcloud/director/v1_5/features/VdcClientLiveTest.java | 2 +- 8 files changed, 10 insertions(+), 21 deletions(-) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AbstractVAppType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AbstractVAppType.java index 18e7963dcc..b25b64cb15 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AbstractVAppType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AbstractVAppType.java @@ -33,11 +33,9 @@ import javax.xml.bind.annotation.XmlType; import org.jclouds.dmtf.ovf.DeploymentOptionSection; import org.jclouds.dmtf.ovf.DiskSection; import org.jclouds.dmtf.ovf.NetworkSection; -import org.jclouds.dmtf.ovf.OperatingSystemSection; import org.jclouds.dmtf.ovf.ProductSection; import org.jclouds.dmtf.ovf.SectionType; import org.jclouds.dmtf.ovf.StartupSection; -import org.jclouds.dmtf.ovf.VirtualHardwareSection; import com.google.common.base.Objects; import com.google.common.base.Objects.ToStringHelper; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CaptureVAppParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CaptureVAppParams.java index 8a0093365c..4836a09b6c 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CaptureVAppParams.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CaptureVAppParams.java @@ -34,11 +34,9 @@ import javax.xml.bind.annotation.XmlType; import org.jclouds.dmtf.ovf.DeploymentOptionSection; import org.jclouds.dmtf.ovf.DiskSection; import org.jclouds.dmtf.ovf.NetworkSection; -import org.jclouds.dmtf.ovf.OperatingSystemSection; import org.jclouds.dmtf.ovf.ProductSection; import org.jclouds.dmtf.ovf.SectionType; import org.jclouds.dmtf.ovf.StartupSection; -import org.jclouds.dmtf.ovf.VirtualHardwareSection; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiationParams.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiationParams.java index be4b74b9d0..c3e3e59255 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiationParams.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/InstantiationParams.java @@ -32,11 +32,9 @@ import javax.xml.bind.annotation.XmlType; import org.jclouds.dmtf.ovf.DeploymentOptionSection; import org.jclouds.dmtf.ovf.DiskSection; import org.jclouds.dmtf.ovf.NetworkSection; -import org.jclouds.dmtf.ovf.OperatingSystemSection; import org.jclouds.dmtf.ovf.ProductSection; import org.jclouds.dmtf.ovf.SectionType; import org.jclouds.dmtf.ovf.StartupSection; -import org.jclouds.dmtf.ovf.VirtualHardwareSection; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceEntityType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceEntityType.java index b0d4fbed5f..ff3b64de00 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceEntityType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceEntityType.java @@ -51,12 +51,12 @@ import com.google.common.collect.Iterables; @XmlType(name = "ResourceEntityType") public abstract class ResourceEntityType extends EntityType { - @XmlType + @XmlType(name = "ResourceEntityTypeStatus") @XmlEnum(Integer.class) public static enum Status { @XmlEnumValue("-1") FAILED_CREATION(-1, "The object could not be created.", true, true, true), - @XmlEnumValue("0") UNRESOLVED(0, "The object is unresolved.", true, true, true), + @XmlEnumValue("0") UNRESOLVED(0, "The object is unresolved or not ready.", true, true, true), @XmlEnumValue("1") RESOLVED(1, "The object is resolved.", true, true, true), @XmlEnumValue("2") DEPLOYED(2, "The object is deployed.", false, false, false), @XmlEnumValue("3") SUSPENDED(3, "The object is suspended.", false, true, true), @@ -73,10 +73,8 @@ public abstract class ResourceEntityType extends EntityType { @XmlEnumValue("14") UPLOAD_QUARANTINED(14, "Upload has been quarantined.", true, false, false), @XmlEnumValue("15") UPLOAD_QUARANTINE_EXPIRED(15, "Upload quarantine period has expired.", true, false, false), - // TODO duplicate code, but mentioned in `POST /vdc/{id}/action/uploadVAppTemplate` - NOT_READY(0, "Not ready", true, false, false), // Convention is "UNRECOGNIZED", but that is already a valid state name! so using UNRECOGNIZED_VALUE - UNRECOGNIZED_VALUE(404, "Unrecognized", false, false, false); + @XmlEnumValue("65535") UNRECOGNIZED_VALUE(65535, "Unrecognized", false, false, false); private Integer value; private String description; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Task.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Task.java index 35536b1180..293811e34c 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Task.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Task.java @@ -57,14 +57,14 @@ public class Task extends EntityType { public static final String MEDIA_TYPE = VCloudDirectorMediaType.TASK; - @XmlType + @XmlType(name = "TaskStatus") @XmlEnum(String.class) public static enum Status { /** The task has been queued for execution. */ @XmlEnumValue("queued") QUEUED("queued"), /** The task is awaiting preprocessing or, if it is a blocking task, administrative action. */ @XmlEnumValue("preRunning") PRE_RUNNING("preRunning"), - /** The task is runnning.*/ + /** The task is runnning. */ @XmlEnumValue("running") RUNNING("running"), /** The task completed with a status of success. */ @XmlEnumValue("success") SUCCESS("success"), @@ -74,10 +74,9 @@ public class Task extends EntityType { @XmlEnumValue("canceled") CANCELED("canceled"), /** The task was aborted by an administrative action. */ @XmlEnumValue("aborted") ABORTED("aborted"), - UNRECOGNIZED("unrecognized"); + @XmlEnumValue("") UNRECOGNIZED("unrecognized"); - public static final List ALL = ImmutableList.of( - QUEUED, PRE_RUNNING, RUNNING, SUCCESS, ERROR, CANCELED, ABORTED); + public static final List ALL = ImmutableList.of(QUEUED, PRE_RUNNING, RUNNING, SUCCESS, ERROR, CANCELED, ABORTED); protected final String stringValue; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplate.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplate.java index 8b24e38410..76813ab1db 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplate.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/VAppTemplate.java @@ -34,11 +34,9 @@ import javax.xml.bind.annotation.XmlRootElement; import org.jclouds.dmtf.ovf.DeploymentOptionSection; import org.jclouds.dmtf.ovf.DiskSection; import org.jclouds.dmtf.ovf.NetworkSection; -import org.jclouds.dmtf.ovf.OperatingSystemSection; import org.jclouds.dmtf.ovf.ProductSection; import org.jclouds.dmtf.ovf.SectionType; import org.jclouds.dmtf.ovf.StartupSection; -import org.jclouds.dmtf.ovf.VirtualHardwareSection; import com.google.common.base.Objects; import com.google.common.collect.ImmutableSet; diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/TaskClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/TaskClientExpectTest.java index 5539424c47..f62745bf1e 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/TaskClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/TaskClientExpectTest.java @@ -82,11 +82,11 @@ public class TaskClientExpectTest extends VCloudDirectorAdminClientExpectTest { .name("Tasks Lists") .type("application/vnd.vmware.vcloud.tasksList+xml") .href(URI.create("https://vcloudbeta.bluelock.com/api/tasksList/6f312e42-cd2b-488d-a2bb-97519cd57ed0")) - .task(taskTwo()) .task(taskOne()) + .task(taskTwo()) .build(); - assertEquals(client.getTaskClient().getTaskList(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")).toString(), expected.toString()); + assertEquals(client.getTaskClient().getTaskList(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")), expected); } @Test diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcClientLiveTest.java index 7fc9150eb1..7ae512dc31 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcClientLiveTest.java @@ -304,7 +304,7 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest { assertEquals(uploadedVAppTemplate.getName(), name, String.format(OBJ_FIELD_EQ, "VAppTemplate", "name", name, uploadedVAppTemplate.getName())); - ResourceEntityType.Status expectedStatus = ResourceEntityType.Status.NOT_READY; + ResourceEntityType.Status expectedStatus = ResourceEntityType.Status.UNRESOLVED; ResourceEntityType.Status actualStatus = uploadedVAppTemplate.getStatus(); assertEquals(actualStatus, expectedStatus, String.format(OBJ_FIELD_EQ, "VAppTemplate", "status", expectedStatus, actualStatus));