Corrections to fix expect and live test errors, including JAXB type naming for enumerations

This commit is contained in:
Andrew Donald Kennedy 2012-04-11 01:00:02 +01:00
parent 4de062c636
commit ef66989727
8 changed files with 10 additions and 21 deletions

View File

@ -33,11 +33,9 @@ import javax.xml.bind.annotation.XmlType;
import org.jclouds.dmtf.ovf.DeploymentOptionSection; import org.jclouds.dmtf.ovf.DeploymentOptionSection;
import org.jclouds.dmtf.ovf.DiskSection; import org.jclouds.dmtf.ovf.DiskSection;
import org.jclouds.dmtf.ovf.NetworkSection; import org.jclouds.dmtf.ovf.NetworkSection;
import org.jclouds.dmtf.ovf.OperatingSystemSection;
import org.jclouds.dmtf.ovf.ProductSection; import org.jclouds.dmtf.ovf.ProductSection;
import org.jclouds.dmtf.ovf.SectionType; import org.jclouds.dmtf.ovf.SectionType;
import org.jclouds.dmtf.ovf.StartupSection; import org.jclouds.dmtf.ovf.StartupSection;
import org.jclouds.dmtf.ovf.VirtualHardwareSection;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper; import com.google.common.base.Objects.ToStringHelper;

View File

@ -34,11 +34,9 @@ import javax.xml.bind.annotation.XmlType;
import org.jclouds.dmtf.ovf.DeploymentOptionSection; import org.jclouds.dmtf.ovf.DeploymentOptionSection;
import org.jclouds.dmtf.ovf.DiskSection; import org.jclouds.dmtf.ovf.DiskSection;
import org.jclouds.dmtf.ovf.NetworkSection; import org.jclouds.dmtf.ovf.NetworkSection;
import org.jclouds.dmtf.ovf.OperatingSystemSection;
import org.jclouds.dmtf.ovf.ProductSection; import org.jclouds.dmtf.ovf.ProductSection;
import org.jclouds.dmtf.ovf.SectionType; import org.jclouds.dmtf.ovf.SectionType;
import org.jclouds.dmtf.ovf.StartupSection; import org.jclouds.dmtf.ovf.StartupSection;
import org.jclouds.dmtf.ovf.VirtualHardwareSection;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;

View File

@ -32,11 +32,9 @@ import javax.xml.bind.annotation.XmlType;
import org.jclouds.dmtf.ovf.DeploymentOptionSection; import org.jclouds.dmtf.ovf.DeploymentOptionSection;
import org.jclouds.dmtf.ovf.DiskSection; import org.jclouds.dmtf.ovf.DiskSection;
import org.jclouds.dmtf.ovf.NetworkSection; import org.jclouds.dmtf.ovf.NetworkSection;
import org.jclouds.dmtf.ovf.OperatingSystemSection;
import org.jclouds.dmtf.ovf.ProductSection; import org.jclouds.dmtf.ovf.ProductSection;
import org.jclouds.dmtf.ovf.SectionType; import org.jclouds.dmtf.ovf.SectionType;
import org.jclouds.dmtf.ovf.StartupSection; import org.jclouds.dmtf.ovf.StartupSection;
import org.jclouds.dmtf.ovf.VirtualHardwareSection;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;

View File

