mirror of https://github.com/apache/jclouds.git
Merge pull request #398 from danikov/vclouds-director-admin-catalog
Issue 830: vCloud director Admin Catalog (getCatalog)
This commit is contained in:
commit
9d56d87d1f
|
@ -26,6 +26,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Session;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Vdc;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ovf.Network;
|
||||
import org.jclouds.vcloud.director.v1_5.features.AdminCatalogAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient;
|
||||
|
@ -106,4 +107,9 @@ public interface VCloudDirectorAsyncClient {
|
|||
@Delegate
|
||||
VAppTemplateAsyncClient getVAppTemplateClient();
|
||||
|
||||
/**
|
||||
* @return asynchronous access to {@link Catalog} features
|
||||
*/
|
||||
@Delegate
|
||||
AdminCatalogAsyncClient getAdminCatalogClient();
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Session;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Vdc;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ovf.Network;
|
||||
import org.jclouds.vcloud.director.v1_5.features.AdminCatalogClient;
|
||||
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;
|
||||
|
@ -84,7 +85,7 @@ public interface VCloudDirectorClient {
|
|||
*/
|
||||
@Delegate
|
||||
CatalogClient getCatalogClient();
|
||||
|
||||
|
||||
/**
|
||||
* @return synchronous access to {@link Media} features
|
||||
*/
|
||||
|
@ -108,5 +109,11 @@ public interface VCloudDirectorClient {
|
|||
*/
|
||||
@Delegate
|
||||
VAppTemplateClient getVAppTemplateClient();
|
||||
|
||||
/**
|
||||
* @return synchronous access to {@link Catalog} features
|
||||
*/
|
||||
@Delegate
|
||||
AdminCatalogClient getAdminCatalogClient();
|
||||
|
||||
}
|
||||
|
|
|
@ -127,6 +127,10 @@ public class VCloudDirectorMediaType {
|
|||
|
||||
public static final String ENVELOPE = "application/vnd.???";
|
||||
|
||||
public static final String ADMIN_CATALOG = "application/vnd.vmware.admin.catalog+xml";
|
||||
|
||||
public static final String ADMIN_ORGANIZATION = "application/vnd.vmware.admin.organization+xml";
|
||||
|
||||
/**
|
||||
*
|
||||
* All acceptable media types.
|
||||
|
@ -140,12 +144,10 @@ public class VCloudDirectorMediaType {
|
|||
MEDIA, OWNER, VDC, ADMIN_USER, V_APP, V_APP_TEMPLATE,
|
||||
CAPTURE_VAPP_PARAMS, CLONE_V_APP_PARAMS, CLONE_V_APP_TEMPLATE_PARAMS,
|
||||
COMPOSE_VAPP_PARAMS, INSTANTIATE_VAPP_TEMPLATE_PARAMS,
|
||||
UPLOAD_VAPP_TEMPLATE_PARAMS,
|
||||
UPLOAD_VAPP_TEMPLATE_PARAMS, ADMIN_CATALOG, ADMIN_ORGANIZATION,
|
||||
QUERY_RESULT_RECORDS, QUERY_RESULT_REFERENCES, QUERY_RESULT_ID_RECORDS,
|
||||
CONTROL_ACCESS,
|
||||
VAPP_TEMPLATE, CUSTOMIZATION_SECTION, GUEST_CUSTOMIZATION_SECTION, NETWORK_SECTION, NETWORK_CONFIG_SECTION, NETWORK_CONNECTION_SECTION,
|
||||
CLONE_MEDIA_PARAMS
|
||||
,
|
||||
LEASE_SETTINGS_SECTION, RELOCATE_TEMPLATE, ENVELOPE
|
||||
CONTROL_ACCESS, VAPP_TEMPLATE, CUSTOMIZATION_SECTION, GUEST_CUSTOMIZATION_SECTION,
|
||||
NETWORK_SECTION, NETWORK_CONFIG_SECTION, NETWORK_CONNECTION_SECTION,
|
||||
CLONE_MEDIA_PARAMS, LEASE_SETTINGS_SECTION, RELOCATE_TEMPLATE, ENVELOPE
|
||||
);
|
||||
}
|
||||
|
|
|
@ -85,6 +85,7 @@ public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirec
|
|||
.put(UploadClient.class, UploadAsyncClient.class)
|
||||
.put(MetadataClient.Readable.class, MetadataAsyncClient.Readable.class)
|
||||
.put(MetadataClient.Writeable.class, MetadataAsyncClient.Writable.class)
|
||||
.put(AdminCatalogClient.class, AdminCatalogAsyncClient.class)
|
||||
.build();
|
||||
|
||||
public VCloudDirectorRestClientModule() {
|
||||
|
|
|
@ -0,0 +1,197 @@
|
|||
/**
|
||||
* 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.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.XmlRootElement;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Admin representation of the container for meta data (key-value pair) associated to different
|
||||
* entities in the system.
|
||||
*
|
||||
*
|
||||
* <p>Java class for AdminCatalog complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="AdminCatalog">
|
||||
* <complexContent>
|
||||
* <extension base="{http://www.vmware.com/vcloud/v1.5}CatalogType">
|
||||
* <anyAttribute processContents='lax' namespace='##other'/>
|
||||
* </extension>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlRootElement(name = "AdminCatalog")
|
||||
public class AdminCatalog extends CatalogType<AdminCatalog> {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromAdminCatalog(this);
|
||||
}
|
||||
|
||||
public static class Builder extends CatalogType.Builder<AdminCatalog> {
|
||||
|
||||
public AdminCatalog build() {
|
||||
return new AdminCatalog(href, type, links, description, tasksInProgress, id, name, owner, catalogItems, isPublished);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see CatalogType#getOwner()
|
||||
*/
|
||||
public Builder owner(Owner owner) {
|
||||
super.owner(owner);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see CatalogType#getCatalogItems()
|
||||
*/
|
||||
public Builder catalogItems(CatalogItems catalogItems) {
|
||||
super.catalogItems(catalogItems);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see CatalogType#isPublished()
|
||||
*/
|
||||
public Builder isPublished(Boolean isPublished) {
|
||||
super.isPublished(isPublished);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see CatalogType#isPublished()
|
||||
*/
|
||||
public Builder published() {
|
||||
super.published();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getName()
|
||||
*/
|
||||
@Override
|
||||
public Builder name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getDescription()
|
||||
*/
|
||||
@Override
|
||||
public Builder description(String description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 EntityType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder links(Set<Link> links) {
|
||||
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder link(Link link) {
|
||||
this.links.add(checkNotNull(link, "link"));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder fromCatalogType(CatalogType<AdminCatalog> in) {
|
||||
return Builder.class.cast(super.fromCatalogType(in));
|
||||
}
|
||||
public Builder fromAdminCatalog(AdminCatalog in) {
|
||||
return fromCatalogType(in);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private AdminCatalog() {
|
||||
// For JAXB
|
||||
}
|
||||
|
||||
public AdminCatalog(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id,
|
||||
String name, Owner owner, CatalogItems catalogItems, Boolean published) {
|
||||
super(href, type, links, description, tasksInProgress, id, name, owner, catalogItems, published);
|
||||
}
|
||||
}
|
|
@ -22,7 +22,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
|
@ -39,7 +39,7 @@ import com.google.common.collect.Sets;
|
|||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@XmlRootElement(name = "Catalog")
|
||||
public class Catalog extends EntityType<Catalog> {
|
||||
public class Catalog extends CatalogType<Catalog> {
|
||||
|
||||
public static final String MEDIA_TYPE = VCloudDirectorMediaType.CATALOG;
|
||||
|
||||
|
@ -53,17 +53,18 @@ public class Catalog extends EntityType<Catalog> {
|
|||
return new Builder().fromCatalog(this);
|
||||
}
|
||||
|
||||
public static class Builder extends EntityType.Builder<Catalog> {
|
||||
|
||||
private Entity owner;
|
||||
private CatalogItems catalogItems;
|
||||
private Boolean isPublished;
|
||||
public static class Builder extends CatalogType.Builder<Catalog> {
|
||||
|
||||
@Override
|
||||
public Catalog build() {
|
||||
return new Catalog(href, type, links, description, tasksInProgress, id, name, owner, catalogItems, isPublished);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Catalog#getOwner()
|
||||
*/
|
||||
public Builder owner(Entity owner) {
|
||||
this.owner = owner;
|
||||
public Builder owner(Owner owner) {
|
||||
super.owner(owner);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -71,7 +72,7 @@ public class Catalog extends EntityType<Catalog> {
|
|||
* @see Catalog#getCatalogItems()
|
||||
*/
|
||||
public Builder catalogItems(CatalogItems catalogItems) {
|
||||
this.catalogItems = catalogItems;
|
||||
super.catalogItems(catalogItems);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -79,7 +80,7 @@ public class Catalog extends EntityType<Catalog> {
|
|||
* @see Catalog#isPublished()
|
||||
*/
|
||||
public Builder isPublished(Boolean isPublished) {
|
||||
this.isPublished = isPublished;
|
||||
super.isPublished(isPublished);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -87,15 +88,10 @@ public class Catalog extends EntityType<Catalog> {
|
|||
* @see Catalog#isPublished()
|
||||
*/
|
||||
public Builder published() {
|
||||
this.isPublished = Boolean.TRUE;
|
||||
super.isPublished(isPublished);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Catalog build() {
|
||||
return new Catalog(href, type, links, description, tasksInProgress, id, name, owner, catalogItems, isPublished);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getName()
|
||||
*/
|
||||
|
@ -169,53 +165,22 @@ public class Catalog extends EntityType<Catalog> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Builder fromEntityType(EntityType<Catalog> in) {
|
||||
return Builder.class.cast(super.fromEntityType(in));
|
||||
public Builder fromCatalogType(CatalogType<Catalog> in) {
|
||||
return Builder.class.cast(super.fromCatalogType(in));
|
||||
}
|
||||
|
||||
public Builder fromCatalog(Catalog in) {
|
||||
return fromEntityType(in).owner(in.getOwner()).catalogItems(in.getCatalogItems()).isPublished(in.isPublished());
|
||||
return fromCatalogType(in).owner(in.getOwner()).catalogItems(in.getCatalogItems()).isPublished(in.isPublished());
|
||||
}
|
||||
}
|
||||
|
||||
public Catalog(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id,
|
||||
String name, Entity owner, CatalogItems catalogItems, Boolean published) {
|
||||
super(href, type, links, description, tasksInProgress, id, name);
|
||||
this.owner = owner;
|
||||
this.catalogItems = catalogItems;
|
||||
this.isPublished = published;
|
||||
String name, Owner owner, CatalogItems catalogItems, Boolean published) {
|
||||
super(href, type, links, description, tasksInProgress, id, name, owner, catalogItems, published);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private Catalog() {
|
||||
// For JAXB and builder use
|
||||
// for JAXB
|
||||
}
|
||||
|
||||
@XmlElement(name = "Owner")
|
||||
private Entity owner;
|
||||
@XmlElement(name = "CatalogItems")
|
||||
private CatalogItems catalogItems;
|
||||
@XmlElement(name = "IsPublished")
|
||||
private Boolean isPublished;
|
||||
|
||||
/**
|
||||
* Gets the value of the owner property.
|
||||
*/
|
||||
public Entity getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the catalogItems property.
|
||||
*/
|
||||
public CatalogItems getCatalogItems() {
|
||||
return catalogItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the isPublished property.
|
||||
*/
|
||||
public Boolean isPublished() {
|
||||
return isPublished;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,16 +18,20 @@
|
|||
*/
|
||||
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.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
|
@ -85,7 +89,7 @@ public class CatalogItems {
|
|||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
private CatalogItems(Collection<Reference> tasks) {
|
||||
private CatalogItems(Set<Reference> catalogItems) {
|
||||
this.catalogItems = catalogItems;
|
||||
}
|
||||
|
||||
|
@ -98,4 +102,28 @@ public class CatalogItems {
|
|||
public Set<Reference> getCatalogItems() {
|
||||
return Collections.unmodifiableSet(this.catalogItems);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
CatalogItems that = CatalogItems.class.cast(o);
|
||||
return equal(this.catalogItems, that.catalogItems);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(catalogItems);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return string().toString();
|
||||
}
|
||||
|
||||
protected ToStringHelper string() {
|
||||
return Objects.toStringHelper("").add("catalogItems", catalogItems);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,242 @@
|
|||
/*
|
||||
* 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.net.URI;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
|
||||
/**
|
||||
* Container for references to VappTemplate and Media objects.
|
||||
* <p/>
|
||||
* <pre>
|
||||
* <complexType name="CatalogType" />
|
||||
* </pre>
|
||||
*
|
||||
* @author danikov
|
||||
*/
|
||||
public class CatalogType<T extends CatalogType<T>> extends EntityType<T> {
|
||||
|
||||
public static <T extends CatalogType<T>> Builder<T> builder() {
|
||||
return new Builder<T>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder<T> toBuilder() {
|
||||
return new Builder<T>().fromCatalogType(this);
|
||||
}
|
||||
|
||||
public static class Builder<T extends CatalogType<T>> extends EntityType.Builder<T> {
|
||||
|
||||
protected Owner owner;
|
||||
protected CatalogItems catalogItems;
|
||||
protected Boolean isPublished;
|
||||
|
||||
/**
|
||||
* @see CatalogType#getOwner()
|
||||
*/
|
||||
public Builder<T> owner(Owner owner) {
|
||||
this.owner = owner;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see CatalogType#getCatalogItems()
|
||||
*/
|
||||
public Builder<T> catalogItems(CatalogItems catalogItems) {
|
||||
this.catalogItems = catalogItems;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see CatalogType#isPublished()
|
||||
*/
|
||||
public Builder<T> isPublished(Boolean isPublished) {
|
||||
this.isPublished = isPublished;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see CatalogType#isPublished()
|
||||
*/
|
||||
public Builder<T> published() {
|
||||
this.isPublished = Boolean.TRUE;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CatalogType<T> build() {
|
||||
return new CatalogType<T>(href, type, links, description, tasksInProgress, id, name, owner, catalogItems, isPublished);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getName()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> name(String name) {
|
||||
super.name(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getDescription()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> description(String description) {
|
||||
super.description(description);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getId()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> id(String id) {
|
||||
super.id(id);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasksInProgress()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> tasksInProgress(TasksInProgress tasksInProgress) {
|
||||
super.tasksInProgress(tasksInProgress);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getHref()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> href(URI href) {
|
||||
super.href(href);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ReferenceType#getType()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> type(String type) {
|
||||
super.type(type);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> links(Set<Link> links) {
|
||||
super.links(links);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getLinks()
|
||||
*/
|
||||
@Override
|
||||
public Builder<T> link(Link link) {
|
||||
super.link(link);
|
||||
return this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Builder<T> fromEntityType(EntityType<T> in) {
|
||||
return Builder.class.cast(super.fromEntityType(in));
|
||||
}
|
||||
|
||||
public Builder<T> fromCatalogType(CatalogType<T> in) {
|
||||
return fromEntityType(in).owner(in.getOwner()).catalogItems(in.getCatalogItems()).isPublished(in.isPublished());
|
||||
}
|
||||
}
|
||||
|
||||
public CatalogType(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id,
|
||||
String name, Owner owner, CatalogItems catalogItems, Boolean published) {
|
||||
super(href, type, links, description, tasksInProgress, id, name);
|
||||
this.owner = owner;
|
||||
this.catalogItems = catalogItems;
|
||||
this.isPublished = published;
|
||||
}
|
||||
|
||||
protected CatalogType() {
|
||||
// For JAXB
|
||||
}
|
||||
|
||||
@XmlElement(name = "Owner")
|
||||
private Owner owner;
|
||||
@XmlElement(name = "CatalogItems")
|
||||
private CatalogItems catalogItems;
|
||||
@XmlElement(name = "IsPublished")
|
||||
private Boolean isPublished;
|
||||
|
||||
/**
|
||||
* Gets the value of the owner property.
|
||||
*/
|
||||
public Owner getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the catalogItems property.
|
||||
*/
|
||||
public CatalogItems getCatalogItems() {
|
||||
return catalogItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the isPublished property.
|
||||
*/
|
||||
public Boolean isPublished() {
|
||||
return isPublished;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
CatalogType<?> that = CatalogType.class.cast(o);
|
||||
return super.equals(that) &&
|
||||
equal(this.owner, that.owner) &&
|
||||
equal(this.catalogItems, that.catalogItems) &&
|
||||
equal(this.isPublished, that.isPublished);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(super.hashCode(), owner, catalogItems, catalogItems);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToStringHelper string() {
|
||||
return super.string().add("owner", owner)
|
||||
.add("catalogItems", catalogItems)
|
||||
.add("isPublished", isPublished);
|
||||
}
|
||||
|
||||
}
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
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.util.Collection;
|
||||
|
@ -27,6 +28,8 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
|
@ -98,5 +101,28 @@ public class CatalogsList {
|
|||
public Set<Reference> getCatalogItems() {
|
||||
return this.catalogReferences;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
CatalogsList that = CatalogsList.class.cast(o);
|
||||
return equal(this.catalogReferences, that.catalogReferences);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(catalogReferences);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return string().toString();
|
||||
}
|
||||
|
||||
protected ToStringHelper string() {
|
||||
return Objects.toStringHelper("").add("catalogReferences", catalogReferences);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
@ -59,7 +60,6 @@ public class Owner
|
|||
extends ResourceType<Owner>
|
||||
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
@ -134,6 +134,7 @@ public class Owner
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private Owner() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* 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.net.URI;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
|
||||
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.vcloud.director.v1_5.domain.AdminCatalog;
|
||||
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* @see AdminCatalogClient
|
||||
* @author danikov
|
||||
*/
|
||||
@RequestFilters(AddVCloudAuthorizationToRequest.class)
|
||||
public interface AdminCatalogAsyncClient {
|
||||
|
||||
/**
|
||||
* Retrieves an admin catalog.
|
||||
*/
|
||||
@GET
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<AdminCatalog> getCatalog(@EndpointParam URI catalogRef);
|
||||
|
||||
// PUT /admin/catalog/{id}
|
||||
// DELETE /admin/catalog/{id}
|
||||
// POST /admin/catalog/{id}/action/publish
|
||||
// GET /admin/catalog/{id}/owner
|
||||
// PUT /admin/catalog/{id}/owner
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* 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.net.URI;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.AdminCatalog;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to {@link AdminCatalog} objects.
|
||||
*
|
||||
* @see AdminCatalogAsyncClient
|
||||
* @author danikov
|
||||
*/
|
||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||
public interface AdminCatalogClient {
|
||||
|
||||
/**
|
||||
* Retrieves a catalog.
|
||||
*
|
||||
* <pre>
|
||||
* GET /admin/catalog/{id}
|
||||
* </pre>
|
||||
*
|
||||
* @param catalogRef the reference for the catalog
|
||||
* @return a catalog
|
||||
*/
|
||||
AdminCatalog getCatalog(URI catalogRef);
|
||||
}
|
|
@ -20,10 +20,10 @@ package org.jclouds.vcloud.director.v1_5.domain;
|
|||
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.CONDITION_FMT;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.MUST_BE_WELL_FORMED_FMT;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_ATTRB_REQ;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_EQ;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.MUST_CONTAIN_FMT;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.NOT_NULL_OBJECT_FMT;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_ATTRB_REQ;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_EQ;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_GTE_0;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_REQ;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.REQUIRED_VALUE_FMT;
|
||||
|
@ -228,11 +228,16 @@ public class Checks {
|
|||
// Check parent type
|
||||
checkEntityType(org);
|
||||
}
|
||||
|
||||
public static void checkAdminCatalog(AdminCatalog catalog) {
|
||||
// Check parent type
|
||||
checkCatalogType(catalog);
|
||||
}
|
||||
|
||||
public static void checkCatalog(Catalog catalog) {
|
||||
public static void checkCatalogType(CatalogType<?> catalog) {
|
||||
// Check optional elements/attributes
|
||||
Entity owner = catalog.getOwner();
|
||||
if (owner != null) checkEntityType(owner);
|
||||
Owner owner = catalog.getOwner();
|
||||
if (owner != null) checkOwner(owner);
|
||||
CatalogItems catalogItems = catalog.getCatalogItems();
|
||||
if (catalogItems != null) {
|
||||
for (Reference catalogItemReference : catalogItems.getCatalogItems()) {
|
||||
|
@ -245,6 +250,16 @@ public class Checks {
|
|||
checkEntityType(catalog);
|
||||
}
|
||||
|
||||
private static void checkOwner(Owner owner) {
|
||||
// Check optional elements/attributes
|
||||
if (owner.getUser() != null) {
|
||||
checkReferenceType(owner.getUser());
|
||||
}
|
||||
|
||||
// Check parent type
|
||||
checkResourceType(owner);
|
||||
}
|
||||
|
||||
public static void checkCatalogItem(CatalogItem catalogItem) {
|
||||
// Check parent type
|
||||
checkEntityType(catalogItem);
|
||||
|
|
|
@ -0,0 +1,139 @@
|
|||
/*
|
||||
* 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 static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.AdminCatalog;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CatalogItems;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||
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.internal.BaseVCloudDirectorRestClientExpectTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Test the {@link CatalogClient} by observing its side effects.
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "CatalogClientExpectTest")
|
||||
public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
|
||||
|
||||
@Test
|
||||
public void testGetCatalog() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("GET", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/catalog/admin/catalog.xml", VCloudDirectorMediaType.ADMIN_CATALOG)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
AdminCatalog expected = catalog();
|
||||
|
||||
Reference catalogRef = Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalog+xml")
|
||||
.name("QunyingTestCatalog")
|
||||
.href(URI.create(endpoint + "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
||||
.build();
|
||||
|
||||
assertEquals(client.getAdminCatalogClient().getCatalog(catalogRef.getURI()), expected);
|
||||
}
|
||||
|
||||
public static final AdminCatalog catalog() {
|
||||
return AdminCatalog.builder()
|
||||
.name("QunyingTestCatalog")
|
||||
.id("urn:vcloud:catalog:7212e451-76e1-4631-b2de-ba1dfd8080e4")
|
||||
.type("application/vnd.vmware.admin.catalog+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
||||
.link(Link.builder()
|
||||
.rel("up")
|
||||
.type("application/vnd.vmware.admin.organization+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
|
||||
.build())
|
||||
.link(Link.builder()
|
||||
.rel("alternate")
|
||||
.type("application/vnd.vmware.vcloud.catalog+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
||||
.build())
|
||||
.link(Link.builder()
|
||||
.rel("down")
|
||||
.type("application/vnd.vmware.vcloud.owner+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/owner"))
|
||||
.build())
|
||||
.link(Link.builder()
|
||||
.rel("add")
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/catalogItems"))
|
||||
.build())
|
||||
.link(Link.builder()
|
||||
.rel("edit")
|
||||
.type("application/vnd.vmware.admin.catalog+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
||||
.build())
|
||||
.link(Link.builder()
|
||||
.rel("remove")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
||||
.build())
|
||||
.link(Link.builder()
|
||||
.rel("down")
|
||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"))
|
||||
.build())
|
||||
.description("Testing")
|
||||
.owner(Owner.builder()
|
||||
.type("application/vnd.vmware.vcloud.owner+xml")
|
||||
.user(Reference.builder()
|
||||
.type("application/vnd.vmware.admin.user+xml")
|
||||
.name("qunying.huang@enstratus.com")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/967d317c-4273-4a95-b8a4-bf63b78e9c69"))
|
||||
.build())
|
||||
.build())
|
||||
.catalogItems(CatalogItems.builder()
|
||||
.item(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.name("image")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/67a469a1-aafe-4b5b-bb31-a6202ad8961f"))
|
||||
.build())
|
||||
.item(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.name("ubuntu10")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"))
|
||||
.build())
|
||||
.item(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.name("imageTesting")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a9e0afdb-a42b-4688-8409-2ac68cf22939"))
|
||||
.build())
|
||||
.item(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.name("TestCase")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/f7598606-aea4-41d7-8f67-2090e28e7876"))
|
||||
.build())
|
||||
.build())
|
||||
.isPublished(false)
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* 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 static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.REF_REQ_LIVE;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.domain.AdminCatalog;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Checks;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Tests live behavior of {@link AdminCatalogClient}.
|
||||
*
|
||||
* @author danikov
|
||||
*/
|
||||
@Test(groups = { "live", "admin", "catalog" }, singleThreaded = true, testName = "CatalogClientLiveTest")
|
||||
public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||
|
||||
/*
|
||||
* Convenience references to API clients.
|
||||
*/
|
||||
|
||||
private AdminCatalogClient catalogClient;
|
||||
|
||||
/*
|
||||
* Shared state between dependant tests.
|
||||
*/
|
||||
private ReferenceType<?> catalogRef;
|
||||
private AdminCatalog catalog;
|
||||
|
||||
@BeforeClass(inheritGroups = true)
|
||||
public void setupRequiredClients() {
|
||||
catalogClient = context.getApi().getAdminCatalogClient();
|
||||
catalogRef = Reference.builder()
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
||||
.build();
|
||||
}
|
||||
|
||||
@Test(testName = "GET /admin/catalog/{id}")
|
||||
public void testGetCatalog() {
|
||||
assertNotNull(catalogRef, String.format(REF_REQ_LIVE, "Catalog"));
|
||||
catalog = catalogClient.getCatalog(catalogRef.getURI());
|
||||
|
||||
Checks.checkAdminCatalog(catalog);
|
||||
}
|
||||
}
|
|
@ -460,6 +460,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
.build())
|
||||
.build())
|
||||
.description("Testing")
|
||||
.isPublished(false)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<AdminCatalog xmlns="http://www.vmware.com/vcloud/v1.5" name="QunyingTestCatalog" id="urn:vcloud:catalog:7212e451-76e1-4631-b2de-ba1dfd8080e4" type="application/vnd.vmware.admin.catalog+xml" href="https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
|
||||
<Link rel="up" type="application/vnd.vmware.admin.organization+xml" href="https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"/>
|
||||
<Link rel="alternate" type="application/vnd.vmware.vcloud.catalog+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.owner+xml" href="https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/owner"/>
|
||||
<Link rel="add" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/catalogItems"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.admin.catalog+xml" href="https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
|
||||
<Link rel="remove" href="https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"/>
|
||||
<Description>Testing</Description>
|
||||
<Owner type="application/vnd.vmware.vcloud.owner+xml">
|
||||
<User type="application/vnd.vmware.admin.user+xml" name="qunying.huang@enstratus.com" href="https://vcloudbeta.bluelock.com/api/admin/user/967d317c-4273-4a95-b8a4-bf63b78e9c69"/>
|
||||
</Owner>
|
||||
<CatalogItems>
|
||||
<CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml" name="image" href="https://vcloudbeta.bluelock.com/api/catalogItem/67a469a1-aafe-4b5b-bb31-a6202ad8961f"/>
|
||||
<CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml" name="ubuntu10" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"/>
|
||||
<CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml" name="imageTesting" href="https://vcloudbeta.bluelock.com/api/catalogItem/a9e0afdb-a42b-4688-8409-2ac68cf22939"/>
|
||||
<CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml" name="TestCase" href="https://vcloudbeta.bluelock.com/api/catalogItem/f7598606-aea4-41d7-8f67-2090e28e7876"/>
|
||||
</CatalogItems>
|
||||
<IsPublished>false</IsPublished>
|
||||
</AdminCatalog>
|
Loading…
Reference in New Issue