diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorAsyncClient.java index 9eb3e15dc4..d52451b1b9 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorAsyncClient.java @@ -43,26 +43,32 @@ public interface VCloudDirectorAsyncClient { Session getCurrentSession(); /** - * @return asynchronous access to Org features + * @return asynchronous access to {@link Org} features */ @Delegate OrgAsyncClient getOrgClient(); /** - * @return asynchronous access to Task features + * @return asynchronous access to {@link Task} features */ @Delegate TaskAsyncClient getTaskClient(); /** - * @return asynchronous access to Network features + * @return asynchronous access to {@link Network} features */ @Delegate NetworkAsyncClient getNetworkClient(); /** - * @return asynchronous access to Catalog features + * @return asynchronous access to {@link Catalog} features */ @Delegate CatalogAsyncClient getCatalogClient(); + + /** + * @return asynchronous access to {@link Media} features + */ + @Delegate + CatalogAsyncClient getMediaClient(); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClient.java index 4ac6d277b0..096e0737c5 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClient.java @@ -24,6 +24,7 @@ import org.jclouds.concurrent.Timeout; import org.jclouds.rest.annotations.Delegate; import org.jclouds.vcloud.director.v1_5.domain.Session; import org.jclouds.vcloud.director.v1_5.features.CatalogClient; +import org.jclouds.vcloud.director.v1_5.features.MediaClient; import org.jclouds.vcloud.director.v1_5.features.NetworkClient; import org.jclouds.vcloud.director.v1_5.features.OrgClient; import org.jclouds.vcloud.director.v1_5.features.TaskClient; @@ -59,7 +60,7 @@ public interface VCloudDirectorClient { TaskClient getTaskClient(); /** - * @return synchronous access to Network features + * @return synchronous access to {@link Network} features */ @Delegate NetworkClient getNetworkClient(); @@ -70,4 +71,9 @@ public interface VCloudDirectorClient { @Delegate CatalogClient getCatalogClient(); + /** + * @return synchronous access to {@link Media} features + */ + @Delegate + MediaClient getMediaClient(); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorMediaType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorMediaType.java index 4e8fb0cf83..372122582d 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorMediaType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorMediaType.java @@ -63,9 +63,14 @@ public class VCloudDirectorMediaType { public static final String PROPERTY = "application/vnd.vmware.vcloud.property+xml"; + public static final String MEDIA = "application/vnd.vmware.vcloud.media+xml"; + + public static final String OWNER = "application/vnd.vmware.vcloud.owner+xml"; + public static final List ALL = Arrays.asList( SESSION, ERROR, ORG_LIST, METADATA, METADATA_ENTRY, METADATA_VALUE, ORG, TASKS_LIST, TASK, ORG_NETWORK, - CATALOG, CATALOG_ITEM, CATALOG_ITEMS, CATALOGS_LIST, PROPERTY + CATALOG, CATALOG_ITEM, CATALOG_ITEMS, CATALOGS_LIST, PROPERTY, + MEDIA, OWNER ); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/config/VCloudDirectorRestClientModule.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/config/VCloudDirectorRestClientModule.java index 522137d648..104fb3f359 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/config/VCloudDirectorRestClientModule.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/config/VCloudDirectorRestClientModule.java @@ -44,6 +44,8 @@ import org.jclouds.vcloud.director.v1_5.domain.Session; import org.jclouds.vcloud.director.v1_5.domain.SessionWithToken; import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncClient; import org.jclouds.vcloud.director.v1_5.features.CatalogClient; +import org.jclouds.vcloud.director.v1_5.features.MediaAsyncClient; +import org.jclouds.vcloud.director.v1_5.features.MediaClient; import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient; import org.jclouds.vcloud.director.v1_5.features.NetworkClient; import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient; @@ -80,6 +82,7 @@ public class VCloudDirectorRestClientModule extends RestClientModuleJava class for File complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="File">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}EntityType">
+ *       <attribute name="size" type="{http://www.w3.org/2001/XMLSchema}long" />
+ *       <attribute name="bytesTransferred" type="{http://www.w3.org/2001/XMLSchema}long" />
+ *       <attribute name="checksum" type="{http://www.w3.org/2001/XMLSchema}normalizedString" />
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "File") +public class File + extends EntityType + +{ + @SuppressWarnings("unchecked") + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromFile(this); + } + + public static class Builder extends EntityType.Builder { + + private Long size; + private Long bytesTransferred; + private String checksum; + + /** + * @see File#getSize() + */ + public Builder size(Long size) { + this.size = size; + return this; + } + + /** + * @see File#getBytesTransferred() + */ + public Builder bytesTransferred(Long bytesTransferred) { + this.bytesTransferred = bytesTransferred; + return this; + } + + /** + * @see File#getChecksum() + */ + public Builder checksum(String checksum) { + this.checksum = checksum; + return this; + } + + + public File build() { + File file = new File(); + file.setSize(size); + file.setBytesTransferred(bytesTransferred); + file.setChecksum(checksum); + return file; + } + + + /** + * @see EntityType#getId() + */ + @Override + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * @see EntityType#getTasksInProgress() + */ + @Override + public Builder tasksInProgress(TasksInProgress tasksInProgress) { + this.tasksInProgress = tasksInProgress; + return this; + } + + /** + * @see ReferenceType#getHref() + */ + @Override + public Builder href(URI href) { + this.href = href; + return this; + } + + /** + * @see ReferenceType#getType() + */ + @Override + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * @see ReferenceType#getLinks() + */ + @Override + public Builder links(Set links) { + this.links = Sets.newLinkedHashSet(checkNotNull(links, "links")); + return this; + } + + /** + * @see ReferenceType#getLinks() + */ + @Override + public Builder link(Link link) { + this.links.add(checkNotNull(link, "link")); + return this; + } + + + @Override + public Builder fromEntityType(EntityType in) { + return Builder.class.cast(super.fromEntityType(in)); + } + public Builder fromFile(File in) { + return fromEntityType(in) + .size(in.getSize()) + .bytesTransferred(in.getBytesTransferred()) + .checksum(in.getChecksum()); + } + } + + private File() { + // For JAXB and builder use + } + + + + @XmlAttribute + protected Long size; + @XmlAttribute + protected Long bytesTransferred; + @XmlAttribute + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + @XmlSchemaType(name = "normalizedString") + protected String checksum; + + /** + * Gets the value of the size property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getSize() { + return size; + } + + /** + * Sets the value of the size property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setSize(Long value) { + this.size = value; + } + + /** + * Gets the value of the bytesTransferred property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getBytesTransferred() { + return bytesTransferred; + } + + /** + * Sets the value of the bytesTransferred property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setBytesTransferred(Long value) { + this.bytesTransferred = value; + } + + /** + * Gets the value of the checksum property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getChecksum() { + return checksum; + } + + /** + * Sets the value of the checksum property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setChecksum(String value) { + this.checksum = value; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + File that = File.class.cast(o); + return equal(size, that.size) && + equal(bytesTransferred, that.bytesTransferred) && + equal(checksum, that.checksum); + } + + @Override + public int hashCode() { + return Objects.hashCode(size, + bytesTransferred, + checksum); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("size", size) + .add("bytesTransferred", bytesTransferred) + .add("checksum", checksum).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FilesList.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FilesList.java new file mode 100644 index 0000000000..57825ab852 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/FilesList.java @@ -0,0 +1,159 @@ +/** + * 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; + +import static com.google.common.base.Objects.equal; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * + * Represents a list of files to be transferred (uploaded + * or downloaded). + * + * + *

Java class for FilesList complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="FilesList">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
+ *       <sequence>
+ *         <element name="File" type="{http://www.vmware.com/vcloud/v1.5}FileType" maxOccurs="unbounded"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "FilesList", propOrder = { + "files" +}) +public class FilesList { + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromFilesList(this); + } + + public static class Builder { + + private List files; + + /** + * @see FilesList#getFile() + */ + public Builder file(List file) { + this.files = file; + return this; + } + + + public FilesList build() { + FilesList filesList = new FilesList(files); + return filesList; + } + + + public Builder fromFilesList(FilesList in) { + return file(in.getFile()); + } + } + + private FilesList() { + // For JAXB and builder use + } + + private FilesList(List files) { + this.files = files; + } + + + @XmlElement(name = "File", required = true) + protected List files; + + /** + * Gets the value of the file property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the file property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getFile().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link FileType } + * + * + */ + public List getFile() { + if (files == null) { + files = new ArrayList(); + } + return this.files; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + FilesList that = FilesList.class.cast(o); + return equal(files, that.files); + } + + @Override + public int hashCode() { + return Objects.hashCode(files); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("file", files).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Media.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Media.java new file mode 100644 index 0000000000..2c9077b665 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Media.java @@ -0,0 +1,322 @@ +/** + * 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; + +import static com.google.common.base.Objects.equal; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS; + +import java.net.URI; +import java.util.Set; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; + + +/** + * + * Represents a media. + * + * + *

Java class for Media complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="Media">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}ResourceEntityType">
+ *       <sequence>
+ *         <element name="Owner" type="{http://www.vmware.com/vcloud/v1.5}OwnerType" minOccurs="0"/>
+ *       </sequence>
+ *       <attribute name="imageType" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       <attribute name="size" use="required" type="{http://www.w3.org/2001/XMLSchema}long" />
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Media") +@XmlType(propOrder = {"owner"}) +public class Media + extends ResourceEntityType + +{ + @SuppressWarnings("unchecked") + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromMedia(this); + } + + public static class Builder extends ResourceEntityType.Builder { + + private Owner owner; + private String imageType; + private long size; + + /** + * @see Media#getOwner() + */ + public Builder owner(Owner owner) { + this.owner = owner; + return this; + } + + /** + * @see Media#getImageType() + */ + public Builder imageType(String imageType) { + this.imageType = imageType; + return this; + } + + /** + * @see Media#getSize() + */ + public Builder size(long size) { + this.size = size; + return this; + } + + + public Media build() { + Media media = new Media(); + media.setOwner(owner); + media.setImageType(imageType); + media.setSize(size); + return media; + } + + /** + * @see ResourceEntityType#getFiles() + */ + public Builder files(FilesList files) { + super.files(files); + return this; + } + + /** + * @see ResourceEntityType#getStatus() + */ + public Builder status(Integer status) { + super.status(status); + return this; + } + + /** + * @see EntityType#getName() + */ + @Override + public Builder name(String name) { + super.name(name); + return this; + } + + /** + * @see EntityType#getDescription() + */ + @Override + public Builder description(String description) { + super.description(description); + return this; + } + + /** + * @see EntityType#getId() + */ + @Override + public Builder id(String id) { + super.id(id); + return this; + } + + /** + * @see EntityType#getTasksInProgress() + */ + @Override + public Builder tasksInProgress(TasksInProgress tasksInProgress) { + super.tasksInProgress(tasksInProgress); + return this; + } + + /** + * @see ReferenceType#getHref() + */ + @Override + public Builder href(URI href) { + super.href(href); + return this; + } + + /** + * @see ReferenceType#getType() + */ + @Override + public Builder type(String type) { + super.type(type); + return this; + } + + /** + * @see ReferenceType#getLinks() + */ + @Override + public Builder links(Set links) { + super.links(links); + return this; + } + + /** + * @see ReferenceType#getLinks() + */ + @Override + public Builder link(Link link) { + super.link(link); + return this; + } + + + @Override + public Builder fromResourceEntityType(ResourceEntityType in) { + return Builder.class.cast(super.fromResourceEntityType(in)); + } + public Builder fromMedia(Media in) { + return fromResourceEntityType(in) + .owner(in.getOwner()) + .imageType(in.getImageType()) + .size(in.getSize()); + } + } + + public Media() { + super(); + } + + @XmlElement(namespace = VCLOUD_1_5_NS, name = "Owner") + protected Owner owner; + @XmlAttribute(required = true) + protected String imageType; + @XmlAttribute(required = true) + protected long size; + + /** + * Gets the value of the owner property. + * + * @return + * possible object is + * {@link Owner } + * + */ + public Owner getOwner() { + return owner; + } + + /** + * Sets the value of the owner property. + * + * @param value + * allowed object is + * {@link Owner } + * + */ + public void setOwner(Owner value) { + this.owner = value; + } + + /** + * Gets the value of the imageType property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getImageType() { + return imageType; + } + + /** + * Sets the value of the imageType property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setImageType(String value) { + this.imageType = value; + } + + /** + * Gets the value of the size property. + * + */ + public long getSize() { + return size; + } + + /** + * Sets the value of the size property. + * + */ + public void setSize(long value) { + this.size = value; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + Media that = Media.class.cast(o); + return equal(owner, that.owner) && + equal(imageType, that.imageType) && + equal(size, that.size); + } + + @Override + public int hashCode() { + return Objects.hashCode(owner, + imageType, + size); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("owner", owner) + .add("imageType", imageType) + .add("size", size).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Owner.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Owner.java new file mode 100644 index 0000000000..88e392cfd3 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Owner.java @@ -0,0 +1,199 @@ +/** + * 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; + +import static com.google.common.base.Objects.equal; +import static com.google.common.base.Preconditions.checkNotNull; + +import java.net.URI; +import java.util.Set; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; +import com.google.common.collect.Sets; + + +/** + * + * Represents the owner of this entity. + * + * + *

Java class for Owner complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="Owner">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}ResourceType">
+ *       <sequence>
+ *         <element name="User" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType"/>
+ *       </sequence>
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "Owner") +@XmlType(propOrder = {"user"}) +public class Owner + extends ResourceType + +{ + @SuppressWarnings("unchecked") + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder().fromOwner(this); + } + + public static class Builder extends ResourceType.Builder { + + private Reference user; + + /** + * @see Owner#getUser() + */ + public Builder user(Reference user) { + this.user = user; + return this; + } + + + public Owner build() { + Owner owner = new Owner(); + owner.setUser(user); + return owner; + } + + + /** + * @see ResourceType#getHref() + */ + @Override + public Builder href(URI href) { + super.href(href); + return this; + } + + /** + * @see ResourceType#getType() + */ + @Override + public Builder type(String type) { + super.type(type); + return this; + } + + /** + * @see ResourceType#getLinks() + */ + @Override + public Builder links(Set links) { + super.links(Sets.newLinkedHashSet(checkNotNull(links, "links"))); + return this; + } + + /** + * @see ResourceType#getLinks() + */ + @Override + public Builder link(Link link) { + super.link(link); + return this; + } + + + @Override + public Builder fromResourceType(ResourceType in) { + return Builder.class.cast(super.fromResourceType(in)); + } + public Builder fromOwner(Owner in) { + return fromResourceType(in) + .user(in.getUser()); + } + } + + private Owner() { + // For JAXB and builder use + } + + + + @XmlElement(name = "User", required = true) + protected Reference user; + + /** + * Gets the value of the user property. + * + * @return + * possible object is + * {@link Reference } + * + */ + public Reference getUser() { + return user; + } + + /** + * Sets the value of the user property. + * + * @param value + * allowed object is + * {@link Reference } + * + */ + public void setUser(Reference value) { + this.user = value; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + Owner that = Owner.class.cast(o); + return equal(user, that.user); + } + + @Override + public int hashCode() { + return Objects.hashCode(user); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("user", user).toString(); + } + +} 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 new file mode 100644 index 0000000000..56c9ac6ea0 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceEntityType.java @@ -0,0 +1,265 @@ +/** + * 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; + +import static com.google.common.base.Objects.equal; +import static com.google.common.base.Preconditions.checkNotNull; + +import java.net.URI; +import java.util.Set; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +import com.google.common.base.Objects; +import com.google.common.collect.Sets; + + +/** + * + * Base type that represents a resource entity such as a vApp + * template or virtual media. + * + * + *

Java class for ResourceEntity complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="ResourceEntity">
+ *   <complexContent>
+ *     <extension base="{http://www.vmware.com/vcloud/v1.5}EntityType">
+ *       <sequence>
+ *         <element name="Files" type="{http://www.vmware.com/vcloud/v1.5}FilesListType" minOccurs="0"/>
+ *       </sequence>
+ *       <attribute name="status" type="{http://www.w3.org/2001/XMLSchema}int" />
+ *       <anyAttribute processContents='lax' namespace='##other'/>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ResourceEntity", propOrder = { + "files" +}) +//@XmlSeeAlso({ +// MediaType.class, +// VAppTemplateType.class, +// AbstractVAppType.class, +// NetworkPoolType.class +//}) +public class ResourceEntityType> extends EntityType { + + public static > Builder builder() { + return new Builder(); + } + + @Override + public Builder toBuilder() { + return new Builder().fromResourceEntityType(this); + } + + public static class Builder> extends EntityType.Builder { + + private FilesList files; + private Integer status; + + /** + * @see ResourceEntityType#getFiles() + */ + public Builder files(FilesList files) { + this.files = files; + return this; + } + + /** + * @see ResourceEntityType#getStatus() + */ + public Builder status(Integer status) { + this.status = status; + return this; + } + + + public ResourceEntityType build() { + ResourceEntityType resourceEntity = new ResourceEntityType(); + resourceEntity.setFiles(files); + resourceEntity.setStatus(status); + return resourceEntity; + } + + + /** + * @see EntityType#getId() + */ + @Override + public Builder id(String id) { + this.id = id; + return this; + } + + /** + * @see EntityType#getTasksInProgress() + */ + @Override + public Builder tasksInProgress(TasksInProgress tasksInProgress) { + this.tasksInProgress = tasksInProgress; + return this; + } + + /** + * @see ReferenceType#getHref() + */ + @Override + public Builder href(URI href) { + this.href = href; + return this; + } + + /** + * @see ReferenceType#getType() + */ + @Override + public Builder type(String type) { + this.type = type; + return this; + } + + /** + * @see ReferenceType#getLinks() + */ + @Override + public Builder links(Set links) { + this.links = Sets.newLinkedHashSet(checkNotNull(links, "links")); + return this; + } + + /** + * @see ReferenceType#getLinks() + */ + @Override + public Builder link(Link link) { + this.links.add(checkNotNull(link, "link")); + return this; + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + @Override + public Builder fromResourceType(ResourceType in) { + return Builder.class.cast(super.fromResourceType(in)); + } + + public Builder fromResourceEntityType(ResourceEntityType in) { + return fromResourceType(in) + .files(in.getFiles()) + .status(in.getStatus()); + } + } + + public ResourceEntityType() { + } + + @XmlElement(name = "Files") + protected FilesList files; + @XmlAttribute + protected Integer status; + + /** + * Gets the value of the files property. + * + * @return + * possible object is + * {@link FilesList } + * + */ + public FilesList getFiles() { + return files; + } + + /** + * Sets the value of the files property. + * + * @param value + * allowed object is + * {@link FilesList } + * + */ + public void setFiles(FilesList value) { + this.files = value; + } + + /** + * Gets the value of the status property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getStatus() { + return status; + } + + /** + * Sets the value of the status property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setStatus(Integer value) { + this.status = value; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + ResourceEntityType that = ResourceEntityType.class.cast(o); + return equal(files, that.files) && + equal(status, that.status); + } + + @Override + public int hashCode() { + return Objects.hashCode(files, + status); + } + + @Override + public String toString() { + return Objects.toStringHelper("") + .add("files", files) + .add("status", status).toString(); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MediaAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MediaAsyncClient.java new file mode 100644 index 0000000000..39ef53d650 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MediaAsyncClient.java @@ -0,0 +1,153 @@ +/** + * 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.features; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; + +import org.jclouds.rest.annotations.BinderParam; +import org.jclouds.rest.annotations.EndpointParam; +import org.jclouds.rest.annotations.ExceptionParser; +import org.jclouds.rest.annotations.JAXBResponseParser; +import org.jclouds.rest.annotations.RequestFilters; +import org.jclouds.rest.binders.BindToXMLPayload; +import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; +import org.jclouds.vcloud.director.v1_5.domain.Media; +import org.jclouds.vcloud.director.v1_5.domain.Metadata; +import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry; +import org.jclouds.vcloud.director.v1_5.domain.MetadataValue; +import org.jclouds.vcloud.director.v1_5.domain.Owner; +import org.jclouds.vcloud.director.v1_5.domain.Reference; +import org.jclouds.vcloud.director.v1_5.domain.Task; +import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest; +import org.jclouds.vcloud.director.v1_5.functions.ReferenceToEndpoint; +import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx; + +import com.google.common.util.concurrent.ListenableFuture; + +/** + * @see MediaClient + * @author danikov + */ +@RequestFilters(AddVCloudAuthorizationToRequest.class) +public interface MediaAsyncClient { + + /** + * @see MediaClient#getMedia(Reference) + */ + @GET + @Consumes + @JAXBResponseParser + @ExceptionParser(ThrowVCloudErrorOn4xx.class) + ListenableFuture getMedia(@EndpointParam(parser = ReferenceToEndpoint.class) Reference mediaRef); + + /** + * @see MediaClient#updateMedia(Reference, Media)) + */ + @PUT + @Consumes(VCloudDirectorMediaType.TASK) + @Produces(VCloudDirectorMediaType.MEDIA) + @JAXBResponseParser + @ExceptionParser(ThrowVCloudErrorOn4xx.class) + ListenableFuture updateMedia(@EndpointParam(parser = ReferenceToEndpoint.class) Reference mediaRef, + @BinderParam(BindToXMLPayload.class) Media media); + + /** + * @see MediaClient#deleteMedia(Reference)) + */ + @DELETE + @Consumes(VCloudDirectorMediaType.TASK) + @JAXBResponseParser + @ExceptionParser(ThrowVCloudErrorOn4xx.class) + ListenableFuture deleteMedia(@EndpointParam(parser = ReferenceToEndpoint.class) Reference mediaRef); + + /** + * @see MediaClient#getOwner(Reference) + */ + @GET + @Path("/owner") + @Consumes + @JAXBResponseParser + @ExceptionParser(ThrowVCloudErrorOn4xx.class) + ListenableFuture getOwner(@EndpointParam(parser = ReferenceToEndpoint.class) Reference mediaRef); + + /** + * @see MediaClient#getMetadata(Reference)) + */ + @GET + @Path("/metadata") + @Consumes + @JAXBResponseParser + @ExceptionParser(ThrowVCloudErrorOn4xx.class) + ListenableFuture getMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) Reference mediaRef); + + /** + * @see MediaClient#mergeMetadata(Reference, Metadata)) + */ + @POST + @Path("/metadata") + @Consumes(VCloudDirectorMediaType.TASK) + @Produces(VCloudDirectorMediaType.METADATA) + @JAXBResponseParser + @ExceptionParser(ThrowVCloudErrorOn4xx.class) + ListenableFuture mergeMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) Reference mediaRef, + @BinderParam(BindToXMLPayload.class) Metadata metadata); + + /** + * @see MediaClient#getMetadataEntry(Reference, String)) + */ + @GET + @Path("/metadata/{key}") + @Consumes + @JAXBResponseParser + @ExceptionParser(ThrowVCloudErrorOn4xx.class) + ListenableFuture getMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) Reference mediaRef, + @PathParam("key") String key); + + /** + * @see MediaClient#setMetadata(Reference, String, MetadataEntry)) + */ + @PUT + @Path("/metadata/{key}") + @Consumes(VCloudDirectorMediaType.TASK) + @Produces(VCloudDirectorMediaType.METADATA_VALUE) + @JAXBResponseParser + @ExceptionParser(ThrowVCloudErrorOn4xx.class) + ListenableFuture setMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) Reference metaDataRef, + @PathParam("key") String key, + @BinderParam(BindToXMLPayload.class) MetadataValue metadataValue); + + /** + * @see MediaClient#deleteMetadataEntry(Reference, String)) + */ + @DELETE + @Path("/metadata/{key}") + @Consumes(VCloudDirectorMediaType.TASK) + @JAXBResponseParser + @ExceptionParser(ThrowVCloudErrorOn4xx.class) + ListenableFuture deleteMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) Reference metaDataRef, + @PathParam("key") String key); + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MediaClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MediaClient.java new file mode 100644 index 0000000000..92d539a019 --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MediaClient.java @@ -0,0 +1,109 @@ +/** + * 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.features; + +import java.util.concurrent.TimeUnit; + +import org.jclouds.concurrent.Timeout; +import org.jclouds.vcloud.director.v1_5.domain.Media; +import org.jclouds.vcloud.director.v1_5.domain.Metadata; +import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry; +import org.jclouds.vcloud.director.v1_5.domain.MetadataValue; +import org.jclouds.vcloud.director.v1_5.domain.Owner; +import org.jclouds.vcloud.director.v1_5.domain.Reference; +import org.jclouds.vcloud.director.v1_5.domain.Task; + +/** + * Provides synchronous access to Media. + *

+ * + * @see MediaAsyncClient + * @see + * @author danikov + */ +@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS) +public interface MediaClient { + + /** + * Retrieves a media. + * + * @return the media or null if not found + */ + Media getMedia(Reference mediaRef); + + /** + * Updates the name/description of a media. + * + * @return a task. This operation is asynchronous and the user should monitor the returned + * task status in order to check when it is completed. + */ + Task updateMedia(Reference mediaRef, Media media); + + /** + * Deletes a media. + */ + Task deleteMedia(Reference mediaRef); + + /** + * Retrieves an owner. + * + * @return the owner or null if not found + */ + Owner getOwner(Reference mediaRef); + + /** + * Retrieves an list of the media's metadata + * + * @return a list of metadata + */ + Metadata getMetadata(Reference mediaRef); + /** + * Merges the metadata for a media with the information provided. + * + * @return a task. This operation is asynchronous and the user should monitor the returned + * task status in order to check when it is completed. + */ + Task mergeMetadata(Reference mediaRef, Metadata metadata); + + /** + * Retrieves a metadata entry + * + * @return the metadata entry, or null if not found + */ + MetadataEntry getMetadataEntry(Reference mediaRef, String key); + + /** + * Sets the metadata for the particular key for the media to the value provided. + * Note: this will replace any existing metadata information + * + * @return a task. This operation is asynchronous and the user should monitor the returned + * task status in order to check when it is completed. + */ + Task setMetadata(Reference mediaRef, String key, MetadataValue metadataEntry); + + /** + * Deletes a metadata entry. + * + * @return a task. This operation is asynchronous and the user should monitor the returned + * task status in order to check when it is completed. + */ + Task deleteMetadataEntry(Reference mediaRef, String key); + + +} diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaClientExpectTest.java new file mode 100644 index 0000000000..cddac2c6c7 --- /dev/null +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaClientExpectTest.java @@ -0,0 +1,577 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + *(Link.builder().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(Link.builder().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.features; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.fail; + +import java.net.URI; + +import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient; +import org.jclouds.vcloud.director.v1_5.VCloudDirectorException; +import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; +import org.jclouds.vcloud.director.v1_5.domain.Error; +import org.jclouds.vcloud.director.v1_5.domain.Link; +import org.jclouds.vcloud.director.v1_5.domain.Media; +import org.jclouds.vcloud.director.v1_5.domain.Metadata; +import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry; +import org.jclouds.vcloud.director.v1_5.domain.MetadataValue; +import org.jclouds.vcloud.director.v1_5.domain.Owner; +import org.jclouds.vcloud.director.v1_5.domain.Reference; +import org.jclouds.vcloud.director.v1_5.domain.Task; +import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; +import org.testng.annotations.Test; + +/** + * Allows us to test a client via its side effects. + * + * @author danikov + */ +@Test(groups = "unit", singleThreaded = true, testName = "NetworkClientExpectTest") +public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { + + @Test + public void testWhenResponseIs2xxLoginReturnsValidMedia() { + URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); + + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("GET", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1") + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/media/media.xml", VCloudDirectorMediaType.MEDIA) + .httpResponseBuilder().build()); + + Media expected = media(); + + Reference mediaRef = Reference.builder().href(mediaUri).build(); + + assertEquals(client.getMediaClient().getMedia(mediaRef), expected); + } + + public void testWhenResponseIs400ForInvalidMediaId() { + URI mediaUri = URI.create(endpoint + "/media/NOTAUUID"); + + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("GET", "/media/NOTAUUID") + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/media/error400.xml", VCloudDirectorMediaType.ERROR) + .httpResponseBuilder().statusCode(400).build()); + + Error expected = Error.builder() + .message("validation error on field 'id': String value has invalid format or length") + .majorErrorCode(400) + .minorErrorCode("BAD_REQUEST") + .build(); + + Reference mediaRef = Reference.builder().href(mediaUri).build(); + + try { + client.getMediaClient().getMedia(mediaRef); + fail("Should give HTTP 400 error"); + } catch (VCloudDirectorException vde) { + assertEquals(vde.getError(), expected); + } catch (Exception e) { + fail("Should have thrown a VCloudDirectorException"); + } + } + + @Test + public void testWhenResponseIs403ForCatalogIdUsedAsMediaId() { + URI mediaUri = URI.create(endpoint + "/media/e9cd3387-ac57-4d27-a481-9bee75e0690f"); + + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("GET", "/media/e9cd3387-ac57-4d27-a481-9bee75e0690f") + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/media/error403-catalog.xml", VCloudDirectorMediaType.ERROR) + .httpResponseBuilder().statusCode(403).build()); + + Error expected = Error.builder() + .message("No access to entity \"(com.vmware.vcloud.entity.media:e9cd3387-ac57-4d27-a481-9bee75e0690f)\".") + .majorErrorCode(403) + .minorErrorCode("ACCESS_TO_RESOURCE_IS_FORBIDDEN") + .build(); + + Reference mediaRef = Reference.builder().href(mediaUri).build(); + + try { + client.getMediaClient().getMedia(mediaRef); + fail("Should give HTTP 403 error"); + } catch (VCloudDirectorException vde) { + assertEquals(vde.getError(), expected); + } catch (Exception e) { + fail("Should have thrown a VCloudDirectorException"); + } + } + + @Test + public void testWhenResponseIs403ForFakeMediaId() { + URI mediaUri = URI.create(endpoint + "/media/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"); + + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("GET", "/media/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/media/error403-fake.xml", VCloudDirectorMediaType.ERROR) + .httpResponseBuilder().statusCode(403).build()); + + Error expected = Error.builder() + .message("No access to entity \"(com.vmware.vcloud.entity.media:aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee)\".") + .majorErrorCode(403) + .minorErrorCode("ACCESS_TO_RESOURCE_IS_FORBIDDEN") + .build(); + + Reference mediaRef = Reference.builder().href(mediaUri).build(); + + try { + client.getMediaClient().getMedia(mediaRef); + fail("Should give HTTP 403 error"); + } catch (VCloudDirectorException vde) { + assertEquals(vde.getError(), expected); + } catch (Exception e) { + fail("Should have thrown a VCloudDirectorException"); + } + } + + @Test + public void testWhenResponseIs2xxLoginUpdateReturnsValidMedia() { + URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); + + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("PUT", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1") + .xmlFilePayload("/media/updateMedia.xml", VCloudDirectorMediaType.MEDIA) + .acceptMedia(VCloudDirectorMediaType.TASK) + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/media/updateMediaTask.xml", VCloudDirectorMediaType.TASK) + .httpResponseBuilder().build()); + + Media update = updateMedia(); + Task expected = updateMediaTask(); + Reference mediaRef = Reference.builder().href(mediaUri).build(); + + assertEquals(client.getMediaClient().updateMedia(mediaRef, update), expected); + } + + @Test + public void testWhenResponseIs2xxLoginDeleteMediaReturnsValidTask() { + URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); + + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("DELETE", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1") + .acceptMedia(VCloudDirectorMediaType.TASK) + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/media/deleteMediaTask.xml", VCloudDirectorMediaType.TASK) + .httpResponseBuilder().build()); + + Task expected = deleteMediaTask(); + Reference mediaRef = Reference.builder().href(mediaUri).build(); + + assertEquals(client.getMediaClient().deleteMedia(mediaRef), expected); + } + + @Test + public void testWhenResponseIs2xxLoginReturnsValidMetadata() { + URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); + + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("GET", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata") + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/media/metadata.xml", VCloudDirectorMediaType.METADATA) + .httpResponseBuilder().build()); + + Reference mediaRef = Reference.builder().href(mediaUri).build(); + + Metadata expected = metadata(); + + assertEquals(client.getMediaClient().getMetadata(mediaRef), expected); + } + + @Test + public void testWhenResponseIs2xxLoginMergeMetadataReturnsValidTask() { + URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); + + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("POST", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata") + .xmlFilePayload("/media/metadata.xml", VCloudDirectorMediaType.METADATA) + .acceptMedia(VCloudDirectorMediaType.TASK) + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/media/mergeMetadataTask.xml", VCloudDirectorMediaType.TASK) + .httpResponseBuilder().build()); + + Reference mediaRef = Reference.builder().href(mediaUri).build(); + Metadata inputMetadata = metadata(); + Task expectedTask = mergeMetadataTask(); + + assertEquals(client.getMediaClient().mergeMetadata(mediaRef, inputMetadata), expectedTask); + } + + public void testWhenResponseIs2xxLoginReturnsValidMetadataEntry() { + URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); + + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("GET", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata/key") + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/media/metadataEntry.xml", VCloudDirectorMediaType.METADATA_ENTRY) + .httpResponseBuilder().build()); + + MetadataEntry expected = metadataEntry(); + + Reference mediaRef = Reference.builder().href(mediaUri).build(); + + assertEquals(client.getMediaClient().getMetadataEntry(mediaRef, "key"), expected); + } + + @Test + public void testWhenResponseIs2xxLoginSetMetadataReturnsValidTask() { + URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); + + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("PUT", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata/key") + .xmlFilePayload("/media/setMetadata.xml", VCloudDirectorMediaType.METADATA_VALUE) + .acceptMedia(VCloudDirectorMediaType.TASK) + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/media/setMetadataTask.xml", VCloudDirectorMediaType.TASK) + .httpResponseBuilder().build()); + + Reference mediaRef = Reference.builder().href(mediaUri).build(); + MetadataValue inputMetadataValue = MetadataValue.builder().value("value").build(); + + Task expectedTask = setMetadataEntryTask(); + + assertEquals(client.getMediaClient().setMetadata(mediaRef, "key", inputMetadataValue), expectedTask); + } + + @Test + public void testWhenResponseIs2xxLoginDeleteMetadataEntryReturnsValidTask() { + URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); + + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("DELETE", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata/key") + .acceptMedia(VCloudDirectorMediaType.TASK) + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/media/deleteMetadataEntryTask.xml", VCloudDirectorMediaType.TASK) + .httpResponseBuilder().build()); + + Reference mediaRef = Reference.builder().href(mediaUri).build(); + Task expectedTask = deleteMetadataEntryTask(); + + assertEquals(client.getMediaClient().deleteMetadataEntry(mediaRef, "key"), expectedTask); + } + + @Test + public void testWhenResponseIs2xxLoginReturnsValidOwner() { + URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); + + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("GET", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/owner") + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/media/owner.xml", VCloudDirectorMediaType.OWNER) + .httpResponseBuilder().build()); + + Owner expected = owner(); + + Reference mediaRef = Reference.builder().href(mediaUri).build(); + + assertEquals(client.getMediaClient().getOwner(mediaRef), expected); + } + + private static Media media() { + return Media.builder() + .size(175163392) + .imageType("iso") + .status(1) + .name("DansTestMedia") + .id("urn:vcloud:media:794eb334-754e-4917-b5a0-5df85cbd61d1") + .href(URI.create("https://mycloud.greenhousedata.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1")) + .link(Link.builder() + .rel("up") + .type("application/vnd.vmware.vcloud.vdc+xml") + .href(URI.create("https://mycloud.greenhousedata.com/api/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f")) + .build()) + .link(Link.builder() + .rel("catalogItem") + .type("application/vnd.vmware.vcloud.catalogItem+xml") + .href(URI.create("https://mycloud.greenhousedata.com/api/catalogItem/1979d680-304e-4118-9283-9210c3b3ed8d")) + .build()) + .link(Link.builder() + .rel("remove") + .href(URI.create("https://mycloud.greenhousedata.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1")) + .build()) + .link(Link.builder() + .rel("edit") + .type("application/vnd.vmware.vcloud.media+xml") + .href(URI.create("https://mycloud.greenhousedata.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1")) + .build()) + .link(Link.builder() + .rel("down") + .type("application/vnd.vmware.vcloud.owner+xml") + .href(URI.create("https://mycloud.greenhousedata.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1/owner")) + .build()) + .link(Link.builder() + .rel("down") + .type("application/vnd.vmware.vcloud.metadata+xml") + .href(URI.create("https://mycloud.greenhousedata.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata")) + .build()) + .description("Windows 2003 R2 Disk2 Standard 32bit & 64bit") + .owner(owner()) + .build(); + } + + private static Media updateMedia() { + return Media.builder() + .size(175163392) + .imageType("iso") + .owner(Owner.builder() + .user(Reference.builder() + .type("application/vnd.vmware.admin.user+xml") + .name("acole") + .href(URI.create("https://mycloud.greenhousedata.com/api/admin/user/c090335b-708c-4c1c-9e3d-89560d002120")) + .build()) + .build()) + .build(); + } + + private static Task updateMediaTask() { + return Task.builder() + .name("task") + .id("urn:vcloud:task:c6dca927-eab4-41fa-ad6a-3ac58602541c") + .type("application/vnd.vmware.vcloud.task+xml") + .href(URI.create("https://vcloudbeta.bluelock.com/api/task/c6dca927-eab4-41fa-ad6a-3ac58602541c")) + .status("running") + .startTime(dateService.iso8601DateParse("2012-02-13T06:35:08.011-05:00")) + .expiryTime(dateService.iso8601DateParse("2012-05-13T06:35:08.011-04:00")) + .operationName("mediaUpdate") + .operation("Updating Media (794eb334-754e-4917-b5a0-5df85cbd61d1)") + .link(Link.builder() + .rel("task:cancel") + .href(URI.create("https://vcloudbeta.bluelock.com/api/task/c6dca927-eab4-41fa-ad6a-3ac58602541c/action/cancel")) + .build()) + .owner(Reference.builder() + .type("application/vnd.vmware.vcloud.media+xml") + .name("") + .href(URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1")) + .build()) + .user(Reference.builder() + .type("application/vnd.vmware.admin.user+xml") + .name("adk@cloudsoftcorp.com") + .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/e9eb1b29-0404-4c5e-8ef7-e584acc51da9")) + .build()) + .org(Reference.builder() + .type("application/vnd.vmware.vcloud.org+xml") + .name("JClouds") + .href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")) + .build()) + .build(); + } + + public static Task deleteMediaTask() { + return Task.builder() + .name("task") + .id("urn:vcloud:task:c6dca927-eab4-41fa-ad6a-3ac58602541c") + .type("application/vnd.vmware.vcloud.task+xml") + .href(URI.create("https://vcloudbeta.bluelock.com/api/task/c6dca927-eab4-41fa-ad6a-3ac58602541c")) + .status("running") + .startTime(dateService.iso8601DateParse("2012-02-13T06:35:08.011-05:00")) + .expiryTime(dateService.iso8601DateParse("2012-05-13T06:35:08.011-04:00")) + .operationName("mediaDelete") + .operation("Deleting Media (794eb334-754e-4917-b5a0-5df85cbd61d1)") + .link(Link.builder() + .rel("task:cancel") + .href(URI.create("https://vcloudbeta.bluelock.com/api/task/c6dca927-eab4-41fa-ad6a-3ac58602541c/action/cancel")) + .build()) + .owner(Reference.builder() + .type("application/vnd.vmware.vcloud.media+xml") + .name("") + .href(URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1")) + .build()) + .user(Reference.builder() + .type("application/vnd.vmware.admin.user+xml") + .name("adk@cloudsoftcorp.com") + .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/e9eb1b29-0404-4c5e-8ef7-e584acc51da9")) + .build()) + .org(Reference.builder() + .type("application/vnd.vmware.vcloud.org+xml") + .name("JClouds") + .href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")) + .build()) + .build(); + } + + private static Owner owner() { + return Owner.builder() + .type("application/vnd.vmware.vcloud.owner+xml") + .user(Reference.builder() + .type("application/vnd.vmware.admin.user+xml") + .name("acole") + .href(URI.create("https://mycloud.greenhousedata.com/api/admin/user/c090335b-708c-4c1c-9e3d-89560d002120")) + .build()) + .build(); + } + + private static Metadata metadata() { + return Metadata.builder() + .type("application/vnd.vmware.vcloud.metadata+xml") + .href(URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata")) + .link(Link.builder() + .rel("up") + .type("application/vnd.vmware.vcloud.media+xml") + .href(URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1")) + .build()) + .entry(MetadataEntry.builder().key("key").value("value").build()) + .build(); + } + + private static MetadataEntry metadataEntry() { + return MetadataEntry.builder() + .href(URI.create("https://vcloudbeta.bluelock.com/api/cmedia/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata/key")) + .link(Link.builder() + .rel("up") + .type("application/vnd.vmware.vcloud.metadata+xml") + .href(URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata")) + .build()) + .key("key").value("value").build(); + } + + private Task mergeMetadataTask() { + return Task.builder() + .status("running") + .startTime(dateService.iso8601DateParse("2012-02-13T06:35:08.011-05:00")) + .operationName("metadataMerge") + .operation("Merging metadata for Media (794eb334-754e-4917-b5a0-5df85cbd61d1)") + .expiryTime(dateService.iso8601DateParse("2012-05-13T06:35:08.011-04:00")) + .name("task") + .id("urn:vcloud:task:c6dca927-eab4-41fa-ad6a-3ac58602541c") + .type("application/vnd.vmware.vcloud.task+xml") + .href(URI.create("https://vcloudbeta.bluelock.com/api/task/c6dca927-eab4-41fa-ad6a-3ac58602541c")) + .link(Link.builder() + .rel("task:cancel") + .href(URI.create("https://vcloudbeta.bluelock.com/api/task/c6dca927-eab4-41fa-ad6a-3ac58602541c/action/cancel")) + .build()) + .owner(Reference.builder() + .type("application/vnd.vmware.vcloud.media+xml") + .name("") + .href(URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1")) + .build()) + .user(Reference.builder() + .type("application/vnd.vmware.admin.user+xml") + .name("adk@cloudsoftcorp.com") + .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/e9eb1b29-0404-4c5e-8ef7-e584acc51da9")) + .build()) + .org(Reference.builder() + .type("application/vnd.vmware.vcloud.org+xml") + .name("JClouds") + .href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")) + .build()) + .build(); + } + + private Task setMetadataEntryTask() { + return Task.builder() + .status("running") + .startTime(dateService.iso8601DateParse("2012-02-13T06:35:08.011-05:00")) + .operationName("metadataSet") + .operation("Setting metadata for Media (794eb334-754e-4917-b5a0-5df85cbd61d1)") + .expiryTime(dateService.iso8601DateParse("2012-05-13T06:35:08.011-04:00")) + .name("task") + .id("urn:vcloud:task:c6dca927-eab4-41fa-ad6a-3ac58602541c") + .type("application/vnd.vmware.vcloud.task+xml") + .href(URI.create("https://vcloudbeta.bluelock.com/api/task/c6dca927-eab4-41fa-ad6a-3ac58602541c")) + .link(Link.builder() + .rel("task:cancel") + .href(URI.create("https://vcloudbeta.bluelock.com/api/task/c6dca927-eab4-41fa-ad6a-3ac58602541c/action/cancel")) + .build()) + .owner(Reference.builder() + .type("application/vnd.vmware.vcloud.media+xml") + .name("") + .href(URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1")) + .build()) + .user(Reference.builder() + .type("application/vnd.vmware.admin.user+xml") + .name("adk@cloudsoftcorp.com") + .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/e9eb1b29-0404-4c5e-8ef7-e584acc51da9")) + .build()) + .org(Reference.builder() + .type("application/vnd.vmware.vcloud.org+xml") + .name("JClouds") + .href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")) + .build()) + .build(); + } + + public static Task deleteMetadataEntryTask() { + return Task.builder() + .name("task") + .id("urn:vcloud:task:c6dca927-eab4-41fa-ad6a-3ac58602541c") + .type("application/vnd.vmware.vcloud.task+xml") + .href(URI.create("https://vcloudbeta.bluelock.com/api/task/c6dca927-eab4-41fa-ad6a-3ac58602541c")) + .status("running") + .startTime(dateService.iso8601DateParse("2012-02-13T06:35:08.011-05:00")) + .expiryTime(dateService.iso8601DateParse("2012-05-13T06:35:08.011-04:00")) + .operationName("metadataDelete") + .operation("Deleting metadata for Media (794eb334-754e-4917-b5a0-5df85cbd61d1)") + .link(Link.builder() + .rel("task:cancel") + .href(URI.create("https://vcloudbeta.bluelock.com/api/task/c6dca927-eab4-41fa-ad6a-3ac58602541c/action/cancel")) + .build()) + .owner(Reference.builder() + .type("application/vnd.vmware.vcloud.media+xml") + .name("") + .href(URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1")) + .build()) + .user(Reference.builder() + .type("application/vnd.vmware.admin.user+xml") + .name("adk@cloudsoftcorp.com") + .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/e9eb1b29-0404-4c5e-8ef7-e584acc51da9")) + .build()) + .org(Reference.builder() + .type("application/vnd.vmware.vcloud.org+xml") + .name("JClouds") + .href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")) + .build()) + .build(); + } +} diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorRestClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorRestClientExpectTest.java index 05c85183a8..75c4a4ea49 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorRestClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorRestClientExpectTest.java @@ -18,8 +18,8 @@ */ package org.jclouds.vcloud.director.v1_5.internal; -import static org.testng.Assert.assertNotNull; import static com.google.common.base.Preconditions.checkNotNull; +import static org.testng.Assert.assertNotNull; import java.net.URI; @@ -31,8 +31,8 @@ import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.testng.annotations.BeforeGroups; -import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ImmutableMultimap; +import com.google.common.collect.LinkedListMultimap; import com.google.common.collect.Multimap; import com.google.inject.Guice; @@ -158,7 +158,7 @@ public class BaseVCloudDirectorRestClientExpectTest extends BaseRestClientExpect * */ protected class VcloudHttpRequestPrimer { - private Multimap headers = ArrayListMultimap.create(); + private Multimap headers = LinkedListMultimap.create(); private HttpRequest.Builder builder = HttpRequest.builder(); public VcloudHttpRequestPrimer() { diff --git a/labs/vcloud-director/src/test/resources/media/deleteMediaTask.xml b/labs/vcloud-director/src/test/resources/media/deleteMediaTask.xml new file mode 100644 index 0000000000..570f815a23 --- /dev/null +++ b/labs/vcloud-director/src/test/resources/media/deleteMediaTask.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/labs/vcloud-director/src/test/resources/media/deleteMetadataEntryTask.xml b/labs/vcloud-director/src/test/resources/media/deleteMetadataEntryTask.xml new file mode 100644 index 0000000000..1baaa50850 --- /dev/null +++ b/labs/vcloud-director/src/test/resources/media/deleteMetadataEntryTask.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/labs/vcloud-director/src/test/resources/media/error400.xml b/labs/vcloud-director/src/test/resources/media/error400.xml new file mode 100644 index 0000000000..981f249e85 --- /dev/null +++ b/labs/vcloud-director/src/test/resources/media/error400.xml @@ -0,0 +1,2 @@ + + diff --git a/labs/vcloud-director/src/test/resources/media/error403-catalog.xml b/labs/vcloud-director/src/test/resources/media/error403-catalog.xml new file mode 100644 index 0000000000..f1f0b7fee5 --- /dev/null +++ b/labs/vcloud-director/src/test/resources/media/error403-catalog.xml @@ -0,0 +1,2 @@ + + diff --git a/labs/vcloud-director/src/test/resources/media/error403-fake.xml b/labs/vcloud-director/src/test/resources/media/error403-fake.xml new file mode 100644 index 0000000000..3b582f3c0c --- /dev/null +++ b/labs/vcloud-director/src/test/resources/media/error403-fake.xml @@ -0,0 +1,2 @@ + + diff --git a/labs/vcloud-director/src/test/resources/media/media.xml b/labs/vcloud-director/src/test/resources/media/media.xml new file mode 100644 index 0000000000..cf0caa5498 --- /dev/null +++ b/labs/vcloud-director/src/test/resources/media/media.xml @@ -0,0 +1,13 @@ + + + + + + + + + Windows 2003 R2 Disk2 Standard 32bit & 64bit + + + + diff --git a/labs/vcloud-director/src/test/resources/media/mergeMetadataTask.xml b/labs/vcloud-director/src/test/resources/media/mergeMetadataTask.xml new file mode 100644 index 0000000000..62cac4b7a2 --- /dev/null +++ b/labs/vcloud-director/src/test/resources/media/mergeMetadataTask.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/labs/vcloud-director/src/test/resources/media/metadata.xml b/labs/vcloud-director/src/test/resources/media/metadata.xml new file mode 100644 index 0000000000..f74560ced5 --- /dev/null +++ b/labs/vcloud-director/src/test/resources/media/metadata.xml @@ -0,0 +1,8 @@ + + + + + key + value + + diff --git a/labs/vcloud-director/src/test/resources/media/metadataEntry.xml b/labs/vcloud-director/src/test/resources/media/metadataEntry.xml new file mode 100644 index 0000000000..0f10d4743e --- /dev/null +++ b/labs/vcloud-director/src/test/resources/media/metadataEntry.xml @@ -0,0 +1,6 @@ + + + + key + value + diff --git a/labs/vcloud-director/src/test/resources/media/owner.xml b/labs/vcloud-director/src/test/resources/media/owner.xml new file mode 100644 index 0000000000..fe6c4228ff --- /dev/null +++ b/labs/vcloud-director/src/test/resources/media/owner.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/labs/vcloud-director/src/test/resources/media/setMetadata.xml b/labs/vcloud-director/src/test/resources/media/setMetadata.xml new file mode 100644 index 0000000000..275e5b4b62 --- /dev/null +++ b/labs/vcloud-director/src/test/resources/media/setMetadata.xml @@ -0,0 +1,4 @@ + + + value + diff --git a/labs/vcloud-director/src/test/resources/media/setMetadataTask.xml b/labs/vcloud-director/src/test/resources/media/setMetadataTask.xml new file mode 100644 index 0000000000..d412e893a8 --- /dev/null +++ b/labs/vcloud-director/src/test/resources/media/setMetadataTask.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/labs/vcloud-director/src/test/resources/media/updateMedia.xml b/labs/vcloud-director/src/test/resources/media/updateMedia.xml new file mode 100644 index 0000000000..8bd62506bd --- /dev/null +++ b/labs/vcloud-director/src/test/resources/media/updateMedia.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/labs/vcloud-director/src/test/resources/media/updateMediaTask.xml b/labs/vcloud-director/src/test/resources/media/updateMediaTask.xml new file mode 100644 index 0000000000..9f8c0aff5c --- /dev/null +++ b/labs/vcloud-director/src/test/resources/media/updateMediaTask.xml @@ -0,0 +1,7 @@ + + + + + + +