@ -51,12 +51,12 @@ import com.google.common.collect.Iterables;
@XmlType(name = "ResourceEntityType") @XmlType(name = "ResourceEntityType")
public abstract class ResourceEntityType extends EntityType { public abstract class ResourceEntityType extends EntityType {
@XmlType @XmlType(name = "ResourceEntityTypeStatus")
@XmlEnum(Integer.class) @XmlEnum(Integer.class)
public static enum Status { public static enum Status {
@XmlEnumValue("-1") FAILED_CREATION(-1, "The object could not be created.", true, true, true), @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("1") RESOLVED(1, "The object is resolved.", true, true, true),
@XmlEnumValue("2") DEPLOYED(2, "The object is deployed.", false, false, false), @XmlEnumValue("2") DEPLOYED(2, "The object is deployed.", false, false, false),
@XmlEnumValue("3") SUSPENDED(3, "The object is suspended.", false, true, true), @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("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), @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 // 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 Integer value;
private String description; private String description;

View File

@ -57,14 +57,14 @@ public class Task extends EntityType {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.TASK; public static final String MEDIA_TYPE = VCloudDirectorMediaType.TASK;
@XmlType @XmlType(name = "TaskStatus")
@XmlEnum(String.class) @XmlEnum(String.class)
public static enum Status { public static enum Status {
/** The task has been queued for execution. */ /** The task has been queued for execution. */
@XmlEnumValue("queued") QUEUED("queued"), @XmlEnumValue("queued") QUEUED("queued"),
/** The task is awaiting preprocessing or, if it is a blocking task, administrative action. */ /** The task is awaiting preprocessing or, if it is a blocking task, administrative action. */
@XmlEnumValue("preRunning") PRE_RUNNING("preRunning"), @XmlEnumValue("preRunning") PRE_RUNNING("preRunning"),
/** The task is runnning.*/ /** The task is runnning. */
@XmlEnumValue("running") RUNNING("running"), @XmlEnumValue("running") RUNNING("running"),
/** The task completed with a status of success. */ /** The task completed with a status of success. */
@XmlEnumValue("success") SUCCESS("success"), @XmlEnumValue("success") SUCCESS("success"),
@ -74,10 +74,9 @@ public class Task extends EntityType {
@XmlEnumValue("canceled") CANCELED("canceled"), @XmlEnumValue("canceled") CANCELED("canceled"),
/** The task was aborted by an administrative action. */ /** The task was aborted by an administrative action. */
@XmlEnumValue("aborted") ABORTED("aborted"), @XmlEnumValue("aborted") ABORTED("aborted"),
UNRECOGNIZED("unrecognized"); @XmlEnumValue("") UNRECOGNIZED("unrecognized");
public static final List<Status> ALL = ImmutableList.of( public static final List<Status> ALL = ImmutableList.of(QUEUED, PRE_RUNNING, RUNNING, SUCCESS, ERROR, CANCELED, ABORTED);
QUEUED, PRE_RUNNING, RUNNING, SUCCESS, ERROR, CANCELED, ABORTED);
protected final String stringValue; protected final String stringValue;

View File

@ -34,11 +34,9 @@ import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.dmtf.ovf.DeploymentOptionSection; import org.jclouds.dmtf.ovf.DeploymentOptionSection;
import org.jclouds.dmtf.ovf.DiskSection; import org.jclouds.dmtf.ovf.DiskSection;
import org.jclouds.dmtf.ovf.NetworkSection; import org.jclouds.dmtf.ovf.NetworkSection;
import org.jclouds.dmtf.ovf.OperatingSystemSection;
import org.jclouds.dmtf.ovf.ProductSection; import org.jclouds.dmtf.ovf.ProductSection;
import org.jclouds.dmtf.ovf.SectionType; import org.jclouds.dmtf.ovf.SectionType;
import org.jclouds.dmtf.ovf.StartupSection; import org.jclouds.dmtf.ovf.StartupSection;
import org.jclouds.dmtf.ovf.VirtualHardwareSection;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;

View File

@ -82,11 +82,11 @@ public class TaskClientExpectTest extends VCloudDirectorAdminClientExpectTest {
.name("Tasks Lists") .name("Tasks Lists")
.type("application/vnd.vmware.vcloud.tasksList+xml") .type("application/vnd.vmware.vcloud.tasksList+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/tasksList/6f312e42-cd2b-488d-a2bb-97519cd57ed0")) .href(URI.create("https://vcloudbeta.bluelock.com/api/tasksList/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
.task(taskTwo())
.task(taskOne()) .task(taskOne())
.task(taskTwo())
.build(); .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 @Test

View File

@ -304,7 +304,7 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
assertEquals(uploadedVAppTemplate.getName(), name, assertEquals(uploadedVAppTemplate.getName(), name,
String.format(OBJ_FIELD_EQ, "VAppTemplate", "name", name, uploadedVAppTemplate.getName())); 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(); ResourceEntityType.Status actualStatus = uploadedVAppTemplate.getStatus();
assertEquals(actualStatus, expectedStatus, assertEquals(actualStatus, expectedStatus,
String.format(OBJ_FIELD_EQ, "VAppTemplate", "status", expectedStatus, actualStatus)); String.format(OBJ_FIELD_EQ, "VAppTemplate", "status", expectedStatus, actualStatus));