mirror of https://github.com/apache/jclouds.git
Merge pull request #455 from grkvlt/vapp-live-tests
Issue 830: VApp live tests
This commit is contained in:
commit
c0fdbdaa27
|
@ -28,6 +28,8 @@ public class VCloudDirectorConstants {
|
||||||
/** The XML namespace used by the clients. */
|
/** The XML namespace used by the clients. */
|
||||||
public static final String VCLOUD_1_5_NS = "http://www.vmware.com/vcloud/v1.5";
|
public static final String VCLOUD_1_5_NS = "http://www.vmware.com/vcloud/v1.5";
|
||||||
|
|
||||||
|
public static final String VCLOUD_VMW_NS = "ihttp://www.vmware.com/schema/ovf";
|
||||||
|
|
||||||
public static final String VCLOUD_OVF_NS = "http://schemas.dmtf.org/ovf/envelope/1";
|
public static final String VCLOUD_OVF_NS = "http://schemas.dmtf.org/ovf/envelope/1";
|
||||||
|
|
||||||
public static final String VCLOUD_OVF_ENV_NS = "http://schemas.dmtf.org/ovf/environment/1";
|
public static final String VCLOUD_OVF_ENV_NS = "http://schemas.dmtf.org/ovf/environment/1";
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.vcloud.director.v1_5.config;
|
package org.jclouds.vcloud.director.v1_5.config;
|
||||||
|
|
||||||
import static com.google.common.base.Throwables.*;
|
import static com.google.common.base.Throwables.propagate;
|
||||||
import static org.jclouds.rest.config.BinderUtils.*;
|
import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -46,6 +46,8 @@ import org.jclouds.vcloud.director.v1_5.features.AdminCatalogAsyncClient;
|
||||||
import org.jclouds.vcloud.director.v1_5.features.AdminCatalogClient;
|
import org.jclouds.vcloud.director.v1_5.features.AdminCatalogClient;
|
||||||
import org.jclouds.vcloud.director.v1_5.features.AdminOrgAsyncClient;
|
import org.jclouds.vcloud.director.v1_5.features.AdminOrgAsyncClient;
|
||||||
import org.jclouds.vcloud.director.v1_5.features.AdminOrgClient;
|
import org.jclouds.vcloud.director.v1_5.features.AdminOrgClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.features.AdminVdcAsyncClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.features.AdminVdcClient;
|
||||||
import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncClient;
|
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.CatalogClient;
|
||||||
import org.jclouds.vcloud.director.v1_5.features.GroupAsyncClient;
|
import org.jclouds.vcloud.director.v1_5.features.GroupAsyncClient;
|
||||||
|
@ -98,7 +100,10 @@ import com.google.inject.name.Named;
|
||||||
@ConfiguresRestClient
|
@ConfiguresRestClient
|
||||||
public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirectorClient, VCloudDirectorAsyncClient> {
|
public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirectorClient, VCloudDirectorAsyncClient> {
|
||||||
|
|
||||||
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()//
|
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>>builder()
|
||||||
|
.put(AdminCatalogClient.class, AdminCatalogAsyncClient.class)
|
||||||
|
.put(AdminOrgClient.class, AdminOrgAsyncClient.class)
|
||||||
|
.put(AdminVdcClient.class, AdminVdcAsyncClient.class)
|
||||||
.put(CatalogClient.class, CatalogAsyncClient.class)
|
.put(CatalogClient.class, CatalogAsyncClient.class)
|
||||||
.put(NetworkClient.class, NetworkAsyncClient.class)
|
.put(NetworkClient.class, NetworkAsyncClient.class)
|
||||||
.put(OrgClient.class, OrgAsyncClient.class)
|
.put(OrgClient.class, OrgAsyncClient.class)
|
||||||
|
@ -111,8 +116,6 @@ public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirec
|
||||||
.put(UploadClient.class, UploadAsyncClient.class)
|
.put(UploadClient.class, UploadAsyncClient.class)
|
||||||
.put(MetadataClient.Readable.class, MetadataAsyncClient.Readable.class)
|
.put(MetadataClient.Readable.class, MetadataAsyncClient.Readable.class)
|
||||||
.put(MetadataClient.Writeable.class, MetadataAsyncClient.Writable.class)
|
.put(MetadataClient.Writeable.class, MetadataAsyncClient.Writable.class)
|
||||||
.put(AdminCatalogClient.class, AdminCatalogAsyncClient.class)
|
|
||||||
.put(AdminOrgClient.class, AdminOrgAsyncClient.class)
|
|
||||||
.put(GroupClient.class, GroupAsyncClient.class)
|
.put(GroupClient.class, GroupAsyncClient.class)
|
||||||
.put(UserClient.class, UserAsyncClient.class)
|
.put(UserClient.class, UserAsyncClient.class)
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
package org.jclouds.vcloud.director.v1_5.domain;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
@ -11,6 +29,7 @@ public class CatalogReference extends Reference {
|
||||||
return new ConcreteBuilder();
|
return new ConcreteBuilder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Builder<?> toBuilder() {
|
public Builder<?> toBuilder() {
|
||||||
return builder().fromCatalogReference(this);
|
return builder().fromCatalogReference(this);
|
||||||
}
|
}
|
||||||
|
@ -52,5 +71,5 @@ public class CatalogReference extends Reference {
|
||||||
return super.equals(that);
|
return super.equals(that);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: hashcode inheritted from ReferenceType
|
// NOTE hashcode inheritted from Reference
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ import com.google.common.collect.Sets;
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(name = "LeaseSettingsSection")
|
@XmlRootElement(name = "LeaseSettingsSection")
|
||||||
@XmlType(name = "LeaseSettingsSection")
|
@XmlType(name = "LeaseSettingsSectionType")
|
||||||
public class LeaseSettingsSection extends SectionType {
|
public class LeaseSettingsSection extends SectionType {
|
||||||
|
|
||||||
public static Builder<?> builder() {
|
public static Builder<?> builder() {
|
||||||
|
@ -142,7 +142,6 @@ public class LeaseSettingsSection extends SectionType {
|
||||||
return self();
|
return self();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LeaseSettingsSection build() {
|
public LeaseSettingsSection build() {
|
||||||
return new LeaseSettingsSection(this);
|
return new LeaseSettingsSection(this);
|
||||||
|
@ -194,17 +193,14 @@ public class LeaseSettingsSection extends SectionType {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value of the link property.
|
* Gets the value of the links property.
|
||||||
*/
|
*/
|
||||||
public Set<Link> getLinks() {
|
public Set<Link> getLinks() {
|
||||||
return Collections.unmodifiableSet(this.links);
|
return Collections.unmodifiableSet(links);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value of the deploymentLeaseInSeconds property.
|
* Gets the value of the deploymentLeaseInSeconds property.
|
||||||
*
|
|
||||||
* @return possible object is
|
|
||||||
* {@link Integer }
|
|
||||||
*/
|
*/
|
||||||
public Integer getDeploymentLeaseInSeconds() {
|
public Integer getDeploymentLeaseInSeconds() {
|
||||||
return deploymentLeaseInSeconds;
|
return deploymentLeaseInSeconds;
|
||||||
|
@ -212,9 +208,6 @@ public class LeaseSettingsSection extends SectionType {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value of the storageLeaseInSeconds property.
|
* Gets the value of the storageLeaseInSeconds property.
|
||||||
*
|
|
||||||
* @return possible object is
|
|
||||||
* {@link Integer }
|
|
||||||
*/
|
*/
|
||||||
public Integer getStorageLeaseInSeconds() {
|
public Integer getStorageLeaseInSeconds() {
|
||||||
return storageLeaseInSeconds;
|
return storageLeaseInSeconds;
|
||||||
|
@ -235,7 +228,7 @@ public class LeaseSettingsSection extends SectionType {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the value of the href property.
|
* Gets the value of the href property.
|
||||||
*/
|
*/
|
||||||
public URI getHref() {
|
public URI getHref() {
|
||||||
return href;
|
return href;
|
||||||
|
@ -243,9 +236,6 @@ public class LeaseSettingsSection extends SectionType {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value of the type property.
|
* Gets the value of the type property.
|
||||||
*
|
|
||||||
* @return possible object is
|
|
||||||
* {@link String }
|
|
||||||
*/
|
*/
|
||||||
public String getType() {
|
public String getType() {
|
||||||
return type;
|
return type;
|
||||||
|
@ -259,13 +249,13 @@ public class LeaseSettingsSection extends SectionType {
|
||||||
return false;
|
return false;
|
||||||
LeaseSettingsSection that = LeaseSettingsSection.class.cast(o);
|
LeaseSettingsSection that = LeaseSettingsSection.class.cast(o);
|
||||||
return super.equals(that) &&
|
return super.equals(that) &&
|
||||||
equal(links, that.links) &&
|
equal(this.links, that.links) &&
|
||||||
equal(deploymentLeaseInSeconds, that.deploymentLeaseInSeconds) &&
|
equal(this.deploymentLeaseInSeconds, that.deploymentLeaseInSeconds) &&
|
||||||
equal(storageLeaseInSeconds, that.storageLeaseInSeconds) &&
|
equal(this.storageLeaseInSeconds, that.storageLeaseInSeconds) &&
|
||||||
equal(deploymentLeaseExpiration, that.deploymentLeaseExpiration) &&
|
equal(this.deploymentLeaseExpiration, that.deploymentLeaseExpiration) &&
|
||||||
equal(storageLeaseExpiration, that.storageLeaseExpiration) &&
|
equal(this.storageLeaseExpiration, that.storageLeaseExpiration) &&
|
||||||
equal(href, that.href) &&
|
equal(this.href, that.href) &&
|
||||||
equal(type, that.type);
|
equal(this.type, that.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -29,6 +29,7 @@ import javax.xml.bind.annotation.XmlAttribute;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import javax.xml.bind.annotation.XmlSchemaType;
|
import javax.xml.bind.annotation.XmlSchemaType;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
|
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
|
||||||
|
|
||||||
|
@ -40,10 +41,11 @@ import com.google.common.collect.Sets;
|
||||||
* Represents a list of network cards existing in a VM.
|
* Represents a list of network cards existing in a VM.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* <complexType name="NetworkConnectionSection" />
|
* <complexType name="NetworkConnectionSectionType" />
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(name = "NetworkConnectionSection")
|
@XmlRootElement(name = "NetworkConnectionSection")
|
||||||
|
@XmlType(name = "NetworkConnectionSectionType")
|
||||||
public class NetworkConnectionSection extends SectionType {
|
public class NetworkConnectionSection extends SectionType {
|
||||||
|
|
||||||
public static Builder<?> builder() {
|
public static Builder<?> builder() {
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.util.List;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAnyElement;
|
import javax.xml.bind.annotation.XmlAnyElement;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import javax.xml.bind.annotation.XmlType;
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
|
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
|
||||||
|
@ -36,12 +37,13 @@ import com.google.common.collect.Lists;
|
||||||
* Runtime information for a specific vm
|
* Runtime information for a specific vm
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* <complexType name="RuntimeInfoSection" />
|
* <complexType name="RuntimeInfoSectionType" />
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author grkvlt@apache.org
|
* @author grkvlt@apache.org
|
||||||
*/
|
*/
|
||||||
@XmlType(name = "RuntimeInfoSection")
|
@XmlRootElement(name = "RuntimeInfoSection")
|
||||||
|
@XmlType(name = "RuntimeInfoSectionType")
|
||||||
public class RuntimeInfoSection extends SectionType {
|
public class RuntimeInfoSection extends SectionType {
|
||||||
|
|
||||||
public static Builder<?> builder() {
|
public static Builder<?> builder() {
|
||||||
|
|
|
@ -21,8 +21,7 @@ package org.jclouds.vcloud.director.v1_5.domain;
|
||||||
|
|
||||||
import static com.google.common.base.Objects.equal;
|
import static com.google.common.base.Objects.equal;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlType;
|
import javax.xml.bind.annotation.XmlType;
|
||||||
import javax.xml.bind.annotation.XmlValue;
|
import javax.xml.bind.annotation.XmlValue;
|
||||||
|
|
||||||
|
@ -35,8 +34,8 @@ import com.google.common.base.Objects;
|
||||||
* <complexType name="ScreenTicket" />
|
* <complexType name="ScreenTicket" />
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlRootElement(name = "ScreenTicket")
|
||||||
@XmlType(name = "ScreenTicket")
|
@XmlType(name = "ScreenTicketType")
|
||||||
public class ScreenTicket {
|
public class ScreenTicket {
|
||||||
|
|
||||||
public static Builder builder() {
|
public static Builder builder() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/**
|
/*
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
* contributor license agreements. See the NOTICE file
|
* contributor license agreements. See the NOTICE file
|
||||||
* distributed with this work for additional information
|
* distributed with this work for additional information
|
||||||
|
@ -16,14 +16,12 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jclouds.vcloud.director.v1_5.domain;
|
package org.jclouds.vcloud.director.v1_5.domain;
|
||||||
|
|
||||||
import static com.google.common.base.Objects.*;
|
import static com.google.common.base.Objects.equal;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import javax.xml.bind.annotation.XmlType;
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
@ -32,20 +30,14 @@ import com.google.common.base.Objects;
|
||||||
* Represents vApp/VM undeployment parameters.
|
* Represents vApp/VM undeployment parameters.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* <complexType name="UndeployVAppParams">
|
* <complexType name="UndeployVAppParamsType" />
|
||||||
* <complexContent>
|
|
||||||
* <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
|
|
||||||
* <sequence>
|
|
||||||
* <element name="UndeployPowerAction" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
|
|
||||||
* </sequence>
|
|
||||||
* <anyAttribute processContents='lax' namespace='##other'/>
|
|
||||||
* </extension>
|
|
||||||
* </complexContent>
|
|
||||||
* </complexType>
|
|
||||||
* </pre>
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author grkvlt@apache.org
|
||||||
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlRootElement(name = "UndeployVAppParams")
|
||||||
@XmlType(name = "UndeployVAppParams")
|
@XmlType(name = "UndeployVAppParamsType")
|
||||||
public class UndeployVAppParams {
|
public class UndeployVAppParams {
|
||||||
|
|
||||||
public static Builder builder() {
|
public static Builder builder() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/**
|
/*
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
* contributor license agreements. See the NOTICE file
|
* contributor license agreements. See the NOTICE file
|
||||||
* distributed with this work for additional information
|
* distributed with this work for additional information
|
||||||
|
@ -16,38 +16,28 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jclouds.vcloud.director.v1_5.domain;
|
package org.jclouds.vcloud.director.v1_5.domain;
|
||||||
|
|
||||||
import static com.google.common.base.Objects.equal;
|
import static com.google.common.base.Objects.equal;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import javax.xml.bind.annotation.XmlType;
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents vApp Template upload parameters.
|
* Represents vApp Template upload parameters.
|
||||||
* <p/>
|
*
|
||||||
* <p/>
|
|
||||||
* <p>Java class for UploadVAppTemplateParams complex type.
|
|
||||||
* <p/>
|
|
||||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
|
||||||
* <p/>
|
|
||||||
* <pre>
|
* <pre>
|
||||||
* <complexType name="UploadVAppTemplateParams">
|
* <complexType name="UploadVAppTemplateParamsType" />
|
||||||
* <complexContent>
|
|
||||||
* <extension base="{http://www.vmware.com/vcloud/v1.5}ParamsType">
|
|
||||||
* <attribute name="transferFormat" type="{http://www.w3.org/2001/XMLSchema}string" />
|
|
||||||
* <attribute name="manifestRequired" type="{http://www.w3.org/2001/XMLSchema}boolean" />
|
|
||||||
* <anyAttribute processContents='lax' namespace='##other'/>
|
|
||||||
* </extension>
|
|
||||||
* </complexContent>
|
|
||||||
* </complexType>
|
|
||||||
* </pre>
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author grkvlt@apache.org
|
||||||
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
@XmlType(name = "UploadVAppTemplateParams")
|
@XmlRootElement(name = "UploadVAppTemplateParams")
|
||||||
|
@XmlType(name = "UploadVAppTemplateParamsType")
|
||||||
public class UploadVAppTemplateParams extends ParamsType {
|
public class UploadVAppTemplateParams extends ParamsType {
|
||||||
public static Builder<?> builder() {
|
public static Builder<?> builder() {
|
||||||
return new ConcreteBuilder();
|
return new ConcreteBuilder();
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
/*
|
||||||
|
* 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 java.net.URI;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "VAppReference")
|
||||||
|
public class VAppReference extends Reference {
|
||||||
|
|
||||||
|
public static Builder<?> builder() {
|
||||||
|
return new ConcreteBuilder();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Builder<?> toBuilder() {
|
||||||
|
return builder().fromVAppReference(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder<B extends Builder<B>> extends Reference.Builder<B> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VAppReference build() {
|
||||||
|
return new VAppReference(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected B fromVAppReference(VAppReference in) {
|
||||||
|
return fromReference(in);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public VAppReference(Builder<?> builder) {
|
||||||
|
super(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
public VAppReference(URI href, String id, String name, String type) {
|
||||||
|
super(href, id, name, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected VAppReference() {
|
||||||
|
// For JAXB
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o)
|
||||||
|
return true;
|
||||||
|
if (o == null || getClass() != o.getClass())
|
||||||
|
return false;
|
||||||
|
VAppReference that = VAppReference.class.cast(o);
|
||||||
|
return super.equals(that);
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE hashcode inheritted from Reference
|
||||||
|
}
|
|
@ -23,6 +23,7 @@ import static com.google.common.base.Objects.*;
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import javax.xml.bind.annotation.XmlType;
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
@ -30,7 +31,7 @@ import com.google.common.base.Objects;
|
||||||
/**
|
/**
|
||||||
* @author grkvlt@apache.org
|
* @author grkvlt@apache.org
|
||||||
*/
|
*/
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlRootElement(name = "VMWareTools")
|
||||||
@XmlType(name = "VMWareTools")
|
@XmlType(name = "VMWareTools")
|
||||||
public class VMWareTools {
|
public class VMWareTools {
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/**
|
/*
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
* contributor license agreements. See the NOTICE file
|
* contributor license agreements. See the NOTICE file
|
||||||
* distributed with this work for additional information
|
* distributed with this work for additional information
|
||||||
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.vcloud.director.v1_5.domain.ovf;
|
package org.jclouds.vcloud.director.v1_5.domain.ovf;
|
||||||
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,11 +18,24 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.vcloud.director.v1_5.domain.ovf;
|
package org.jclouds.vcloud.director.v1_5.domain.ovf;
|
||||||
|
|
||||||
|
import static com.google.common.base.Objects.equal;
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
|
||||||
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_VMW_NS;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An OperatingSystemSection specifies the operating system installed on a virtual machine.
|
* An OperatingSystemSection specifies the operating system installed on a virtual machine.
|
||||||
|
@ -48,6 +61,10 @@ public class OperatingSystemSection extends SectionType {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private String description;
|
private String description;
|
||||||
private String version;
|
private String version;
|
||||||
|
private String osType;
|
||||||
|
private URI href;
|
||||||
|
private String type;
|
||||||
|
private Set<Link> links;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see OperatingSystemSection#getId()
|
* @see OperatingSystemSection#getId()
|
||||||
|
@ -73,6 +90,48 @@ public class OperatingSystemSection extends SectionType {
|
||||||
return self();
|
return self();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see OperatingSystemSection#getOsType()
|
||||||
|
*/
|
||||||
|
public B osType(String osType) {
|
||||||
|
this.osType = osType;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see OperatingSystemSection#getHref()
|
||||||
|
*/
|
||||||
|
public B href(URI href) {
|
||||||
|
this.href = href;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see OperatingSystemSection#getType()
|
||||||
|
*/
|
||||||
|
public B type(String type) {
|
||||||
|
this.type = type;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see OperatingSystemSection#getLinks()
|
||||||
|
*/
|
||||||
|
public B links(Set<Link> links) {
|
||||||
|
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see ResourceType#getLinks()
|
||||||
|
*/
|
||||||
|
public B link(Link link) {
|
||||||
|
if (links == null)
|
||||||
|
links = Sets.newLinkedHashSet();
|
||||||
|
this.links.add(checkNotNull(link, "link"));
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
@ -82,22 +141,35 @@ public class OperatingSystemSection extends SectionType {
|
||||||
}
|
}
|
||||||
|
|
||||||
public B fromOperatingSystemSection(OperatingSystemSection in) {
|
public B fromOperatingSystemSection(OperatingSystemSection in) {
|
||||||
return id(in.getId()).info(in.getInfo()).description(in.getDescription());
|
return fromSectionType(in).id(in.getId()).version(in.getVersion()).description(in.getDescription())
|
||||||
|
.osType(in.getOsType()).href(in.getHref()).type(in.getType()).links(in.getLinks());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlAttribute
|
@XmlAttribute(required = true)
|
||||||
protected Integer id;
|
protected Integer id;
|
||||||
@XmlAttribute
|
@XmlAttribute
|
||||||
protected String version;
|
protected String version;
|
||||||
@XmlElement
|
@XmlElement
|
||||||
protected String description;
|
protected String description;
|
||||||
|
@XmlAttribute(namespace = VCLOUD_VMW_NS)
|
||||||
|
protected String osType;
|
||||||
|
@XmlAttribute(namespace = VCLOUD_1_5_NS)
|
||||||
|
private URI href;
|
||||||
|
@XmlAttribute(namespace = VCLOUD_1_5_NS)
|
||||||
|
private String type;
|
||||||
|
@XmlElement(name = "Link", namespace = VCLOUD_1_5_NS)
|
||||||
|
private Set<Link> links;
|
||||||
|
|
||||||
public OperatingSystemSection(Builder<?> builder) {
|
public OperatingSystemSection(Builder<?> builder) {
|
||||||
super(builder);
|
super(builder);
|
||||||
this.id = builder.id;
|
this.id = builder.id;
|
||||||
this.description = builder.description;
|
this.description = builder.description;
|
||||||
this.version = builder.version;
|
this.version = builder.version;
|
||||||
|
this.osType = builder.osType;
|
||||||
|
this.href = builder.href;
|
||||||
|
this.type = builder.type;
|
||||||
|
this.links = builder.links;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected OperatingSystemSection() {
|
protected OperatingSystemSection() {
|
||||||
|
@ -105,29 +177,65 @@ public class OperatingSystemSection extends SectionType {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gets the OVF id
|
||||||
*
|
*
|
||||||
* @return ovf id
|
|
||||||
* @see org.jclouds.vcloud.director.v1_5.domain.cim.OSType#getCode()
|
* @see org.jclouds.vcloud.director.v1_5.domain.cim.OSType#getCode()
|
||||||
*/
|
*/
|
||||||
public Integer getId() {
|
public Integer getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the version
|
||||||
|
*/
|
||||||
public String getVersion() {
|
public String getVersion() {
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Gets the description or null
|
||||||
* @return description or null
|
|
||||||
*/
|
*/
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the osType
|
||||||
|
*/
|
||||||
|
public String getOsType() {
|
||||||
|
return osType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains the URI to the entity.
|
||||||
|
*
|
||||||
|
* @see ResourceType#getHref()
|
||||||
|
*/
|
||||||
|
public URI getHref() {
|
||||||
|
return href;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains the type of the the entity.
|
||||||
|
*
|
||||||
|
* @see ResourceType#getType()
|
||||||
|
*/
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set of optional links to an entity or operation associated with this object.
|
||||||
|
*
|
||||||
|
* @see ResourceType#getLinks()
|
||||||
|
*/
|
||||||
|
public Set<Link> getLinks() {
|
||||||
|
return links == null ? ImmutableSet.<Link>of() : Collections.unmodifiableSet(links);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(super.hashCode(), description);
|
return Objects.hashCode(super.hashCode(), id, version, description, osType, href, type, links);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -136,13 +244,15 @@ public class OperatingSystemSection extends SectionType {
|
||||||
if (obj == null) return false;
|
if (obj == null) return false;
|
||||||
if (getClass() != obj.getClass()) return false;
|
if (getClass() != obj.getClass()) return false;
|
||||||
|
|
||||||
OperatingSystemSection other = (OperatingSystemSection) obj;
|
OperatingSystemSection that = (OperatingSystemSection) obj;
|
||||||
return super.equals(other) && Objects.equal(description, other.description);
|
return super.equals(that) &&
|
||||||
|
equal(this.id, that.id) && equal(this.version, that.version) && equal(this.description, that.description) &&
|
||||||
|
equal(this.osType, that.osType) && equal(this.href, that.href) && equal(this.links, that.links) && equal(this.type, that.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Objects.ToStringHelper string() {
|
protected Objects.ToStringHelper string() {
|
||||||
return super.string().add("description", description);
|
return super.string().add("id", id).add("version", version).add("description", description).add("osType", osType)
|
||||||
|
.add("href", href).add("links", links).add("type", type);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -23,6 +23,7 @@ import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OV
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.CustomizationSection;
|
import org.jclouds.vcloud.director.v1_5.domain.CustomizationSection;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection;
|
import org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection;
|
||||||
|
@ -41,6 +42,7 @@ import com.google.common.base.Objects;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
* @author Adam Lowe
|
* @author Adam Lowe
|
||||||
*/
|
*/
|
||||||
|
@XmlType(name = "Section_Type")
|
||||||
@XmlSeeAlso({
|
@XmlSeeAlso({
|
||||||
CustomizationSection.class,
|
CustomizationSection.class,
|
||||||
DeploymentOptionSection.class,
|
DeploymentOptionSection.class,
|
||||||
|
@ -85,6 +87,22 @@ public abstract class SectionType {
|
||||||
return self();
|
return self();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see SectionType#isRequired()
|
||||||
|
*/
|
||||||
|
public B required() {
|
||||||
|
this.required = Boolean.TRUE;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see SectionType#isRequired()
|
||||||
|
*/
|
||||||
|
public B notRequired() {
|
||||||
|
this.required = Boolean.FALSE;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
public B fromSectionType(SectionType in) {
|
public B fromSectionType(SectionType in) {
|
||||||
return info(in.getInfo()).required(in.isRequired());
|
return info(in.getInfo()).required(in.isRequired());
|
||||||
}
|
}
|
||||||
|
@ -135,7 +153,7 @@ public abstract class SectionType {
|
||||||
if (getClass() != obj.getClass())
|
if (getClass() != obj.getClass())
|
||||||
return false;
|
return false;
|
||||||
SectionType other = (SectionType) obj;
|
SectionType other = (SectionType) obj;
|
||||||
return Objects.equal(info, other.info) && Objects.equal(required, other.required);
|
return Objects.equal(this.info, other.info) && Objects.equal(this.required, other.required);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,15 +1,26 @@
|
||||||
//
|
/*
|
||||||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
|
* contributor license agreements. See the NOTICE file
|
||||||
// Any modifications to this file will be lost upon recompilation of the source schema.
|
* distributed with this work for additional information
|
||||||
// Generated on: 2012.02.08 at 02:47:44 PM GMT
|
* regarding copyright ownership. jclouds licenses this file
|
||||||
//
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
package org.jclouds.vcloud.director.v1_5.domain.ovf;
|
package org.jclouds.vcloud.director.v1_5.domain.ovf;
|
||||||
|
|
||||||
import static com.google.common.base.Objects.equal;
|
import static com.google.common.base.Objects.equal;
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -44,14 +55,22 @@ public class StartupSection extends SectionType {
|
||||||
|
|
||||||
public static class Builder<B extends Builder<B>> extends SectionType.Builder<B> {
|
public static class Builder<B extends Builder<B>> extends SectionType.Builder<B> {
|
||||||
|
|
||||||
private List<StartupSectionItem> item = Collections.emptyList();
|
private List<StartupSectionItem> items = Collections.emptyList();
|
||||||
private List<Object> any = Collections.emptyList();
|
private List<Object> any = Collections.emptyList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see StartupSection#getItem()
|
* @see StartupSection#getItem()
|
||||||
*/
|
*/
|
||||||
public B item(List<StartupSectionItem> item) {
|
public B items(List<StartupSectionItem> items) {
|
||||||
this.item = item;
|
this.items = checkNotNull(items, "items");
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see StartupSection#getItem()
|
||||||
|
*/
|
||||||
|
public B item(StartupSectionItem item) {
|
||||||
|
this.items.add(checkNotNull(item, "item"));
|
||||||
return self();
|
return self();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,12 +88,12 @@ public class StartupSection extends SectionType {
|
||||||
}
|
}
|
||||||
|
|
||||||
public B fromStartupSection(StartupSection in) {
|
public B fromStartupSection(StartupSection in) {
|
||||||
return fromSectionType(in).item(item).any(any);
|
return fromSectionType(in).items(items).any(any);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(name = "Item")
|
@XmlElement(name = "Item")
|
||||||
private List<StartupSectionItem> item;
|
private List<StartupSectionItem> items;
|
||||||
@XmlAnyElement(lax = true)
|
@XmlAnyElement(lax = true)
|
||||||
private List<Object> any;
|
private List<Object> any;
|
||||||
|
|
||||||
|
@ -84,50 +103,22 @@ public class StartupSection extends SectionType {
|
||||||
|
|
||||||
public StartupSection(Builder<?> builder) {
|
public StartupSection(Builder<?> builder) {
|
||||||
super(builder);
|
super(builder);
|
||||||
this.item = (item != null) ? ImmutableList.<StartupSectionItem>copyOf(builder.item) : Collections.<StartupSectionItem>emptyList();
|
this.items = (items != null) ? ImmutableList.<StartupSectionItem>copyOf(builder.items) : Collections.<StartupSectionItem>emptyList();
|
||||||
this.any = (any != null) ? ImmutableList.<Object>copyOf(builder.any) : Collections.<Object>emptyList();
|
this.any = (any != null) ? ImmutableList.<Object>copyOf(builder.any) : Collections.<Object>emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value of the item property.
|
* Gets the value of the item property.
|
||||||
* <p>
|
|
||||||
* 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 <CODE>set</CODE> method for the item property.
|
|
||||||
* <p>
|
|
||||||
* For example, to add a new item, do as follows:
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* getItem().add(newItem);
|
|
||||||
* </pre>
|
|
||||||
* <p>
|
|
||||||
* Objects of the following type(s) are allowed in the list {@link StartupSectionItem }
|
|
||||||
*/
|
*/
|
||||||
public List<StartupSectionItem> getItem() {
|
public List<StartupSectionItem> getItem() {
|
||||||
if (item == null) {
|
return items;
|
||||||
item = new ArrayList<StartupSectionItem>();
|
|
||||||
}
|
|
||||||
return this.item;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value of the any property.
|
* Gets the value of the any property.
|
||||||
* <p>
|
|
||||||
* 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 <CODE>set</CODE> method for the any property.
|
|
||||||
* <p>
|
|
||||||
* For example, to add a new item, do as follows:
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* getAny().add(newItem);
|
|
||||||
* </pre>
|
|
||||||
* <p>
|
|
||||||
* Objects of the following type(s) are allowed in the list {@link Object } {@link Element }
|
|
||||||
*/
|
*/
|
||||||
public List<Object> getAny() {
|
public List<Object> getAny() {
|
||||||
if (any == null) {
|
return any;
|
||||||
any = new ArrayList<Object>();
|
|
||||||
}
|
|
||||||
return this.any;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -138,16 +129,16 @@ public class StartupSection extends SectionType {
|
||||||
return false;
|
return false;
|
||||||
StartupSection that = StartupSection.class.cast(o);
|
StartupSection that = StartupSection.class.cast(o);
|
||||||
return super.equals(that) &&
|
return super.equals(that) &&
|
||||||
equal(this.item, that.item) && equal(this.any, that.any);
|
equal(this.items, that.items) && equal(this.any, that.any);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(super.hashCode(), item, any);
|
return Objects.hashCode(super.hashCode(), items, any);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ToStringHelper string() {
|
public ToStringHelper string() {
|
||||||
return super.string().add("item", item).add("any", any);
|
return super.string().add("items", items).add("any", any);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/**
|
/*
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
* contributor license agreements. See the NOTICE file
|
* contributor license agreements. See the NOTICE file
|
||||||
* distributed with this work for additional information
|
* distributed with this work for additional information
|
||||||
|
@ -16,7 +16,6 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jclouds.vcloud.director.v1_5.domain.query;
|
package org.jclouds.vcloud.director.v1_5.domain.query;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
@ -37,6 +36,7 @@ public class CatalogReferences extends QueryResultReferences {
|
||||||
return new ConcreteBuilder();
|
return new ConcreteBuilder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Builder<?> toBuilder() {
|
public Builder<?> toBuilder() {
|
||||||
return builder().fromCatalogReferences(this);
|
return builder().fromCatalogReferences(this);
|
||||||
}
|
}
|
||||||
|
@ -63,4 +63,16 @@ public class CatalogReferences extends QueryResultReferences {
|
||||||
protected CatalogReferences() {
|
protected CatalogReferences() {
|
||||||
// for JAXB
|
// for JAXB
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o)
|
||||||
|
return true;
|
||||||
|
if (o == null || getClass() != o.getClass())
|
||||||
|
return false;
|
||||||
|
CatalogReferences that = CatalogReferences.class.cast(o);
|
||||||
|
return super.equals(that);
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE hashcode inheritted from QueryResultReferences
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/**
|
/*
|
||||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
* contributor license agreements. See the NOTICE file
|
* contributor license agreements. See the NOTICE file
|
||||||
* distributed with this work for additional information
|
* distributed with this work for additional information
|
||||||
|
@ -16,7 +16,6 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jclouds.vcloud.director.v1_5.domain.query;
|
package org.jclouds.vcloud.director.v1_5.domain.query;
|
||||||
|
|
||||||
import static com.google.common.base.Objects.equal;
|
import static com.google.common.base.Objects.equal;
|
||||||
|
@ -27,6 +26,7 @@ import java.util.Date;
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import javax.xml.bind.annotation.XmlSchemaType;
|
import javax.xml.bind.annotation.XmlSchemaType;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.base.Objects.ToStringHelper;
|
import com.google.common.base.Objects.ToStringHelper;
|
||||||
|
@ -35,18 +35,20 @@ import com.google.common.base.Objects.ToStringHelper;
|
||||||
* Represents the results from a Catalog vCloud query as a record.
|
* Represents the results from a Catalog vCloud query as a record.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* <complexType name="QueryResultCatalogRecord" />
|
* <complexType name="QueryResultCatalogRecordType" />
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author grkvlt@apache.org
|
* @author grkvlt@apache.org
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(name = "CatalogRecord")
|
@XmlRootElement(name = "CatalogRecord")
|
||||||
|
@XmlType(name = "QueryResultCatalogRecordType")
|
||||||
public class QueryResultCatalogRecord extends QueryResultRecordType {
|
public class QueryResultCatalogRecord extends QueryResultRecordType {
|
||||||
|
|
||||||
public static Builder<?> builder() {
|
public static Builder<?> builder() {
|
||||||
return new ConcreteBuilder();
|
return new ConcreteBuilder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Builder<?> toBuilder() {
|
public Builder<?> toBuilder() {
|
||||||
return builder().fromQueryResultCatalogRecord(this);
|
return builder().fromQueryResultCatalogRecord(this);
|
||||||
}
|
}
|
||||||
|
@ -184,8 +186,8 @@ public class QueryResultCatalogRecord extends QueryResultRecordType {
|
||||||
private QueryResultCatalogRecord(Builder<?> builder) {
|
private QueryResultCatalogRecord(Builder<?> builder) {
|
||||||
super(builder);
|
super(builder);
|
||||||
this.name = builder.name;
|
this.name = builder.name;
|
||||||
isPublished = builder.isPublished;
|
this.isPublished = builder.isPublished;
|
||||||
isShared = builder.isShared;
|
this.isShared = builder.isShared;
|
||||||
this.creationDate = builder.creationDate;
|
this.creationDate = builder.creationDate;
|
||||||
this.orgName = builder.orgName;
|
this.orgName = builder.orgName;
|
||||||
this.ownerName = builder.ownerName;
|
this.ownerName = builder.ownerName;
|
||||||
|
|
|
@ -0,0 +1,518 @@
|
||||||
|
/**
|
||||||
|
* 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.query;
|
||||||
|
|
||||||
|
import static com.google.common.base.Objects.equal;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
|
import com.google.common.base.Objects;
|
||||||
|
import com.google.common.base.Objects.ToStringHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the results from a Datastore vCloud query as a record.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* <complexType name="QueryResultDatastoreRecordType" />
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author grkvlt@apache.org
|
||||||
|
*/
|
||||||
|
@XmlRootElement(name = "DatastoreRecord")
|
||||||
|
@XmlType(name = "QueryResultDatastoreRecordType")
|
||||||
|
public class QueryResultDatastoreRecord extends QueryResultRecordType {
|
||||||
|
|
||||||
|
public static Builder<?> builder() {
|
||||||
|
return new ConcreteBuilder();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Builder<?> toBuilder() {
|
||||||
|
return builder().fromQueryResultDatastoreRecord(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder<B extends Builder<B>> extends QueryResultRecordType.Builder<B> {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String datastoreType;
|
||||||
|
private Boolean isEnabled;
|
||||||
|
private Boolean isDeleted;
|
||||||
|
private Long storageUsedMB;
|
||||||
|
private Long storageMB;
|
||||||
|
private Long provisionedStorageMB;
|
||||||
|
private Long requestedStorageMB;
|
||||||
|
private String vc;
|
||||||
|
private String vcName;
|
||||||
|
private String moref;
|
||||||
|
private Integer numberOfProviderVdcs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultDatastoreRecord#getName()
|
||||||
|
*/
|
||||||
|
public B name(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultDatastoreRecord#getDatastoreType()
|
||||||
|
*/
|
||||||
|
public B datastoreType(String datastoreType) {
|
||||||
|
this.datastoreType = datastoreType;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultDatastoreRecord#isEnabled()
|
||||||
|
*/
|
||||||
|
public B isEnabled(Boolean isEnabled) {
|
||||||
|
this.isEnabled = isEnabled;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultDatastoreRecord#isEnabled()
|
||||||
|
*/
|
||||||
|
public B enabled() {
|
||||||
|
this.isEnabled = Boolean.TRUE;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultDatastoreRecord#isEnabled()
|
||||||
|
*/
|
||||||
|
public B disabled() {
|
||||||
|
this.isEnabled = Boolean.FALSE;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultDatastoreRecord#isDeleted()
|
||||||
|
*/
|
||||||
|
public B isDeleted(Boolean isDeleted) {
|
||||||
|
this.isDeleted = isDeleted;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultDatastoreRecord#isDeleted()
|
||||||
|
*/
|
||||||
|
public B deleted() {
|
||||||
|
this.isDeleted = Boolean.TRUE;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultDatastoreRecord#isDeleted()
|
||||||
|
*/
|
||||||
|
public B notDeleted() {
|
||||||
|
this.isDeleted = Boolean.FALSE;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultDatastoreRecord#getStorageUsedMB()
|
||||||
|
*/
|
||||||
|
public B storageUsedMB(Long storageUsedMB) {
|
||||||
|
this.storageUsedMB = storageUsedMB;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultDatastoreRecord#getStorageMB()
|
||||||
|
*/
|
||||||
|
public B storageMB(Long storageMB) {
|
||||||
|
this.storageMB = storageMB;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultDatastoreRecord#getProvisionedStorageMB()
|
||||||
|
*/
|
||||||
|
public B provisionedStorageMB(Long provisionedStorageMB) {
|
||||||
|
this.provisionedStorageMB = provisionedStorageMB;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultDatastoreRecord#getRequestedStorageMB()
|
||||||
|
*/
|
||||||
|
public B requestedStorageMB(Long requestedStorageMB) {
|
||||||
|
this.requestedStorageMB = requestedStorageMB;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultDatastoreRecord#getVc()
|
||||||
|
*/
|
||||||
|
public B vc(String vc) {
|
||||||
|
this.vc = vc;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultDatastoreRecord#getVcName()
|
||||||
|
*/
|
||||||
|
public B vcName(String vcName) {
|
||||||
|
this.vcName = vcName;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultDatastoreRecord#getMoref()
|
||||||
|
*/
|
||||||
|
public B moref(String moref) {
|
||||||
|
this.moref = moref;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultDatastoreRecord#getNumberOfProviderVdcs()
|
||||||
|
*/
|
||||||
|
public B numberOfProviderVdcs(Integer numberOfProviderVdcs) {
|
||||||
|
this.numberOfProviderVdcs = numberOfProviderVdcs;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public QueryResultDatastoreRecord build() {
|
||||||
|
return new QueryResultDatastoreRecord(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public B fromQueryResultDatastoreRecord(QueryResultDatastoreRecord in) {
|
||||||
|
return fromQueryResultRecordType(in)
|
||||||
|
.name(in.getName())
|
||||||
|
.datastoreType(in.getDatastoreType())
|
||||||
|
.isEnabled(in.isEnabled())
|
||||||
|
.isDeleted(in.isDeleted())
|
||||||
|
.storageUsedMB(in.getStorageUsedMB())
|
||||||
|
.storageMB(in.getStorageMB())
|
||||||
|
.provisionedStorageMB(in.getProvisionedStorageMB())
|
||||||
|
.requestedStorageMB(in.getRequestedStorageMB())
|
||||||
|
.vc(in.getVc())
|
||||||
|
.vcName(in.getVcName())
|
||||||
|
.moref(in.getMoref())
|
||||||
|
.numberOfProviderVdcs(in.getNumberOfProviderVdcs());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private QueryResultDatastoreRecord(Builder<?> builder) {
|
||||||
|
super(builder);
|
||||||
|
this.name = builder.name;
|
||||||
|
this.datastoreType = builder.datastoreType;
|
||||||
|
this.isEnabled = builder.isEnabled;
|
||||||
|
this.isDeleted = builder.isDeleted;
|
||||||
|
this.storageUsedMB = builder.storageUsedMB;
|
||||||
|
this.storageMB = builder.storageMB;
|
||||||
|
this.provisionedStorageMB = builder.provisionedStorageMB;
|
||||||
|
this.requestedStorageMB = builder.requestedStorageMB;
|
||||||
|
this.vc = builder.vc;
|
||||||
|
this.vcName = builder.vcName;
|
||||||
|
this.moref = builder.moref;
|
||||||
|
this.numberOfProviderVdcs = builder.numberOfProviderVdcs;
|
||||||
|
}
|
||||||
|
|
||||||
|
private QueryResultDatastoreRecord() {
|
||||||
|
// for JAXB
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlAttribute
|
||||||
|
protected String name;
|
||||||
|
@XmlAttribute
|
||||||
|
protected String datastoreType;
|
||||||
|
@XmlAttribute
|
||||||
|
protected Boolean isEnabled;
|
||||||
|
@XmlAttribute
|
||||||
|
protected Boolean isDeleted;
|
||||||
|
@XmlAttribute
|
||||||
|
protected Long storageUsedMB;
|
||||||
|
@XmlAttribute
|
||||||
|
protected Long storageMB;
|
||||||
|
@XmlAttribute
|
||||||
|
protected Long provisionedStorageMB;
|
||||||
|
@XmlAttribute
|
||||||
|
protected Long requestedStorageMB;
|
||||||
|
@XmlAttribute
|
||||||
|
protected String vc;
|
||||||
|
@XmlAttribute
|
||||||
|
protected String vcName;
|
||||||
|
@XmlAttribute
|
||||||
|
protected String moref;
|
||||||
|
@XmlAttribute
|
||||||
|
protected Integer numberOfProviderVdcs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the name property.
|
||||||
|
*
|
||||||
|
* @return possible object is {@link String }
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value of the name property.
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* allowed object is {@link String }
|
||||||
|
*/
|
||||||
|
public void setName(String value) {
|
||||||
|
this.name = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the datastoreType property.
|
||||||
|
*
|
||||||
|
* @return possible object is {@link String }
|
||||||
|
*/
|
||||||
|
public String getDatastoreType() {
|
||||||
|
return datastoreType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value of the datastoreType property.
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* allowed object is {@link String }
|
||||||
|
*/
|
||||||
|
public void setDatastoreType(String value) {
|
||||||
|
this.datastoreType = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the isEnabled property.
|
||||||
|
*
|
||||||
|
* @return possible object is {@link Boolean }
|
||||||
|
*/
|
||||||
|
public Boolean isEnabled() {
|
||||||
|
return isEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value of the isEnabled property.
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* allowed object is {@link Boolean }
|
||||||
|
*/
|
||||||
|
public void setIsEnabled(Boolean value) {
|
||||||
|
this.isEnabled = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the isDeleted property.
|
||||||
|
*
|
||||||
|
* @return possible object is {@link Boolean }
|
||||||
|
*/
|
||||||
|
public Boolean isDeleted() {
|
||||||
|
return isDeleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value of the isDeleted property.
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* allowed object is {@link Boolean }
|
||||||
|
*/
|
||||||
|
public void setIsDeleted(Boolean value) {
|
||||||
|
this.isDeleted = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the storageUsedMB property.
|
||||||
|
*
|
||||||
|
* @return possible object is {@link Long }
|
||||||
|
*/
|
||||||
|
public Long getStorageUsedMB() {
|
||||||
|
return storageUsedMB;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value of the storageUsedMB property.
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* allowed object is {@link Long }
|
||||||
|
*/
|
||||||
|
public void setStorageUsedMB(Long value) {
|
||||||
|
this.storageUsedMB = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the storageMB property.
|
||||||
|
*
|
||||||
|
* @return possible object is {@link Long }
|
||||||
|
*/
|
||||||
|
public Long getStorageMB() {
|
||||||
|
return storageMB;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value of the storageMB property.
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* allowed object is {@link Long }
|
||||||
|
*/
|
||||||
|
public void setStorageMB(Long value) {
|
||||||
|
this.storageMB = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the provisionedStorageMB property.
|
||||||
|
*
|
||||||
|
* @return possible object is {@link Long }
|
||||||
|
*/
|
||||||
|
public Long getProvisionedStorageMB() {
|
||||||
|
return provisionedStorageMB;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value of the provisionedStorageMB property.
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* allowed object is {@link Long }
|
||||||
|
*/
|
||||||
|
public void setProvisionedStorageMB(Long value) {
|
||||||
|
this.provisionedStorageMB = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the requestedStorageMB property.
|
||||||
|
*
|
||||||
|
* @return possible object is {@link Long }
|
||||||
|
*/
|
||||||
|
public Long getRequestedStorageMB() {
|
||||||
|
return requestedStorageMB;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value of the requestedStorageMB property.
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* allowed object is {@link Long }
|
||||||
|
*/
|
||||||
|
public void setRequestedStorageMB(Long value) {
|
||||||
|
this.requestedStorageMB = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the vc property.
|
||||||
|
*
|
||||||
|
* @return possible object is {@link String }
|
||||||
|
*/
|
||||||
|
public String getVc() {
|
||||||
|
return vc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value of the vc property.
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* allowed object is {@link String }
|
||||||
|
*/
|
||||||
|
public void setVc(String value) {
|
||||||
|
this.vc = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the vcName property.
|
||||||
|
*
|
||||||
|
* @return possible object is {@link String }
|
||||||
|
*/
|
||||||
|
public String getVcName() {
|
||||||
|
return vcName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value of the vcName property.
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* allowed object is {@link String }
|
||||||
|
*/
|
||||||
|
public void setVcName(String value) {
|
||||||
|
this.vcName = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the moref property.
|
||||||
|
*
|
||||||
|
* @return possible object is {@link String }
|
||||||
|
*/
|
||||||
|
public String getMoref() {
|
||||||
|
return moref;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value of the moref property.
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* allowed object is {@link String }
|
||||||
|
*/
|
||||||
|
public void setMoref(String value) {
|
||||||
|
this.moref = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the numberOfProviderVdcs property.
|
||||||
|
*
|
||||||
|
* @return possible object is {@link Integer }
|
||||||
|
*/
|
||||||
|
public Integer getNumberOfProviderVdcs() {
|
||||||
|
return numberOfProviderVdcs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value of the numberOfProviderVdcs property.
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* allowed object is {@link Integer }
|
||||||
|
*/
|
||||||
|
public void setNumberOfProviderVdcs(Integer value) {
|
||||||
|
this.numberOfProviderVdcs = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o)
|
||||||
|
return true;
|
||||||
|
if (o == null || getClass() != o.getClass())
|
||||||
|
return false;
|
||||||
|
QueryResultDatastoreRecord that = QueryResultDatastoreRecord.class.cast(o);
|
||||||
|
return super.equals(that) && equal(name, that.name) && equal(datastoreType, that.datastoreType) && equal(isEnabled, that.isEnabled) && equal(isDeleted, that.isDeleted)
|
||||||
|
&& equal(storageUsedMB, that.storageUsedMB) && equal(storageMB, that.storageMB) && equal(provisionedStorageMB, that.provisionedStorageMB)
|
||||||
|
&& equal(requestedStorageMB, that.requestedStorageMB) && equal(vc, that.vc) && equal(vcName, that.vcName) && equal(moref, that.moref)
|
||||||
|
&& equal(numberOfProviderVdcs, that.numberOfProviderVdcs);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hashCode(super.hashCode(), name, datastoreType, isEnabled, isDeleted, storageUsedMB, storageMB, provisionedStorageMB, requestedStorageMB, vc, vcName, moref, numberOfProviderVdcs);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ToStringHelper string() {
|
||||||
|
return super.string().add("name", name).add("datastoreType", datastoreType).add("isEnabled", isEnabled).add("isDeleted", isDeleted).add("storageUsedMB", storageUsedMB).add("storageMB",
|
||||||
|
storageMB).add("provisionedStorageMB", provisionedStorageMB).add("requestedStorageMB", requestedStorageMB).add("vc", vc).add("vcName", vcName).add("moref", moref).add(
|
||||||
|
"numberOfProviderVdcs", numberOfProviderVdcs);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -16,12 +16,13 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jclouds.vcloud.director.v1_5.domain.query;
|
package org.jclouds.vcloud.director.v1_5.domain.query;
|
||||||
|
|
||||||
import static com.google.common.base.Objects.equal;
|
import static com.google.common.base.Objects.equal;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.base.Objects.ToStringHelper;
|
import com.google.common.base.Objects.ToStringHelper;
|
||||||
|
@ -30,17 +31,20 @@ import com.google.common.base.Objects.ToStringHelper;
|
||||||
* Represents the results from a Network vCloud query as a record.
|
* Represents the results from a Network vCloud query as a record.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* <complexType name="QueryResultNetworkRecord" />
|
* <complexType name="QueryResultNetworkRecordType" />
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author grkvlt@apache.org
|
* @author grkvlt@apache.org
|
||||||
*/
|
*/
|
||||||
|
@XmlRootElement(name = "OrgNetworkRecord")
|
||||||
|
@XmlType(name = "QueryResultNetworkRecordType")
|
||||||
public class QueryResultNetworkRecord extends QueryResultRecordType {
|
public class QueryResultNetworkRecord extends QueryResultRecordType {
|
||||||
|
|
||||||
public static Builder<?> builder() {
|
public static Builder<?> builder() {
|
||||||
return new ConcreteBuilder();
|
return new ConcreteBuilder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Builder<?> toBuilder() {
|
public Builder<?> toBuilder() {
|
||||||
return builder().fromQueryResultNetworkRecord(this);
|
return builder().fromQueryResultNetworkRecord(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ public class QueryResultRecords extends ContainerType {
|
||||||
return new ConcreteBuilder();
|
return new ConcreteBuilder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Builder<?> toBuilder() {
|
public Builder<?> toBuilder() {
|
||||||
return builder().fromQueryResultRecords(this);
|
return builder().fromQueryResultRecords(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class QueryResultReferences extends ContainerType {
|
||||||
return new ConcreteBuilder();
|
return new ConcreteBuilder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Builder<?> toBuilder() {
|
public Builder<?> toBuilder() {
|
||||||
return builder().fromQueryResultReferences(this);
|
return builder().fromQueryResultReferences(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,343 @@
|
||||||
|
/*
|
||||||
|
* 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.query;
|
||||||
|
|
||||||
|
import static com.google.common.base.Objects.equal;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlSchemaType;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
|
import com.google.common.base.Objects;
|
||||||
|
import com.google.common.base.Objects.ToStringHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the results from a VApp vCloud query as a record.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* <complexType name="QueryResultVAppRecordType" />
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author grkvlt@apache.org
|
||||||
|
*/
|
||||||
|
@XmlRootElement(name = "VAppRecord")
|
||||||
|
@XmlType(name = "QueryResultVAppRecordType")
|
||||||
|
public class QueryResultVAppRecord extends QueryResultRecordType {
|
||||||
|
|
||||||
|
public static Builder<?> builder() {
|
||||||
|
return new ConcreteBuilder();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Builder<?> toBuilder() {
|
||||||
|
return builder().fromQueryResultVAppRecord(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder<B extends Builder<B>> extends QueryResultRecordType.Builder<B> {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String vdc;
|
||||||
|
private String vdcName;
|
||||||
|
private Boolean isPublic;
|
||||||
|
private Boolean isEnabled;
|
||||||
|
private Boolean isBusy;
|
||||||
|
private Date creationDate;
|
||||||
|
private String status;
|
||||||
|
private String ownerName;
|
||||||
|
private Boolean isDeployed;
|
||||||
|
private Boolean isInMaintenanceMode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultVAppRecord#getName()
|
||||||
|
*/
|
||||||
|
public B name(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultVAppRecord#getVdc()
|
||||||
|
*/
|
||||||
|
public B vdc(String vdc) {
|
||||||
|
this.vdc = vdc;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultVAppRecord#getVdcName()
|
||||||
|
*/
|
||||||
|
public B vdcName(String vdcName) {
|
||||||
|
this.vdcName = vdcName;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultVAppRecord#getIsPublic()
|
||||||
|
*/
|
||||||
|
public B isPublic(Boolean isPublic) {
|
||||||
|
this.isPublic = isPublic;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultVAppRecord#getIsEnabled()
|
||||||
|
*/
|
||||||
|
public B isEnabled(Boolean isEnabled) {
|
||||||
|
this.isEnabled = isEnabled;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultVAppRecord#getIsBusy()
|
||||||
|
*/
|
||||||
|
public B isBusy(Boolean isBusy) {
|
||||||
|
this.isBusy = isBusy;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultVAppRecord#getCreationDate()
|
||||||
|
*/
|
||||||
|
public B creationDate(Date creationDate) {
|
||||||
|
this.creationDate = creationDate;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultVAppRecord#getStatus()
|
||||||
|
*/
|
||||||
|
public B status(String status) {
|
||||||
|
this.status = status;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultVAppRecord#getOwnerName()
|
||||||
|
*/
|
||||||
|
public B ownerName(String ownerName) {
|
||||||
|
this.ownerName = ownerName;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultVAppRecord#getIsDeployed()
|
||||||
|
*/
|
||||||
|
public B isDeployed(Boolean isDeployed) {
|
||||||
|
this.isDeployed = isDeployed;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see QueryResultVAppRecord#getIsInMaintenanceMode()
|
||||||
|
*/
|
||||||
|
public B isInMaintenanceMode(Boolean isInMaintenanceMode) {
|
||||||
|
this.isInMaintenanceMode = isInMaintenanceMode;
|
||||||
|
return self();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public QueryResultVAppRecord build() {
|
||||||
|
return new QueryResultVAppRecord(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public B fromQueryResultVAppRecord(QueryResultVAppRecord in) {
|
||||||
|
return fromQueryResultRecordType(in)
|
||||||
|
.name(in.getName())
|
||||||
|
.vdc(in.getVdc())
|
||||||
|
.vdcName(in.getVdcName())
|
||||||
|
.isPublic(in.isIsPublic())
|
||||||
|
.isEnabled(in.isIsEnabled())
|
||||||
|
.isBusy(in.isIsBusy())
|
||||||
|
.creationDate(in.getCreationDate())
|
||||||
|
.status(in.getStatus())
|
||||||
|
.ownerName(in.getOwnerName())
|
||||||
|
.isDeployed(in.isIsDeployed())
|
||||||
|
.isInMaintenanceMode(in.isIsInMaintenanceMode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private QueryResultVAppRecord() {
|
||||||
|
// For JAXB and builder use
|
||||||
|
}
|
||||||
|
|
||||||
|
private QueryResultVAppRecord(Builder<?> builder) {
|
||||||
|
super(builder);
|
||||||
|
this.name = builder.name;
|
||||||
|
this.vdc = builder.vdc;
|
||||||
|
this.vdcName = builder.vdcName;
|
||||||
|
this.isPublic = builder.isPublic;
|
||||||
|
this.isEnabled = builder.isEnabled;
|
||||||
|
this.isBusy = builder.isBusy;
|
||||||
|
this.creationDate = builder.creationDate;
|
||||||
|
this.status = builder.status;
|
||||||
|
this.ownerName = builder.ownerName;
|
||||||
|
this.isDeployed = builder.isDeployed;
|
||||||
|
this.isInMaintenanceMode = builder.isInMaintenanceMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlAttribute
|
||||||
|
protected String name;
|
||||||
|
@XmlAttribute
|
||||||
|
protected String vdc;
|
||||||
|
@XmlAttribute
|
||||||
|
protected String vdcName;
|
||||||
|
@XmlAttribute
|
||||||
|
protected Boolean isPublic;
|
||||||
|
@XmlAttribute
|
||||||
|
protected Boolean isEnabled;
|
||||||
|
@XmlAttribute
|
||||||
|
protected Boolean isBusy;
|
||||||
|
@XmlAttribute
|
||||||
|
@XmlSchemaType(name = "dateTime")
|
||||||
|
protected Date creationDate;
|
||||||
|
@XmlAttribute
|
||||||
|
protected String status;
|
||||||
|
@XmlAttribute
|
||||||
|
protected String ownerName;
|
||||||
|
@XmlAttribute
|
||||||
|
protected Boolean isDeployed;
|
||||||
|
@XmlAttribute
|
||||||
|
protected Boolean isInMaintenanceMode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the name property.
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the vdc property.
|
||||||
|
*/
|
||||||
|
public String getVdc() {
|
||||||
|
return vdc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the vdcName property.
|
||||||
|
*/
|
||||||
|
public String getVdcName() {
|
||||||
|
return vdcName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the isPublic property.
|
||||||
|
*/
|
||||||
|
public Boolean isIsPublic() {
|
||||||
|
return isPublic;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the isEnabled property.
|
||||||
|
*/
|
||||||
|
public Boolean isIsEnabled() {
|
||||||
|
return isEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the isBusy property.
|
||||||
|
*/
|
||||||
|
public Boolean isIsBusy() {
|
||||||
|
return isBusy;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the creationDate property.
|
||||||
|
*/
|
||||||
|
public Date getCreationDate() {
|
||||||
|
return creationDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the status property.
|
||||||
|
*/
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the ownerName property.
|
||||||
|
*/
|
||||||
|
public String getOwnerName() {
|
||||||
|
return ownerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the isDeployed property.
|
||||||
|
*/
|
||||||
|
public Boolean isIsDeployed() {
|
||||||
|
return isDeployed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the value of the isInMaintenanceMode property.
|
||||||
|
*/
|
||||||
|
public Boolean isIsInMaintenanceMode() {
|
||||||
|
return isInMaintenanceMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o)
|
||||||
|
return true;
|
||||||
|
if (o == null || getClass() != o.getClass())
|
||||||
|
return false;
|
||||||
|
QueryResultVAppRecord that = QueryResultVAppRecord.class.cast(o);
|
||||||
|
return super.equals(that) &&
|
||||||
|
equal(this.name, that.name) &&
|
||||||
|
equal(this.vdc, that.vdc) &&
|
||||||
|
equal(this.vdcName, that.vdcName) &&
|
||||||
|
equal(this.isPublic, that.isPublic) &&
|
||||||
|
equal(this.isEnabled, that.isEnabled) &&
|
||||||
|
equal(this.isBusy, that.isBusy) &&
|
||||||
|
equal(this.creationDate, that.creationDate) &&
|
||||||
|
equal(this.status, that.status) &&
|
||||||
|
equal(this.ownerName, that.ownerName) &&
|
||||||
|
equal(this.isDeployed, that.isDeployed) &&
|
||||||
|
equal(this.isInMaintenanceMode, that.isInMaintenanceMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hashCode(super.hashCode(), name, vdc, vdcName, isPublic, isEnabled, isBusy, creationDate, status, ownerName, isDeployed, isInMaintenanceMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ToStringHelper string() {
|
||||||
|
return super.string()
|
||||||
|
.add("name", name)
|
||||||
|
.add("vdc", vdc)
|
||||||
|
.add("vdcName", vdcName)
|
||||||
|
.add("isPublic", isPublic)
|
||||||
|
.add("isEnabled", isEnabled)
|
||||||
|
.add("isBusy", isBusy)
|
||||||
|
.add("creationDate", creationDate)
|
||||||
|
.add("status", status)
|
||||||
|
.add("ownerName", ownerName)
|
||||||
|
.add("isDeployed", isDeployed)
|
||||||
|
.add("isInMaintenanceMode", isInMaintenanceMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
/*
|
||||||
|
* 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.query;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the results from a vCloud query as references.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* <complexType name="QueryResultReferences" />
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author grkvlt@apache.org
|
||||||
|
*/
|
||||||
|
@XmlRootElement(name = "VAppReferences")
|
||||||
|
public class VAppReferences extends QueryResultReferences {
|
||||||
|
|
||||||
|
public static Builder<?> builder() {
|
||||||
|
return new ConcreteBuilder();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Builder<?> toBuilder() {
|
||||||
|
return builder().fromVAppReferences(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder<B extends Builder<B>> extends QueryResultReferences.Builder<B> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VAppReferences build() {
|
||||||
|
return new VAppReferences(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public B fromVAppReferences(VAppReferences in) {
|
||||||
|
return fromQueryResultReferences(in);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected VAppReferences(Builder<?> builder) {
|
||||||
|
super(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected VAppReferences() {
|
||||||
|
// for JAXB
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o)
|
||||||
|
return true;
|
||||||
|
if (o == null || getClass() != o.getClass())
|
||||||
|
return false;
|
||||||
|
VAppReferences that = VAppReferences.class.cast(o);
|
||||||
|
return super.equals(that);
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE hashcode inheritted from QueryResultReferences
|
||||||
|
}
|
|
@ -31,6 +31,7 @@ import org.jclouds.rest.annotations.SkipEncoding;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.query.CatalogReferences;
|
import org.jclouds.vcloud.director.v1_5.domain.query.CatalogReferences;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.query.QueryList;
|
import org.jclouds.vcloud.director.v1_5.domain.query.QueryList;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;
|
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.domain.query.VAppReferences;
|
||||||
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
|
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
|
||||||
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
|
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
|
||||||
|
|
||||||
|
@ -42,7 +43,6 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
*/
|
*/
|
||||||
@RequestFilters(AddVCloudAuthorizationToRequest.class)
|
@RequestFilters(AddVCloudAuthorizationToRequest.class)
|
||||||
@SkipEncoding({ '=' })
|
@SkipEncoding({ '=' })
|
||||||
@SuppressWarnings("rawtypes")
|
|
||||||
public interface QueryAsyncClient {
|
public interface QueryAsyncClient {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -78,7 +78,7 @@ public interface QueryAsyncClient {
|
||||||
@QueryParam("format") String format, @QueryParam("type") String type, @QueryParam("filter") String filter);
|
@QueryParam("format") String format, @QueryParam("type") String type, @QueryParam("filter") String filter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a list of Catalogs by using REST API general QueryHandler.
|
* Retrieves a list of {@link Catalog}s by using REST API general QueryHandler.
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Path("/catalogs/query")
|
@Path("/catalogs/query")
|
||||||
|
@ -126,4 +126,54 @@ public interface QueryAsyncClient {
|
||||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
ListenableFuture<CatalogReferences> catalogReferencesQuery(@QueryParam("page") Integer page, @QueryParam("pageSize") Integer pageSize,
|
ListenableFuture<CatalogReferences> catalogReferencesQuery(@QueryParam("page") Integer page, @QueryParam("pageSize") Integer pageSize,
|
||||||
@QueryParam("filter") String filter);
|
@QueryParam("filter") String filter);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a list of {@link VApp}s by using REST API general QueryHandler.
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Path("/vApps/query")
|
||||||
|
@Consumes
|
||||||
|
@JAXBResponseParser
|
||||||
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
|
ListenableFuture<QueryResultRecords> vAppsQueryAll();
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/vApps/query")
|
||||||
|
@Consumes
|
||||||
|
@JAXBResponseParser
|
||||||
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
|
ListenableFuture<QueryResultRecords> vAppsQuery(@QueryParam("filter") String filter);
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/vApps/query")
|
||||||
|
@Consumes
|
||||||
|
@JAXBResponseParser
|
||||||
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
|
ListenableFuture<QueryResultRecords> vAppsQuery(@QueryParam("page") Integer page, @QueryParam("pageSize") Integer pageSize,
|
||||||
|
@QueryParam("filter") String filter);
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/vApps/query")
|
||||||
|
@Consumes
|
||||||
|
@QueryParams(keys = { "format" }, values = { "references" })
|
||||||
|
@JAXBResponseParser
|
||||||
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
|
ListenableFuture<VAppReferences> vAppReferencesQueryAll();
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/vApps/query")
|
||||||
|
@Consumes
|
||||||
|
@QueryParams(keys = { "format" }, values = { "references" })
|
||||||
|
@JAXBResponseParser
|
||||||
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
|
ListenableFuture<VAppReferences> vAppReferencesQuery(@QueryParam("filter") String filter);
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/vApps/query")
|
||||||
|
@Consumes
|
||||||
|
@QueryParams(keys = { "format" }, values = { "references" })
|
||||||
|
@JAXBResponseParser
|
||||||
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
|
ListenableFuture<VAppReferences> vAppReferencesQuery(@QueryParam("page") Integer page, @QueryParam("pageSize") Integer pageSize,
|
||||||
|
@QueryParam("filter") String filter);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,18 +24,19 @@ import org.jclouds.concurrent.Timeout;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.query.CatalogReferences;
|
import org.jclouds.vcloud.director.v1_5.domain.query.CatalogReferences;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.query.QueryList;
|
import org.jclouds.vcloud.director.v1_5.domain.query.QueryList;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;
|
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.domain.query.VAppReferences;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to The REST API query interface.
|
* Provides synchronous access to The REST API query interface.
|
||||||
*
|
*
|
||||||
* @see TaskAsyncClient
|
* @see QueryAsyncClient
|
||||||
* @author grkvlt@apache.org
|
* @author grkvlt@apache.org
|
||||||
*/
|
*/
|
||||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||||
public interface QueryClient {
|
public interface QueryClient {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* REST API General queries handler.
|
* REST API query {@link Link} list.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* GET /query
|
* GET /query
|
||||||
|
@ -43,33 +44,97 @@ public interface QueryClient {
|
||||||
*/
|
*/
|
||||||
QueryList queryList();
|
QueryList queryList();
|
||||||
|
|
||||||
QueryResultRecords queryAll(String type);
|
|
||||||
|
|
||||||
QueryResultRecords query(String type, String filter);
|
|
||||||
|
|
||||||
QueryResultRecords query(Integer page, Integer pageSize, String format, String type, String filter);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a list of Catalogs by using REST API general QueryHandler.
|
* Retrieves a list of entities by using REST API general QueryHandler.
|
||||||
*
|
*
|
||||||
* If filter is provided it will be applied to the corresponding result set.
|
* If filter is provided it will be applied to the corresponding result set.
|
||||||
* Format determines the elements representation - references or records.
|
* Format determines the elements representation - references or records.
|
||||||
* Default format is references.
|
* Default format is references.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
|
* GET /query
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @see #queryList()
|
||||||
|
* @see #query(String, String)
|
||||||
|
* @see #query(Integer, Integer, String, String, String)
|
||||||
|
*/
|
||||||
|
QueryResultRecords queryAll(String type);
|
||||||
|
|
||||||
|
/** @see #queryAll() */
|
||||||
|
QueryResultRecords query(String type, String filter);
|
||||||
|
|
||||||
|
/** @see #queryAll() */
|
||||||
|
QueryResultRecords query(Integer page, Integer pageSize, String format, String type, String filter);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a list of {@link Catalog}s by using REST API general QueryHandler.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
* GET /catalogs/query
|
* GET /catalogs/query
|
||||||
* </pre>
|
* </pre>
|
||||||
|
*
|
||||||
|
* @see #queryAll(String)
|
||||||
*/
|
*/
|
||||||
QueryResultRecords catalogsQueryAll();
|
QueryResultRecords catalogsQueryAll();
|
||||||
|
|
||||||
|
/** @see #queryAll() */
|
||||||
QueryResultRecords catalogsQuery(String filter);
|
QueryResultRecords catalogsQuery(String filter);
|
||||||
|
|
||||||
|
/** @see #queryAll() */
|
||||||
QueryResultRecords catalogsQuery(Integer page, Integer pageSize, String filter);
|
QueryResultRecords catalogsQuery(Integer page, Integer pageSize, String filter);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a list of {@link CatalogReference}s by using REST API general QueryHandler.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* GET /catalogs/query?format=references
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @see #queryAll(String)
|
||||||
|
*/
|
||||||
CatalogReferences catalogReferencesQueryAll();
|
CatalogReferences catalogReferencesQueryAll();
|
||||||
|
|
||||||
|
/** @see #catalogReferencesQueryAll() */
|
||||||
CatalogReferences catalogReferencesQuery(String filter);
|
CatalogReferences catalogReferencesQuery(String filter);
|
||||||
|
|
||||||
|
/** @see #catalogReferencesQueryAll() */
|
||||||
CatalogReferences catalogReferencesQuery(Integer page, Integer pageSize, String filter);
|
CatalogReferences catalogReferencesQuery(Integer page, Integer pageSize, String filter);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a list of {@link VApp}s by using REST API general QueryHandler.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* GET /vApps/query
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @see #queryAll(String)
|
||||||
|
*/
|
||||||
|
QueryResultRecords vAppsQueryAll();
|
||||||
|
|
||||||
|
/** @see #queryAll() */
|
||||||
|
QueryResultRecords vAppsQuery(String filter);
|
||||||
|
|
||||||
|
/** @see #queryAll() */
|
||||||
|
QueryResultRecords vAppsQuery(Integer page, Integer pageSize, String filter);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a list of {@link VAppReference}s by using REST API general QueryHandler.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* GET /vApps/query?format=references
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @see #queryAll(String)
|
||||||
|
*/
|
||||||
|
/** @see #queryAll() */
|
||||||
|
VAppReferences vAppReferencesQueryAll();
|
||||||
|
|
||||||
|
/** @see #queryAll() */
|
||||||
|
VAppReferences vAppReferencesQuery(String filter);
|
||||||
|
|
||||||
|
/** @see #queryAll() */
|
||||||
|
VAppReferences vAppReferencesQuery(Integer page, Integer pageSize, String filter);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,7 +300,7 @@ public interface VAppAsyncClient {
|
||||||
@Consumes
|
@Consumes
|
||||||
@JAXBResponseParser
|
@JAXBResponseParser
|
||||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
ListenableFuture<GuestCustomizationSection> getGuestCustomizationSection(@EndpointParam URI vAppURI);
|
ListenableFuture<GuestCustomizationSection> getGuestCustomizationSection(@EndpointParam URI vmURI);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see VAppClient#modifyGuestCustomizationSection(URI, GuestCustomizationSection)
|
* @see VAppClient#modifyGuestCustomizationSection(URI, GuestCustomizationSection)
|
||||||
|
@ -311,7 +311,7 @@ public interface VAppAsyncClient {
|
||||||
@Consumes(TASK)
|
@Consumes(TASK)
|
||||||
@JAXBResponseParser
|
@JAXBResponseParser
|
||||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
ListenableFuture<Task> modifyGuestCustomizationSection(@EndpointParam URI vAppURI,
|
ListenableFuture<Task> modifyGuestCustomizationSection(@EndpointParam URI vmURI,
|
||||||
@BinderParam(BindToXMLPayload.class) GuestCustomizationSection section);
|
@BinderParam(BindToXMLPayload.class) GuestCustomizationSection section);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -345,7 +345,7 @@ public interface VAppAsyncClient {
|
||||||
@Consumes(TASK)
|
@Consumes(TASK)
|
||||||
@JAXBResponseParser
|
@JAXBResponseParser
|
||||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
ListenableFuture<Task> ejectMedia(@EndpointParam URI vAppURI,
|
ListenableFuture<Task> ejectMedia(@EndpointParam URI vmURI,
|
||||||
@BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams);
|
@BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -357,7 +357,7 @@ public interface VAppAsyncClient {
|
||||||
@Consumes(TASK)
|
@Consumes(TASK)
|
||||||
@JAXBResponseParser
|
@JAXBResponseParser
|
||||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
ListenableFuture<Task> insertMedia(@EndpointParam URI vAppURI,
|
ListenableFuture<Task> insertMedia(@EndpointParam URI vmURI,
|
||||||
@BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams);
|
@BinderParam(BindToXMLPayload.class) MediaInsertOrEjectParams mediaParams);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -396,18 +396,18 @@ public interface VAppAsyncClient {
|
||||||
@Consumes
|
@Consumes
|
||||||
@JAXBResponseParser
|
@JAXBResponseParser
|
||||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
ListenableFuture<NetworkConnectionSection> getNetworkConnectionSection(@EndpointParam URI vAppURI);
|
ListenableFuture<NetworkConnectionSection> getNetworkConnectionSection(@EndpointParam URI vmURI);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see VAppClient#modifyNetworkConnectionSection(URI, NetworkConnectionSection)
|
* @see VAppClient#modifyNetworkConnectionSection(URI, NetworkConnectionSection)
|
||||||
*/
|
*/
|
||||||
@PUT
|
@PUT
|
||||||
@Path("/networkConfigSection")
|
@Path("/networkConnectionSection")
|
||||||
@Produces(NETWORK_CONFIG_SECTION)
|
@Produces(NETWORK_CONFIG_SECTION)
|
||||||
@Consumes(TASK)
|
@Consumes(TASK)
|
||||||
@JAXBResponseParser
|
@JAXBResponseParser
|
||||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
ListenableFuture<Task> modifyNetworkConnectionSection(@EndpointParam URI vAppURI,
|
ListenableFuture<Task> modifyNetworkConnectionSection(@EndpointParam URI vmURI,
|
||||||
@BinderParam(BindToXMLPayload.class) NetworkConnectionSection section);
|
@BinderParam(BindToXMLPayload.class) NetworkConnectionSection section);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -428,7 +428,7 @@ public interface VAppAsyncClient {
|
||||||
@Consumes
|
@Consumes
|
||||||
@JAXBResponseParser
|
@JAXBResponseParser
|
||||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
ListenableFuture<OperatingSystemSection> getOperatingSystemSection(@EndpointParam URI vAppURI);
|
ListenableFuture<OperatingSystemSection> getOperatingSystemSection(@EndpointParam URI vmURI);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see VAppClient#modifyOperatingSystemSection(URI, OperatingSystemSection)
|
* @see VAppClient#modifyOperatingSystemSection(URI, OperatingSystemSection)
|
||||||
|
@ -439,7 +439,7 @@ public interface VAppAsyncClient {
|
||||||
@Consumes(TASK)
|
@Consumes(TASK)
|
||||||
@JAXBResponseParser
|
@JAXBResponseParser
|
||||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
ListenableFuture<Task> modifyOperatingSystemSection(@EndpointParam URI vAppURI,
|
ListenableFuture<Task> modifyOperatingSystemSection(@EndpointParam URI vmURI,
|
||||||
@BinderParam(BindToXMLPayload.class) OperatingSystemSection section);
|
@BinderParam(BindToXMLPayload.class) OperatingSystemSection section);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -516,7 +516,7 @@ public interface VAppAsyncClient {
|
||||||
@Consumes
|
@Consumes
|
||||||
@JAXBResponseParser
|
@JAXBResponseParser
|
||||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
ListenableFuture<RuntimeInfoSection> getRuntimeInfoSection(@EndpointParam URI vAppURI);
|
ListenableFuture<RuntimeInfoSection> getRuntimeInfoSection(@EndpointParam URI vmURI);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see VAppClient#getScreenImage(URI)
|
* @see VAppClient#getScreenImage(URI)
|
||||||
|
@ -568,7 +568,7 @@ public interface VAppAsyncClient {
|
||||||
@Consumes
|
@Consumes
|
||||||
@JAXBResponseParser
|
@JAXBResponseParser
|
||||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
ListenableFuture<VirtualHardwareSection> getVirtualHardwareSection(@EndpointParam URI vAppURI);
|
ListenableFuture<VirtualHardwareSection> getVirtualHardwareSection(@EndpointParam URI vmURI);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see VAppClient#modifyVirtualHardwareSection(URI, VirtualHardwareSection)
|
* @see VAppClient#modifyVirtualHardwareSection(URI, VirtualHardwareSection)
|
||||||
|
@ -579,7 +579,7 @@ public interface VAppAsyncClient {
|
||||||
@Consumes(TASK)
|
@Consumes(TASK)
|
||||||
@JAXBResponseParser
|
@JAXBResponseParser
|
||||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
ListenableFuture<Task> modifyVirtualHardwareSection(@EndpointParam URI vAppURI,
|
ListenableFuture<Task> modifyVirtualHardwareSection(@EndpointParam URI vmURI,
|
||||||
@BinderParam(BindToXMLPayload.class) VirtualHardwareSection section);
|
@BinderParam(BindToXMLPayload.class) VirtualHardwareSection section);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -376,7 +376,7 @@ public interface VAppClient {
|
||||||
*
|
*
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
GuestCustomizationSection getGuestCustomizationSection(URI vAppURI);
|
GuestCustomizationSection getGuestCustomizationSection(URI vmURI);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modifies the guest customization section of a VM.
|
* Modifies the guest customization section of a VM.
|
||||||
|
@ -387,10 +387,10 @@ public interface VAppClient {
|
||||||
*
|
*
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
Task modifyGuestCustomizationSection(URI vAppURI, GuestCustomizationSection section);
|
Task modifyGuestCustomizationSection(URI vmURI, GuestCustomizationSection section);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the lease settings section of a VM.
|
* Retrieves the lease settings section of a vApp or vApp template.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* GET /vApp/{id}/leaseSettingsSection
|
* GET /vApp/{id}/leaseSettingsSection
|
||||||
|
@ -401,7 +401,7 @@ public interface VAppClient {
|
||||||
LeaseSettingsSection getLeaseSettingsSection(URI vAppURI);
|
LeaseSettingsSection getLeaseSettingsSection(URI vAppURI);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modifies the lease settings section of a VM.
|
* Modifies the lease settings section of a vApp or vApp template.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* PUT /vApp/{id}/leaseSettingsSection
|
* PUT /vApp/{id}/leaseSettingsSection
|
||||||
|
@ -420,7 +420,7 @@ public interface VAppClient {
|
||||||
*
|
*
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
Task ejectMedia(URI vAppURI, MediaInsertOrEjectParams mediaParams);
|
Task ejectMedia(URI vmURI, MediaInsertOrEjectParams mediaParams);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inserts a media into a VM.
|
* Inserts a media into a VM.
|
||||||
|
@ -431,7 +431,7 @@ public interface VAppClient {
|
||||||
*
|
*
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
Task insertMedia(URI vAppURI, MediaInsertOrEjectParams mediaParams);
|
Task insertMedia(URI vmURI, MediaInsertOrEjectParams mediaParams);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return synchronous access to {@link Metadata} features
|
* @return synchronous access to {@link Metadata} features
|
||||||
|
@ -440,7 +440,7 @@ public interface VAppClient {
|
||||||
MetadataClient.Writeable getMetadataClient();
|
MetadataClient.Writeable getMetadataClient();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the network configuration section of a VM.
|
* Retrieves the network config section of a vApp or vApp template.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* GET /vApp/{id}/networkConfigSection
|
* GET /vApp/{id}/networkConfigSection
|
||||||
|
@ -448,10 +448,10 @@ public interface VAppClient {
|
||||||
*
|
*
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
NetworkConfigSection getNetworkConfigSection(URI vAppURI);
|
NetworkConfigSection getNetworkConfigSection(URI vmURI);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modifies the network configuration section of a VM.
|
* Modifies the network config section of a vApp.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* PUT /vApp/{id}/networkConfigSection
|
* PUT /vApp/{id}/networkConfigSection
|
||||||
|
@ -459,7 +459,7 @@ public interface VAppClient {
|
||||||
*
|
*
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
Task modifyNetworkConfigSection(URI vAppURI, NetworkConfigSection section);
|
Task modifyNetworkConfigSection(URI vmURI, NetworkConfigSection section);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the network connection section of a VM.
|
* Retrieves the network connection section of a VM.
|
||||||
|
@ -470,7 +470,7 @@ public interface VAppClient {
|
||||||
*
|
*
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
NetworkConnectionSection getNetworkConnectionSection(URI vAppURI);
|
NetworkConnectionSection getNetworkConnectionSection(URI vmURI);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modifies the network connection section of a VM.
|
* Modifies the network connection section of a VM.
|
||||||
|
@ -481,10 +481,10 @@ public interface VAppClient {
|
||||||
*
|
*
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
Task modifyNetworkConnectionSection(URI vAppURI, NetworkConnectionSection section);
|
Task modifyNetworkConnectionSection(URI vmURI, NetworkConnectionSection section);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the network section of a VM.
|
* Retrieves the network section of a vApp or vApp template.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* GET /vApp/{id}/networkSection
|
* GET /vApp/{id}/networkSection
|
||||||
|
@ -503,7 +503,7 @@ public interface VAppClient {
|
||||||
*
|
*
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
OperatingSystemSection getOperatingSystemSection(URI vAppURI);
|
OperatingSystemSection getOperatingSystemSection(URI vmURI);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modifies the operating system section of a VM.
|
* Modifies the operating system section of a VM.
|
||||||
|
@ -514,7 +514,7 @@ public interface VAppClient {
|
||||||
*
|
*
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
Task modifyOperatingSystemSection(URI vAppURI, OperatingSystemSection section);
|
Task modifyOperatingSystemSection(URI vmURI, OperatingSystemSection section);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the owner of a vApp.
|
* Retrieves the owner of a vApp.
|
||||||
|
@ -596,7 +596,7 @@ public interface VAppClient {
|
||||||
*
|
*
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
RuntimeInfoSection getRuntimeInfoSection(URI vAppURI);
|
RuntimeInfoSection getRuntimeInfoSection(URI vmURI);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the thumbnail of the screen of a VM.
|
* Retrieves the thumbnail of the screen of a VM.
|
||||||
|
@ -628,7 +628,7 @@ public interface VAppClient {
|
||||||
ScreenTicket getScreenTicket(URI vAppURI);
|
ScreenTicket getScreenTicket(URI vAppURI);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the startup section of a VM.
|
* Retrieves the startup section of a VApp.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* GET /vApp/{id}/startupSection
|
* GET /vApp/{id}/startupSection
|
||||||
|
@ -639,7 +639,7 @@ public interface VAppClient {
|
||||||
StartupSection getStartupSection(URI vAppURI);
|
StartupSection getStartupSection(URI vAppURI);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modifies the startup section of a VM.
|
* Modifies the startup section of a VApp.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* PUT /vApp/{id}/startupSection
|
* PUT /vApp/{id}/startupSection
|
||||||
|
@ -658,7 +658,7 @@ public interface VAppClient {
|
||||||
*
|
*
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
VirtualHardwareSection getVirtualHardwareSection(URI vAppURI);
|
VirtualHardwareSection getVirtualHardwareSection(URI vmURI);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modifies the virtual hardware section of a VM.
|
* Modifies the virtual hardware section of a VM.
|
||||||
|
@ -669,7 +669,7 @@ public interface VAppClient {
|
||||||
*
|
*
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
Task modifyVirtualHardwareSection(URI vAppURI, VirtualHardwareSection section);
|
Task modifyVirtualHardwareSection(URI vmURI, VirtualHardwareSection section);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the CPU properties in virtual hardware section of a VM.
|
* Retrieves the CPU properties in virtual hardware section of a VM.
|
||||||
|
|
|
@ -20,27 +20,22 @@ package org.jclouds.vcloud.director.v1_5.predicates;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Predicates handy when working with Reference Types
|
* Predicates for working with {@link Reference} collections.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ReferenceTypePredicates {
|
public class ReferenceTypePredicates {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* matches references of the given name
|
* Matches {@link Reference}s of the given name.
|
||||||
*
|
*
|
||||||
* @param <T>
|
* @param T type of the reference, for example {@link Link}
|
||||||
* type of the ReferenceType, ex. {@link Link}
|
* @param name value of the name attribute of the referenced object
|
||||||
* @param name
|
|
||||||
* ex. {@code context.getApi().getCurrentSession().getOrg()}
|
|
||||||
* @return predicate that will match references of the given name
|
* @return predicate that will match references of the given name
|
||||||
*/
|
*/
|
||||||
public static <T extends Reference> Predicate<T> nameEquals(final String name) {
|
public static <T extends Reference> Predicate<T> nameEquals(final String name) {
|
||||||
|
@ -60,12 +55,10 @@ public class ReferenceTypePredicates {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* matches references of the given type
|
* Matches {@link Reference}s of the given type.
|
||||||
*
|
*
|
||||||
* @param <T>
|
* @param T type of the reference, for example {@link Link}
|
||||||
* type of the ReferenceType, ex. {@link Link}
|
* @param type the media type string of the referenced object, for example {@link VCloudDirectorMediaType#CATALOG}
|
||||||
* @param type
|
|
||||||
* ex. {@link VCloudDirectorMediaType#CATALOG}
|
|
||||||
* @return predicate that will match references of the given type
|
* @return predicate that will match references of the given type
|
||||||
* @see VCloudDirectorMediaType
|
* @see VCloudDirectorMediaType
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -23,9 +23,15 @@ package org.jclouds.vcloud.director.v1_5;
|
||||||
*/
|
*/
|
||||||
public class VCloudDirectorLiveTestConstants {
|
public class VCloudDirectorLiveTestConstants {
|
||||||
|
|
||||||
|
/* regular expressions for pattern matching */
|
||||||
|
|
||||||
|
public static final String MAC_ADDRESS_PATTERN = "^([0-9A-F]{2}[:-]){5}([0-9A-F]{2})$";
|
||||||
|
|
||||||
|
/* Error code 200 indicates success. */
|
||||||
|
|
||||||
public static final String OK = "ERR-200: ok";
|
public static final String OK = "ERR-200: ok";
|
||||||
|
|
||||||
/* Error codes from 100 to 199 reflect parsing and other errors in domain objects. */
|
/* Error codes from 100 to 199 reflect parsing and other errors in domain object fields and attributes. */
|
||||||
|
|
||||||
public static final String REF_REQ_LIVE = "ERR-101: %s reference required to perform live tests";
|
public static final String REF_REQ_LIVE = "ERR-101: %s reference required to perform live tests";
|
||||||
|
|
||||||
|
@ -53,7 +59,7 @@ public class VCloudDirectorLiveTestConstants {
|
||||||
|
|
||||||
public static final String TASK_COMPLETE_TIMELY = "ERR-113: Task %s should complete in a timely fashion";
|
public static final String TASK_COMPLETE_TIMELY = "ERR-113: Task %s should complete in a timely fashion";
|
||||||
|
|
||||||
public static final String NOT_NULL_OBJECT_FMT = "ERR-114: The %s field of the %s must not be null";
|
public static final String NOT_NULL_OBJ_FIELD_FMT = "ERR-114: The %s field of the %s must not be null";
|
||||||
|
|
||||||
public static final String NOT_EMPTY_OBJECT_FMT = "ERR-115: One or more %s fields of the %s must be present";
|
public static final String NOT_EMPTY_OBJECT_FMT = "ERR-115: One or more %s fields of the %s must be present";
|
||||||
|
|
||||||
|
@ -75,6 +81,12 @@ public class VCloudDirectorLiveTestConstants {
|
||||||
|
|
||||||
public static final String OBJ_FIELD_EMPTY_TO_DELETE = "ERR-124: %s must have no %s to be deleted (%s)";
|
public static final String OBJ_FIELD_EMPTY_TO_DELETE = "ERR-124: %s must have no %s to be deleted (%s)";
|
||||||
|
|
||||||
|
public static final String NOT_NULL_OBJ_FMT = "ERR-125: The %s object must not be null";
|
||||||
|
|
||||||
|
public static final String NOT_EMPTY_STRING_FMT = "ERR-126: The %s field must not be an empty string";
|
||||||
|
|
||||||
|
public static final String MATCHES_STRING_FMT = "ERR-127: The %s field must match the pattern \"%s\"";
|
||||||
|
|
||||||
/* Error codes from 300 to 399 reflect entities and their links and relationship errors. */
|
/* Error codes from 300 to 399 reflect entities and their links and relationship errors. */
|
||||||
|
|
||||||
public static final String ENTITY_NON_NULL = "ERR-301: The %s entity must not be null";
|
public static final String ENTITY_NON_NULL = "ERR-301: The %s entity must not be null";
|
||||||
|
|
|
@ -19,9 +19,13 @@
|
||||||
package org.jclouds.vcloud.director.v1_5.domain;
|
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.CONDITION_FMT;
|
||||||
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.MAC_ADDRESS_PATTERN;
|
||||||
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.MATCHES_STRING_FMT;
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.MUST_BE_WELL_FORMED_FMT;
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.MUST_BE_WELL_FORMED_FMT;
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.MUST_CONTAIN_FMT;
|
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.NOT_EMPTY_STRING_FMT;
|
||||||
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.NOT_NULL_OBJ_FIELD_FMT;
|
||||||
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.NOT_NULL_OBJ_FMT;
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_DEL;
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_DEL;
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_ATTRB_REQ;
|
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_EQ;
|
||||||
|
@ -56,7 +60,9 @@ import org.jclouds.vcloud.director.v1_5.domain.ovf.Network;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection;
|
import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.ovf.OperatingSystemSection;
|
import org.jclouds.vcloud.director.v1_5.domain.ovf.OperatingSystemSection;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.ovf.ProductSection;
|
import org.jclouds.vcloud.director.v1_5.domain.ovf.ProductSection;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.domain.ovf.RASD;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
|
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.domain.ovf.StartupSection;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection;
|
import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualSystem;
|
import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualSystem;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.ovf.environment.EnvironmentType;
|
import org.jclouds.vcloud.director.v1_5.domain.ovf.environment.EnvironmentType;
|
||||||
|
@ -85,7 +91,7 @@ public class Checks {
|
||||||
|
|
||||||
public static void checkEntityType(EntityType entity) {
|
public static void checkEntityType(EntityType entity) {
|
||||||
// Check required fields
|
// Check required fields
|
||||||
assertNotNull(entity.getName(), String.format(NOT_NULL_OBJECT_FMT, "Name", "EntityType"));
|
assertNotNull(entity.getName(), String.format(NOT_NULL_OBJ_FIELD_FMT, "Name", "EntityType"));
|
||||||
|
|
||||||
// Check optional fields
|
// Check optional fields
|
||||||
// NOTE description cannot be checked
|
// NOTE description cannot be checked
|
||||||
|
@ -109,7 +115,7 @@ public class Checks {
|
||||||
|
|
||||||
public static void checkReferenceType(Reference reference, Collection<String> validTypes) {
|
public static void checkReferenceType(Reference reference, Collection<String> validTypes) {
|
||||||
// Check required fields
|
// Check required fields
|
||||||
assertNotNull(reference.getHref(), String.format(NOT_NULL_OBJECT_FMT, "Href", "ReferenceType"));
|
assertNotNull(reference.getHref(), String.format(NOT_NULL_OBJ_FIELD_FMT, "Href", "ReferenceType"));
|
||||||
|
|
||||||
// Check optional fields
|
// Check optional fields
|
||||||
String id = reference.getId();
|
String id = reference.getId();
|
||||||
|
@ -164,7 +170,7 @@ public class Checks {
|
||||||
|
|
||||||
public static void checkLink(Link link) {
|
public static void checkLink(Link link) {
|
||||||
// Check required fields
|
// Check required fields
|
||||||
assertNotNull(link.getRel(), String.format(NOT_NULL_OBJECT_FMT, "Rel", "Link"));
|
assertNotNull(link.getRel(), String.format(NOT_NULL_OBJ_FIELD_FMT, "Rel", "Link"));
|
||||||
assertTrue(Link.Rel.ALL.contains(link.getRel()), String.format(REQUIRED_VALUE_OBJECT_FMT, "Rel", "Link", link.getRel(), Iterables.toString(Link.Rel.ALL)));
|
assertTrue(Link.Rel.ALL.contains(link.getRel()), String.format(REQUIRED_VALUE_OBJECT_FMT, "Rel", "Link", link.getRel(), Iterables.toString(Link.Rel.ALL)));
|
||||||
|
|
||||||
// Check parent type
|
// Check parent type
|
||||||
|
@ -173,7 +179,7 @@ public class Checks {
|
||||||
|
|
||||||
public static void checkTask(Task task) {
|
public static void checkTask(Task task) {
|
||||||
// Check required fields
|
// Check required fields
|
||||||
assertNotNull(task.getStatus(), String.format(NOT_NULL_OBJECT_FMT, "Status", "Task"));
|
assertNotNull(task.getStatus(), String.format(NOT_NULL_OBJ_FIELD_FMT, "Status", "Task"));
|
||||||
assertTrue(Task.Status.ALL.contains(task.getStatus()), String.format(REQUIRED_VALUE_OBJECT_FMT, "Status", "Task", task.getStatus(), Iterables.toString(Task.Status.ALL)));
|
assertTrue(Task.Status.ALL.contains(task.getStatus()), String.format(REQUIRED_VALUE_OBJECT_FMT, "Status", "Task", task.getStatus(), Iterables.toString(Task.Status.ALL)));
|
||||||
|
|
||||||
// Check optional fields
|
// Check optional fields
|
||||||
|
@ -228,8 +234,8 @@ public class Checks {
|
||||||
|
|
||||||
public static void checkMetadataEntry(MetadataEntry metadataEntry) {
|
public static void checkMetadataEntry(MetadataEntry metadataEntry) {
|
||||||
// Check required fields
|
// Check required fields
|
||||||
assertNotNull(metadataEntry.getKey(), String.format(NOT_NULL_OBJECT_FMT, "Key", "MetadataEntry"));
|
assertNotNull(metadataEntry.getKey(), String.format(NOT_NULL_OBJ_FIELD_FMT, "Key", "MetadataEntry"));
|
||||||
assertNotNull(metadataEntry.getValue(), String.format(NOT_NULL_OBJECT_FMT, "Value", "MetadataEntry"));
|
assertNotNull(metadataEntry.getValue(), String.format(NOT_NULL_OBJ_FIELD_FMT, "Value", "MetadataEntry"));
|
||||||
|
|
||||||
// Check parent type
|
// Check parent type
|
||||||
checkResourceType(metadataEntry);
|
checkResourceType(metadataEntry);
|
||||||
|
@ -237,7 +243,7 @@ public class Checks {
|
||||||
|
|
||||||
public static void checkMetadataValue(MetadataValue metadataValue) {
|
public static void checkMetadataValue(MetadataValue metadataValue) {
|
||||||
// Check required elements and attributes
|
// Check required elements and attributes
|
||||||
assertNotNull(metadataValue.getValue(), String.format(NOT_NULL_OBJECT_FMT, "Value", "MetadataValue"));
|
assertNotNull(metadataValue.getValue(), String.format(NOT_NULL_OBJ_FIELD_FMT, "Value", "MetadataValue"));
|
||||||
|
|
||||||
// Check parent type
|
// Check parent type
|
||||||
checkResourceType(metadataValue);
|
checkResourceType(metadataValue);
|
||||||
|
@ -249,9 +255,9 @@ public class Checks {
|
||||||
|
|
||||||
public static void checkError(Error error) {
|
public static void checkError(Error error) {
|
||||||
// Check required fields
|
// Check required fields
|
||||||
assertNotNull(error.getMessage(), String.format(NOT_NULL_OBJECT_FMT, "Message", "Error"));
|
assertNotNull(error.getMessage(), String.format(NOT_NULL_OBJ_FIELD_FMT, "Message", "Error"));
|
||||||
assertNotNull(error.getMajorErrorCode(), String.format(NOT_NULL_OBJECT_FMT, "MajorErrorCode", "Error"));
|
assertNotNull(error.getMajorErrorCode(), String.format(NOT_NULL_OBJ_FIELD_FMT, "MajorErrorCode", "Error"));
|
||||||
assertNotNull(error.getMinorErrorCode(), String.format(NOT_NULL_OBJECT_FMT, "MinorErrorCode", "Error"));
|
assertNotNull(error.getMinorErrorCode(), String.format(NOT_NULL_OBJ_FIELD_FMT, "MinorErrorCode", "Error"));
|
||||||
|
|
||||||
// NOTE vendorSpecificErrorCode cannot be checked
|
// NOTE vendorSpecificErrorCode cannot be checked
|
||||||
// NOTE stackTrace cannot be checked
|
// NOTE stackTrace cannot be checked
|
||||||
|
@ -259,7 +265,7 @@ public class Checks {
|
||||||
|
|
||||||
public static void checkOrg(Org org) {
|
public static void checkOrg(Org org) {
|
||||||
// Check required elements and attributes
|
// Check required elements and attributes
|
||||||
assertNotNull(org.getFullName(), String.format(NOT_NULL_OBJECT_FMT, "FullName", "Org"));
|
assertNotNull(org.getFullName(), String.format(NOT_NULL_OBJ_FIELD_FMT, "FullName", "Org"));
|
||||||
|
|
||||||
// Check parent type
|
// Check parent type
|
||||||
checkEntityType(org);
|
checkEntityType(org);
|
||||||
|
@ -267,7 +273,7 @@ public class Checks {
|
||||||
|
|
||||||
public static void checkAdminOrg(AdminOrg org) {
|
public static void checkAdminOrg(AdminOrg org) {
|
||||||
// required
|
// required
|
||||||
assertNotNull(org.getSettings(), String.format(NOT_NULL_OBJECT_FMT, "settings", "AdminOrg"));
|
assertNotNull(org.getSettings(), String.format(NOT_NULL_OBJ_FIELD_FMT, "settings", "AdminOrg"));
|
||||||
|
|
||||||
// optional
|
// optional
|
||||||
if (org.getGroups() != null) {
|
if (org.getGroups() != null) {
|
||||||
|
@ -405,7 +411,7 @@ public class Checks {
|
||||||
public static void checkNetworkFeatures(NetworkFeatures features) {
|
public static void checkNetworkFeatures(NetworkFeatures features) {
|
||||||
// Check optional fields
|
// Check optional fields
|
||||||
if (features.getNetworkServices() != null) {
|
if (features.getNetworkServices() != null) {
|
||||||
for (NetworkServiceType service : features.getNetworkServices()) {
|
for (NetworkServiceType<?> service : features.getNetworkServices()) {
|
||||||
checkNetworkService(service);
|
checkNetworkService(service);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -456,12 +462,14 @@ public class Checks {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkIpAddress(String ip) {
|
public static void checkIpAddress(String ip) {
|
||||||
InetAddresses.isInetAddress(ip);
|
// Check the string is a valid IP address
|
||||||
|
assertTrue(InetAddresses.isInetAddress(ip), String.format(CONDITION_FMT, "IpAddress", "a valid IP address", ip));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkMacAddress(String macAddress) {
|
private static void checkMacAddress(String macAddress) {
|
||||||
assertNotNull(macAddress, String.format(NOT_NULL_OBJECT_FMT, "macAddress", ""));
|
// Check the string is a valid MAC address
|
||||||
assertTrue(macAddress.matches("^([0-9A-F]{2}[:-]){5}([0-9A-F]{2})$"));
|
assertNotNull(macAddress, String.format(NOT_EMPTY_STRING_FMT, "macAddress"));
|
||||||
|
assertTrue(macAddress.matches(MAC_ADDRESS_PATTERN), String.format(MATCHES_STRING_FMT, "macAddress", MAC_ADDRESS_PATTERN));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkComputeCapacity(ComputeCapacity computeCapacity) {
|
public static void checkComputeCapacity(ComputeCapacity computeCapacity) {
|
||||||
|
@ -493,7 +501,6 @@ public class Checks {
|
||||||
assertNotNull(capacity.getLimit(), "The limit attribute of a CapacityWithUsage must be set");
|
assertNotNull(capacity.getLimit(), "The limit attribute of a CapacityWithUsage must be set");
|
||||||
assertTrue(capacity.getLimit() >= 0, "Limit must be greater than or equal to 0");
|
assertTrue(capacity.getLimit() >= 0, "Limit must be greater than or equal to 0");
|
||||||
|
|
||||||
|
|
||||||
// Check optional fields
|
// Check optional fields
|
||||||
if (capacity.getAllocated() != null) {
|
if (capacity.getAllocated() != null) {
|
||||||
assertTrue(capacity.getAllocated() >= 0, "allocated must be greater than or equal to 0");
|
assertTrue(capacity.getAllocated() >= 0, "allocated must be greater than or equal to 0");
|
||||||
|
@ -615,7 +622,7 @@ public class Checks {
|
||||||
|
|
||||||
public static void checkVAppTemplate(VAppTemplate template) {
|
public static void checkVAppTemplate(VAppTemplate template) {
|
||||||
// Check required fields
|
// Check required fields
|
||||||
assertNotNull(template.getName(), String.format(NOT_NULL_OBJECT_FMT, "Name", "VAppTemplate"));
|
assertNotNull(template.getName(), String.format(NOT_NULL_OBJ_FIELD_FMT, "Name", "VAppTemplate"));
|
||||||
|
|
||||||
// Check optional fields
|
// Check optional fields
|
||||||
Owner owner = template.getOwner();
|
Owner owner = template.getOwner();
|
||||||
|
@ -698,12 +705,16 @@ public class Checks {
|
||||||
// Check optional fields
|
// Check optional fields
|
||||||
VirtualSystemSettingData virtualSystem = hardware.getSystem();
|
VirtualSystemSettingData virtualSystem = hardware.getSystem();
|
||||||
if (virtualSystem != null) checkVirtualSystemSettingData(virtualSystem);
|
if (virtualSystem != null) checkVirtualSystemSettingData(virtualSystem);
|
||||||
|
if (hardware.getTransports() != null) {
|
||||||
for (String transport : hardware.getTransports()) {
|
for (String transport : hardware.getTransports()) {
|
||||||
// NOTE transport cannot be checked
|
// NOTE transport cannot be checked
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (hardware.getItems() != null) {
|
||||||
for (ResourceAllocationSettingData item : hardware.getItems()) {
|
for (ResourceAllocationSettingData item : hardware.getItems()) {
|
||||||
checkResourceAllocationSettingData(item);
|
checkResourceAllocationSettingData(item);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check parent type
|
// Check parent type
|
||||||
checkSectionType(hardware);
|
checkSectionType(hardware);
|
||||||
|
@ -810,16 +821,16 @@ public class Checks {
|
||||||
// NOTE canPublishCatalogs cannot be checked
|
// NOTE canPublishCatalogs cannot be checked
|
||||||
// NOTE useServerBootSequence cannot be checked
|
// NOTE useServerBootSequence cannot be checked
|
||||||
if (settings.getDeployedVMQuota() != null) {
|
if (settings.getDeployedVMQuota() != null) {
|
||||||
assertTrue(settings.getDeployedVMQuota() >= 0, String.format(
|
assertTrue(settings.getDeployedVMQuota() >= 0,
|
||||||
OBJ_FIELD_GTE_0, "deployedVMQuota", "port", settings.getDeployedVMQuota()));
|
String.format(OBJ_FIELD_GTE_0, "deployedVMQuota", "port", settings.getDeployedVMQuota()));
|
||||||
}
|
}
|
||||||
if (settings.getStoredVmQuota() != null) {
|
if (settings.getStoredVmQuota() != null) {
|
||||||
assertTrue(settings.getStoredVmQuota() >= 0, String.format(
|
assertTrue(settings.getStoredVmQuota() >= 0,
|
||||||
OBJ_FIELD_GTE_0, "storedVmQuota", "port", settings.getStoredVmQuota()));
|
String.format(OBJ_FIELD_GTE_0, "storedVmQuota", "port", settings.getStoredVmQuota()));
|
||||||
}
|
}
|
||||||
if (settings.getDelayAfterPowerOnSeconds() != null) {
|
if (settings.getDelayAfterPowerOnSeconds() != null) {
|
||||||
assertTrue(settings.getDelayAfterPowerOnSeconds() >= 0, String.format(
|
assertTrue(settings.getDelayAfterPowerOnSeconds() >= 0,
|
||||||
OBJ_FIELD_GTE_0, "delayAfterPowerOnSeconds", "port", settings.getDelayAfterPowerOnSeconds()));
|
String.format(OBJ_FIELD_GTE_0, "delayAfterPowerOnSeconds", "port", settings.getDelayAfterPowerOnSeconds()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// parent type
|
// parent type
|
||||||
|
@ -830,8 +841,9 @@ public class Checks {
|
||||||
// Check optional fields
|
// Check optional fields
|
||||||
// NOTE customUsersOu cannot be checked
|
// NOTE customUsersOu cannot be checked
|
||||||
if (settings.getLdapMode() != null) {
|
if (settings.getLdapMode() != null) {
|
||||||
assertTrue(LdapMode.ALL.contains(settings.getLdapMode()), String.format(REQUIRED_VALUE_OBJECT_FMT,
|
assertTrue(LdapMode.ALL.contains(settings.getLdapMode()),
|
||||||
"LdapMode", "OrdLdapSettings", settings.getLdapMode(), Iterables.toString(OrgLdapSettings.LdapMode.ALL)));
|
String.format(REQUIRED_VALUE_OBJECT_FMT, "LdapMode", "OrdLdapSettings", settings.getLdapMode(),
|
||||||
|
Iterables.toString(OrgLdapSettings.LdapMode.ALL)));
|
||||||
}
|
}
|
||||||
if (settings.getCustomOrgLdapSettings() != null) {
|
if (settings.getCustomOrgLdapSettings() != null) {
|
||||||
checkCustomOrgLdapSettings(settings.getCustomOrgLdapSettings());
|
checkCustomOrgLdapSettings(settings.getCustomOrgLdapSettings());
|
||||||
|
@ -845,16 +857,16 @@ public class Checks {
|
||||||
// required
|
// required
|
||||||
assertNotNull(settings.getHostName(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "hostName"));
|
assertNotNull(settings.getHostName(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "hostName"));
|
||||||
assertNotNull(settings.getPort(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "port"));
|
assertNotNull(settings.getPort(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "port"));
|
||||||
assertTrue(settings.getPort() >= 0, String.format(
|
assertTrue(settings.getPort() >= 0,
|
||||||
OBJ_FIELD_GTE_0, "CustomOrgLdapSettings", "port", settings.getPort()));
|
String.format(OBJ_FIELD_GTE_0, "CustomOrgLdapSettings", "port", settings.getPort()));
|
||||||
assertNotNull(settings.getAuthenticationMechanism(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "authenticationMechanism"));
|
assertNotNull(settings.getAuthenticationMechanism(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "authenticationMechanism"));
|
||||||
assertTrue(AuthenticationMechanism.ALL.contains(settings.getAuthenticationMechanism()), String.format(REQUIRED_VALUE_OBJECT_FMT,
|
assertTrue(AuthenticationMechanism.ALL.contains(settings.getAuthenticationMechanism()),
|
||||||
"AuthenticationMechanism", "CustomOrdLdapSettings", settings.getAuthenticationMechanism(),
|
String.format(REQUIRED_VALUE_OBJECT_FMT, "AuthenticationMechanism", "CustomOrdLdapSettings", settings.getAuthenticationMechanism(),
|
||||||
Iterables.toString(CustomOrgLdapSettings.AuthenticationMechanism.ALL)));
|
Iterables.toString(CustomOrgLdapSettings.AuthenticationMechanism.ALL)));
|
||||||
assertNotNull(settings.isGroupSearchBaseEnabled(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "isGroupSearchBaseEnabled"));
|
assertNotNull(settings.isGroupSearchBaseEnabled(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "isGroupSearchBaseEnabled"));
|
||||||
assertNotNull(settings.getConnectorType(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "connectorType"));
|
assertNotNull(settings.getConnectorType(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "connectorType"));
|
||||||
assertTrue(ConnectorType.ALL.contains(settings.getConnectorType()), String.format(REQUIRED_VALUE_OBJECT_FMT,
|
assertTrue(ConnectorType.ALL.contains(settings.getConnectorType()),
|
||||||
"ConnectorType", "CustomOrdLdapSettings", settings.getConnectorType(),
|
String.format(REQUIRED_VALUE_OBJECT_FMT, "ConnectorType", "CustomOrdLdapSettings", settings.getConnectorType(),
|
||||||
Iterables.toString(CustomOrgLdapSettings.ConnectorType.ALL)));
|
Iterables.toString(CustomOrgLdapSettings.ConnectorType.ALL)));
|
||||||
assertNotNull(settings.getUserAttributes(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "userAttributes"));
|
assertNotNull(settings.getUserAttributes(), String.format(OBJ_FIELD_REQ, "CustomOrgLdapSettings", "userAttributes"));
|
||||||
checkUserAttributes("CustomOrdLdapSettings", settings.getUserAttributes());
|
checkUserAttributes("CustomOrdLdapSettings", settings.getUserAttributes());
|
||||||
|
@ -901,13 +913,16 @@ public class Checks {
|
||||||
|
|
||||||
public static void checkPasswordPolicySettings(OrgPasswordPolicySettings settings) {
|
public static void checkPasswordPolicySettings(OrgPasswordPolicySettings settings) {
|
||||||
// required
|
// required
|
||||||
assertNotNull(settings.isAccountLockoutEnabled(), String.format(OBJ_FIELD_REQ, "OrgPasswordPolicySettings", "isAccountLockoutEnabled"));
|
assertNotNull(settings.isAccountLockoutEnabled(),
|
||||||
assertNotNull(settings.getInvalidLoginsBeforeLockout(), String.format(OBJ_FIELD_REQ, "OrgPasswordPolicySettings", "invalidLoginsBeforeLockout"));
|
String.format(OBJ_FIELD_REQ, "OrgPasswordPolicySettings", "isAccountLockoutEnabled"));
|
||||||
assertTrue(settings.getInvalidLoginsBeforeLockout() >= 0, String.format(
|
assertNotNull(settings.getInvalidLoginsBeforeLockout(),
|
||||||
OBJ_FIELD_GTE_0, "OrgPasswordPolicySettings", "storageLeaseSeconds", settings.getInvalidLoginsBeforeLockout()));
|
String.format(OBJ_FIELD_REQ, "OrgPasswordPolicySettings", "invalidLoginsBeforeLockout"));
|
||||||
assertNotNull(settings.getAccountLockoutIntervalMinutes(), String.format(OBJ_FIELD_REQ, "OrgPasswordPolicySettings", "accountLockoutIntervalMinutes"));
|
assertTrue(settings.getInvalidLoginsBeforeLockout() >= 0,
|
||||||
assertTrue(settings.getAccountLockoutIntervalMinutes() >= 0, String.format(
|
String.format(OBJ_FIELD_GTE_0, "OrgPasswordPolicySettings", "storageLeaseSeconds", settings.getInvalidLoginsBeforeLockout()));
|
||||||
OBJ_FIELD_GTE_0, "OrgPasswordPolicySettings", "accountLockoutIntervalMinutes", settings.getAccountLockoutIntervalMinutes()));
|
assertNotNull(settings.getAccountLockoutIntervalMinutes(),
|
||||||
|
String.format(OBJ_FIELD_REQ, "OrgPasswordPolicySettings", "accountLockoutIntervalMinutes"));
|
||||||
|
assertTrue(settings.getAccountLockoutIntervalMinutes() >= 0,
|
||||||
|
String.format(OBJ_FIELD_GTE_0, "OrgPasswordPolicySettings", "accountLockoutIntervalMinutes", settings.getAccountLockoutIntervalMinutes()));
|
||||||
|
|
||||||
// parent type
|
// parent type
|
||||||
checkResourceType(settings);
|
checkResourceType(settings);
|
||||||
|
@ -917,12 +932,12 @@ public class Checks {
|
||||||
// Check optional fields
|
// Check optional fields
|
||||||
// NOTE deleteOnStorageLeaseExpiration cannot be checked
|
// NOTE deleteOnStorageLeaseExpiration cannot be checked
|
||||||
if (settings.getStorageLeaseSeconds() != null) {
|
if (settings.getStorageLeaseSeconds() != null) {
|
||||||
assertTrue(settings.getStorageLeaseSeconds() >= 0, String.format(
|
assertTrue(settings.getStorageLeaseSeconds() >= 0,
|
||||||
OBJ_FIELD_GTE_0, "OrgLeaseSettings", "storageLeaseSeconds", settings.getStorageLeaseSeconds()));
|
String.format(OBJ_FIELD_GTE_0, "OrgLeaseSettings", "storageLeaseSeconds", settings.getStorageLeaseSeconds()));
|
||||||
}
|
}
|
||||||
if (settings.getDeploymentLeaseSeconds() != null) {
|
if (settings.getDeploymentLeaseSeconds() != null) {
|
||||||
assertTrue(settings.getDeploymentLeaseSeconds() >= 0, String.format(
|
assertTrue(settings.getDeploymentLeaseSeconds() >= 0,
|
||||||
OBJ_FIELD_GTE_0, "OrgLeaseSettings", "deploymentLeaseSeconds", settings.getDeploymentLeaseSeconds()));
|
String.format(OBJ_FIELD_GTE_0, "OrgLeaseSettings", "deploymentLeaseSeconds", settings.getDeploymentLeaseSeconds()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// parent type
|
// parent type
|
||||||
|
@ -933,8 +948,8 @@ public class Checks {
|
||||||
// Check optional fields
|
// Check optional fields
|
||||||
// NOTE deleteOnStorageLeaseExpiration cannot be checked
|
// NOTE deleteOnStorageLeaseExpiration cannot be checked
|
||||||
if (settings.getStorageLeaseSeconds() != null) {
|
if (settings.getStorageLeaseSeconds() != null) {
|
||||||
assertTrue(settings.getStorageLeaseSeconds() >= 0, String.format(
|
assertTrue(settings.getStorageLeaseSeconds() >= 0,
|
||||||
OBJ_FIELD_GTE_0, "OrgVAppTemplateLeaseSettings", "storageLeaseSeconds", settings.getStorageLeaseSeconds()));
|
String.format(OBJ_FIELD_GTE_0, "OrgVAppTemplateLeaseSettings", "storageLeaseSeconds", settings.getStorageLeaseSeconds()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// parent type
|
// parent type
|
||||||
|
@ -965,12 +980,12 @@ public class Checks {
|
||||||
checkEmailAddress(user.getAlertEmail());
|
checkEmailAddress(user.getAlertEmail());
|
||||||
}
|
}
|
||||||
if (user.getStoredVmQuota() != null) {
|
if (user.getStoredVmQuota() != null) {
|
||||||
assertTrue(user.getStoredVmQuota() >= 0, String.format(OBJ_FIELD_GTE_0,
|
assertTrue(user.getStoredVmQuota() >= 0,
|
||||||
"User", "storedVmQuota", user.getStoredVmQuota()));
|
String.format(OBJ_FIELD_GTE_0, "User", "storedVmQuota", user.getStoredVmQuota()));
|
||||||
}
|
}
|
||||||
if (user.getDeployedVmQuota() != null) {
|
if (user.getDeployedVmQuota() != null) {
|
||||||
assertTrue(user.getDeployedVmQuota() >= 0, String.format(OBJ_FIELD_GTE_0,
|
assertTrue(user.getDeployedVmQuota() >= 0,
|
||||||
"User", "deployedVmQuota", user.getDeployedVmQuota()));
|
String.format(OBJ_FIELD_GTE_0, "User", "deployedVmQuota", user.getDeployedVmQuota()));
|
||||||
}
|
}
|
||||||
if (user.getRole() != null) {
|
if (user.getRole() != null) {
|
||||||
checkReferenceType(user.getRole());
|
checkReferenceType(user.getRole());
|
||||||
|
@ -986,99 +1001,174 @@ public class Checks {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkTelephone(String number) {
|
public static void checkTelephone(String number) {
|
||||||
// TODO: regex validate telephone
|
// TODO regex validate telephone
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkCustomizationSection(CustomizationSection val) {
|
public static void checkScreenTicket(ScreenTicket ticket) {
|
||||||
assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "CustomizationSection", ""));
|
// NOTE the value field cannot be checked
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void checkCustomizationSection(CustomizationSection section) {
|
||||||
|
assertNotNull(section, String.format(NOT_NULL_OBJ_FMT, "CustomizationSection"));
|
||||||
|
|
||||||
// Check optional fields
|
// Check optional fields
|
||||||
if (val.getLinks() != null) {
|
if (section.getLinks() != null) {
|
||||||
for (Link link : val.getLinks()) {
|
for (Link link : section.getLinks()) {
|
||||||
checkLink(link);
|
checkLink(link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (val.getType() != null) {
|
if (section.getType() != null) checkType(section.getType());
|
||||||
checkType(val.getType());
|
if (section.getHref() != null) checkHref(section.getHref());
|
||||||
}
|
|
||||||
if (val.getHref() != null) {
|
// Check parent type
|
||||||
checkHref(val.getHref());
|
checkOvfSectionType(section);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkOvfSectionType(val);
|
public static void checkProductSectionList(ProductSectionList sections) {
|
||||||
}
|
assertNotNull(sections, String.format(NOT_NULL_OBJ_FMT, "ProductSectionList"));
|
||||||
|
|
||||||
public static void checkProductSectionList(ProductSectionList val) {
|
for (ProductSection productSection : sections) {
|
||||||
assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "ProductSectionList", ""));
|
|
||||||
|
|
||||||
for (ProductSection productSection : val) {
|
|
||||||
checkOvfProductSection(productSection);
|
checkOvfProductSection(productSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkResourceType(val);
|
// Check parent type
|
||||||
|
checkResourceType(sections);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkGuestCustomizationSection(GuestCustomizationSection val) {
|
public static void checkGuestCustomizationSection(GuestCustomizationSection section) {
|
||||||
assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "GuestCustomizationSection", ""));
|
assertNotNull(section, String.format(NOT_NULL_OBJ_FMT, "NetworkConfigSection"));
|
||||||
|
|
||||||
if (!val.isJoinDomainEnabled()) {
|
|
||||||
assertFalse(val.isUseOrgSettings());
|
if (!section.isJoinDomainEnabled()) {
|
||||||
assertNull(val.getDomainName());
|
assertFalse(section.isUseOrgSettings());
|
||||||
assertNull(val.getDomainUserName());
|
assertNull(section.getDomainName());
|
||||||
assertNull(val.getDomainUserPassword());
|
assertNull(section.getDomainUserName());
|
||||||
|
assertNull(section.getDomainUserPassword());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!val.isAdminPasswordEnabled()) {
|
if (!section.isAdminPasswordEnabled()) {
|
||||||
assertFalse(val.isAdminPasswordAuto());
|
assertFalse(section.isAdminPasswordAuto());
|
||||||
assertFalse(val.isResetPasswordRequired());
|
assertFalse(section.isResetPasswordRequired());
|
||||||
if (val.isAdminPasswordAuto()) {
|
if (section.isAdminPasswordAuto()) {
|
||||||
assertNull(val.getAdminPassword());
|
assertNull(section.getAdminPassword());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkOvfSectionType(val);
|
// Check parent type
|
||||||
|
checkOvfSectionType(section);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkLeaseSettingsSection(LeaseSettingsSection val) {
|
public static void checkLeaseSettingsSection(LeaseSettingsSection section) {
|
||||||
if (val.getLinks() != null) {
|
assertNotNull(section, String.format(NOT_NULL_OBJ_FMT, "LeaseSettingsSection"));
|
||||||
for (Link link : val.getLinks()) {
|
|
||||||
|
if (section.getLinks() != null) {
|
||||||
|
for (Link link : section.getLinks()) {
|
||||||
checkLink(link);
|
checkLink(link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkOvfSectionType(val);
|
// Check parent type
|
||||||
|
checkOvfSectionType(section);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkNetworkConfigSection(NetworkConfigSection val) {
|
public static void checkNetworkConfigSection(NetworkConfigSection section) {
|
||||||
if (val.getNetworkConfigs() != null) {
|
assertNotNull(section, String.format(NOT_NULL_OBJ_FMT, "NetworkConfigSection"));
|
||||||
for (VAppNetworkConfiguration networkConfig : val.getNetworkConfigs()) {
|
|
||||||
|
if (section.getNetworkConfigs() != null) {
|
||||||
|
for (VAppNetworkConfiguration networkConfig : section.getNetworkConfigs()) {
|
||||||
checkVAppNetworkConfig(networkConfig);
|
checkVAppNetworkConfig(networkConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (val.getLinks() != null) {
|
if (section.getLinks() != null) {
|
||||||
for (Link link : val.getLinks()) {
|
for (Link link : section.getLinks()) {
|
||||||
checkLink(link);
|
checkLink(link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (val.getHref() != null) {
|
if (section.getHref() != null) {
|
||||||
checkHref(val.getHref());
|
checkHref(section.getHref());
|
||||||
}
|
}
|
||||||
|
|
||||||
checkOvfSectionType(val);
|
// Check parent type
|
||||||
|
checkOvfSectionType(section);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void checkNetworkSection(NetworkSection section) {
|
||||||
|
assertNotNull(section, String.format(NOT_NULL_OBJ_FMT, "NetworkSection"));
|
||||||
|
|
||||||
|
// Check optional fields
|
||||||
|
if (section.getNetworks() != null) {
|
||||||
|
for (Network network : section.getNetworks()) {
|
||||||
|
checkNetwork(network);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check parent type
|
||||||
|
checkOvfSectionType(section);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void checkNetwork(Network network) {
|
||||||
|
assertNotNull(network, String.format(NOT_NULL_OBJ_FMT, "Network"));
|
||||||
|
|
||||||
|
// Check optional fields
|
||||||
|
// NOTE name field cannot be checked
|
||||||
|
// NOTE description field cannot be checked
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void checkOperatingSystemSection(OperatingSystemSection section) {
|
||||||
|
assertNotNull(section, String.format(NOT_NULL_OBJ_FMT, "OperatingSystemSection"));
|
||||||
|
|
||||||
|
// Check optional fields
|
||||||
|
// NOTE id field cannot be checked
|
||||||
|
// NOTE version field cannot be checked
|
||||||
|
// NOTE description field cannot be checked
|
||||||
|
|
||||||
|
// Check parent type
|
||||||
|
checkOvfSectionType(section);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void checkRuntimeInfoSection(RuntimeInfoSection section) {
|
||||||
|
assertNotNull(section, String.format(NOT_NULL_OBJ_FMT, "RuntimeInfoSection"));
|
||||||
|
|
||||||
|
// Check optional fields
|
||||||
|
VMWareTools tools = section.getVMWareTools();
|
||||||
|
if (tools != null) checkVMWareTools(tools);
|
||||||
|
|
||||||
|
// NOTE does this mean anything?
|
||||||
|
for (Object any : section.getAny()) {
|
||||||
|
assertNotNull(any);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check parent type
|
||||||
|
checkOvfSectionType(section);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void checkVMWareTools(VMWareTools tools) {
|
||||||
|
assertNotNull(tools, String.format(NOT_NULL_OBJ_FMT, "VMWareTools"));
|
||||||
|
|
||||||
|
// Check required fields
|
||||||
|
assertNotNull(tools.getVersion(), String.format(NOT_NULL_OBJ_FIELD_FMT, "version", "VMWareTools"));
|
||||||
|
assertFalse(tools.getVersion().isEmpty(), String.format(NOT_EMPTY_STRING_FMT, "VMWareTools.version"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void checkStartupSection(StartupSection section) {
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
// Check parent type
|
||||||
|
checkOvfSectionType(section);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkVAppNetworkConfig(VAppNetworkConfiguration val) {
|
private static void checkVAppNetworkConfig(VAppNetworkConfiguration val) {
|
||||||
assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "VAppNetworkConfiguration", ""));
|
assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "VAppNetworkConfiguration"));
|
||||||
|
|
||||||
// required fields
|
// required fields
|
||||||
assertNotNull(val.getNetworkName(), String.format(NOT_NULL_OBJECT_FMT, "NetworkName", "VAppNetworkConfiguration"));
|
assertNotNull(val.getNetworkName(), String.format(NOT_NULL_OBJ_FIELD_FMT, "NetworkName", "VAppNetworkConfiguration"));
|
||||||
checkNetworkConfiguration(val.getConfiguration());
|
checkNetworkConfiguration(val.getConfiguration());
|
||||||
|
|
||||||
checkResourceType(val);
|
checkResourceType(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkNetworkConnectionSection(NetworkConnectionSection val) {
|
public static void checkNetworkConnectionSection(NetworkConnectionSection val) {
|
||||||
assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "VAppConnectionSection", ""));
|
assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "VAppConnectionSection"));
|
||||||
|
|
||||||
// Check optional fields
|
// Check optional fields
|
||||||
if (val.getLinks() != null) {
|
if (val.getLinks() != null) {
|
||||||
|
@ -1102,11 +1192,11 @@ public class Checks {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkNetworkConnection(NetworkConnection val) {
|
private static void checkNetworkConnection(NetworkConnection val) {
|
||||||
assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "NetworkConnection", ""));
|
assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "NetworkConnection"));
|
||||||
|
|
||||||
// Check required fields
|
// Check required fields
|
||||||
assertNotNull(val.getNetwork(), String.format(NOT_NULL_OBJECT_FMT, "Network", "NetworkConnection"));
|
assertNotNull(val.getNetwork(), String.format(NOT_NULL_OBJ_FIELD_FMT, "Network", "NetworkConnection"));
|
||||||
assertNotNull(val.getIpAddressAllocationMode(), String.format(NOT_NULL_OBJECT_FMT, "IpAddressAllocationMode", "NetworkConnection"));
|
assertNotNull(val.getIpAddressAllocationMode(), String.format(NOT_NULL_OBJ_FIELD_FMT, "IpAddressAllocationMode", "NetworkConnection"));
|
||||||
IpAddressAllocationMode mode = NetworkConnection.IpAddressAllocationMode.valueOf(val.getIpAddressAllocationMode());
|
IpAddressAllocationMode mode = NetworkConnection.IpAddressAllocationMode.valueOf(val.getIpAddressAllocationMode());
|
||||||
assertTrue(NetworkConnection.IpAddressAllocationMode.ALL.contains(mode),
|
assertTrue(NetworkConnection.IpAddressAllocationMode.ALL.contains(mode),
|
||||||
String.format(REQUIRED_VALUE_OBJECT_FMT, "IpAddressAllocationMode", "NetworkConnection", val.getIpAddressAllocationMode(), Iterables.toString(NetworkConnection.IpAddressAllocationMode.ALL)));
|
String.format(REQUIRED_VALUE_OBJECT_FMT, "IpAddressAllocationMode", "NetworkConnection", val.getIpAddressAllocationMode(), Iterables.toString(NetworkConnection.IpAddressAllocationMode.ALL)));
|
||||||
|
@ -1122,17 +1212,28 @@ public class Checks {
|
||||||
if (val.getMACAddress() != null) {
|
if (val.getMACAddress() != null) {
|
||||||
checkMacAddress(val.getMACAddress());
|
checkMacAddress(val.getMACAddress());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME Missing?
|
public static void checkRASD(RASD rasd) {
|
||||||
//val.getVCloudExtension();
|
// Check fields
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void checkRasdItemsList(RasdItemsList items) {
|
||||||
|
// Check fields
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
for (RASD item : items.getItems()) {
|
||||||
|
checkRASD(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkOvfSectionType(SectionType section) {
|
public static void checkOvfSectionType(SectionType section) {
|
||||||
assertNotNull(section, String.format(NOT_NULL_OBJECT_FMT, "SectionType", ""));
|
assertNotNull(section, String.format(NOT_NULL_OBJ_FMT, "SectionType"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkOvfProductSection(ProductSection val) {
|
public static void checkOvfProductSection(ProductSection val) {
|
||||||
assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "ProductSection", ""));
|
assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "ProductSection"));
|
||||||
|
|
||||||
if (val.getProperties() != null) {
|
if (val.getProperties() != null) {
|
||||||
for (org.jclouds.vcloud.director.v1_5.domain.ovf.Property property : val.getProperties()) {
|
for (org.jclouds.vcloud.director.v1_5.domain.ovf.Property property : val.getProperties()) {
|
||||||
|
@ -1140,15 +1241,16 @@ public class Checks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check parent type
|
||||||
checkOvfSectionType(val);
|
checkOvfSectionType(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkOvfProperty(org.jclouds.vcloud.director.v1_5.domain.ovf.Property val) {
|
private static void checkOvfProperty(org.jclouds.vcloud.director.v1_5.domain.ovf.Property val) {
|
||||||
assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "Property", ""));
|
assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "Property"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkOvfNetworkSection(NetworkSection val) {
|
public static void checkOvfNetworkSection(NetworkSection val) {
|
||||||
assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "NetworkSection", ""));
|
assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "NetworkSection"));
|
||||||
|
|
||||||
if (val.getNetworks() != null) {
|
if (val.getNetworks() != null) {
|
||||||
for (Network network : val.getNetworks()) {
|
for (Network network : val.getNetworks()) {
|
||||||
|
@ -1160,11 +1262,11 @@ public class Checks {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkOvfNetwork(Network val) {
|
private static void checkOvfNetwork(Network val) {
|
||||||
assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "Network", ""));
|
assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "Network"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkOvfEnvelope(Envelope val) {
|
public static void checkOvfEnvelope(Envelope val) {
|
||||||
assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "Envelope", ""));
|
assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "Envelope"));
|
||||||
|
|
||||||
if (val.getDiskSections() != null) {
|
if (val.getDiskSections() != null) {
|
||||||
for (DiskSection diskSection : val.getDiskSections()) {
|
for (DiskSection diskSection : val.getDiskSections()) {
|
||||||
|
@ -1182,7 +1284,7 @@ public class Checks {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkOvfVirtualSystem(VirtualSystem val) {
|
private static void checkOvfVirtualSystem(VirtualSystem val) {
|
||||||
assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "VirtualSystem", ""));
|
assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "VirtualSystem"));
|
||||||
|
|
||||||
if (val.getProductSections() != null) {
|
if (val.getProductSections() != null) {
|
||||||
for (ProductSection productSection : val.getProductSections()) {
|
for (ProductSection productSection : val.getProductSections()) {
|
||||||
|
@ -1199,47 +1301,54 @@ public class Checks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkOvfDiskSection(DiskSection val) {
|
private static void checkOvfDiskSection(DiskSection section) {
|
||||||
assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "DiskSection", ""));
|
assertNotNull(section, String.format(NOT_NULL_OBJ_FMT, "DiskSection"));
|
||||||
|
|
||||||
if (val.getDisks() != null) {
|
if (section.getDisks() != null) {
|
||||||
for (Disk disk : val.getDisks()) {
|
for (Disk disk : section.getDisks()) {
|
||||||
checkOvfDisk(disk);
|
checkOvfDisk(disk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check parent type
|
||||||
|
checkOvfSectionType(section);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkOvfDisk(Disk val) {
|
private static void checkOvfDisk(Disk disk) {
|
||||||
assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "Disk", ""));
|
assertNotNull(disk, String.format(NOT_NULL_OBJ_FMT, "Disk"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkOvfOperationSystemSection(OperatingSystemSection val) {
|
private static void checkOvfOperationSystemSection(OperatingSystemSection section) {
|
||||||
checkOvfSectionType(val);
|
assertNotNull(section, String.format(NOT_NULL_OBJ_FMT, "OperatingSystemSection"));
|
||||||
|
|
||||||
|
// Check parent type
|
||||||
|
checkOvfSectionType(section);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkOvfVirtualHardwareSection(VirtualHardwareSection val) {
|
private static void checkOvfVirtualHardwareSection(VirtualHardwareSection section) {
|
||||||
assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "VirtualHardwareSection", ""));
|
assertNotNull(section, String.format(NOT_NULL_OBJ_FMT, "VirtualHardwareSection"));
|
||||||
|
|
||||||
if (val.getItems() != null) {
|
if (section.getItems() != null) {
|
||||||
for (ResourceAllocationSettingData item : val.getItems()) {
|
for (ResourceAllocationSettingData item : section.getItems()) {
|
||||||
checkCimResourceAllocationSettingData(item);
|
checkCimResourceAllocationSettingData(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (val.getSystem() != null) {
|
if (section.getSystem() != null) {
|
||||||
checkCimVirtualSystemSettingData(val.getSystem());
|
checkCimVirtualSystemSettingData(section.getSystem());
|
||||||
}
|
}
|
||||||
|
|
||||||
checkOvfSectionType(val);
|
// Check parent type
|
||||||
|
checkOvfSectionType(section);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkCimVirtualSystemSettingData(VirtualSystemSettingData val) {
|
private static void checkCimVirtualSystemSettingData(VirtualSystemSettingData val) {
|
||||||
// TODO Could do more assertions...
|
// TODO Could do more assertions...
|
||||||
assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "VirtualSystemSettingData", ""));
|
assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "VirtualSystemSettingData"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkCimResourceAllocationSettingData(ResourceAllocationSettingData val) {
|
private static void checkCimResourceAllocationSettingData(ResourceAllocationSettingData val) {
|
||||||
// TODO Could do more assertions...
|
// TODO Could do more assertions...
|
||||||
assertNotNull(val, String.format(NOT_NULL_OBJECT_FMT, "ResouorceAllocatoinSettingData", ""));
|
assertNotNull(val, String.format(NOT_NULL_OBJ_FMT, "ResouorceAllocatoinSettingData"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkAdminVdc(AdminVdc vdc) {
|
public static void checkAdminVdc(AdminVdc vdc) {
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
package org.jclouds.vcloud.director.v1_5.features;
|
package org.jclouds.vcloud.director.v1_5.features;
|
||||||
|
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.CONDITION_FMT;
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.CONDITION_FMT;
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.ENTITY_CONDITION;
|
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.ENTITY_EQUAL;
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.ENTITY_EQUAL;
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.ENTITY_NON_NULL;
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.ENTITY_NON_NULL;
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_EQ;
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_EQ;
|
||||||
|
@ -29,10 +28,20 @@ import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.MEDIA;
|
||||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkControlAccessParams;
|
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkControlAccessParams;
|
||||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkGuestCustomizationSection;
|
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkGuestCustomizationSection;
|
||||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkLeaseSettingsSection;
|
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkLeaseSettingsSection;
|
||||||
|
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadataFor;
|
||||||
|
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadataKeyAbsentFor;
|
||||||
|
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadataValueFor;
|
||||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkNetworkConfigSection;
|
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkNetworkConfigSection;
|
||||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkNetworkConnectionSection;
|
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkNetworkConnectionSection;
|
||||||
|
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkNetworkSection;
|
||||||
|
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkOperatingSystemSection;
|
||||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkOwner;
|
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkOwner;
|
||||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkProductSectionList;
|
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkProductSectionList;
|
||||||
|
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkRASD;
|
||||||
|
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkRasdItemsList;
|
||||||
|
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkRuntimeInfoSection;
|
||||||
|
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkScreenTicket;
|
||||||
|
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkStartupSection;
|
||||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkVApp;
|
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkVApp;
|
||||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkVirtualHardwareSection;
|
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkVirtualHardwareSection;
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
@ -74,6 +83,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.RelocateParams;
|
import org.jclouds.vcloud.director.v1_5.domain.RelocateParams;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status;
|
import org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.RuntimeInfoSection;
|
import org.jclouds.vcloud.director.v1_5.domain.RuntimeInfoSection;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.domain.ScreenTicket;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.UndeployVAppParams;
|
import org.jclouds.vcloud.director.v1_5.domain.UndeployVAppParams;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.VApp;
|
import org.jclouds.vcloud.director.v1_5.domain.VApp;
|
||||||
|
@ -86,6 +96,8 @@ import org.jclouds.vcloud.director.v1_5.domain.ovf.OperatingSystemSection;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.ovf.RASD;
|
import org.jclouds.vcloud.director.v1_5.domain.ovf.RASD;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.ovf.StartupSection;
|
import org.jclouds.vcloud.director.v1_5.domain.ovf.StartupSection;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection;
|
import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecordType;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords;
|
||||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
|
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
|
||||||
import org.jclouds.vcloud.director.v1_5.predicates.ReferenceTypePredicates;
|
import org.jclouds.vcloud.director.v1_5.predicates.ReferenceTypePredicates;
|
||||||
import org.jclouds.xml.internal.JAXBParser;
|
import org.jclouds.xml.internal.JAXBParser;
|
||||||
|
@ -101,7 +113,6 @@ import com.google.common.base.Throwables;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code VAppClient}
|
* Tests behavior of {@code VAppClient}
|
||||||
|
@ -130,8 +141,6 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
* Objects shared between tests.
|
* Objects shared between tests.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private JAXBParser parser;
|
|
||||||
|
|
||||||
private Vdc vdc;
|
private Vdc vdc;
|
||||||
private VApp vApp;
|
private VApp vApp;
|
||||||
private VAppTemplate vAppTemplate;
|
private VAppTemplate vAppTemplate;
|
||||||
|
@ -147,8 +156,6 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
vAppTemplateClient = context.getApi().getVAppTemplateClient();
|
vAppTemplateClient = context.getApi().getVAppTemplateClient();
|
||||||
vdcClient = context.getApi().getVdcClient();
|
vdcClient = context.getApi().getVdcClient();
|
||||||
metadataClient = vAppClient.getMetadataClient();
|
metadataClient = vAppClient.getMetadataClient();
|
||||||
|
|
||||||
parser = new JAXBParser();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeClass(inheritGroups = true)
|
@BeforeClass(inheritGroups = true)
|
||||||
|
@ -159,34 +166,7 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
vAppTemplate = vAppTemplateClient.getVAppTemplate(vAppTemplateURI);
|
vAppTemplate = vAppTemplateClient.getVAppTemplate(vAppTemplateURI);
|
||||||
assertNotNull(vAppTemplate, String.format(ENTITY_NON_NULL, VAPP_TEMPLATE));
|
assertNotNull(vAppTemplate, String.format(ENTITY_NON_NULL, VAPP_TEMPLATE));
|
||||||
|
|
||||||
// Delete the test-vapp VApp if present
|
cleanUp();
|
||||||
Iterable<Reference> vApps = Iterables.filter(
|
|
||||||
vdc.getResourceEntities().getResourceEntities(),
|
|
||||||
Predicates.and(
|
|
||||||
ReferenceTypePredicates.<Reference>typeEquals(VCloudDirectorMediaType.VAPP),
|
|
||||||
Predicates.or(
|
|
||||||
ReferenceTypePredicates.<Reference>nameEquals("test-vapp"),
|
|
||||||
ReferenceTypePredicates.<Reference>nameEquals("new-name")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if (vApps != null && !Iterables.isEmpty(vApps)) {
|
|
||||||
for (Reference each : vApps) {
|
|
||||||
VApp found = vAppClient.getVApp(each.getHref());
|
|
||||||
// debug(found);
|
|
||||||
if (found.getStatus().equals(Status.POWERED_ON.getValue())) {
|
|
||||||
Task shutdownTask = vAppClient.shutdown(found.getHref());
|
|
||||||
retryTaskSuccess.apply(shutdownTask);
|
|
||||||
}
|
|
||||||
if (found.isDeployed()) {
|
|
||||||
UndeployVAppParams params = UndeployVAppParams.builder().build();
|
|
||||||
Task undeployTask = vAppClient.undeploy(vApp.getHref(), params);
|
|
||||||
retryTaskSuccess.apply(undeployTask);
|
|
||||||
}
|
|
||||||
Task deleteTask = vAppClient.deleteVApp(found.getHref());
|
|
||||||
retryTaskSuccess.apply(deleteTask);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -208,7 +188,11 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
|
|
||||||
// Check the required fields are set
|
// Check the required fields are set
|
||||||
assertEquals(vApp.isDeployed(), Boolean.FALSE, String.format(OBJ_FIELD_EQ, VAPP, "deployed", "FALSE", vApp.isDeployed().toString()));
|
assertEquals(vApp.isDeployed(), Boolean.FALSE, String.format(OBJ_FIELD_EQ, VAPP, "deployed", "FALSE", vApp.isDeployed().toString()));
|
||||||
// TODO others
|
assertEquals(vApp.getName(), "test-vapp", String.format(OBJ_FIELD_EQ, VAPP, "name", "test-vapp", vApp.getName()));
|
||||||
|
assertEquals(vApp.getDescription(), "Test VApp", String.format(OBJ_FIELD_EQ, VAPP, "Description", "Test VApp", vApp.getDescription()));
|
||||||
|
|
||||||
|
// TODO instantiationParams instantiationParams()
|
||||||
|
// TODO source.href vAppTemplateURI
|
||||||
|
|
||||||
// Check status
|
// Check status
|
||||||
Status poweredOffStatus = Status.POWERED_OFF;
|
Status poweredOffStatus = Status.POWERED_OFF;
|
||||||
|
@ -220,10 +204,7 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
*/
|
*/
|
||||||
@Test(testName = "PUT /vApp/{id}", dependsOnMethods = { "testGetVApp" })
|
@Test(testName = "PUT /vApp/{id}", dependsOnMethods = { "testGetVApp" })
|
||||||
public void testModifyVApp() {
|
public void testModifyVApp() {
|
||||||
VApp newVApp = VApp.builder()
|
VApp newVApp = VApp.builder().name("new-name").description("New Description").build();
|
||||||
.name("new-name")
|
|
||||||
.description("New Description")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
// The method under test
|
// The method under test
|
||||||
Task modifyVApp = vAppClient.modifyVApp(vApp.getHref(), newVApp);
|
Task modifyVApp = vAppClient.modifyVApp(vApp.getHref(), newVApp);
|
||||||
|
@ -284,8 +265,8 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
vApp = vAppClient.getVApp(vApp.getHref());
|
vApp = vAppClient.getVApp(vApp.getHref());
|
||||||
|
|
||||||
// Check status
|
// Check status
|
||||||
Status poweredOnStatus = Status.POWERED_ON;
|
Status poweredOffStatus = Status.POWERED_OFF;
|
||||||
assertEquals(vApp.getStatus(), poweredOnStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOnStatus.toString(), Status.fromValue(vApp.getStatus()).toString()));
|
assertEquals(vApp.getStatus(), poweredOffStatus.getValue(), String.format(OBJ_FIELD_EQ, VAPP, "status", poweredOffStatus.toString(), Status.fromValue(vApp.getStatus()).toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "POST /vApp/{id}/power/action/shutdown", dependsOnMethods = { "testReboot" })
|
@Test(testName = "POST /vApp/{id}/power/action/shutdown", dependsOnMethods = { "testReboot" })
|
||||||
|
@ -381,7 +362,10 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
|
|
||||||
// The method under test
|
// The method under test
|
||||||
ControlAccessParams modified = vAppClient.controlAccess(vApp.getHref(), params);
|
ControlAccessParams modified = vAppClient.controlAccess(vApp.getHref(), params);
|
||||||
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
checkControlAccessParams(modified);
|
checkControlAccessParams(modified);
|
||||||
|
// Check the required fields are set
|
||||||
assertEquals(modified, params, String.format(ENTITY_EQUAL, "ControlAccessParams"));
|
assertEquals(modified, params, String.format(ENTITY_EQUAL, "ControlAccessParams"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,7 +378,11 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
|
|
||||||
// The method under test
|
// The method under test
|
||||||
ControlAccessParams modified = vAppClient.controlAccess(vApp.getHref(), params);
|
ControlAccessParams modified = vAppClient.controlAccess(vApp.getHref(), params);
|
||||||
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
checkControlAccessParams(modified);
|
checkControlAccessParams(modified);
|
||||||
|
|
||||||
|
// Check entities are equal
|
||||||
assertEquals(modified, params, String.format(ENTITY_EQUAL, "ControlAccessParams"));
|
assertEquals(modified, params, String.format(ENTITY_EQUAL, "ControlAccessParams"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -435,18 +423,20 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
// contentLength=0, contentMD5=null, contentType=application/vnd.vmware.vcloud.recomposeVAppParams+xml], written=false]]: Could not marshall object"
|
// contentLength=0, contentMD5=null, contentType=application/vnd.vmware.vcloud.recomposeVAppParams+xml], written=false]]: Could not marshall object"
|
||||||
@Test(testName = "POST /vApp/{id}/action/recomposeVApp", dependsOnMethods = { "testGetVApp" })
|
@Test(testName = "POST /vApp/{id}/action/recomposeVApp", dependsOnMethods = { "testGetVApp" })
|
||||||
public void testRecomposeVApp() {
|
public void testRecomposeVApp() {
|
||||||
RecomposeVAppParams params = RecomposeVAppParams.builder()
|
RecomposeVAppParams params = RecomposeVAppParams.builder().build();
|
||||||
.build();
|
|
||||||
|
|
||||||
// The method under test
|
// The method under test
|
||||||
Task recomposeVApp = vAppClient.recomposeVApp(vApp.getHref(), params);
|
Task recomposeVApp = vAppClient.recomposeVApp(vApp.getHref(), params);
|
||||||
assertTrue(retryTaskSuccess.apply(recomposeVApp), String.format(TASK_COMPLETE_TIMELY, "recomposeVApp"));
|
assertTrue(retryTaskSuccess.apply(recomposeVApp), String.format(TASK_COMPLETE_TIMELY, "recomposeVApp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "POST /vApp/{id}/action/relocate", dependsOnMethods = { "testGetVApp" })
|
// NOTE This test is disabled, as it is not possible to look up datastores using the User API
|
||||||
|
@Test(enabled = false, testName = "POST /vApp/{id}/action/relocate", dependsOnMethods = { "testGetVApp" })
|
||||||
public void testRelocate() {
|
public void testRelocate() {
|
||||||
RelocateParams params = RelocateParams.builder()
|
// Relocate to the last of the available datastores
|
||||||
.build();
|
QueryResultRecords records = context.getApi().getQueryClient().queryAll("datastore");
|
||||||
|
QueryResultRecordType datastore = Iterables.getLast(records.getRecords());
|
||||||
|
RelocateParams params = RelocateParams.builder().datastore(Reference.builder().href(datastore.getHref()).build()).build();
|
||||||
|
|
||||||
// The method under test
|
// The method under test
|
||||||
Task relocate = vAppClient.relocate(vApp.getHref(), params);
|
Task relocate = vAppClient.relocate(vApp.getHref(), params);
|
||||||
|
@ -464,70 +454,133 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
public void testGetControlAccess() {
|
public void testGetControlAccess() {
|
||||||
// The method under test
|
// The method under test
|
||||||
ControlAccessParams controlAccess = vAppClient.getControlAccess(vApp.getHref());
|
ControlAccessParams controlAccess = vAppClient.getControlAccess(vApp.getHref());
|
||||||
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
checkControlAccessParams(controlAccess);
|
checkControlAccessParams(controlAccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "GET /vApp/{id}/guestCustomizationSection", dependsOnMethods = { "testGetVApp" })
|
@Test(testName = "GET /vApp/{id}/guestCustomizationSection", dependsOnMethods = { "testGetVApp" })
|
||||||
public void testGetGuestCustomizationSection() {
|
public void testGetGuestCustomizationSection() {
|
||||||
|
// Get URI for child VM
|
||||||
|
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
|
||||||
|
|
||||||
// The method under test
|
// The method under test
|
||||||
GuestCustomizationSection section = vAppClient.getGuestCustomizationSection(vApp.getHref());
|
GuestCustomizationSection section = vAppClient.getGuestCustomizationSection(vmURI);
|
||||||
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
checkGuestCustomizationSection(section);
|
checkGuestCustomizationSection(section);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "PUT /vApp/{id}/guestCustomizationSection", dependsOnMethods = { "testGetGuestCustomizationSection" })
|
@Test(testName = "PUT /vApp/{id}/guestCustomizationSection", dependsOnMethods = { "testGetGuestCustomizationSection" })
|
||||||
public void testModifyGuestCustomizationSection() {
|
public void testModifyGuestCustomizationSection() {
|
||||||
GuestCustomizationSection section = vAppClient.getGuestCustomizationSection(vApp.getHref());
|
// Get URI for child VM
|
||||||
// section.setX()
|
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
|
||||||
|
|
||||||
|
// Copy existing section and update fields
|
||||||
|
GuestCustomizationSection oldSection = vAppClient.getGuestCustomizationSection(vmURI);
|
||||||
|
GuestCustomizationSection newSection = oldSection.toBuilder()
|
||||||
|
.computerName("newComputerName")
|
||||||
|
.adminPassword(null) // Not allowed
|
||||||
|
.build();
|
||||||
|
|
||||||
// The method under test
|
// The method under test
|
||||||
Task modifyGuestCustomizationSection = vAppClient.modifyGuestCustomizationSection(vApp.getHref(), section);
|
Task modifyGuestCustomizationSection = vAppClient.modifyGuestCustomizationSection(vmURI, newSection);
|
||||||
assertTrue(retryTaskSuccess.apply(modifyGuestCustomizationSection), String.format(TASK_COMPLETE_TIMELY, "modifyGuestCustomizationSection"));
|
assertTrue(retryTaskSuccess.apply(modifyGuestCustomizationSection), String.format(TASK_COMPLETE_TIMELY, "modifyGuestCustomizationSection"));
|
||||||
|
|
||||||
GuestCustomizationSection modified = vAppClient.getGuestCustomizationSection(vApp.getHref());
|
// Retrieve the modified section
|
||||||
// assertEquals(modified.getX, "");
|
GuestCustomizationSection modified = vAppClient.getGuestCustomizationSection(vmURI);
|
||||||
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
|
checkGuestCustomizationSection(modified);
|
||||||
|
|
||||||
|
// Check the modified section fields are set correctly
|
||||||
|
assertEquals(modified.getComputerName(), newSection.getComputerName());
|
||||||
|
|
||||||
|
// Check the section was modified correctly
|
||||||
|
assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "GuestCustomizationSection"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "GET /vApp/{id}/leaseSettingsSection", dependsOnMethods = { "testGetVApp" })
|
@Test(testName = "GET /vApp/{id}/leaseSettingsSection", dependsOnMethods = { "testGetVApp" })
|
||||||
public void testGetLeaseSettingsSection() {
|
public void testGetLeaseSettingsSection() {
|
||||||
// The method under test
|
// The method under test
|
||||||
LeaseSettingsSection section = vAppClient.getLeaseSettingsSection(vApp.getHref());
|
LeaseSettingsSection section = vAppClient.getLeaseSettingsSection(vApp.getHref());
|
||||||
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
checkLeaseSettingsSection(section);
|
checkLeaseSettingsSection(section);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "PUT /vApp/{id}/leaseSettingsSection", dependsOnMethods = { "testGetLeaseSettingsSection" })
|
@Test(testName = "PUT /vApp/{id}/leaseSettingsSection", dependsOnMethods = { "testGetLeaseSettingsSection" })
|
||||||
public void testModifyLeaseSettingsSection() {
|
public void testModifyLeaseSettingsSection() {
|
||||||
LeaseSettingsSection section = vAppClient.getLeaseSettingsSection(vApp.getHref());
|
// Copy existing section
|
||||||
|
LeaseSettingsSection oldSection = vAppClient.getLeaseSettingsSection(vApp.getHref());
|
||||||
// section.setX()
|
LeaseSettingsSection newSection = oldSection.toBuilder().build();
|
||||||
|
|
||||||
// The method under test
|
// The method under test
|
||||||
Task modifyLeaseSettingsSection = vAppClient.modifyLeaseSettingsSection(vApp.getHref(), section);
|
Task modifyLeaseSettingsSection = vAppClient.modifyLeaseSettingsSection(vApp.getHref(), newSection);
|
||||||
assertTrue(retryTaskSuccess.apply(modifyLeaseSettingsSection), String.format(TASK_COMPLETE_TIMELY, "modifyLeaseSettingsSection"));
|
assertTrue(retryTaskSuccess.apply(modifyLeaseSettingsSection), String.format(TASK_COMPLETE_TIMELY, "modifyLeaseSettingsSection"));
|
||||||
|
|
||||||
|
// Retrieve the modified section
|
||||||
LeaseSettingsSection modified = vAppClient.getLeaseSettingsSection(vApp.getHref());
|
LeaseSettingsSection modified = vAppClient.getLeaseSettingsSection(vApp.getHref());
|
||||||
// assertEquals(modified.getX, "");
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
|
checkLeaseSettingsSection(modified);
|
||||||
|
|
||||||
|
// Check the date fields
|
||||||
|
if (modified.getDeploymentLeaseExpiration() != null) {
|
||||||
|
assertTrue(modified.getDeploymentLeaseExpiration().after(newSection.getDeploymentLeaseExpiration()),
|
||||||
|
String.format("The new deploymentLeaseExpiration timestamp must be later than the original: %s > %s",
|
||||||
|
dateService.iso8601DateFormat(modified.getDeploymentLeaseExpiration()),
|
||||||
|
dateService.iso8601DateFormat(newSection.getDeploymentLeaseExpiration())));
|
||||||
|
}
|
||||||
|
if (modified.getStorageLeaseExpiration() != null) {
|
||||||
|
assertTrue(modified.getStorageLeaseExpiration().after(newSection.getStorageLeaseExpiration()),
|
||||||
|
String.format("The new storageLeaseExpiration timestamp must be later than the original: %s > %s",
|
||||||
|
dateService.iso8601DateFormat(modified.getStorageLeaseExpiration()),
|
||||||
|
dateService.iso8601DateFormat(newSection.getStorageLeaseExpiration())));
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME "Error: validation error : EntityRef has incorrect type, expected type is com.vmware.vcloud.entity.vm."
|
// Reset the date fields
|
||||||
|
modified = modified.toBuilder()
|
||||||
|
.deploymentLeaseExpiration(null)
|
||||||
|
.storageLeaseExpiration(null)
|
||||||
|
.build();
|
||||||
|
newSection = newSection.toBuilder()
|
||||||
|
.deploymentLeaseExpiration(null)
|
||||||
|
.storageLeaseExpiration(null)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// Check the section was modified correctly
|
||||||
|
assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "LeaseSettingsSection"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME "Error: The requested operation on media "com.vmware.vcloud.entity.media:abfcb4b7-809f-4b50-a0aa-8c97bf09a5b0" is not supported in the current state."
|
||||||
@Test(testName = "PUT /vApp/{id}/media/action/insertMedia", dependsOnMethods = { "testGetVApp" })
|
@Test(testName = "PUT /vApp/{id}/media/action/insertMedia", dependsOnMethods = { "testGetVApp" })
|
||||||
public void testInsertMedia() {
|
public void testInsertMedia() {
|
||||||
|
// Setup media params from configured media id
|
||||||
MediaInsertOrEjectParams params = MediaInsertOrEjectParams.builder()
|
MediaInsertOrEjectParams params = MediaInsertOrEjectParams.builder()
|
||||||
.media(Reference.builder().href(mediaURI).type(MEDIA).build())
|
.media(Reference.builder().href(mediaURI).type(MEDIA).build())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
// Get URI for child VM
|
||||||
|
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
|
||||||
|
|
||||||
// The method under test
|
// The method under test
|
||||||
Task insertMedia = vAppClient.insertMedia(vApp.getHref(), params);
|
Task insertMedia = vAppClient.insertMedia(vmURI, params);
|
||||||
assertTrue(retryTaskSuccess.apply(insertMedia), String.format(TASK_COMPLETE_TIMELY, "insertMedia"));
|
assertTrue(retryTaskSuccess.apply(insertMedia), String.format(TASK_COMPLETE_TIMELY, "insertMedia"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "PUT /vApp/{id}/media/action/ejectMedia", dependsOnMethods = { "testInsertMedia" })
|
@Test(testName = "PUT /vApp/{id}/media/action/ejectMedia", dependsOnMethods = { "testInsertMedia" })
|
||||||
public void testEjectMedia() {
|
public void testEjectMedia() {
|
||||||
|
// Setup media params from configured media id
|
||||||
MediaInsertOrEjectParams params = MediaInsertOrEjectParams.builder()
|
MediaInsertOrEjectParams params = MediaInsertOrEjectParams.builder()
|
||||||
.media(Reference.builder().href(mediaURI).type(MEDIA).build())
|
.media(Reference.builder().href(mediaURI).type(MEDIA).build())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
// Get URI for child VM
|
||||||
|
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
|
||||||
|
|
||||||
// The method under test
|
// The method under test
|
||||||
Task ejectMedia = vAppClient.ejectMedia(vApp.getHref(), params);
|
Task ejectMedia = vAppClient.ejectMedia(vmURI, params);
|
||||||
assertTrue(retryTaskSuccess.apply(ejectMedia), String.format(TASK_COMPLETE_TIMELY, "ejectMedia"));
|
assertTrue(retryTaskSuccess.apply(ejectMedia), String.format(TASK_COMPLETE_TIMELY, "ejectMedia"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -535,89 +588,149 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
public void testGetNetworkConfigSection() {
|
public void testGetNetworkConfigSection() {
|
||||||
// The method under test
|
// The method under test
|
||||||
NetworkConfigSection section = vAppClient.getNetworkConfigSection(vApp.getHref());
|
NetworkConfigSection section = vAppClient.getNetworkConfigSection(vApp.getHref());
|
||||||
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
checkNetworkConfigSection(section);
|
checkNetworkConfigSection(section);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "PUT /vApp/{id}/networkConfigSection", dependsOnMethods = { "testGetNetworkConfigSection" })
|
@Test(testName = "PUT /vApp/{id}/networkConfigSection", dependsOnMethods = { "testGetNetworkConfigSection" })
|
||||||
public void testModifyNetworkConfigSection() {
|
public void testModifyNetworkConfigSection() {
|
||||||
NetworkConfigSection section = vAppClient.getNetworkConfigSection(vApp.getHref());
|
// Copy existing section and update fields
|
||||||
|
NetworkConfigSection oldSection = vAppClient.getNetworkConfigSection(vApp.getHref());
|
||||||
// section.setX()
|
NetworkConfigSection newSection = oldSection.toBuilder()
|
||||||
|
// .info("New NetworkConfigSection Info")
|
||||||
|
.build();
|
||||||
|
|
||||||
// The method under test
|
// The method under test
|
||||||
Task modifyNetworkConfigSection = vAppClient.modifyNetworkConfigSection(vApp.getHref(), section);
|
Task modifyNetworkConfigSection = vAppClient.modifyNetworkConfigSection(vApp.getHref(), newSection);
|
||||||
assertTrue(retryTaskSuccess.apply(modifyNetworkConfigSection), String.format(TASK_COMPLETE_TIMELY, "modifyNetworkConfigSection"));
|
assertTrue(retryTaskSuccess.apply(modifyNetworkConfigSection), String.format(TASK_COMPLETE_TIMELY, "modifyNetworkConfigSection"));
|
||||||
|
|
||||||
|
// Retrieve the modified section
|
||||||
NetworkConfigSection modified = vAppClient.getNetworkConfigSection(vApp.getHref());
|
NetworkConfigSection modified = vAppClient.getNetworkConfigSection(vApp.getHref());
|
||||||
// assertEquals(modified.getX, "");
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
|
checkNetworkConfigSection(modified);
|
||||||
|
|
||||||
|
// Check the modified section fields are set correctly
|
||||||
|
// assertEquals(modified.getInfo(), newSection.getInfo());
|
||||||
|
|
||||||
|
// Check the section was modified correctly
|
||||||
|
assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "NetworkConfigSection"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "GET /vApp/{id}/networkConnectionSection", dependsOnMethods = { "testGetVApp" })
|
@Test(testName = "GET /vApp/{id}/networkConnectionSection", dependsOnMethods = { "testGetVApp" })
|
||||||
public void testGetNetworkConnectionSection() {
|
public void testGetNetworkConnectionSection() {
|
||||||
|
// Get URI for child VM
|
||||||
|
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
|
||||||
|
|
||||||
// The method under test
|
// The method under test
|
||||||
NetworkConnectionSection section = vAppClient.getNetworkConnectionSection(vApp.getHref());
|
NetworkConnectionSection section = vAppClient.getNetworkConnectionSection(vmURI);
|
||||||
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
checkNetworkConnectionSection(section);
|
checkNetworkConnectionSection(section);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "PUT /vApp/{id}/networkConnectionSection", dependsOnMethods = { "testGetNetworkConnectionSection" })
|
@Test(testName = "PUT /vApp/{id}/networkConnectionSection", dependsOnMethods = { "testGetNetworkConnectionSection" })
|
||||||
public void testModifyNetworkConnectionSection() {
|
public void testModifyNetworkConnectionSection() {
|
||||||
NetworkConnectionSection section = vAppClient.getNetworkConnectionSection(vApp.getHref());
|
// Get URI for child VM
|
||||||
|
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
|
||||||
|
|
||||||
// section.setX()
|
// Copy existing section and update fields
|
||||||
|
NetworkConnectionSection oldSection = vAppClient.getNetworkConnectionSection(vmURI);
|
||||||
|
NetworkConnectionSection newSection = oldSection.toBuilder()
|
||||||
|
.info("Changed NetworkConnectionSection Info")
|
||||||
|
.build();
|
||||||
|
|
||||||
// The method under test
|
// The method under test
|
||||||
Task modifyNetworkConnectionSection = vAppClient.modifyNetworkConnectionSection(vApp.getHref(), section);
|
Task modifyNetworkConnectionSection = vAppClient.modifyNetworkConnectionSection(vmURI, newSection);
|
||||||
assertTrue(retryTaskSuccess.apply(modifyNetworkConnectionSection), String.format(TASK_COMPLETE_TIMELY, "modifyNetworkConnectionSection"));
|
assertTrue(retryTaskSuccess.apply(modifyNetworkConnectionSection), String.format(TASK_COMPLETE_TIMELY, "modifyNetworkConnectionSection"));
|
||||||
|
|
||||||
NetworkConnectionSection modified = vAppClient.getNetworkConnectionSection(vApp.getHref());
|
// Retrieve the modified section
|
||||||
// assertEquals(modified.getX, "");
|
NetworkConnectionSection modified = vAppClient.getNetworkConnectionSection(vmURI);
|
||||||
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
|
checkNetworkConnectionSection(modified);
|
||||||
|
|
||||||
|
// Check the modified section fields are set correctly
|
||||||
|
assertEquals(modified.getInfo(), newSection.getInfo());
|
||||||
|
|
||||||
|
// Check the section was modified correctly
|
||||||
|
assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "NetworkConnectionSection"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "GET /vApp/{id}/networkSection", dependsOnMethods = { "testGetVApp" })
|
@Test(testName = "GET /vApp/{id}/networkSection", dependsOnMethods = { "testGetVApp" })
|
||||||
public void testGetNetworkSection() {
|
public void testGetNetworkSection() {
|
||||||
// The method under test
|
// The method under test
|
||||||
NetworkSection section = vAppClient.getNetworkSection(vApp.getHref());
|
NetworkSection section = vAppClient.getNetworkSection(vApp.getHref());
|
||||||
// checkNetworkSection(section);
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
|
checkNetworkSection(section);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "GET /vApp/{id}/operatingSystemSection", dependsOnMethods = { "testGetVApp" })
|
@Test(testName = "GET /vApp/{id}/operatingSystemSection", dependsOnMethods = { "testGetVApp" })
|
||||||
public void testGetOperatingSystemSection() {
|
public void testGetOperatingSystemSection() {
|
||||||
|
// Get URI for child VM
|
||||||
|
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
|
||||||
|
|
||||||
// The method under test
|
// The method under test
|
||||||
OperatingSystemSection section = vAppClient.getOperatingSystemSection(vApp.getHref());
|
OperatingSystemSection section = vAppClient.getOperatingSystemSection(vmURI);
|
||||||
// checkOperatingSystemSection(section);
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
|
checkOperatingSystemSection(section);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "PUT /vApp/{id}/operatingSystemSection", dependsOnMethods = { "testGetOperatingSystemSection" })
|
@Test(testName = "PUT /vApp/{id}/operatingSystemSection", dependsOnMethods = { "testGetOperatingSystemSection" })
|
||||||
public void testModifyOperatingSystemSection() {
|
public void testModifyOperatingSystemSection() {
|
||||||
OperatingSystemSection section = vAppClient.getOperatingSystemSection(vApp.getHref());
|
// Get URI for child VM
|
||||||
|
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
|
||||||
|
|
||||||
// section.setX()
|
// Copy existing section and update fields
|
||||||
|
OperatingSystemSection oldSection = vAppClient.getOperatingSystemSection(vmURI);
|
||||||
|
OperatingSystemSection newSection = oldSection.toBuilder()
|
||||||
|
.info("Changed OperatingSystemSection Description")
|
||||||
|
.description("Changed OperatingSystemSection Description")
|
||||||
|
.build();
|
||||||
|
debug(newSection);
|
||||||
|
assertNotNull(newSection.getId());
|
||||||
|
|
||||||
// The method under test
|
// The method under test
|
||||||
Task modifySection = vAppClient.modifyOperatingSystemSection(vApp.getHref(), section);
|
Task modifyOperatingSystemSection = vAppClient.modifyOperatingSystemSection(vmURI, newSection);
|
||||||
assertTrue(retryTaskSuccess.apply(modifySection), String.format(TASK_COMPLETE_TIMELY, "modifySection"));
|
assertTrue(retryTaskSuccess.apply(modifyOperatingSystemSection), String.format(TASK_COMPLETE_TIMELY, "modifyOperatingSystemSection"));
|
||||||
|
|
||||||
OperatingSystemSection modified = vAppClient.getOperatingSystemSection(vApp.getHref());
|
// Retrieve the modified section
|
||||||
// assertEquals(modified.getX, "");
|
OperatingSystemSection modified = vAppClient.getOperatingSystemSection(vmURI);
|
||||||
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
|
checkOperatingSystemSection(modified);
|
||||||
|
|
||||||
|
// Check the modified section fields are set correctly
|
||||||
|
assertEquals(modified.getInfo(), newSection.getInfo());
|
||||||
|
assertEquals(modified.getDescription(), newSection.getDescription());
|
||||||
|
|
||||||
|
// Check the section was modified correctly
|
||||||
|
assertEquals(modified, newSection, String.format(ENTITY_EQUAL, "OperatingSystemSection"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "GET /vApp/{id}/owner", dependsOnMethods = { "testGetVApp" })
|
@Test(testName = "GET /vApp/{id}/owner", dependsOnMethods = { "testGetVApp" })
|
||||||
public void testGetOwner() {
|
public void testGetOwner() {
|
||||||
// The method under test
|
// The method under test
|
||||||
Owner owner = vAppClient.getOwner(vApp.getHref());
|
Owner owner = vAppClient.getOwner(vApp.getHref());
|
||||||
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
checkOwner(owner);
|
checkOwner(owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "PUT /vApp/{id}/owner", dependsOnMethods = { "testGetOwner" })
|
@Test(testName = "PUT /vApp/{id}/owner", dependsOnMethods = { "testGetOwner" })
|
||||||
public void testModifyOwner() {
|
public void testModifyOwner() {
|
||||||
Owner newOwner = Owner.builder()
|
Owner newOwner = Owner.builder().user(Reference.builder().href(userURI).type(ADMIN_USER).build()).build();
|
||||||
.user(Reference.builder().href(userURI).type(ADMIN_USER).build())
|
|
||||||
.build();
|
|
||||||
|
|
||||||
// The method under test
|
// The method under test
|
||||||
vAppClient.modifyOwner(vApp.getHref(), newOwner);
|
vAppClient.modifyOwner(vApp.getHref(), newOwner);
|
||||||
|
|
||||||
|
// Get the new VApp owner
|
||||||
Owner modified = vAppClient.getOwner(vApp.getHref());
|
Owner modified = vAppClient.getOwner(vApp.getHref());
|
||||||
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
checkOwner(modified);
|
checkOwner(modified);
|
||||||
|
|
||||||
// Check the href fields match
|
// Check the href fields match
|
||||||
|
@ -628,6 +741,8 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
public void testGetProductSections() {
|
public void testGetProductSections() {
|
||||||
// The method under test
|
// The method under test
|
||||||
ProductSectionList sectionList = vAppClient.getProductSections(vApp.getHref());
|
ProductSectionList sectionList = vAppClient.getProductSections(vApp.getHref());
|
||||||
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
checkProductSectionList(sectionList);
|
checkProductSectionList(sectionList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -650,6 +765,8 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
// TODO how to test?
|
// TODO how to test?
|
||||||
// The method under test
|
// The method under test
|
||||||
VmPendingQuestion question = vAppClient.getPendingQuestion(vApp.getHref());
|
VmPendingQuestion question = vAppClient.getPendingQuestion(vApp.getHref());
|
||||||
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
// checkQuestion(question);
|
// checkQuestion(question);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -666,71 +783,109 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
|
|
||||||
@Test(testName = "GET /vApp/{id}/runtimeInfoSection", dependsOnMethods = { "testGetVApp" })
|
@Test(testName = "GET /vApp/{id}/runtimeInfoSection", dependsOnMethods = { "testGetVApp" })
|
||||||
public void testGetRuntimeInfoSection() {
|
public void testGetRuntimeInfoSection() {
|
||||||
|
// Get URI for child VM
|
||||||
|
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
|
||||||
|
|
||||||
// The method under test
|
// The method under test
|
||||||
RuntimeInfoSection section = vAppClient.getRuntimeInfoSection(vApp.getHref());
|
RuntimeInfoSection section = vAppClient.getRuntimeInfoSection(vmURI);
|
||||||
// checkRuntimeInfoSection(section);
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
|
checkRuntimeInfoSection(section);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "GET /vApp/{id}/screen", dependsOnMethods = { "testGetVApp" })
|
@Test(testName = "GET /vApp/{id}/screen", dependsOnMethods = { "testGetVApp" })
|
||||||
public void testGetScreenImage() {
|
public void testGetScreenImage() {
|
||||||
// The method under test
|
// The method under test
|
||||||
byte[] image = vAppClient.getScreenImage(vApp.getHref());
|
byte[] image = vAppClient.getScreenImage(vApp.getHref());
|
||||||
// TODO how to check?
|
|
||||||
|
// Check returned bytes against PNG header magic number
|
||||||
|
byte[] pngHeaderBytes = new byte[] { (byte) 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A };
|
||||||
|
assertNotNull(image);
|
||||||
|
assertTrue(image.length > pngHeaderBytes.length);
|
||||||
|
for (int i = 0; i < pngHeaderBytes.length; i++) {
|
||||||
|
assertEquals(image[i], pngHeaderBytes[i], String.format("Image differs from PNG format at byte %d of header", i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "GET /vApp/{id}/screen/action/acquireTicket", dependsOnMethods = { "testGetVApp" })
|
@Test(testName = "GET /vApp/{id}/screen/action/acquireTicket", dependsOnMethods = { "testGetVApp" })
|
||||||
public void testGetScreenTicket() {
|
public void testGetScreenTicket() {
|
||||||
// The method under test
|
// The method under test
|
||||||
byte[] image = vAppClient.getScreenImage(vApp.getHref());
|
ScreenTicket ticket = vAppClient.getScreenTicket(vApp.getHref());
|
||||||
// TODO how to check?
|
|
||||||
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
|
checkScreenTicket(ticket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "GET /vApp/{id}/startupSection", dependsOnMethods = { "testGetVApp" })
|
@Test(testName = "GET /vApp/{id}/startupSection", dependsOnMethods = { "testGetVApp" })
|
||||||
public void testGetStartupSection() {
|
public void testGetStartupSection() {
|
||||||
// The method under test
|
// The method under test
|
||||||
StartupSection section = vAppClient.getStartupSection(vApp.getHref());
|
StartupSection section = vAppClient.getStartupSection(vApp.getHref());
|
||||||
// checkStartupSection(section);
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
|
checkStartupSection(section);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "PUT /vApp/{id}/startupSection", dependsOnMethods = { "testGetStartupSection" })
|
@Test(testName = "PUT /vApp/{id}/startupSection", dependsOnMethods = { "testGetStartupSection" })
|
||||||
public void testModifyStartupSection() {
|
public void testModifyStartupSection() {
|
||||||
StartupSection section = vAppClient.getStartupSection(vApp.getHref());
|
// Copy existing section and update fields
|
||||||
|
StartupSection oldSection = vAppClient.getStartupSection(vApp.getHref());
|
||||||
// section.setX()
|
StartupSection newSection = oldSection.toBuilder().build();
|
||||||
|
|
||||||
// The method under test
|
// The method under test
|
||||||
Task modifyStartupSection = vAppClient.modifyStartupSection(vApp.getHref(), section);
|
Task modifyStartupSection = vAppClient.modifyStartupSection(vApp.getHref(), newSection);
|
||||||
assertTrue(retryTaskSuccess.apply(modifyStartupSection), String.format(TASK_COMPLETE_TIMELY, "modifyStartupSection"));
|
assertTrue(retryTaskSuccess.apply(modifyStartupSection), String.format(TASK_COMPLETE_TIMELY, "modifyStartupSection"));
|
||||||
|
|
||||||
|
// Retrieve the modified section
|
||||||
StartupSection modified = vAppClient.getStartupSection(vApp.getHref());
|
StartupSection modified = vAppClient.getStartupSection(vApp.getHref());
|
||||||
// assertEquals(modified.getX, "");
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
|
checkStartupSection(modified);
|
||||||
|
|
||||||
|
// Check the modified section fields are set correctly
|
||||||
|
// assertEquals(modified.getX(), "");
|
||||||
|
assertEquals(modified, newSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "GET /vApp/{id}/virtualHardwareSection", dependsOnMethods = { "testGetVApp" })
|
@Test(testName = "GET /vApp/{id}/virtualHardwareSection", dependsOnMethods = { "testGetVApp" })
|
||||||
public void testGetVirtualHardwareSection() {
|
public void testGetVirtualHardwareSection() {
|
||||||
|
// Get URI for child VM
|
||||||
|
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
|
||||||
|
|
||||||
// Method under test
|
// Method under test
|
||||||
VirtualHardwareSection hardware = vAppClient.getVirtualHardwareSection(vApp.getHref());
|
VirtualHardwareSection hardware = vAppClient.getVirtualHardwareSection(vmURI);
|
||||||
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
checkVirtualHardwareSection(hardware);
|
checkVirtualHardwareSection(hardware);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "PUT /vApp/{id}/virtualHardwareSection", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
@Test(testName = "PUT /vApp/{id}/virtualHardwareSection", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
||||||
public void testModifyVirtualHardwareSection() {
|
public void testModifyVirtualHardwareSection() {
|
||||||
VirtualHardwareSection hardware = vAppClient.getVirtualHardwareSection(vApp.getHref());
|
// Get URI for child VM
|
||||||
hardware.setInfo("New Info");
|
URI vmURI = Iterables.getOnlyElement(vApp.getChildren().getVms()).getHref();
|
||||||
|
|
||||||
// Method under test
|
// Copy existing section and update fields
|
||||||
Task modifyVirtualHardwareSection = vAppClient.modifyVirtualHardwareSection(vApp.getHref(), hardware);
|
VirtualHardwareSection oldSection = vAppClient.getVirtualHardwareSection(vmURI);
|
||||||
|
VirtualHardwareSection newSection = oldSection.toBuilder().build();
|
||||||
|
|
||||||
|
// The method under test
|
||||||
|
Task modifyVirtualHardwareSection = vAppClient.modifyVirtualHardwareSection(vmURI, newSection);
|
||||||
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSection), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSection"));
|
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSection), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSection"));
|
||||||
|
|
||||||
VirtualHardwareSection modified = vAppClient.getVirtualHardwareSection(vApp.getHref());
|
// Retrieve the modified section
|
||||||
assertEquals(modified.getInfo(), "New Info");
|
VirtualHardwareSection modified = vAppClient.getVirtualHardwareSection(vmURI);
|
||||||
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
|
checkVirtualHardwareSection(modified);
|
||||||
|
|
||||||
|
// Check the modified section fields are set correctly
|
||||||
|
// assertEquals(modified.getX(), "");
|
||||||
|
assertEquals(modified, newSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "GET /vApp/{id}/virtualHardwareSection/cpu", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
@Test(testName = "GET /vApp/{id}/virtualHardwareSection/cpu", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
||||||
public void testGetVirtualHardwareSectionCpu() {
|
public void testGetVirtualHardwareSectionCpu() {
|
||||||
RASD rasd = vAppClient.getVirtualHardwareSectionCpu(vApp.getHref());
|
RASD rasd = vAppClient.getVirtualHardwareSectionCpu(vApp.getHref());
|
||||||
// checkRASD(rasd);
|
checkRASD(rasd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "PUT /vApp/{id}/virtualHardwareSection/cpu", dependsOnMethods = { "testGetVirtualHardwareSectionCpu" })
|
@Test(testName = "PUT /vApp/{id}/virtualHardwareSection/cpu", dependsOnMethods = { "testGetVirtualHardwareSectionCpu" })
|
||||||
|
@ -742,40 +897,62 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
Task modifyVirtualHardwareSectionCpu = vAppClient.modifyVirtualHardwareSectionCpu(vApp.getHref(), rasd);
|
Task modifyVirtualHardwareSectionCpu = vAppClient.modifyVirtualHardwareSectionCpu(vApp.getHref(), rasd);
|
||||||
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionCpu), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionCpu"));
|
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionCpu), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionCpu"));
|
||||||
|
|
||||||
|
// Retrieve the modified section
|
||||||
RASD modified = vAppClient.getVirtualHardwareSectionCpu(vApp.getHref());
|
RASD modified = vAppClient.getVirtualHardwareSectionCpu(vApp.getHref());
|
||||||
// assertEquals(modified.getInfo(), "New Info");
|
|
||||||
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
|
checkRASD(modified);
|
||||||
|
|
||||||
|
// assertEquals(modified.getInfo(), "New Info");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "GET /vApp/{id}/virtualHardwareSection/disks", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
@Test(testName = "GET /vApp/{id}/virtualHardwareSection/disks", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
||||||
public void testGetVirtualHardwareSectionDisks() {
|
public void testGetVirtualHardwareSectionDisks() {
|
||||||
RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionDisks(vApp.getHref());
|
RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionDisks(vApp.getHref());
|
||||||
// checkRasdItemsList(rasdItems);
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
|
checkRasdItemsList(rasdItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "PUT /vApp/{id}/virtualHardwareSection/disks", dependsOnMethods = { "testGetVirtualHardwareSectionDisks" })
|
@Test(testName = "PUT /vApp/{id}/virtualHardwareSection/disks", dependsOnMethods = { "testGetVirtualHardwareSectionDisks" })
|
||||||
public void testModifyVirtualHardwareSectionDisks() {
|
public void testModifyVirtualHardwareSectionDisks() {
|
||||||
RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionDisks(vApp.getHref());
|
// Copy the existing items list and add a new item
|
||||||
// rasd.setX("New Info");
|
RasdItemsList oldRasdItems = vAppClient.getVirtualHardwareSectionDisks(vApp.getHref());
|
||||||
|
RASD item = RASD.builder().build();
|
||||||
|
RasdItemsList newRasdItems = oldRasdItems.toBuilder()
|
||||||
|
.item(item)
|
||||||
|
.build();
|
||||||
|
|
||||||
// Method under test
|
// Method under test
|
||||||
Task modifyVirtualHardwareSectionDisks = vAppClient.modifyVirtualHardwareSectionDisks(vApp.getHref(), rasdItems);
|
Task modifyVirtualHardwareSectionDisks = vAppClient.modifyVirtualHardwareSectionDisks(vApp.getHref(), newRasdItems);
|
||||||
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionDisks), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionDisks"));
|
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionDisks), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionDisks"));
|
||||||
|
|
||||||
|
// Retrieve the modified section
|
||||||
RasdItemsList modified = vAppClient.getVirtualHardwareSectionDisks(vApp.getHref());
|
RasdItemsList modified = vAppClient.getVirtualHardwareSectionDisks(vApp.getHref());
|
||||||
// assertEquals(modified.getInfo(), "New Info");
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
|
checkRasdItemsList(modified);
|
||||||
|
|
||||||
|
// Check the modified items list
|
||||||
|
// assertEquals(modified.getX(), "");
|
||||||
|
assertTrue(modified.getItems().contains(item));
|
||||||
|
assertEquals(modified, newRasdItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "GET /vApp/{id}/virtualHardwareSection/media", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
@Test(testName = "GET /vApp/{id}/virtualHardwareSection/media", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
||||||
public void testGetVirtualHardwareSectionMedia() {
|
public void testGetVirtualHardwareSectionMedia() {
|
||||||
RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionMedia(vApp.getHref());
|
RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionMedia(vApp.getHref());
|
||||||
// checkRasdItemsList(rasdItems);
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
|
checkRasdItemsList(rasdItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "GET /vApp/{id}/virtualHardwareSection/memory", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
@Test(testName = "GET /vApp/{id}/virtualHardwareSection/memory", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
||||||
public void testGetVirtualHardwareSectionMemory() {
|
public void testGetVirtualHardwareSectionMemory() {
|
||||||
RASD rasd = vAppClient.getVirtualHardwareSectionCpu(vApp.getHref());
|
RASD rasd = vAppClient.getVirtualHardwareSectionCpu(vApp.getHref());
|
||||||
// checkRASD(rasd);
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
|
checkRASD(rasd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "PUT /vApp/{id}/virtualHardwareSection/memory", dependsOnMethods = { "testGetVirtualHardwareSectionMemory" })
|
@Test(testName = "PUT /vApp/{id}/virtualHardwareSection/memory", dependsOnMethods = { "testGetVirtualHardwareSectionMemory" })
|
||||||
|
@ -794,65 +971,96 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
@Test(testName = "GET /vApp/{id}/virtualHardwareSection/networkCards", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
@Test(testName = "GET /vApp/{id}/virtualHardwareSection/networkCards", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
||||||
public void testGetVirtualHardwareSectionNetworkCards() {
|
public void testGetVirtualHardwareSectionNetworkCards() {
|
||||||
RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionNetworkCards(vApp.getHref());
|
RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionNetworkCards(vApp.getHref());
|
||||||
// checkRasdItemsList(rasdItems);
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
|
checkRasdItemsList(rasdItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "PUT /vApp/{id}/virtualHardwareSection/networkCards", dependsOnMethods = { "testGetVirtualHardwareSectionNetworkCards" })
|
@Test(testName = "PUT /vApp/{id}/virtualHardwareSection/networkCards", dependsOnMethods = { "testGetVirtualHardwareSectionNetworkCards" })
|
||||||
public void testModifyVirtualHardwareSectionNetworkCards() {
|
public void testModifyVirtualHardwareSectionNetworkCards() {
|
||||||
RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionNetworkCards(vApp.getHref());
|
// Copy the existing items list and add a new item
|
||||||
// rasd.setX("New Info");
|
RasdItemsList oldRasdItems = vAppClient.getVirtualHardwareSectionNetworkCards(vApp.getHref());
|
||||||
|
RASD item = RASD.builder().build();
|
||||||
|
RasdItemsList newRasdItems = oldRasdItems.toBuilder()
|
||||||
|
.item(item)
|
||||||
|
.build();
|
||||||
|
|
||||||
// Method under test
|
// Method under test
|
||||||
Task modifyVirtualHardwareSectionNetworkCards = vAppClient.modifyVirtualHardwareSectionNetworkCards(vApp.getHref(), rasdItems);
|
Task modifyVirtualHardwareSectionNetworkCards = vAppClient.modifyVirtualHardwareSectionNetworkCards(vApp.getHref(), newRasdItems);
|
||||||
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionNetworkCards), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionNetworkCards"));
|
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionNetworkCards), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionNetworkCards"));
|
||||||
|
|
||||||
|
// Retrieve the modified section
|
||||||
RasdItemsList modified = vAppClient.getVirtualHardwareSectionNetworkCards(vApp.getHref());
|
RasdItemsList modified = vAppClient.getVirtualHardwareSectionNetworkCards(vApp.getHref());
|
||||||
// assertEquals(modified.getInfo(), "New Info");
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
|
checkRasdItemsList(modified);
|
||||||
|
|
||||||
|
// Check the modified items list
|
||||||
|
// assertEquals(modified.getX(), "");
|
||||||
|
assertTrue(modified.getItems().contains(item));
|
||||||
|
assertEquals(modified, newRasdItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "GET /vApp/{id}/virtualHardwareSection/serialPorts", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
@Test(testName = "GET /vApp/{id}/virtualHardwareSection/serialPorts", dependsOnMethods = { "testGetVirtualHardwareSection" })
|
||||||
public void testGetVirtualHardwareSectionSerialPorts() {
|
public void testGetVirtualHardwareSectionSerialPorts() {
|
||||||
RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionSerialPorts(vApp.getHref());
|
RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionSerialPorts(vApp.getHref());
|
||||||
// checkRasdItemsList(rasdItems);
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
|
checkRasdItemsList(rasdItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "PUT /vApp/{id}/virtualHardwareSection/serialPorts", dependsOnMethods = { "testGetVirtualHardwareSectionSerialPorts" })
|
@Test(testName = "PUT /vApp/{id}/virtualHardwareSection/serialPorts", dependsOnMethods = { "testGetVirtualHardwareSectionSerialPorts" })
|
||||||
public void testModifyVirtualHardwareSectionSerialPorts() {
|
public void testModifyVirtualHardwareSectionSerialPorts() {
|
||||||
RasdItemsList rasdItems = vAppClient.getVirtualHardwareSectionSerialPorts(vApp.getHref());
|
// Copy the existing items list and add a new item
|
||||||
// rasd.setX("New Info");
|
RasdItemsList oldRasdItems = vAppClient.getVirtualHardwareSectionSerialPorts(vApp.getHref());
|
||||||
|
RASD item = RASD.builder().build();
|
||||||
|
RasdItemsList newRasdItems = oldRasdItems.toBuilder()
|
||||||
|
.item(item)
|
||||||
|
.build();
|
||||||
|
|
||||||
// Method under test
|
// Method under test
|
||||||
Task modifyVirtualHardwareSectionSerialPorts = vAppClient.modifyVirtualHardwareSectionSerialPorts(vApp.getHref(), rasdItems);
|
Task modifyVirtualHardwareSectionSerialPorts = vAppClient.modifyVirtualHardwareSectionSerialPorts(vApp.getHref(), newRasdItems);
|
||||||
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionSerialPorts), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionSerialPorts"));
|
assertTrue(retryTaskSuccess.apply(modifyVirtualHardwareSectionSerialPorts), String.format(TASK_COMPLETE_TIMELY, "modifyVirtualHardwareSectionSerialPorts"));
|
||||||
|
|
||||||
|
// Retrieve the modified section
|
||||||
RasdItemsList modified = vAppClient.getVirtualHardwareSectionSerialPorts(vApp.getHref());
|
RasdItemsList modified = vAppClient.getVirtualHardwareSectionSerialPorts(vApp.getHref());
|
||||||
// assertEquals(modified.getInfo(), "New Info");
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
|
checkRasdItemsList(modified);
|
||||||
|
|
||||||
|
// Check the modified items list
|
||||||
|
// assertEquals(modified.getX(), "");
|
||||||
|
assertTrue(modified.getItems().contains(item));
|
||||||
|
assertEquals(modified, newRasdItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "GET /vApp/{id}/metadata", dependsOnMethods = { "testGetVApp" })
|
@Test(testName = "GET /vApp/{id}/metadata", dependsOnMethods = { "testGetVApp" })
|
||||||
public void testGetMetadata() {
|
public void testGetMetadata() {
|
||||||
Metadata metadata = metadataClient.getMetadata(vApp.getHref());
|
Metadata metadata = metadataClient.getMetadata(vApp.getHref());
|
||||||
|
|
||||||
Checks.checkMetadataFor(VAPP, metadata);
|
// Check the retrieved object is well formed
|
||||||
|
checkMetadataFor(VAPP, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "PUT & GET /vApp/{id}/metadata", dependsOnMethods = { "testGetMetadata" })
|
@Test(testName = "PUT & GET /vApp/{id}/metadata", dependsOnMethods = { "testGetMetadata" })
|
||||||
public void testSetAndGetMetadataValue() {
|
public void testSetAndGetMetadataValue() {
|
||||||
// Store a value
|
// Store a value
|
||||||
String key = ""+random.nextInt();
|
String key = Integer.toString(random.nextInt());
|
||||||
String value = ""+random.nextInt();
|
String value = Integer.toString(random.nextInt());
|
||||||
MetadataValue metadataValue = MetadataValue.builder().value(value).build();
|
MetadataValue metadataValue = MetadataValue.builder().value(value).build();
|
||||||
metadataClient.setMetadata(vApp.getHref(), key, metadataValue);
|
metadataClient.setMetadata(vApp.getHref(), key, metadataValue);
|
||||||
|
|
||||||
// Retrieve the value, and assert it was set correctly
|
// Retrieve the value, and assert it was set correctly
|
||||||
MetadataValue newMetadataValue = metadataClient.getMetadataValue(vApp.getHref(), key);
|
MetadataValue newMetadataValue = metadataClient.getMetadataValue(vApp.getHref(), key);
|
||||||
Checks.checkMetadataValueFor(VAPP, newMetadataValue, value);
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
|
checkMetadataValueFor(VAPP, newMetadataValue, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "DELETE /vApp/{id}/metadata/{key}", dependsOnMethods = { "testSetAndGetMetadataValue" })
|
@Test(testName = "DELETE /vApp/{id}/metadata/{key}", dependsOnMethods = { "testSetAndGetMetadataValue" })
|
||||||
public void testDeleteMetadataEntry() {
|
public void testDeleteMetadataEntry() {
|
||||||
// Store a value, to be deleted
|
// Store a value, to be deleted
|
||||||
String key = ""+random.nextInt();
|
String key = Integer.toString(random.nextInt());
|
||||||
MetadataValue metadataValue = MetadataValue.builder().value("myval").build();
|
MetadataValue metadataValue = MetadataValue.builder().value("myval").build();
|
||||||
metadataClient.setMetadata(vApp.getHref(), key, metadataValue);
|
metadataClient.setMetadata(vApp.getHref(), key, metadataValue);
|
||||||
|
|
||||||
|
@ -862,7 +1070,9 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
|
|
||||||
// Confirm the entry has been deleted
|
// Confirm the entry has been deleted
|
||||||
Metadata newMetadata = metadataClient.getMetadata(vApp.getHref());
|
Metadata newMetadata = metadataClient.getMetadata(vApp.getHref());
|
||||||
Checks.checkMetadataKeyAbsentFor(VAPP, newMetadata, key);
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
|
checkMetadataKeyAbsentFor(VAPP, newMetadata, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "POST /vApp/{id}/metadata", dependsOnMethods = { "testGetMetadata" })
|
@Test(testName = "POST /vApp/{id}/metadata", dependsOnMethods = { "testGetMetadata" })
|
||||||
|
@ -871,13 +1081,10 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
Map<String, String> oldMetadataMap = Checks.metadataToMap(oldMetadata);
|
Map<String, String> oldMetadataMap = Checks.metadataToMap(oldMetadata);
|
||||||
|
|
||||||
// Store a value, to be deleted
|
// Store a value, to be deleted
|
||||||
String key = ""+random.nextInt();
|
String key = Integer.toString(random.nextInt());
|
||||||
String value = ""+random.nextInt();
|
String value = Integer.toString(random.nextInt());
|
||||||
Metadata addedMetadata = Metadata.builder()
|
Metadata addedMetadata = Metadata.builder()
|
||||||
.entry(MetadataEntry.builder()
|
.entry(MetadataEntry.builder().key(key).value(value).build())
|
||||||
.key(key)
|
|
||||||
.value(value)
|
|
||||||
.build())
|
|
||||||
.build();
|
.build();
|
||||||
Task task = metadataClient.mergeMetadata(vApp.getHref(), addedMetadata);
|
Task task = metadataClient.mergeMetadata(vApp.getHref(), addedMetadata);
|
||||||
retryTaskSuccess.apply(task);
|
retryTaskSuccess.apply(task);
|
||||||
|
@ -888,7 +1095,9 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
.putAll(oldMetadataMap)
|
.putAll(oldMetadataMap)
|
||||||
.put(key, value)
|
.put(key, value)
|
||||||
.build();
|
.build();
|
||||||
Checks.checkMetadataFor(VAPP, newMetadata, expectedMetadataMap);
|
|
||||||
|
// Check the retrieved object is well formed
|
||||||
|
checkMetadataFor(VAPP, newMetadata, expectedMetadataMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -909,14 +1118,52 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass(groups = { "live" })
|
// NOTE This method is also called by the BeforeClass method setupRequiredClients
|
||||||
|
@AfterClass(alwaysRun = true, description = "Clean up the environment by deleting created VApps named 'test-vapp' or 'new-name'")
|
||||||
public void cleanUp() {
|
public void cleanUp() {
|
||||||
if (vApp != null) {
|
// Find references in the Vdc with the VApp type and named 'test-vapp' or 'new-name'
|
||||||
Task deleteVApp = vAppClient.deleteVApp(vApp.getHref());
|
Iterable<Reference> vApps = Iterables.filter(
|
||||||
retryTaskSuccess.apply(deleteVApp);
|
vdc.getResourceEntities().getResourceEntities(),
|
||||||
|
Predicates.and(
|
||||||
|
ReferenceTypePredicates.<Reference> typeEquals(VCloudDirectorMediaType.VAPP),
|
||||||
|
Predicates.or(
|
||||||
|
ReferenceTypePredicates.<Reference> nameEquals("test-vapp"),
|
||||||
|
ReferenceTypePredicates.<Reference> nameEquals("new-name")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// If we found any references, delete the VApp they point to
|
||||||
|
if (vApps != null && !Iterables.isEmpty(vApps)) {
|
||||||
|
for (Reference each : vApps) {
|
||||||
|
VApp found = vAppClient.getVApp(each.getHref());
|
||||||
|
// debug(found);
|
||||||
|
|
||||||
|
// Shutdown and power off the VApp if necessary
|
||||||
|
if (found.getStatus().equals(Status.POWERED_ON.getValue())) {
|
||||||
|
Task shutdownTask = vAppClient.shutdown(found.getHref());
|
||||||
|
retryTaskSuccess.apply(shutdownTask);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Undeploy the VApp if necessary
|
||||||
|
if (found.isDeployed()) {
|
||||||
|
UndeployVAppParams params = UndeployVAppParams.builder().build();
|
||||||
|
Task undeployTask = vAppClient.undeploy(found.getHref(), params);
|
||||||
|
retryTaskSuccess.apply(undeployTask);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete the VApp
|
||||||
|
Task deleteTask = vAppClient.deleteVApp(found.getHref());
|
||||||
|
retryTaskSuccess.apply(deleteTask);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiate a {@link VApp} in a {@link Vdc} using the {@link VAppTemplate} we have configured for the tests.
|
||||||
|
*
|
||||||
|
* @return the VApp that is being instantiated
|
||||||
|
*/
|
||||||
private VApp instantiateVApp() {
|
private VApp instantiateVApp() {
|
||||||
InstantiateVAppTemplateParams instantiate = InstantiateVAppTemplateParams.builder()
|
InstantiateVAppTemplateParams instantiate = InstantiateVAppTemplateParams.builder()
|
||||||
.name("test-vapp")
|
.name("test-vapp")
|
||||||
|
@ -927,14 +1174,13 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
.source(Reference.builder().href(vAppTemplateURI).build())
|
.source(Reference.builder().href(vAppTemplateURI).build())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// debug(instantiate);
|
|
||||||
|
|
||||||
VApp vAppInstantiated = vdcClient.instantiateVApp(vdcURI, instantiate);
|
VApp vAppInstantiated = vdcClient.instantiateVApp(vdcURI, instantiate);
|
||||||
assertNotNull(vAppInstantiated, String.format(ENTITY_NON_NULL, VAPP));
|
assertNotNull(vAppInstantiated, String.format(ENTITY_NON_NULL, VAPP));
|
||||||
|
|
||||||
return vAppInstantiated;
|
return vAppInstantiated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Build an {@link InstantiationParams} object. */
|
||||||
private InstantiationParams instantiationParams() {
|
private InstantiationParams instantiationParams() {
|
||||||
InstantiationParams instantiationParams = InstantiationParams.builder()
|
InstantiationParams instantiationParams = InstantiationParams.builder()
|
||||||
.sections(ImmutableSet.of(networkConfigSection()))
|
.sections(ImmutableSet.of(networkConfigSection()))
|
||||||
|
@ -943,11 +1189,13 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
return instantiationParams;
|
return instantiationParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Build a {@link NetworkConfigSection} object. */
|
||||||
private NetworkConfigSection networkConfigSection() {
|
private NetworkConfigSection networkConfigSection() {
|
||||||
NetworkConfigSection networkConfigSection = NetworkConfigSection.builder()
|
NetworkConfigSection networkConfigSection = NetworkConfigSection.builder()
|
||||||
.info("Configuration parameters for logical networks")
|
.info("Configuration parameters for logical networks")
|
||||||
.networkConfigs(
|
.networkConfigs(
|
||||||
ImmutableSet.of(VAppNetworkConfiguration.builder()
|
ImmutableSet.of(
|
||||||
|
VAppNetworkConfiguration.builder()
|
||||||
.networkName("vAppNetwork")
|
.networkName("vAppNetwork")
|
||||||
.configuration(networkConfiguration())
|
.configuration(networkConfiguration())
|
||||||
.build()))
|
.build()))
|
||||||
|
@ -956,20 +1204,24 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
return networkConfigSection;
|
return networkConfigSection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Build a {@link NetworkConfiguration} object. */
|
||||||
private NetworkConfiguration networkConfiguration() {
|
private NetworkConfiguration networkConfiguration() {
|
||||||
Set<Reference> networks = vdc.getAvailableNetworks().getNetworks();
|
Set<Reference> networks = vdc.getAvailableNetworks().getNetworks();
|
||||||
Optional<Reference> parentNetwork = Iterables.tryFind(
|
|
||||||
networks, new Predicate<Reference>() {
|
// Look up the network in the Vdc with the id configured for the tests
|
||||||
|
Optional<Reference> parentNetwork = Iterables.tryFind(networks, new Predicate<Reference>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Reference reference) {
|
public boolean apply(Reference reference) {
|
||||||
return reference.getHref().equals(networkURI);
|
return reference.getHref().equals(networkURI);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Check we actually found a network reference
|
||||||
if (!parentNetwork.isPresent()) {
|
if (!parentNetwork.isPresent()) {
|
||||||
fail(String.format("Could not find network %s in vdc", networkURI.toASCIIString()));
|
fail(String.format("Could not find network %s in vdc", networkURI.toASCIIString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Build the configuration object
|
||||||
NetworkConfiguration networkConfiguration = NetworkConfiguration.builder()
|
NetworkConfiguration networkConfiguration = NetworkConfiguration.builder()
|
||||||
.parentNetwork(parentNetwork.get())
|
.parentNetwork(parentNetwork.get())
|
||||||
.fenceMode("bridged")
|
.fenceMode("bridged")
|
||||||
|
@ -979,14 +1231,12 @@ public class VAppClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marshals a JAXB annotated object into XML.
|
* Marshals a JAXB annotated object into XML. The XML is output on {@link System#err}.
|
||||||
*
|
|
||||||
* The XML is output on {@link System#err}.
|
|
||||||
*/
|
*/
|
||||||
private void debug(Object object) {
|
private void debug(Object object) {
|
||||||
String xml;
|
JAXBParser parser = new JAXBParser();
|
||||||
try {
|
try {
|
||||||
xml = parser.toXML(object);
|
String xml = parser.toXML(object);
|
||||||
|
|
||||||
System.err.println(Strings.repeat("-", 80));
|
System.err.println(Strings.repeat("-", 80));
|
||||||
System.err.println(xml);
|
System.err.println(xml);
|
||||||
|
|
|
@ -18,12 +18,15 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.vcloud.director.v1_5.internal;
|
package org.jclouds.vcloud.director.v1_5.internal;
|
||||||
|
|
||||||
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.jclouds.compute.BaseVersionedServiceLiveTest;
|
import org.jclouds.compute.BaseVersionedServiceLiveTest;
|
||||||
|
import org.jclouds.date.DateService;
|
||||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||||
import org.jclouds.predicates.RetryablePredicate;
|
import org.jclouds.predicates.RetryablePredicate;
|
||||||
import org.jclouds.rest.RestContext;
|
import org.jclouds.rest.RestContext;
|
||||||
|
@ -41,6 +44,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||||
import org.jclouds.vcloud.director.v1_5.predicates.ReferenceTypePredicates;
|
import org.jclouds.vcloud.director.v1_5.predicates.ReferenceTypePredicates;
|
||||||
import org.jclouds.vcloud.director.v1_5.predicates.TaskSuccess;
|
import org.jclouds.vcloud.director.v1_5.predicates.TaskSuccess;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
|
import org.testng.annotations.BeforeGroups;
|
||||||
import org.testng.annotations.Listeners;
|
import org.testng.annotations.Listeners;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -50,6 +54,7 @@ import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.inject.Guice;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,6 +74,14 @@ public abstract class BaseVCloudDirectorClientLiveTest extends BaseVersionedServ
|
||||||
provider = "vcloud-director";
|
provider = "vcloud-director";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static DateService dateService;
|
||||||
|
|
||||||
|
@BeforeGroups("live")
|
||||||
|
protected static void setupDateService() {
|
||||||
|
dateService = Guice.createInjector().getInstance(DateService.class);
|
||||||
|
assertNotNull(dateService);
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE Implement as required to populate xxxClient fields, or NOP
|
// NOTE Implement as required to populate xxxClient fields, or NOP
|
||||||
public abstract void setupRequiredClients() throws Exception;
|
public abstract void setupRequiredClients() throws Exception;
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class BaseVCloudDirectorRestClientExpectTest extends BaseRestClientExpect
|
||||||
protected static DateService dateService;
|
protected static DateService dateService;
|
||||||
|
|
||||||
@BeforeGroups("unit")
|
@BeforeGroups("unit")
|
||||||
protected static void setUpInjector() {
|
protected static void setupDateService() {
|
||||||
dateService = Guice.createInjector().getInstance(DateService.class);
|
dateService = Guice.createInjector().getInstance(DateService.class);
|
||||||
assertNotNull(dateService);
|
assertNotNull(dateService);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<ns2:LeaseSettingsSection type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="http://vcloud.example.com/api/v1.5/vAppTemplate/vAppTemplate-7/leaseSettingsSection/" ns1:required="false" xmlns:ns2="http://www.vmware.com/vcloud/v1.5" xmlns:ns1="http://schemas.dmtf.org/ovf/envelope/1">
|
<LeaseSettingsSection type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="http://vcloud.example.com/api/v1.5/vAppTemplate/vAppTemplate-7/leaseSettingsSection/" ovf:required="false" xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1">
|
||||||
<ns1:Info>VApp lease settings</ns1:Info>
|
<ovf:Info>VApp lease settings</ovf:Info>
|
||||||
<ns2:Link rel="edit" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="http://vcloud.example.com/api/v1.5/vAppTemplate/vAppTemplate-7/leaseSettingsSection/"/>
|
<Link rel="edit" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="http://vcloud.example.com/api/v1.5/vAppTemplate/vAppTemplate-7/leaseSettingsSection/"/>
|
||||||
<ns2:DeploymentLeaseInSeconds>3600</ns2:DeploymentLeaseInSeconds>
|
<DeploymentLeaseInSeconds>3600</DeploymentLeaseInSeconds>
|
||||||
<ns2:StorageLeaseInSeconds>3600</ns2:StorageLeaseInSeconds>
|
<StorageLeaseInSeconds>3600</StorageLeaseInSeconds>
|
||||||
<ns2:DeploymentLeaseExpiration>2010-01-21T21:50:59.764-08:00</ns2:DeploymentLeaseExpiration>
|
<DeploymentLeaseExpiration>2010-01-21T21:50:59.764-08:00</DeploymentLeaseExpiration>
|
||||||
</ns2:LeaseSettingsSection>
|
</LeaseSettingsSection>
|
Loading…
Reference in New Issue