From 28b7309b0310c560ab35f1e544b2459ef02587a2 Mon Sep 17 00:00:00 2001 From: Andrew Donald Kennedy Date: Fri, 10 Feb 2012 13:28:35 +0000 Subject: [PATCH] Tidyup --- .../director/v1_5/domain/EntityType.java | 2 -- .../director/v1_5/domain/IpAddresses.java | 6 ++-- .../vcloud/director/v1_5/domain/IpRange.java | 10 +++--- .../vcloud/director/v1_5/domain/IpRanges.java | 6 ++-- .../vcloud/director/v1_5/domain/IpScope.java | 20 +++++------ .../v1_5/domain/NetworkConfiguration.java | 18 +++++----- .../director/v1_5/domain/NetworkFeatures.java | 6 ++-- .../director/v1_5/domain/NetworkService.java | 6 ++-- .../director/v1_5/domain/OrgNetwork.java | 22 ++++++------ .../director/v1_5/domain/ReferenceType.java | 2 -- .../director/v1_5/domain/ResourceType.java | 3 +- .../director/v1_5/domain/RouterInfo.java | 6 ++-- .../v1_5/domain/SyslogServerSettings.java | 8 ++--- .../features/NetworkClientExpectTest.java | 35 +++++++++++-------- 14 files changed, 74 insertions(+), 76 deletions(-) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/EntityType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/EntityType.java index 0568885c8f..6a9c68def2 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/EntityType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/EntityType.java @@ -30,8 +30,6 @@ import javax.xml.bind.annotation.XmlElement; import com.google.common.base.Objects; import com.google.common.base.Objects.ToStringHelper; -import com.google.common.base.Splitter; -import com.google.common.collect.Iterables; import com.google.common.collect.Sets; /** diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpAddresses.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpAddresses.java index c7dfa043a0..b023b5a6fb 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpAddresses.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpAddresses.java @@ -20,7 +20,7 @@ package org.jclouds.vcloud.director.v1_5.domain; import static com.google.common.base.Objects.equal; import static com.google.common.base.Preconditions.checkNotNull; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NS; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*; import java.util.Set; @@ -36,7 +36,7 @@ import com.google.common.collect.Sets; * * @author danikov */ -@XmlRootElement(namespace = NS, name = "IpAddresses") +@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "IpAddresses") public class IpAddresses { public static Builder builder() { @@ -83,7 +83,7 @@ public class IpAddresses { this.ipAddresses = ImmutableSet.copyOf(orgs); } - @XmlElement(namespace = NS, name = "IpAddress") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "IpAddress") private Set ipAddresses = Sets.newLinkedHashSet(); public Set getIpAddresses() { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpRange.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpRange.java index efffaee687..0274573425 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpRange.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpRange.java @@ -16,10 +16,10 @@ * 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 static com.google.common.base.Objects.equal; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NS; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @@ -31,7 +31,7 @@ import com.google.common.base.Objects; * * @author danikov */ -@XmlRootElement(namespace = NS, name = "IpRange") +@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "IpRange") public class IpRange { public static Builder builder() { @@ -82,9 +82,9 @@ public class IpRange { } - @XmlElement(namespace = NS, name = "StartAddress") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "StartAddress") private String startAddress; - @XmlElement(namespace = NS, name = "EndAddress") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "EndAddress") private String endAddress; /** diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpRanges.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpRanges.java index da637355ac..c46beb5991 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpRanges.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpRanges.java @@ -20,7 +20,7 @@ package org.jclouds.vcloud.director.v1_5.domain; import static com.google.common.base.Objects.equal; import static com.google.common.base.Preconditions.checkNotNull; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NS; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*; import java.util.Set; @@ -36,7 +36,7 @@ import com.google.common.collect.Sets; * * @author danikov */ -@XmlRootElement(namespace = NS, name = "IpRanges") +@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "IpRanges") public class IpRanges { public static Builder builder() { @@ -83,7 +83,7 @@ public class IpRanges { this.ipRanges = ImmutableSet.copyOf(ipRanges); } - @XmlElement(namespace = NS, name = "IpRange") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "IpRange") private Set ipRanges = Sets.newLinkedHashSet(); public Set getIpRanges() { diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpScope.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpScope.java index 763082741b..ce847727a0 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpScope.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/IpScope.java @@ -19,7 +19,7 @@ package org.jclouds.vcloud.director.v1_5.domain; import static com.google.common.base.Objects.equal; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NS; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -33,7 +33,7 @@ import com.google.common.base.Objects; * * @author danikov */ -@XmlRootElement(namespace = NS, name = "IpScope") +@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "IpScope") @XmlAccessorType(XmlAccessType.FIELD) public class IpScope { @@ -151,21 +151,21 @@ public class IpScope { this.isInherited = isInherited; } - @XmlElement(namespace = NS, name = "IsInherited") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "IsInherited") private boolean isInherited; - @XmlElement(namespace = NS, name = "Gateway") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "Gateway") private String gateway; - @XmlElement(namespace = NS, name = "Netmask") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "Netmask") private String netmask; - @XmlElement(namespace = NS, name = "Dns1") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "Dns1") private String dns1; - @XmlElement(namespace = NS, name = "Dns2") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "Dns2") private String dns2; - @XmlElement(namespace = NS, name = "DnsSuffix") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "DnsSuffix") private String dnsSuffix; - @XmlElement(namespace = NS, name = "IpRanges") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "IpRanges") private IpRanges ipRanges; - @XmlElement(namespace = NS, name = "AllocatedIpAddresses") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "AllocatedIpAddresses") private IpAddresses allocatedIpAddresses; /** diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConfiguration.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConfiguration.java index 694c1fd815..3146845319 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConfiguration.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkConfiguration.java @@ -19,7 +19,7 @@ package org.jclouds.vcloud.director.v1_5.domain; import static com.google.common.base.Objects.equal; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NS; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -33,7 +33,7 @@ import com.google.common.base.Objects; * * @author danikov */ -@XmlRootElement(namespace = NS, name = "NetworkConfiguration") +@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "NetworkConfiguration") @XmlAccessorType(XmlAccessType.FIELD) public class NetworkConfiguration{ @@ -138,19 +138,19 @@ public class NetworkConfiguration{ this.fenceMode = fenceMode; } - @XmlElement(namespace = NS, name = "IpScope") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "IpScope") private IpScope ipScope; - @XmlElement(namespace = NS, name = "ParentNetwork") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "ParentNetwork") private ReferenceType parentNetwork; - @XmlElement(namespace = NS, name = "FenceMode") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "FenceMode") private String fenceMode; - @XmlElement(namespace = NS, name = "RetainNetInfoAcrossDeployments") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "RetainNetInfoAcrossDeployments") private boolean retainNetInfoAcrossDeployments = false; - @XmlElement(namespace = NS, name = "Features") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "Features") private NetworkFeatures features; - @XmlElement(namespace = NS, name = "SyslogServerSettings") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "SyslogServerSettings") private SyslogServerSettings syslogServerSettings; - @XmlElement(namespace = NS, name = "RouterInfo") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "RouterInfo") private RouterInfo routerInfo; /** diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkFeatures.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkFeatures.java index b8a6d47897..036ee7f159 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkFeatures.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkFeatures.java @@ -20,7 +20,7 @@ package org.jclouds.vcloud.director.v1_5.domain; import static com.google.common.base.Objects.equal; import static com.google.common.base.Preconditions.checkNotNull; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NS; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*; import java.util.Set; @@ -36,7 +36,7 @@ import com.google.common.collect.Sets; * * @author danikov */ -@XmlRootElement(namespace = NS, name = "Features") +@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Features") public class NetworkFeatures { public static Builder builder() { @@ -82,7 +82,7 @@ public class NetworkFeatures { // For JAXB and builder use } - @XmlElement(namespace = NS, name = "NetworkService") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "NetworkService") private Set services = Sets.newLinkedHashSet(); /** diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkService.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkService.java index 6fcbff73ac..3787b740ac 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkService.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/NetworkService.java @@ -19,7 +19,7 @@ package org.jclouds.vcloud.director.v1_5.domain; import static com.google.common.base.Objects.equal; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NS; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @@ -31,7 +31,7 @@ import com.google.common.base.Objects; * * @author danikov */ -@XmlRootElement(namespace = NS, name = "NetworkService") +@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "NetworkService") public class NetworkService { public static Builder builder() { @@ -69,7 +69,7 @@ public class NetworkService { // For JAXB and builder use } - @XmlElement(namespace = NS, name = "IsEnabled") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "IsEnabled") private boolean isEnabled; /** diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgNetwork.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgNetwork.java index 9133bf4f03..f2e72fac77 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgNetwork.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/OrgNetwork.java @@ -18,9 +18,9 @@ */ package org.jclouds.vcloud.director.v1_5.domain; -import static com.google.common.base.Objects.equal; -import static com.google.common.base.Preconditions.checkNotNull; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NS; +import static com.google.common.base.Objects.*; +import static com.google.common.base.Preconditions.*; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*; import java.net.URI; import java.util.Set; @@ -28,13 +28,11 @@ import java.util.Set; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; -import org.jclouds.ovf.Network; - import com.google.common.base.Objects; import com.google.common.base.Objects.ToStringHelper; import com.google.common.collect.Sets; -@XmlRootElement(namespace = NS, name = "OrgNetwork") +@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "OrgNetwork") public class OrgNetwork extends EntityType { @SuppressWarnings("unchecked") @@ -54,7 +52,7 @@ public class OrgNetwork extends EntityType { private IpAddresses allowedExternalIpAddresses; /** - * @see Network#getConfiguration() + * @see OrgNetwork#getConfiguration() */ public Builder configuration(NetworkConfiguration networkConfiguration) { this.networkConfiguration = networkConfiguration; @@ -62,7 +60,7 @@ public class OrgNetwork extends EntityType { } /** - * @see Network#getNetworkPool() + * @see OrgNetwork#getNetworkPool() */ public Builder networkPool(ReferenceType networkPool) { this.networkPool = networkPool; @@ -70,7 +68,7 @@ public class OrgNetwork extends EntityType { } /** - * @see Network#getAllowedExternalIpAddresses() + * @see OrgNetwork#getAllowedExternalIpAddresses() */ public Builder allowedExternalIpAddresses(IpAddresses allowedExternalIpAddresses) { this.allowedExternalIpAddresses = allowedExternalIpAddresses; @@ -183,11 +181,11 @@ public class OrgNetwork extends EntityType { super(href, name); } - @XmlElement(namespace = NS, name = "Configuration") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "Configuration") private NetworkConfiguration networkConfiguration; - @XmlElement(namespace = NS, name = "NetworkPool") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "NetworkPool") private ReferenceType networkPool; - @XmlElement(namespace = NS, name = "AllowedExternalIpAddresses") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "AllowedExternalIpAddresses") private IpAddresses allowedExternalIpAddresses; /** diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ReferenceType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ReferenceType.java index 8e3f022ba9..e9444d8ef7 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ReferenceType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ReferenceType.java @@ -28,9 +28,7 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import com.google.common.base.Objects; -import com.google.common.base.Splitter; import com.google.common.base.Objects.ToStringHelper; -import com.google.common.collect.Iterables; /** * A reference to a resource. diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceType.java index 1b190760c6..abeb7bf3b4 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceType.java @@ -31,7 +31,6 @@ import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import com.google.common.base.Objects; -import com.google.common.base.Splitter; import com.google.common.base.Objects.ToStringHelper; import com.google.common.collect.Iterables; import com.google.common.collect.Sets; @@ -202,4 +201,4 @@ public class ResourceType> implements URISupplier { protected ToStringHelper string() { return Objects.toStringHelper("").add("href", href).add("links", links).add("type", type); } -} \ No newline at end of file +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/RouterInfo.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/RouterInfo.java index 99151515a8..13afc7fced 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/RouterInfo.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/RouterInfo.java @@ -19,7 +19,7 @@ package org.jclouds.vcloud.director.v1_5.domain; import static com.google.common.base.Objects.equal; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NS; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @@ -31,7 +31,7 @@ import com.google.common.base.Objects; * * @author danikov */ -@XmlRootElement(namespace = NS, name = "RouterInfo") +@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "RouterInfo") public class RouterInfo { public static Builder builder() { return new Builder(); @@ -71,7 +71,7 @@ public class RouterInfo { } - @XmlElement(namespace = NS, name = "ExternalIp") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "ExternalIp") private String externalIp; /** diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SyslogServerSettings.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SyslogServerSettings.java index 5217ad1252..9f21d7446c 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SyslogServerSettings.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/SyslogServerSettings.java @@ -19,7 +19,7 @@ package org.jclouds.vcloud.director.v1_5.domain; import static com.google.common.base.Objects.equal; -import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.NS; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -34,7 +34,7 @@ import com.google.common.base.Objects; * * @author danikov */ -@XmlRootElement(namespace = NS, name = "SyslogServerSettings") +@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "SyslogServerSettings") @XmlAccessorType(XmlAccessType.FIELD) public class SyslogServerSettings { @@ -83,9 +83,9 @@ public class SyslogServerSettings { // For JAXB and builder use } - @XmlElement(namespace = NS, name = "SyslogServerIp1") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "SyslogServerIp1") private String syslogServerIp1; - @XmlElement(namespace = NS, name = "SyslogServerIp2") + @XmlElement(namespace = VCLOUD_1_5_NS, name = "SyslogServerIp2") private String syslogServerIp2; /** diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkClientExpectTest.java index a5c3732c7c..5d2f897f85 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkClientExpectTest.java @@ -18,7 +18,7 @@ */ package org.jclouds.vcloud.director.v1_5.features; -import static org.testng.Assert.assertEquals; +import static org.testng.Assert.*; import java.net.URI; @@ -33,6 +33,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Metadata; import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry; import org.jclouds.vcloud.director.v1_5.domain.NetworkConfiguration; import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork; +import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.domain.SyslogServerSettings; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; import org.testng.annotations.Test; @@ -51,13 +52,13 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, getStandardRequest("GET", networkRef), - getStandardPayloadResponse("/network/network.xml", VCloudDirectorMediaType.ORG_NETWORK_XML)); + getStandardPayloadResponse("/network/network.xml", VCloudDirectorMediaType.ORG_NETWORK)); OrgNetwork expected = OrgNetwork .builder() .name("internet01-Jclouds") .id("urn:vcloud:network:55a677cf-ab3f-48ae-b880-fab90421980c") - .type(VCloudDirectorMediaType.ORG_NETWORK_XML) + .type(VCloudDirectorMediaType.ORG_NETWORK) .href(URI.create("https://vcloudbeta.bluelock.com/api/network/55a677cf-ab3f-48ae-b880-fab90421980c")) .link(Link.builder() .rel("up") @@ -96,12 +97,12 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT @Test public void testWhenResponseIs2xxLoginReturnsValidMetadata() { - URI orgRef = URI.create("https://vcloudbeta.bluelock.com/api/network/55a677cf-ab3f-48ae-b880-fab90421980c"); - URI metaRef = URI.create(orgRef.toASCIIString()+"/metadata/"); + URI orgUri = URI.create(endpoint + "/network/55a677cf-ab3f-48ae-b880-fab90421980c"); + URI metaUri = URI.create(orgUri.toASCIIString() + "/metadata/"); VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, - getStandardRequest("GET", metaRef), - getStandardPayloadResponse("/network/metadata.xml", VCloudDirectorMediaType.METADATA_XML)); + getStandardRequest("GET", metaUri), + getStandardPayloadResponse("/network/metadata.xml", VCloudDirectorMediaType.METADATA)); Metadata expected = Metadata.builder() .type("application/vnd.vmware.vcloud.metadata+xml") @@ -113,21 +114,25 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT .build()) .build(); - assertEquals(client.getOrgClient().getMetadata(orgRef), expected); + // TODO change network client to use ReferenceType params + Reference orgRef = Reference.builder().href(orgUri).build(); + + assertEquals(client.getNetworkClient().getMetadata(orgUri), expected); } @Test(enabled=false) // No metadata in exemplar xml... public void testWhenResponseIs2xxLoginReturnsValidMetadataEntry() { - URI metadataRef = URI.create( - "https://vcloudbeta.bluelock.com/api/network/55a677cf-ab3f-48ae-b880-fab90421980c/metadata/KEY"); + URI metadataUri = URI.create(endpoint + "/network/55a677cf-ab3f-48ae-b880-fab90421980c/metadata/KEY"); VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, - getStandardRequest("GET", metadataRef), - getStandardPayloadResponse("/network/metadata.xml", VCloudDirectorMediaType.METADATAENTRY_XML)); + getStandardRequest("GET", metadataUri), + getStandardPayloadResponse("/network/metadata.xml", VCloudDirectorMediaType.METADATA_ENTRY)); - MetadataEntry expected = MetadataEntry.builder() - .build(); + MetadataEntry expected = MetadataEntry.builder().build(); - assertEquals(client.getOrgClient().getMetadataEntry(metadataRef), expected); + // TODO change network client to use ReferenceType params + Reference orgRef = Reference.builder().href(metadataUri).build(); + + assertEquals(client.getNetworkClient().getMetadataEntry(metadataUri), expected); } }