Issue 830: Rename RASD to ResourceAllocationSettingData and change RASD and VSSD domain objects to OVF namespace

This commit is contained in:
Andrew Donald Kennedy 2012-03-19 13:58:23 +00:00
parent 6846dad9fc
commit 3e114c7b2e
17 changed files with 463 additions and 1490 deletions

View File

@ -161,9 +161,6 @@ public class CustomizationSection extends SectionType {
/**
* Gets the value of the href property.
*
* @return possible object is
* {@link String }
*/
public URI getHref() {
return href;
@ -171,9 +168,6 @@ public class CustomizationSection extends SectionType {
/**
* Gets the value of the type property.
*
* @return possible object is
* {@link String }
*/
public String getType() {
return type;

View File

@ -99,6 +99,14 @@ public class NetworkConnectionSection extends SectionType {
return self();
}
/**
* @see NetworkConnectionSection#getLinks()
*/
public B link(Link link) {
this.links.add(checkNotNull(link, "link"));
return self();
}
/**
* @see NetworkConnectionSection#getHref()
*/
@ -133,8 +141,8 @@ public class NetworkConnectionSection extends SectionType {
private NetworkConnectionSection(Builder<?> builder) {
super(builder);
this.primaryNetworkConnectionIndex = builder.primaryNetworkConnectionIndex;
this.networkConnections = ImmutableSet.copyOf(builder.networkConnections);
this.links = ImmutableSet.copyOf(builder.links);
this.networkConnections = builder.networkConnections != null ? ImmutableSet.copyOf(builder.networkConnections) : Sets.<NetworkConnection>newLinkedHashSet();
this.links = builder.links != null ? ImmutableSet.copyOf(builder.links) : Sets.<Link>newLinkedHashSet();
this.href = builder.href;
this.type = builder.type;
}
@ -166,20 +174,16 @@ public class NetworkConnectionSection extends SectionType {
/**
* Gets the value of the networkConnection property.
* <p/>
* Objects of the following type(s) are allowed in the list {@link NetworkConnection }
*/
public Set<NetworkConnection> getNetworkConnections() {
return Collections.unmodifiableSet(this.networkConnections);
return ImmutableSet.copyOf(networkConnections);
}
/**
* Gets the value of the link property.
* <p/>
* Objects of the following type(s) are allowed in the list {@link Link }
*/
public Set<Link> getLinks() {
return Collections.unmodifiableSet(this.links);
return ImmutableSet.copyOf(links);
}
/**
@ -207,8 +211,10 @@ public class NetworkConnectionSection extends SectionType {
NetworkConnectionSection that = NetworkConnectionSection.class.cast(o);
return super.equals(that) &&
equal(primaryNetworkConnectionIndex, that.primaryNetworkConnectionIndex) &&
equal(networkConnections, that.networkConnections) && equal(links, that.links) &&
equal(href, that.href) && equal(type, that.type);
equal(networkConnections, that.networkConnections) &&
equal(links, that.links) &&
equal(href, that.href) &&
equal(type, that.type);
}
@Override

View File

@ -27,7 +27,7 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.RASD;
import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
@ -59,12 +59,12 @@ public class RasdItemsList extends ResourceType {
public static abstract class Builder<B extends Builder<B>> extends ResourceType.Builder<B> {
private List<RASD> items = Lists.newArrayList();
private List<ResourceAllocationSettingData> items = Lists.newArrayList();
/**
* @see RasdItemsList#getItems()
*/
public B items(List<RASD> items) {
public B items(List<ResourceAllocationSettingData> items) {
this.items = checkNotNull(items, "items");
return self();
}
@ -72,7 +72,7 @@ public class RasdItemsList extends ResourceType {
/**
* @see RasdItemsList#getItems()
*/
public B item(RASD item) {
public B item(ResourceAllocationSettingData item) {
this.items.add(checkNotNull(item, "item"));
return self();
}
@ -98,12 +98,12 @@ public class RasdItemsList extends ResourceType {
}
@XmlElement(name = "Item")
protected List<RASD> items = Lists.newArrayList();
protected List<ResourceAllocationSettingData> items = Lists.newArrayList();
/**
* A RASD item content.
*/
public List<RASD> getItems() {
public List<ResourceAllocationSettingData> getItems() {
return items;
}

View File

@ -20,8 +20,13 @@ package org.jclouds.vcloud.director.v1_5.domain.cim;
import static com.google.common.base.Objects.equal;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
import javax.xml.namespace.QName;
import com.google.common.base.Objects;
@ -45,6 +50,8 @@ public class CimString {
@XmlValue
protected String value;
@XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
/**
* Gets the value of the value property.
@ -57,6 +64,13 @@ public class CimString {
this.value = value;
}
/**
* Gets a map that contains attributes that aren't bound to any typed property on this class.
*/
public Map<QName, String> getOtherAttributes() {
return otherAttributes;
}
@Override
public int hashCode() {
return Objects.hashCode(value);

View File

@ -22,7 +22,9 @@ import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_RASD_NS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import java.math.BigInteger;
import java.net.URI;
import java.util.Collections;
import java.util.List;
@ -33,6 +35,7 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.vcloud.director.v1_5.domain.Link;
@ -60,7 +63,35 @@ import com.google.common.collect.Sets;
* @author grkvlt@apache.org
* @see http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd
*/
@XmlType(name = "CIM_ResourceAllocationSettingData_Type", namespace = VCLOUD_CIM_RASD_NS)
@XmlRootElement(name = "Item", namespace = VCLOUD_1_5_NS)
@XmlType(name = "CIM_ResourceAllocationSettingData_Type", namespace = VCLOUD_OVF_NS,
propOrder = {
"address",
"addressOnParent",
"allocationUnits",
"automaticAllocation",
"automaticDeallocation",
"caption",
"connections",
"consumerVisibility",
"description",
"elementName",
"hostResources",
"instanceID",
"limit",
"mappingBehavior",
"otherResourceType",
"parent",
"poolID",
"reservation",
"resourceSubType",
"resourceType",
"virtualQuantity",
"virtualQuantityUnits",
"weight",
"links"
}
)
public class ResourceAllocationSettingData {
public static Builder builder() {
@ -73,37 +104,37 @@ public class ResourceAllocationSettingData {
public static class Builder {
protected CimString elementName;
protected CimString instanceID;
protected CimString caption;
protected CimString description;
protected CimString address;
protected CimString addressOnParent;
protected CimString allocationUnits;
protected CimBoolean automaticAllocation;
protected CimBoolean automaticDeallocation;
protected ConsumerVisibility consumerVisibility;
protected CimUnsignedLong limit;
protected MappingBehavior mappingBehavior;
protected CimString otherResourceType;
protected CimString parent;
protected CimString poolID;
protected CimUnsignedLong reservation;
protected CimString resourceSubType;
protected ResourceType resourceType;
protected CimUnsignedLong virtualQuantity;
protected CimString virtualQuantityUnits;
protected CimUnsignedInt weight;
protected List<CimString> connections = Lists.newArrayList();
protected List<CimString> hostResources = Lists.newArrayList();
protected URI href;
protected String type;
private String elementName;
private String instanceID;
private String caption;
private String description;
private String address;
private String addressOnParent;
private String allocationUnits;
private Boolean automaticAllocation;
private Boolean automaticDeallocation;
private ConsumerVisibility consumerVisibility;
private BigInteger limit;
private MappingBehavior mappingBehavior;
private String otherResourceType;
private String parent;
private String poolID;
private BigInteger reservation;
private String resourceSubType;
private ResourceType resourceType;
private BigInteger virtualQuantity;
private String virtualQuantityUnits;
private Long weight;
private List<CimString> connections = Lists.newArrayList();
private List<CimString> hostResources = Lists.newArrayList();
private URI href;
private String type;
private Set<Link> links = Sets.newLinkedHashSet();
/**
* @see ResourceAllocationSettingData#getElementName()
*/
public Builder elementName(CimString elementName) {
public Builder elementName(String elementName) {
this.elementName = elementName;
return this;
}
@ -111,7 +142,7 @@ public class ResourceAllocationSettingData {
/**
*@see ResourceAllocationSettingData#getInstanceId()
*/
public Builder instanceID(CimString instanceID) {
public Builder instanceID(String instanceID) {
this.instanceID = instanceID;
return this;
}
@ -119,7 +150,7 @@ public class ResourceAllocationSettingData {
/**
* @see ResourceAllocationSettingData#getCaption()
*/
public Builder caption(CimString caption) {
public Builder caption(String caption) {
this.caption = caption;
return this;
}
@ -127,7 +158,7 @@ public class ResourceAllocationSettingData {
/**
* @see ResourceAllocationSettingData#getDescription()
*/
public Builder description(CimString description) {
public Builder description(String description) {
this.description = description;
return this;
}
@ -135,7 +166,7 @@ public class ResourceAllocationSettingData {
/**
* @see ResourceAllocationSettingData#getAddress
*/
public Builder address(CimString address) {
public Builder address(String address) {
this.address = address;
return this;
}
@ -143,7 +174,7 @@ public class ResourceAllocationSettingData {
/**
* @see ResourceAllocationSettingData#getAddressOnParent
*/
public Builder addressOnParent(CimString addressOnParent) {
public Builder addressOnParent(String addressOnParent) {
this.addressOnParent = addressOnParent;
return this;
}
@ -151,7 +182,7 @@ public class ResourceAllocationSettingData {
/**
* @see ResourceAllocationSettingData#getAllocationUnits
*/
public Builder allocationUnits(CimString allocationUnits) {
public Builder allocationUnits(String allocationUnits) {
this.allocationUnits = allocationUnits;
return this;
}
@ -159,7 +190,7 @@ public class ResourceAllocationSettingData {
/**
* @see ResourceAllocationSettingData#isAutomaticAllocation()
*/
public Builder automaticAllocation(CimBoolean automaticAllocation) {
public Builder automaticAllocation(Boolean automaticAllocation) {
this.automaticAllocation = automaticAllocation;
return this;
}
@ -167,7 +198,7 @@ public class ResourceAllocationSettingData {
/**
* @see ResourceAllocationSettingData#isAutomaticDeallocation()
*/
public Builder automaticDeallocation(CimBoolean automaticDeallocation) {
public Builder automaticDeallocation(Boolean automaticDeallocation) {
this.automaticDeallocation = automaticDeallocation;
return this;
}
@ -183,7 +214,7 @@ public class ResourceAllocationSettingData {
/**
* @see ResourceAllocationSettingData#getLimit
*/
public Builder limit(CimUnsignedLong limit) {
public Builder limit(BigInteger limit) {
this.limit = limit;
return this;
}
@ -199,7 +230,7 @@ public class ResourceAllocationSettingData {
/**
* @see ResourceAllocationSettingData#getOtherResourceType
*/
public Builder otherResourceType(CimString otherResourceType) {
public Builder otherResourceType(String otherResourceType) {
this.otherResourceType = otherResourceType;
return this;
}
@ -207,7 +238,7 @@ public class ResourceAllocationSettingData {
/**
* @see ResourceAllocationSettingData#getParent
*/
public Builder parent(CimString parent) {
public Builder parent(String parent) {
this.parent = parent;
return this;
}
@ -215,7 +246,7 @@ public class ResourceAllocationSettingData {
/**
* @see ResourceAllocationSettingData#getPoolID
*/
public Builder poolID(CimString poolID) {
public Builder poolID(String poolID) {
this.poolID = poolID;
return this;
}
@ -223,7 +254,7 @@ public class ResourceAllocationSettingData {
/**
* @see ResourceAllocationSettingData#getReservation
*/
public Builder reservation(CimUnsignedLong reservation) {
public Builder reservation(BigInteger reservation) {
this.reservation = reservation;
return this;
}
@ -231,7 +262,7 @@ public class ResourceAllocationSettingData {
/**
* @see ResourceAllocationSettingData#getResourceSubType
*/
public Builder resourceSubType(CimString resourceSubType) {
public Builder resourceSubType(String resourceSubType) {
this.resourceSubType = resourceSubType;
return this;
}
@ -247,7 +278,7 @@ public class ResourceAllocationSettingData {
/**
* @see ResourceAllocationSettingData#getVirtualQuantity
*/
public Builder virtualQuantity(CimUnsignedLong virtualQuantity) {
public Builder virtualQuantity(BigInteger virtualQuantity) {
this.virtualQuantity = virtualQuantity;
return this;
}
@ -255,7 +286,7 @@ public class ResourceAllocationSettingData {
/**
* @see ResourceAllocationSettingData#getVirtualQuantityUnits
*/
public Builder virtualQuantityUnits(CimString virtualQuantityUnits) {
public Builder virtualQuantityUnits(String virtualQuantityUnits) {
this.virtualQuantityUnits = virtualQuantityUnits;
return this;
}
@ -263,7 +294,7 @@ public class ResourceAllocationSettingData {
/**
* @see ResourceAllocationSettingData#getWeight
*/
public Builder weight(CimUnsignedInt weight) {
public Builder weight(Long weight) {
this.weight = weight;
return this;
}
@ -276,14 +307,6 @@ public class ResourceAllocationSettingData {
return this;
}
/**
* @see ResourceAllocationSettingData#getHostResources()
*/
public Builder hostResource(CimString hostResource) {
this.hostResources.add(checkNotNull(hostResource, "hostResource"));
return this;
}
/**
* @see ResourceAllocationSettingData#getConnections
*/
@ -292,6 +315,14 @@ public class ResourceAllocationSettingData {
return this;
}
/**
* @see ResourceAllocationSettingData#getHostResources()
*/
public Builder hostResource(CimString hostResource) {
this.hostResources.add(checkNotNull(hostResource, "hostResource"));
return this;
}
/**
* @see ResourceAllocationSettingData#getHostResources
*/
@ -528,66 +559,68 @@ public class ResourceAllocationSettingData {
return MAPPING_BEHAVIOR_BY_ID.get(Integer.valueOf(checkNotNull(behavior, "behavior")));
}
}
// <rasd:Elementname>foo</rasd:ElementName>
@XmlElement(name = "ElementName", namespace = VCLOUD_CIM_RASD_NS)
protected CimString elementName;
private String elementName;
@XmlElement(name = "InstanceID", namespace = VCLOUD_CIM_RASD_NS)
protected CimString instanceID;
private String instanceID;
@XmlElement(name = "Caption", namespace = VCLOUD_CIM_RASD_NS)
protected CimString caption;
private String caption;
@XmlElement(name = "Description", namespace = VCLOUD_CIM_RASD_NS)
protected CimString description;
private String description;
@XmlElement(name = "Address", namespace = VCLOUD_CIM_RASD_NS)
protected CimString address;
private String address;
@XmlElement(name = "AddressOnParent", namespace = VCLOUD_CIM_RASD_NS)
protected CimString addressOnParent;
private String addressOnParent;
@XmlElement(name = "AllocationUnits", namespace = VCLOUD_CIM_RASD_NS)
protected CimString allocationUnits;
private String allocationUnits;
@XmlElement(name = "AutomaticAllocation", namespace = VCLOUD_CIM_RASD_NS)
protected CimBoolean automaticAllocation;
private Boolean automaticAllocation;
@XmlElement(name = "AutomaticDeallocation", namespace = VCLOUD_CIM_RASD_NS)
protected CimBoolean automaticDeallocation;
private Boolean automaticDeallocation;
@XmlElement(name = "ConsumerVisibility", namespace = VCLOUD_CIM_RASD_NS)
protected ConsumerVisibility consumerVisibility;
private ConsumerVisibility consumerVisibility;
@XmlElement(name = "Limit", namespace = VCLOUD_CIM_RASD_NS)
protected CimUnsignedLong limit;
private BigInteger limit;
@XmlElement(name = "MappingBehavior", namespace = VCLOUD_CIM_RASD_NS)
protected MappingBehavior mappingBehavior;
private MappingBehavior mappingBehavior;
@XmlElement(name = "OtherResourceType", namespace = VCLOUD_CIM_RASD_NS)
protected CimString otherResourceType;
private String otherResourceType;
@XmlElement(name = "Parent", namespace = VCLOUD_CIM_RASD_NS)
protected CimString parent;
private String parent;
@XmlElement(name = "PoolID", namespace = VCLOUD_CIM_RASD_NS)
protected CimString poolID;
private String poolID;
@XmlElement(name = "Reservation", namespace = VCLOUD_CIM_RASD_NS)
protected CimUnsignedLong reservation;
private BigInteger reservation;
@XmlElement(name = "ResourceSubType", namespace = VCLOUD_CIM_RASD_NS)
protected CimString resourceSubType;
private String resourceSubType;
@XmlElement(name = "ResourceType", namespace = VCLOUD_CIM_RASD_NS)
protected ResourceType resourceType;
private ResourceType resourceType;
@XmlElement(name = "VirtualQuantity", namespace = VCLOUD_CIM_RASD_NS)
protected CimUnsignedLong virtualQuantity;
private BigInteger virtualQuantity;
@XmlElement(name = "VirtualQuantityUnits", namespace = VCLOUD_CIM_RASD_NS)
protected CimString virtualQuantityUnits;
private String virtualQuantityUnits;
@XmlElement(name = "Weight", namespace = VCLOUD_CIM_RASD_NS)
protected CimUnsignedInt weight;
private Long weight;
@XmlElement(name = "Connection", namespace = VCLOUD_CIM_RASD_NS)
protected List<CimString> connections;
private List<CimString> connections = Lists.newArrayList();
@XmlElement(name = "HostResource", namespace = VCLOUD_CIM_RASD_NS)
protected List<CimString> hostResources;
private List<CimString> hostResources = Lists.newArrayList();
@XmlAttribute(name = "type", namespace = VCLOUD_1_5_NS)
protected String type;
private String type;
@XmlAttribute(name = "href", namespace = VCLOUD_1_5_NS)
protected URI href;
private URI href;
@XmlElement(name = "Link", namespace = VCLOUD_1_5_NS)
private Set<Link> links = Sets.newLinkedHashSet();
private ResourceAllocationSettingData(CimString elementName, CimString instanceID, CimString caption, CimString description,
CimString address, CimString addressOnParent, CimString allocationUnits, CimBoolean automaticAllocation,
CimBoolean automaticDeallocation, ConsumerVisibility consumerVisibility, CimUnsignedLong limit,
MappingBehavior mappingBehavior, CimString otherResourceType, CimString parent, CimString poolID, CimUnsignedLong reservation,
CimString resourceSubType, ResourceType resourceType, CimUnsignedLong virtualQuantity, CimString virtualQuantityUnits,
CimUnsignedInt weight, List<CimString> connections, List<CimString> hostResources, String type, URI href, Set<Link> links) {
private ResourceAllocationSettingData(String elementName, String instanceID, String caption, String description,
String address, String addressOnParent, String allocationUnits, Boolean automaticAllocation,
Boolean automaticDeallocation, ConsumerVisibility consumerVisibility, BigInteger limit,
MappingBehavior mappingBehavior, String otherResourceType, String parent, String poolID, BigInteger reservation,
String resourceSubType, ResourceType resourceType, BigInteger virtualQuantity, String virtualQuantityUnits,
Long weight, List<CimString> connections, List<CimString> hostResources, String type, URI href, Set<Link> links) {
this.elementName = elementName;
this.instanceID = instanceID;
this.caption = caption;
@ -625,7 +658,7 @@ public class ResourceAllocationSettingData {
* can be used as an index property for a search or query. (Note: The name does not have to be
* unique within a namespace.)
*/
public CimString getElementName() {
public String getElementName() {
return elementName;
}
@ -633,21 +666,21 @@ public class ResourceAllocationSettingData {
* Within the scope of the instantiating Namespace, InstanceID opaquely and uniquely identifies
* an instance of this class.
*/
public CimString getInstanceID() {
public String getInstanceID() {
return instanceID;
}
/**
* The Caption property is a short textual description (one- line string) of the object.
*/
public CimString getCaption() {
public String getCaption() {
return caption;
}
/**
* The Description property provides a textual description of the object.
*/
public CimString getDescription() {
public String getDescription() {
return description;
}
@ -655,7 +688,7 @@ public class ResourceAllocationSettingData {
* The address of the resource. For example, the MAC address of a Ethernet
* port.
*/
public CimString getAddress() {
public String getAddress() {
return address;
}
@ -666,7 +699,7 @@ public class ResourceAllocationSettingData {
* if the parent is a PCI Controller, this property would specify the PCI
* slot of this child device.
*/
public CimString getAddressOnParent() {
public String getAddressOnParent() {
return addressOnParent;
}
@ -680,7 +713,7 @@ public class ResourceAllocationSettingData {
* value of the Programmatic Units qualifier as defined in Annex C.1 of
* DSP0004 V2.5 or later.
*/
public CimString getAllocationUnits() {
public String getAllocationUnits() {
return allocationUnits;
}
@ -693,7 +726,7 @@ public class ResourceAllocationSettingData {
* on time, the media is not present. An explicit operation is required to
* allocate the resource.
*/
public CimBoolean isAutomaticAllocation() {
public Boolean isAutomaticAllocation() {
return automaticAllocation;
}
@ -704,7 +737,7 @@ public class ResourceAllocationSettingData {
* set to false, the resource will remain allocated and must be explicitly
* de-allocated.
*/
public CimBoolean isAutomaticDeallocation() {
public Boolean isAutomaticDeallocation() {
return automaticDeallocation;
}
@ -723,7 +756,7 @@ public class ResourceAllocationSettingData {
* for this allocation. The value of the Limit property is expressed in the
* unit specified by the value of the AllocationUnits property.
*/
public CimUnsignedLong getLimit() {
public BigInteger getLimit() {
return limit;
}
@ -740,7 +773,7 @@ public class ResourceAllocationSettingData {
* A string that describes the resource type when a well defined value is not
* available and ResourceType has the value "Other".
*/
public CimString getOtherResourceType() {
public String getOtherResourceType() {
return otherResourceType;
}
@ -748,7 +781,7 @@ public class ResourceAllocationSettingData {
* The Parent of the resource. For example, a controller for the current
* allocation
*/
public CimString getParent() {
public String getParent() {
return parent;
}
@ -757,7 +790,7 @@ public class ResourceAllocationSettingData {
* allocated from, or which ResourcePool the resource will be allocated from
* when the allocation occurs.
*/
public CimString getPoolID() {
public String getPoolID() {
return poolID;
}
@ -769,7 +802,7 @@ public class ResourceAllocationSettingData {
* the Reservation property is expressed in the unit specified by the value
* of the AllocationUnits property.
*/
public CimUnsignedLong getReservation() {
public BigInteger getReservation() {
return reservation;
}
@ -777,7 +810,7 @@ public class ResourceAllocationSettingData {
* A string describing an implementation specific sub-type for this resource.
* F
*/
public CimString getResourceSubType() {
public String getResourceSubType() {
return resourceSubType;
}
@ -797,7 +830,7 @@ public class ResourceAllocationSettingData {
* VirtualQuantity property should be expressed in units as defined by the
* value of the VirtualQuantityUnits property.
*/
public CimUnsignedLong getVirtualQuantity() {
public BigInteger getVirtualQuantity() {
return virtualQuantity;
}
@ -813,7 +846,7 @@ public class ResourceAllocationSettingData {
* this property shall be a legal value of the Programmatic Units qualifier
* as defined in Annex C.1 of DSP0004 V2.5 or later.
*/
public CimString getVirtualQuantityUnits() {
public String getVirtualQuantityUnits() {
return virtualQuantityUnits;
}
@ -823,7 +856,7 @@ public class ResourceAllocationSettingData {
* has no unit of measure, and is only relevant when compared to other
* allocations vying for the same host resources.
*/
public CimUnsignedInt getWeight() {
public Long getWeight() {
return weight;
}
@ -918,7 +951,7 @@ public class ResourceAllocationSettingData {
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
@ -949,7 +982,6 @@ public class ResourceAllocationSettingData {
equal(this.type, that.type) &&
equal(this.href, that.href) &&
equal(this.links, that.links);
}
}

View File

@ -21,7 +21,9 @@ package org.jclouds.vcloud.director.v1_5.domain.cim;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_VSSD_NS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import java.math.BigInteger;
import java.util.Date;
import java.util.Map;
@ -58,7 +60,7 @@ import com.google.common.collect.Maps;
* @author grkvlt@apache.org
* @see http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd
*/
@XmlType(name = "CIM_VirtualSystemSettingData_Type", namespace = VCLOUD_CIM_VSSD_NS)
@XmlType(name = "CIM_VirtualSystemSettingData_Type", namespace = VCLOUD_OVF_NS)
public class VirtualSystemSettingData {
public static Builder builder() {
@ -71,44 +73,44 @@ public class VirtualSystemSettingData {
public static class Builder {
protected CimString elementName;
protected CimString instanceID;
private CimString caption;
private CimString description;
private String elementName;
private String instanceID;
private String caption;
private String description;
private AutomaticRecoveryAction automaticRecoveryAction;
private AutomaticShutdownAction automaticShutdownAction;
private AutomaticStartupAction automaticStartupAction;
private CimUnsignedLong automaticStartupActionDelay;
private CimUnsignedInt automaticStartupActionSequenceNumber;
private CimString configurationDataRoot;
private CimString configurationFile;
private CimString configurationID;
private BigInteger automaticStartupActionDelay;
private Long automaticStartupActionSequenceNumber;
private String configurationDataRoot;
private String configurationFile;
private String configurationID;
private Date creationTime;
private CimString logDataRoot;
private CimString recoveryFile;
private CimString snapshotDataRoot;
private CimString suspendDataRoot;
private CimString swapFileDataRoot;
private CimString virtualSystemIdentifier;
private CimString virtualSystemType;
private CimString notes;
private String logDataRoot;
private String recoveryFile;
private String snapshotDataRoot;
private String suspendDataRoot;
private String swapFileDataRoot;
private String virtualSystemIdentifier;
private String virtualSystemType;
private String notes;
public Builder elementName(CimString elementName) {
public Builder elementName(String elementName) {
this.elementName = elementName;
return this;
}
public Builder instanceID(CimString instanceID) {
public Builder instanceID(String instanceID) {
this.instanceID = instanceID;
return this;
}
public Builder caption(CimString caption) {
public Builder caption(String caption) {
this.caption = caption;
return this;
}
public Builder description(CimString description) {
public Builder description(String description) {
this.description = description;
return this;
}
@ -128,27 +130,27 @@ public class VirtualSystemSettingData {
return this;
}
public Builder automaticStartupActionDelay(CimUnsignedLong automaticStartupActionDelay) {
public Builder automaticStartupActionDelay(BigInteger automaticStartupActionDelay) {
this.automaticStartupActionDelay = automaticStartupActionDelay;
return this;
}
public Builder automaticStartupActionSequenceNumber(CimUnsignedInt automaticStartupActionSequenceNumber) {
public Builder automaticStartupActionSequenceNumber(Long automaticStartupActionSequenceNumber) {
this.automaticStartupActionSequenceNumber = automaticStartupActionSequenceNumber;
return this;
}
public Builder configurationDataRoot(CimString configurationDataRoot) {
public Builder configurationDataRoot(String configurationDataRoot) {
this.configurationDataRoot = configurationDataRoot;
return this;
}
public Builder configurationFile(CimString configurationFile) {
public Builder configurationFile(String configurationFile) {
this.configurationFile = configurationFile;
return this;
}
public Builder configurationID(CimString configurationID) {
public Builder configurationID(String configurationID) {
this.configurationID = configurationID;
return this;
}
@ -158,42 +160,42 @@ public class VirtualSystemSettingData {
return this;
}
public Builder logDataRoot(CimString logDataRoot) {
public Builder logDataRoot(String logDataRoot) {
this.logDataRoot = logDataRoot;
return this;
}
public Builder recoveryFile(CimString recoveryFile) {
public Builder recoveryFile(String recoveryFile) {
this.recoveryFile = recoveryFile;
return this;
}
public Builder snapshotDataRoot(CimString snapshotDataRoot) {
public Builder snapshotDataRoot(String snapshotDataRoot) {
this.snapshotDataRoot = snapshotDataRoot;
return this;
}
public Builder suspendDataRoot(CimString suspendDataRoot) {
public Builder suspendDataRoot(String suspendDataRoot) {
this.suspendDataRoot = suspendDataRoot;
return this;
}
public Builder swapFileDataRoot(CimString swapFileDataRoot) {
public Builder swapFileDataRoot(String swapFileDataRoot) {
this.swapFileDataRoot = swapFileDataRoot;
return this;
}
public Builder virtualSystemIdentifier(CimString virtualSystemIdentifier) {
public Builder virtualSystemIdentifier(String virtualSystemIdentifier) {
this.virtualSystemIdentifier = virtualSystemIdentifier;
return this;
}
public Builder virtualSystemType(CimString virtualSystemType) {
public Builder virtualSystemType(String virtualSystemType) {
this.virtualSystemType = virtualSystemType;
return this;
}
public Builder notes(CimString notes) {
public Builder notes(String notes) {
this.notes = notes;
return this;
}
@ -338,17 +340,17 @@ public class VirtualSystemSettingData {
}
@XmlElement(name = "ElementName", namespace = VCLOUD_CIM_VSSD_NS)
protected CimString elementName;
private String elementName;
@XmlElement(name = "InstanceID", namespace = VCLOUD_CIM_VSSD_NS)
protected CimString instanceID;
private String instanceID;
@XmlElement(name = "Caption", namespace = VCLOUD_CIM_VSSD_NS)
protected CimString caption;
private String caption;
@XmlElement(name = "Description", namespace = VCLOUD_CIM_VSSD_NS)
protected CimString description;
private String description;
@XmlElement(name = "VirtualSystemIdentifier", namespace = VCLOUD_CIM_VSSD_NS)
private CimString virtualSystemIdentifier;
private String virtualSystemIdentifier;
@XmlElement(name = "VirtualSystemType", namespace = VCLOUD_CIM_VSSD_NS)
private CimString virtualSystemType;
private String virtualSystemType;
@XmlElement(name = "AutomaticRecoveryAction", namespace = VCLOUD_CIM_VSSD_NS)
private AutomaticRecoveryAction automaticRecoveryAction;
@XmlElement(name = "AutomaticShutdownAction", namespace = VCLOUD_CIM_VSSD_NS)
@ -356,37 +358,37 @@ public class VirtualSystemSettingData {
@XmlElement(name = "AutomaticStartupAction", namespace = VCLOUD_CIM_VSSD_NS)
private AutomaticStartupAction automaticStartupAction;
@XmlElement(name = "AutomaticStartupActionDelay", namespace = VCLOUD_CIM_VSSD_NS)
private CimUnsignedLong automaticStartupActionDelay;
private BigInteger automaticStartupActionDelay;
@XmlElement(name = "AutomaticStartupActionSequenceNumber", namespace = VCLOUD_CIM_VSSD_NS)
private CimUnsignedInt automaticStartupActionSequenceNumber;
private Long automaticStartupActionSequenceNumber;
@XmlElement(name = "ConfigurationDataRoot", namespace = VCLOUD_CIM_VSSD_NS)
private CimString configurationDataRoot;
private String configurationDataRoot;
@XmlElement(name = "ConfigurationFile", namespace = VCLOUD_CIM_VSSD_NS)
private CimString configurationFile;
private String configurationFile;
@XmlElement(name = "ConfigurationID", namespace = VCLOUD_CIM_VSSD_NS)
private CimString configurationID;
private String configurationID;
@XmlElement(name = "CreationTime", namespace = VCLOUD_CIM_VSSD_NS)
private Date creationTime;
@XmlElement(name = "LogDataRoot", namespace = VCLOUD_CIM_VSSD_NS)
private CimString logDataRoot;
private String logDataRoot;
@XmlElement(name = "RecoveryFile", namespace = VCLOUD_CIM_VSSD_NS)
private CimString recoveryFile;
private String recoveryFile;
@XmlElement(name = "SnapshotDataRoot", namespace = VCLOUD_CIM_VSSD_NS)
private CimString snapshotDataRoot;
private String snapshotDataRoot;
@XmlElement(name = "SuspendDataRoot", namespace = VCLOUD_CIM_VSSD_NS)
private CimString suspendDataRoot;
private String suspendDataRoot;
@XmlElement(name = "SwapFileDataRoot", namespace = VCLOUD_CIM_VSSD_NS)
private CimString swapFileDataRoot;
private String swapFileDataRoot;
@XmlElement(name = "Notes", namespace = VCLOUD_CIM_VSSD_NS)
private CimString notes;
private String notes;
private VirtualSystemSettingData(CimString elementName, CimString instanceID, CimString caption, CimString description,
private VirtualSystemSettingData(String elementName, String instanceID, String caption, String description,
AutomaticRecoveryAction automaticRecoveryAction, AutomaticShutdownAction automaticShutdownAction,
AutomaticStartupAction automaticStartupAction, CimUnsignedLong automaticStartupActionDelay,
CimUnsignedInt automaticStartupActionSequenceNumber, CimString configurationDataRoot, CimString configurationFile,
CimString configurationID, Date creationTime, CimString logDataRoot, CimString recoveryFile, CimString snapshotDataRoot,
CimString suspendDataRoot, CimString swapFileDataRoot, CimString virtualSystemIdentifier,
CimString virtualSystemType, CimString notes) {
AutomaticStartupAction automaticStartupAction, BigInteger automaticStartupActionDelay,
Long automaticStartupActionSequenceNumber, String configurationDataRoot, String configurationFile,
String configurationID, Date creationTime, String logDataRoot, String recoveryFile, String snapshotDataRoot,
String suspendDataRoot, String swapFileDataRoot, String virtualSystemIdentifier,
String virtualSystemType, String notes) {
this.elementName = elementName;
this.instanceID = instanceID;
this.caption = caption;
@ -419,7 +421,7 @@ public class VirtualSystemSettingData {
* can be used as an index property for a search or query. (Note: The name does not have to be
* unique within a namespace.)
*/
public CimString getElementName() {
public String getElementName() {
return elementName;
}
@ -427,21 +429,21 @@ public class VirtualSystemSettingData {
* Within the scope of the instantiating Namespace, InstanceID opaquely and uniquely identifies
* an instance of this class.
*/
public CimString getInstanceID() {
public String getInstanceID() {
return instanceID;
}
/**
* The Caption property is a short textual description (one- line string) of the object.
*/
public CimString getCaption() {
public String getCaption() {
return caption;
}
/**
* The Description property provides a textual description of the object.
*/
public CimString getDescription() {
public String getDescription() {
return description;
}
@ -472,7 +474,7 @@ public class VirtualSystemSettingData {
* Delay applicable to startup action. The value shall be in the interval variant of the datetime
* datatype.
*/
public CimUnsignedLong getAutomaticStartupActionDelay() {
public BigInteger getAutomaticStartupActionDelay() {
return automaticStartupActionDelay;
}
@ -482,7 +484,7 @@ public class VirtualSystemSettingData {
* same value, the sequence is implementation dependent. A value of 0 indicates that the sequence
* is implementation dependent.
*/
public CimUnsignedInt getAutomaticStartupActionSequenceNumber() {
public Long getAutomaticStartupActionSequenceNumber() {
return automaticStartupActionSequenceNumber;
}
@ -490,9 +492,9 @@ public class VirtualSystemSettingData {
* Filepath of a directory where information about the virtual system configuration is
* stored.
*
* Format shall be CimString based on RFC-2079.
* Format shall be String based on RFC-2079.
*/
public CimString getConfigurationDataRoot() {
public String getConfigurationDataRoot() {
return configurationDataRoot;
}
@ -501,9 +503,9 @@ public class VirtualSystemSettingData {
*
* A relative path appends to the value of the {@link #getConfigurationDataRoot()} property.
* <p>
* Format shall be CimString based on RFC-2079.
* Format shall be String based on RFC-2079.
*/
public CimString getConfigurationFile() {
public String getConfigurationFile() {
return configurationFile;
}
@ -512,7 +514,7 @@ public class VirtualSystemSettingData {
* the InstanceID as it is assigned by the implementation to a virtual system or a virtual system
* configuration. It is not a key, and the same value may occur within more than one instance.
*/
public CimString getConfigurationID() {
public String getConfigurationID() {
return configurationID;
}
@ -528,18 +530,18 @@ public class VirtualSystemSettingData {
*
* A relative path appends to the value of the {@link #getConfigurationDataRoot()} property.
* <p>
* Format shall be CimString based on RFC-2079.
* Format shall be String based on RFC-2079.
*/
public CimString getLogDataRoot() {
public String getLogDataRoot() {
return logDataRoot;
}
/**
* Filepath of a file where recovery relateded information of the virtual system is stored.
*
* Format shall be CimString based on RFC-2079.
* Format shall be String based on RFC-2079.
*/
public CimString getRecoveryFile() {
public String getRecoveryFile() {
return recoveryFile;
}
@ -548,9 +550,9 @@ public class VirtualSystemSettingData {
*
* A relative path appends to the value of the {@link #getConfigurationDataRoot()} property.
* <p>
* Format shall be CimString based on RFC-2079.
* Format shall be String based on RFC-2079.
*/
public CimString getSnapshotDataRoot() {
public String getSnapshotDataRoot() {
return snapshotDataRoot;
}
@ -559,9 +561,9 @@ public class VirtualSystemSettingData {
*
* A relative path appends to the value of the {@link #getConfigurationDataRoot()} property.
* <p>
* Format shall be CimString based on RFC-2079.
* Format shall be String based on RFC-2079.
*/
public CimString getSuspendDataRoot() {
public String getSuspendDataRoot() {
return suspendDataRoot;
}
@ -570,9 +572,9 @@ public class VirtualSystemSettingData {
*
* A relative path appends to the value of the {@link #getConfigurationDataRoot()} property.
* <p>
* Format shall be CimString based on RFC-2079.
* Format shall be String based on RFC-2079.
*/
public CimString getSwapFileDataRoot() {
public String getSwapFileDataRoot() {
return swapFileDataRoot;
}
@ -586,21 +588,21 @@ public class VirtualSystemSettingData {
* may contain implementation specific rules (like simple patterns or regular expresssion) that
* may be interpreted by the implementation when assigning a VirtualSystemIdentifier.
*/
public CimString getVirtualSystemIdentifier() {
public String getVirtualSystemIdentifier() {
return virtualSystemIdentifier;
}
/**
* VirtualSystemType shall reflect a particular type of virtual system.
*/
public CimString getVirtualSystemType() {
public String getVirtualSystemType() {
return virtualSystemType;
}
/**
* End-user supplied notes that are related to the virtual system.
*/
public CimString getNotes() {
public String getNotes() {
return notes;
}

View File

@ -19,18 +19,19 @@
@XmlSchema(namespace = VCLOUD_CIM_NS, elementFormDefault = XmlNsForm.QUALIFIED,
xmlns = {
@XmlNs(prefix = "cim", namespaceURI = VCLOUD_CIM_NS),
@XmlNs(prefix = "ovf", namespaceURI = VCLOUD_OVF_NS),
@XmlNs(prefix = "vssd", namespaceURI = VCLOUD_CIM_VSSD_NS),
@XmlNs(prefix = "rasd", namespaceURI = VCLOUD_CIM_RASD_NS),
@XmlNs(prefix = "vcloud", namespaceURI = VCLOUD_1_5_NS)
}
)
// http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData
@XmlAccessorType(XmlAccessType.FIELD)
package org.jclouds.vcloud.director.v1_5.domain.cim;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_NS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_VSSD_NS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_CIM_RASD_NS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;

View File

@ -1,136 +0,0 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.domain.ovf;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.vcloud.director.v1_5.domain.cim.CIMResourceAllocationSettingDataType;
/**
* Wrapper for CIM_ResourceAllocationSettingData_Type
*
* <pre>
* &lt;complexType name="RASD_Type" /&gt;
* </pre>
*
* @author grkvlt@apache.org
*/
@XmlType(name = "RASD_Type")
@XmlRootElement(name = "Item", namespace = VCLOUD_1_5_NS)
public class RASD extends CIMResourceAllocationSettingDataType {
// TODO Add toString, hashCode and equals
public static Builder<?> builder() {
return new ConcreteBuilder();
}
@Override
public Builder<?> toBuilder() {
return builder().fromRASD(this);
}
public static class Builder<B extends Builder<B>> extends CIMResourceAllocationSettingDataType.Builder<B> {
private Boolean required;
private String configuration;
private String bound;
public B required(Boolean val) {
this.required = val;
return self();
}
public B configuration(String val) {
this.configuration = val;
return self();
}
public B bound(String val) {
this.bound = val;
return self();
}
public B fromRASD(RASD val) {
return fromCIMResourceAllocationSettingDataType(val).required(val.isRequired()).configuration(val.getConfiguration()).bound(val.getBound());
}
@Override
public RASD build() {
return new RASD(this);
}
}
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
}
@XmlAttribute(namespace = VCLOUD_OVF_NS)
private Boolean required;
@XmlAttribute(namespace = VCLOUD_OVF_NS)
private String configuration;
@XmlAttribute(namespace = VCLOUD_OVF_NS)
private String bound;
protected RASD() {
// For JAXB
}
protected RASD(Builder<?> builder) {
super(builder);
this.required = builder.required;
this.configuration = builder.configuration;
this.bound = builder.bound;
}
/**
* Gets the value of the required property.
*
* @return possible object is {@link Boolean }
*/
public boolean isRequired() {
if (required == null) {
return true;
} else {
return required;
}
}
/**
* Gets the value of the configuration property.
*
* @return possible object is {@link String }
*/
public String getConfiguration() {
return configuration;
}
/**
* Gets the value of the bound property.
*
* @return possible object is {@link String }
*/
public String getBound() {
return bound;
}
}

View File

@ -73,7 +73,6 @@ public abstract class SectionType {
public static abstract class Builder<B extends Builder<B>> {
private String info;
private Boolean required;
private Set<Link> links = Sets.newLinkedHashSet();
@SuppressWarnings("unchecked")
protected B self() {
@ -114,40 +113,19 @@ public abstract class SectionType {
return self();
}
/**
* @see ResourceType#getLinks()
*/
public B links(Set<Link> links) {
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
return self();
}
/**
* @see ResourceType#getLinks()
*/
public B link(Link link) {
if (links == null)
links = Sets.newLinkedHashSet();
this.links.add(checkNotNull(link, "link"));
return self();
}
public B fromSectionType(SectionType in) {
return info(in.getInfo()).required(in.isRequired()).links(Sets.newLinkedHashSet(in.getLinks()));
return info(in.getInfo()).required(in.isRequired());
}
}
@XmlElement(name = "Info", required = true)
private String info;
@XmlAttribute(namespace = VCLOUD_OVF_NS)
@XmlAttribute
private Boolean required;
@XmlElement(name = "Link", namespace = VCLOUD_1_5_NS)
private Set<Link> links = Sets.newLinkedHashSet();
protected SectionType(Builder<?> builder) {
this.info = builder.info;
this.required = builder.required;
this.links = builder.links != null ? ImmutableSet.copyOf(builder.links) : Collections.<Link>emptySet();
}
protected SectionType() {
@ -171,16 +149,9 @@ public abstract class SectionType {
return required;
}
/**
* Set of optional links to an entity or operation associated with this object.
*/
public Set<Link> getLinks() {
return links != null ? ImmutableSet.copyOf(links) : Collections.<Link>emptySet();
}
@Override
public int hashCode() {
return Objects.hashCode(info, required, links);
return Objects.hashCode(info, required);
}
@Override
@ -192,7 +163,7 @@ public abstract class SectionType {
if (getClass() != obj.getClass())
return false;
SectionType other = (SectionType) obj;
return equal(this.info, other.info) && equal(this.required, other.required) && equal(this.links, other.links);
return equal(this.info, other.info) && equal(this.required, other.required);
}
@Override
@ -201,7 +172,7 @@ public abstract class SectionType {
}
protected Objects.ToStringHelper string() {
return Objects.toStringHelper("").add("info", info).add("required", required).add("links", links);
return Objects.toStringHelper("").add("info", info).add("required", required);
}
}

View File

@ -20,15 +20,19 @@ package org.jclouds.vcloud.director.v1_5.domain.ovf;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI;
import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import org.jclouds.vcloud.director.v1_5.domain.Link;
import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData;
import org.jclouds.vcloud.director.v1_5.domain.cim.VirtualSystemSettingData;
@ -65,9 +69,12 @@ public class VirtualHardwareSection extends SectionType {
public static class Builder<B extends Builder<B>> extends SectionType.Builder<B> {
protected VirtualSystemSettingData virtualSystem;
protected String transport;
protected Set<ResourceAllocationSettingData> items = Sets.newLinkedHashSet();
private VirtualSystemSettingData virtualSystem;
private String transport;
private Set<ResourceAllocationSettingData> items = Sets.newLinkedHashSet();
private Set<Link> links = Sets.newLinkedHashSet();
private URI href;
private String type;
/**
* @see VirtualHardwareSection#getSystem
@ -117,6 +124,38 @@ public class VirtualHardwareSection extends SectionType {
return self();
}
/**
* @see VirtualHardwareSection#getLinks()
*/
public B links(Set<Link> links) {
this.links = checkNotNull(links, "links");
return self();
}
/**
* @see VirtualHardwareSection#getLinks()
*/
public B link(Link link) {
this.links.add(checkNotNull(link, "link"));
return self();
}
/**
* @see VirtualHardwareSection#getHref()
*/
public B href(URI href) {
this.href = href;
return self();
}
/**
* @see VirtualHardwareSection#getType()
*/
public B type(String type) {
this.type = type;
return self();
}
/**
* {@inheritDoc}
*/
@ -129,7 +168,10 @@ public class VirtualHardwareSection extends SectionType {
return fromSectionType(in)
.items(in.getItems())
.transport(in.getTransport())
.system(in.getSystem());
.system(in.getSystem())
.links(Sets.newLinkedHashSet(in.getLinks()))
.href(in.getHref())
.type(in.getType());
}
}
@ -139,12 +181,22 @@ public class VirtualHardwareSection extends SectionType {
private String transport;
@XmlElement(name = "Item")
private Set<ResourceAllocationSettingData> items = Sets.newLinkedHashSet();
@XmlElement(name = "Link", namespace = VCLOUD_1_5_NS)
protected Set<Link> links = Sets.newLinkedHashSet();
@XmlAttribute(namespace = VCLOUD_1_5_NS)
@XmlSchemaType(name = "anyURI")
protected URI href;
@XmlAttribute(namespace = VCLOUD_1_5_NS)
protected String type;
private VirtualHardwareSection(Builder<?> builder) {
super(builder);
this.virtualSystem = builder.virtualSystem;
this.transport = builder.transport;
this.items = builder.items != null ? ImmutableSet.copyOf(builder.items) : Collections.<ResourceAllocationSettingData>emptySet();
this.items = builder.items != null ? ImmutableSet.copyOf(builder.items) : Sets.<ResourceAllocationSettingData>newLinkedHashSet();
this.links = builder.links != null ? ImmutableSet.copyOf(builder.links) : Sets.<Link>newLinkedHashSet();
this.href = builder.href;
this.type = builder.type;
}
private VirtualHardwareSection() {
@ -178,13 +230,36 @@ public class VirtualHardwareSection extends SectionType {
return virtualSystem;
}
public Set<? extends ResourceAllocationSettingData> getItems() {
return items;
public Set<ResourceAllocationSettingData> getItems() {
return ImmutableSet.copyOf(items);
}
/**
* Gets the value of the link property.
*/
public Set<Link> getLinks() {
return ImmutableSet.copyOf(links);
}
/**
* @return the value of the href property.
*/
public URI getHref() {
return href;
}
/**
* Gets the value of the type property.
*
* @return possible object is {@link String }
*/
public String getType() {
return type;
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(), transport, virtualSystem, items);
return Objects.hashCode(super.hashCode(), transport, virtualSystem, items, links, href, type);
}
@Override
@ -196,11 +271,14 @@ public class VirtualHardwareSection extends SectionType {
return super.equals(that) &&
equal(this.transport, that.transport) &&
equal(this.virtualSystem, that.virtualSystem) &&
equal(this.items, that.items);
equal(this.items, that.items) &&
equal(this.links, that.links) &&
equal(this.href, that.href) &&
equal(this.type, that.type);
}
@Override
protected Objects.ToStringHelper string() {
return super.string().add("transport", transport).add("virtualSystem", virtualSystem).add("items", items);
return super.string().add("transport", transport).add("virtualSystem", virtualSystem).add("items", items).add("links", links).add("href", href).add("type", type);
}
}

View File

@ -18,7 +18,27 @@
*/
package org.jclouds.vcloud.director.v1_5.features;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.*;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.ANY_IMAGE;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.CONTROL_ACCESS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.DEPLOY_VAPP_PARAMS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.GUEST_CUSTOMIZATION_SECTION;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.LEASE_SETTINGS_SECTION;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.MEDIA_PARAMS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NETWORK_CONFIG_SECTION;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NETWORK_CONNECTION_SECTION;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.OPERATING_SYSTEM_SECTION;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.OVF_RASD_ITEM;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.OWNER;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.PRODUCT_SECTION_LIST;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.RECOMPOSE_VAPP_PARAMS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.RELOCATE_VM_PARAMS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.STARTUP_SECTION;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.TASK;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.UNDEPLOY_VAPP_PARAMS;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VAPP;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VIRTUAL_HARDWARE_SECTION;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.VM_PENDING_ANSWER;
import java.net.URI;
@ -56,9 +76,9 @@ import org.jclouds.vcloud.director.v1_5.domain.UndeployVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.VApp;
import org.jclouds.vcloud.director.v1_5.domain.VmPendingQuestion;
import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswer;
import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData;
import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.OperatingSystemSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.RASD;
import org.jclouds.vcloud.director.v1_5.domain.ovf.StartupSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
@ -590,10 +610,10 @@ public interface VAppAsyncClient {
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<RASD> getVirtualHardwareSectionCpu(@EndpointParam URI vAppURI);
ListenableFuture<ResourceAllocationSettingData> getVirtualHardwareSectionCpu(@EndpointParam URI vAppURI);
/**
* @see VAppClient#modifyVirtualHardwareSectionCpu(URI, RASD)
* @see VAppClient#modifyVirtualHardwareSectionCpu(URI, ResourceAllocationSettingData)
*/
@PUT
@Path("/virtualHardwareSection/cpu")
@ -602,7 +622,7 @@ public interface VAppAsyncClient {
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> modifyVirtualHardwareSectionCpu(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) RASD rasd);
@BinderParam(BindToXMLPayload.class) ResourceAllocationSettingData rasd);
/**
* @see VAppClient#getVirtualHardwareSectionDisks(URI)
@ -644,10 +664,10 @@ public interface VAppAsyncClient {
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<RASD> getVirtualHardwareSectionMemory(@EndpointParam URI vAppURI);
ListenableFuture<ResourceAllocationSettingData> getVirtualHardwareSectionMemory(@EndpointParam URI vAppURI);
/**
* @see VAppClient#modifyVirtualHardwareSectionMemory(URI, RASD)
* @see VAppClient#modifyVirtualHardwareSectionMemory(URI, ResourceAllocationSettingData)
*/
@PUT
@Path("/virtualHardwareSection/memory")
@ -656,7 +676,7 @@ public interface VAppAsyncClient {
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> modifyVirtualHardwareSectionMemory(@EndpointParam URI vAppURI,
@BinderParam(BindToXMLPayload.class) RASD rasd);
@BinderParam(BindToXMLPayload.class) ResourceAllocationSettingData rasd);
/**
* @see VAppClient#getVirtualHardwareSectionNetworkCards(URI)

View File

@ -42,9 +42,9 @@ import org.jclouds.vcloud.director.v1_5.domain.UndeployVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.VApp;
import org.jclouds.vcloud.director.v1_5.domain.VmPendingQuestion;
import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswer;
import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData;
import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.OperatingSystemSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.RASD;
import org.jclouds.vcloud.director.v1_5.domain.ovf.StartupSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection;
@ -680,7 +680,7 @@ public interface VAppClient {
*
* @since 0.9
*/
RASD getVirtualHardwareSectionCpu(URI vAppURI);
ResourceAllocationSettingData getVirtualHardwareSectionCpu(URI vAppURI);
/**
* Modifies the CPU properties in virtual hardware section of a VM.
@ -691,10 +691,10 @@ public interface VAppClient {
*
* @since 0.9
*/
Task modifyVirtualHardwareSectionCpu(URI vAppURI, RASD rasd);
Task modifyVirtualHardwareSectionCpu(URI vAppURI, ResourceAllocationSettingData rasd);
/**
* Retrieves a list of RASD items for disks from virtual hardware section of a VM.
* Retrieves a list of ResourceAllocationSettingData items for disks from virtual hardware section of a VM.
*
* <pre>
* GET /vApp/{id}/virtualHardwareSection/disks
@ -716,7 +716,7 @@ public interface VAppClient {
Task modifyVirtualHardwareSectionDisks(URI vAppURI, RasdItemsList rasdItemsList);
/**
* Retrieves the list of RASD items that represents the floppies and CD/DVD drives in a VM.
* Retrieves the list of ResourceAllocationSettingData items that represents the floppies and CD/DVD drives in a VM.
*
* <pre>
* GET /vApp/{id}/virtualHardwareSection/media
@ -727,7 +727,7 @@ public interface VAppClient {
RasdItemsList getVirtualHardwareSectionMedia(URI vAppURI);
/**
* Retrieves the RASD item that contains memory information from virtual hardware section of a VM.
* Retrieves the ResourceAllocationSettingData item that contains memory information from virtual hardware section of a VM.
*
* <pre>
* GET /vApp/{id}/virtualHardwareSection/memory
@ -735,7 +735,7 @@ public interface VAppClient {
*
* @since 0.9
*/
RASD getVirtualHardwareSectionMemory(URI vAppURI);
ResourceAllocationSettingData getVirtualHardwareSectionMemory(URI vAppURI);
/**
* Modifies the memory properties in virtual hardware section of a VM.
@ -746,10 +746,10 @@ public interface VAppClient {
*
* @since 0.9
*/
Task modifyVirtualHardwareSectionMemory(URI vAppURI, RASD rasd);
Task modifyVirtualHardwareSectionMemory(URI vAppURI, ResourceAllocationSettingData rasd);
/**
* Retrieves a list of RASD items for network cards from virtual hardware section of a VM.
* Retrieves a list of ResourceAllocationSettingData items for network cards from virtual hardware section of a VM.
*
* <pre>
* GET /vApp/{id}/virtualHardwareSection/networkCards
@ -771,7 +771,7 @@ public interface VAppClient {
Task modifyVirtualHardwareSectionNetworkCards(URI vAppURI, RasdItemsList rasdItemsList);
/**
* Retrieves a list of RASD items for serial ports from virtual hardware section of a VM.
* Retrieves a list of ResourceAllocationSettingData items for serial ports from virtual hardware section of a VM.
*
* <pre>
* GET /vApp/{id}/virtualHardwareSection/serialPorts

View File

@ -58,7 +58,6 @@ import org.jclouds.vcloud.director.v1_5.domain.ovf.Envelope;
import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.OperatingSystemSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.ProductSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.RASD;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.StartupSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection;
@ -1252,17 +1251,12 @@ public class Checks {
}
}
public static void checkRASD(RASD rasd) {
// Check fields
// TODO
}
public static void checkRasdItemsList(RasdItemsList items) {
// Check fields
// TODO
for (RASD item : items.getItems()) {
checkRASD(item);
for (ResourceAllocationSettingData item : items.getItems()) {
checkResourceAllocationSettingData(item);
}
}

View File

@ -49,7 +49,7 @@ import org.jclouds.vcloud.director.v1_5.domain.cim.CimBoolean;
import org.jclouds.vcloud.director.v1_5.domain.cim.CimString;
import org.jclouds.vcloud.director.v1_5.domain.cim.CimUnsignedInt;
import org.jclouds.vcloud.director.v1_5.domain.cim.CimUnsignedLong;
import org.jclouds.vcloud.director.v1_5.domain.ovf.RASD;
import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.jclouds.vcloud.director.v1_5.predicates.ReferenceTypePredicates;
import org.jclouds.xml.internal.JAXBParser;
@ -249,13 +249,13 @@ public abstract class AbstractVAppClientLiveTest extends BaseVCloudDirectorClien
}
protected void checkHasMatchingItem(final String context, final RasdItemsList items, final String instanceId, final String elementName) {
Optional<RASD> found = Iterables.tryFind(items.getItems(), new Predicate<RASD>() {
Optional<ResourceAllocationSettingData> found = Iterables.tryFind(items.getItems(), new Predicate<ResourceAllocationSettingData>() {
@Override
public boolean apply(RASD item) {
String itemInstanceId = item.getInstanceID().getValue();
public boolean apply(ResourceAllocationSettingData item) {
String itemInstanceId = item.getInstanceID();
if (itemInstanceId.equals(instanceId)) {
Assert.assertEquals(item.getElementName().getValue(), elementName,
String.format(OBJ_FIELD_EQ, VAPP, context + "/" + instanceId + "/elementName", elementName, item.getElementName().getValue()));
Assert.assertEquals(item.getElementName(), elementName,
String.format(OBJ_FIELD_EQ, VAPP, context + "/" + instanceId + "/elementName", elementName, item.getElementName()));
return true;
}

View File

@ -46,9 +46,9 @@ import org.jclouds.vcloud.director.v1_5.domain.UndeployVAppParams;
import org.jclouds.vcloud.director.v1_5.domain.VApp;
import org.jclouds.vcloud.director.v1_5.domain.VmPendingQuestion;
import org.jclouds.vcloud.director.v1_5.domain.VmQuestionAnswer;
import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData;
import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.OperatingSystemSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.RASD;
import org.jclouds.vcloud.director.v1_5.domain.ovf.StartupSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
@ -898,7 +898,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
.xmlFilePayload("/vApp/getVirtualHardwareSectionCpu.xml", VCloudDirectorMediaType.OVF_RASD_ITEM)
.httpResponseBuilder().build());
RASD expected = getVirtualHardwareSectionCpu();
ResourceAllocationSettingData expected = getVirtualHardwareSectionCpu();
assertEquals(client.getVAppClient().getVirtualHardwareSectionCpu(vAppURI), expected);
}
@ -915,7 +915,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionCpuTask.xml", VCloudDirectorMediaType.TASK)
.httpResponseBuilder().build());
RASD cpu = getVirtualHardwareSectionCpu(); // .toBuilder();
ResourceAllocationSettingData cpu = getVirtualHardwareSectionCpu(); // .toBuilder();
// .build();
Task expected = modifyVirtualHardwareSectionCpuTask();
@ -986,7 +986,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
.xmlFilePayload("/vApp/getVirtualHardwareSectionMemory.xml", VCloudDirectorMediaType.OVF_RASD_ITEM)
.httpResponseBuilder().build());
RASD expected = getVirtualHardwareSectionMemory();
ResourceAllocationSettingData expected = getVirtualHardwareSectionMemory();
assertEquals(client.getVAppClient().getVirtualHardwareSectionMemory(vAppURI), expected);
}
@ -1003,7 +1003,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionMemoryTask.xml", VCloudDirectorMediaType.TASK)
.httpResponseBuilder().build());
RASD memory = getVirtualHardwareSectionCpu(); // .toBuilder();
ResourceAllocationSettingData memory = getVirtualHardwareSectionCpu(); // .toBuilder();
// .build();
Task expected = modifyVirtualHardwareSectionMemoryTask();
@ -1414,8 +1414,8 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
return task;
}
public static RASD getVirtualHardwareSectionCpu() {
RASD cpu = RASD.builder()
public static ResourceAllocationSettingData getVirtualHardwareSectionCpu() {
ResourceAllocationSettingData cpu = ResourceAllocationSettingData.builder()
.build();
return cpu;
@ -1449,8 +1449,8 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
return media;
}
public static RASD getVirtualHardwareSectionMemory() {
RASD memory = RASD.builder()
public static ResourceAllocationSettingData getVirtualHardwareSectionMemory() {
ResourceAllocationSettingData memory = ResourceAllocationSettingData.builder()
.build();
return memory;

View File

@ -37,8 +37,8 @@ import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkNetworkSection
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkOperatingSystemSection;
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkOwner;
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkProductSectionList;
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkRASD;
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkRasdItemsList;
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkResourceAllocationSettingData;
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkRuntimeInfoSection;
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkScreenTicket;
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkStartupSection;
@ -55,7 +55,6 @@ import java.math.BigInteger;
import java.net.URI;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
@ -89,12 +88,10 @@ import org.jclouds.vcloud.director.v1_5.domain.VApp;
import org.jclouds.vcloud.director.v1_5.domain.VmPendingQuestion;
import org.jclouds.vcloud.director.v1_5.domain.cim.OSType;
import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData;
import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData.ResourceType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.MsgType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.OperatingSystemSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.ProductSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.RASD;
import org.jclouds.vcloud.director.v1_5.domain.ovf.StartupSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection;
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecordType;
@ -102,11 +99,11 @@ import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;
import org.testng.annotations.Test;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.base.Predicate;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
/**
* Tests behavior of the {@link VAppClient}.
@ -343,7 +340,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
assertTrue(retryTaskSuccess.apply(discardSuspendedState), String.format(TASK_COMPLETE_TIMELY, "discardSuspendedState"));
}
@Test(testName = "POST /vApp/{id}/action/enterMaintenanceMode", dependsOnMethods = { "testGetVApp" })
@Test(testName = "POST /vApp/{id}/action/enterMaintenanceMode", dependsOnMethods = { "testPowerOnVApp" })
public void testEnterMaintenanceMode() {
// The method under test
vAppClient.enterMaintenanceMode(vApp.getHref());
@ -763,10 +760,13 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
checkRuntimeInfoSection(section);
}
@Test(testName = "GET /vApp/{id}/screen", dependsOnMethods = { "testGetVApp" })
@Test(testName = "GET /vApp/{id}/screen", dependsOnMethods = { "testPowerOnVApp" })
public void testGetScreenImage() {
// Get URI for child VM
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
// The method under test
byte[] image = vAppClient.getScreenImage(vApp.getHref());
byte[] image = vAppClient.getScreenImage(vmURI);
// Check returned bytes against PNG header magic number
byte[] pngHeaderBytes = new byte[] { (byte) 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A };
@ -779,8 +779,11 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
@Test(testName = "GET /vApp/{id}/screen/action/acquireTicket", dependsOnMethods = { "testGetVApp" })
public void testGetScreenTicket() {
// Get URI for child VM
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
// The method under test
ScreenTicket ticket = vAppClient.getScreenTicket(vApp.getHref());
ScreenTicket ticket = vAppClient.getScreenTicket(vmURI);
// Check the retrieved object is well formed
checkScreenTicket(ticket);
@ -835,23 +838,22 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
// Copy existing section and update fields
VirtualHardwareSection oldSection = vAppClient.getVirtualHardwareSection(vmURI);
Optional<? extends ResourceAllocationSettingData> memory = Iterables.tryFind(oldSection.getItems(),
new Predicate<ResourceAllocationSettingData>() {
@Override
public boolean apply(ResourceAllocationSettingData item) {
return item.getResourceType() == ResourceType.MEMORY;
}
});
if (memory.isPresent()) debug(memory);
Set<ResourceAllocationSettingData> oldItems = oldSection.getItems();
ResourceAllocationSettingData oldMemory = Iterables.find(oldItems, new Predicate<ResourceAllocationSettingData>() {
@Override
public boolean apply(ResourceAllocationSettingData rasd) {
return rasd.getResourceType() == ResourceAllocationSettingData.ResourceType.MEMORY;
}
});
ResourceAllocationSettingData newMemory = oldMemory.toBuilder()
.elementName("1024 MB of memory")
.virtualQuantity(BigInteger.valueOf(1024L))
.build();
Set<ResourceAllocationSettingData> newItems = Sets.newLinkedHashSet(oldItems);
newItems.remove(oldMemory);
newItems.add(newMemory);
VirtualHardwareSection newSection = oldSection.toBuilder()
.item(ResourceAllocationSettingData.builder()
.elementName(cimString("Memory"))
.instanceID(cimString(UUID.randomUUID().toString()))
.allocationUnits(cimString("byte * 2^20"))
.reservation(cimUnsignedLong(BigInteger.valueOf(0L)))
.virtualQuantity(cimUnsignedLong(BigInteger.valueOf(1024L)))
.weight(cimUnsignedInt(0L))
.build())
.items(newItems)
.build();
// The method under test
@ -859,14 +861,22 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSection), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSection"));
// Retrieve the modified section
VirtualHardwareSection modified = vAppClient.getVirtualHardwareSection(vmURI);
VirtualHardwareSection modifiedSection = vAppClient.getVirtualHardwareSection(vmURI);
// Check the retrieved object is well formed
checkVirtualHardwareSection(modified);
checkVirtualHardwareSection(modifiedSection);
// Check the modified section fields are set correctly
// assertEquals(modified.getX(), "");
assertEquals(modified, newSection);
Set<ResourceAllocationSettingData> modifiedItems = modifiedSection.getItems();
ResourceAllocationSettingData modifiedMemory = Iterables.find(modifiedItems, new Predicate<ResourceAllocationSettingData>() {
@Override
public boolean apply(ResourceAllocationSettingData rasd) {
return rasd.getResourceType() == ResourceAllocationSettingData.ResourceType.MEMORY;
}
});
assertEquals(modifiedMemory.getVirtualQuantity(), BigInteger.valueOf(1024L));
assertEquals(modifiedMemory, newMemory);
assertEquals(modifiedSection, newSection);
}
@Test(testName = "GET /vApp/{id}/virtualHardwareSection/cpu", dependsOnMethods = { "testGetVirtualHardwareSection" })
@ -875,10 +885,10 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
// Method under test
RASD rasd = vAppClient.getVirtualHardwareSectionCpu(vmURI);
ResourceAllocationSettingData rasd = vAppClient.getVirtualHardwareSectionCpu(vmURI);
// Check the retrieved object is well formed
checkRASD(rasd);
checkResourceAllocationSettingData(rasd);
}
@Test(testName = "PUT /vApp/{id}/virtualHardwareSection/cpu", dependsOnMethods = { "testGetVirtualHardwareSectionCpu" })
@ -886,24 +896,26 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
// Get URI for child VM
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
RASD origSection = vAppClient.getVirtualHardwareSectionCpu(vmURI);
RASD newSection = origSection.toBuilder().build();
// Copy existing section and update fields
ResourceAllocationSettingData oldItem = vAppClient.getVirtualHardwareSectionCpu(vmURI);
ResourceAllocationSettingData newItem = oldItem.toBuilder()
.build();
// Method under test
Task modifyVirtualHardwareSectionCpu = vAppClient.modifyVirtualHardwareSectionCpu(vmURI, newSection);
Task modifyVirtualHardwareSectionCpu = vAppClient.modifyVirtualHardwareSectionCpu(vmURI, newItem);
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionCpu), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionCpu"));
// Retrieve the modified section
RASD modified = vAppClient.getVirtualHardwareSectionCpu(vmURI);
ResourceAllocationSettingData modified = vAppClient.getVirtualHardwareSectionCpu(vmURI);
// Check the retrieved object
checkRASD(modified);
checkResourceAllocationSettingData(modified);
// TODO What is modifiable? What can we change, so we can assert the change took effect?
// I tried changing "weight", but it continued to have the value zero when looked up post-modify.
//
// long weight = random.nextInt(Integer.MAX_VALUE);
// RASD newSection = origSection.toBuilder()
// ResourceAllocationSettingData newSection = origSection.toBuilder()
// .weight(newCimUnsignedInt(weight))
// .build();
// ...
@ -944,8 +956,8 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
// TODO What is modifiable? What can we change, so we can assert the change took effect?
// I tried changing "elementName" of one of the items, but it continued to have the old value when looked up post-modify.
//
// List<RASD> newItems = new ArrayList<RASD>(oldSection.getItems());
// RASD item0 = newItems.get(0);
// List<ResourceAllocationSettingData> newItems = new ArrayList<ResourceAllocationSettingData>(oldSection.getItems());
// ResourceAllocationSettingData item0 = newItems.get(0);
// String item0InstanceId = item0.getInstanceID().getValue();
// String item0ElementName = item0.getElementName().getValue()+"-"+random.nextInt(Integer.MAX_VALUE);
// newItems.set(0, item0.toBuilder().elementName(newCimString(item0ElementName)).build());
@ -954,7 +966,7 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
// .build();
// ...
// long weight = random.nextInt(Integer.MAX_VALUE);
// RASD newSection = origSection.toBuilder()
// ResourceAllocationSettingData newSection = origSection.toBuilder()
// .weight(newCimUnsignedInt(weight))
// .build();
// ...
@ -979,10 +991,10 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
// Method under test
RASD rasd = vAppClient.getVirtualHardwareSectionCpu(vmURI);
ResourceAllocationSettingData rasd = vAppClient.getVirtualHardwareSectionCpu(vmURI);
// Check the retrieved object is well formed
checkRASD(rasd);
checkResourceAllocationSettingData(rasd);
}
@Test(testName = "PUT /vApp/{id}/virtualHardwareSection/memory", dependsOnMethods = { "testGetVirtualHardwareSectionMemory" })
@ -990,18 +1002,18 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
// Get URI for child VM
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
RASD origSection = vAppClient.getVirtualHardwareSectionMemory(vmURI);
RASD newSection = origSection.toBuilder().build();
ResourceAllocationSettingData origSection = vAppClient.getVirtualHardwareSectionMemory(vmURI);
ResourceAllocationSettingData newSection = origSection.toBuilder().build();
// Method under test
Task modifyVirtualHardwareSectionMemory = vAppClient.modifyVirtualHardwareSectionMemory(vmURI, newSection);
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionMemory), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionMemory"));
// Retrieve the modified section
RASD modified = vAppClient.getVirtualHardwareSectionMemory(vmURI);
ResourceAllocationSettingData modified = vAppClient.getVirtualHardwareSectionMemory(vmURI);
// Check the retrieved object
checkRASD(modified);
checkResourceAllocationSettingData(modified);
// TODO What is modifiable? What can we change, so we can assert the change took effect?
// I tried changing "weight", but it continued to have the value zero when looked up post-modify.