From 4cf75310c54c584fe4cd7eee94915767598d8d70 Mon Sep 17 00:00:00 2001 From: "adrian.f.cole" Date: Fri, 8 Jan 2010 20:30:15 +0000 Subject: [PATCH] Issue 112: updated to latest schema git-svn-id: http://jclouds.googlecode.com/svn/trunk@2618 3d8758e0-26b5-11de-8745-db77d3ebf521 --- .../vcloud/VCloudPropertiesBuilder.java | 2 +- ...antiateVAppTemplateParamsToXmlPayload.java | 7 +++---- .../jclouds/vcloud/VCloudAsyncClientTest.java | 21 ++++++++++--------- .../src/test/resources/cloneVApp-default.xml | 2 +- vcloud/core/src/test/resources/cloneVApp.xml | 2 +- .../src/test/resources/newvapp-hosting.xml | 2 +- .../resources/newvapp-hostingcpumemdisk.xml | 2 +- .../TerremarkVCloudPropertiesBuilder.java | 2 -- ...antiateVAppTemplateParamsToXmlPayload.java | 3 +-- .../TerremarkVCloudAsyncClientTest.java | 4 ++-- ...antiateVAppTemplateParams-options-test.xml | 2 +- .../InstantiateVAppTemplateParams-test.xml | 2 +- .../resources/terremark/configureVApp.xml | 2 +- 13 files changed, 25 insertions(+), 28 deletions(-) diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/VCloudPropertiesBuilder.java b/vcloud/core/src/main/java/org/jclouds/vcloud/VCloudPropertiesBuilder.java index 5afd9e75e5..93f5d6e383 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/VCloudPropertiesBuilder.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/VCloudPropertiesBuilder.java @@ -43,7 +43,7 @@ public class VCloudPropertiesBuilder extends HttpPropertiesBuilder { Properties properties = super.defaultProperties(); properties.setProperty(PROPERTY_VCLOUD_VERSION, "0.8"); properties.setProperty(PROPERTY_VCLOUD_SESSIONINTERVAL, 9 * 60 + ""); - properties.setProperty(PROPERTY_VCLOUD_XML_NAMESPACE, "http://www.vmware.com/vcloud/0.8"); + properties.setProperty(PROPERTY_VCLOUD_XML_NAMESPACE, "http://www.vmware.com/vcloud/v0.8"); properties.setProperty(PROPERTY_VCLOUD_XML_SCHEMA, "http://vcloud.safesecureweb.com/ns/vcloud.xsd"); return properties; } diff --git a/vcloud/core/src/main/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayload.java b/vcloud/core/src/main/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayload.java index b93f4230d9..48617d3d79 100644 --- a/vcloud/core/src/main/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayload.java +++ b/vcloud/core/src/main/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayload.java @@ -170,8 +170,7 @@ public class BindInstantiateVAppTemplateParamsToXmlPayload implements MapBinder Map properties) { if (properties.size() > 0) { XMLBuilder productSectionBuilder = instantiationParamsBuilder.e("ProductSection").a( - "xmlns:q1", "http://www.vmware.com/vcloud/v1").a("xmlns:ovf", - "http://schemas.dmtf.org/ovf/envelope/1"); + "xmlns:q1", ns).a("xmlns:ovf", "http://schemas.dmtf.org/ovf/envelope/1"); for (Entry entry : properties.entrySet()) { productSectionBuilder.e("Property") .a("xmlns", "http://schemas.dmtf.org/ovf/envelope/1").a("ovf:key", @@ -181,7 +180,7 @@ public class BindInstantiateVAppTemplateParamsToXmlPayload implements MapBinder } protected void addNetworkConfig(XMLBuilder instantiationParamsBuilder, String name, - String network) { + String network) { XMLBuilder networkConfigBuilder = instantiationParamsBuilder.e("NetworkConfigSection").e( "NetworkConfig").a("name", name); XMLBuilder featuresBuilder = networkConfigBuilder.e("Features"); @@ -194,7 +193,7 @@ public class BindInstantiateVAppTemplateParamsToXmlPayload implements MapBinder SortedMap virtualHardwareQuantity) { if (virtualHardwareQuantity.size() > 0) { XMLBuilder virtualHardwareSectionBuilder = instantiationParamsBuilder.e( - "VirtualHardwareSection").a("xmlns:q1", "http://www.vmware.com/vcloud/v1"); + "VirtualHardwareSection").a("xmlns:q1", ns); for (Entry entry : virtualHardwareQuantity.entrySet()) { XMLBuilder itemBuilder = virtualHardwareSectionBuilder.e("Item").a("xmlns", "http://schemas.dmtf.org/ovf/envelope/1"); diff --git a/vcloud/core/src/test/java/org/jclouds/vcloud/VCloudAsyncClientTest.java b/vcloud/core/src/test/java/org/jclouds/vcloud/VCloudAsyncClientTest.java index 47c14d0c71..246020bf76 100644 --- a/vcloud/core/src/test/java/org/jclouds/vcloud/VCloudAsyncClientTest.java +++ b/vcloud/core/src/test/java/org/jclouds/vcloud/VCloudAsyncClientTest.java @@ -85,7 +85,7 @@ public class VCloudAsyncClientTest extends RestClientTest { "POST http://vcloud/vdc/1/action/instantiateVAppTemplate HTTP/1.1"); assertHeadersEqual( httpMethod, - "Accept: application/vnd.vmware.vcloud.vApp+xml\nContent-Length: 636\nContent-Type: application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml\n"); + "Accept: application/vnd.vmware.vcloud.vApp+xml\nContent-Length: 638\nContent-Type: application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml\n"); assertPayloadEquals(httpMethod, Utils.toStringAndClose(getClass().getResourceAsStream( "/newvapp-hosting.xml"))); @@ -109,7 +109,7 @@ public class VCloudAsyncClientTest extends RestClientTest { "POST http://vcloud/vdc/1/action/instantiateVAppTemplate HTTP/1.1"); assertHeadersEqual( httpMethod, - "Accept: application/vnd.vmware.vcloud.vApp+xml\nContent-Length: 2018\nContent-Type: application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml\n"); + "Accept: application/vnd.vmware.vcloud.vApp+xml\nContent-Length: 2022\nContent-Type: application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml\n"); assertPayloadEquals(httpMethod, Utils.toStringAndClose(getClass().getResourceAsStream( "/newvapp-hostingcpumemdisk.xml"))); @@ -129,7 +129,7 @@ public class VCloudAsyncClientTest extends RestClientTest { assertRequestLineEquals(httpMethod, "POST http://vcloud/vdc/1/action/cloneVApp HTTP/1.1"); assertHeadersEqual( httpMethod, - "Accept: application/vnd.vmware.vcloud.task+xml\nContent-Length: 396\nContent-Type: application/vnd.vmware.vcloud.cloneVAppParams+xml\n"); + "Accept: application/vnd.vmware.vcloud.task+xml\nContent-Length: 398\nContent-Type: application/vnd.vmware.vcloud.cloneVAppParams+xml\n"); assertPayloadEquals(httpMethod, Utils.toStringAndClose(getClass().getResourceAsStream( "/cloneVApp-default.xml"))); @@ -150,7 +150,7 @@ public class VCloudAsyncClientTest extends RestClientTest { assertRequestLineEquals(httpMethod, "POST http://vcloud/vdc/1/action/cloneVApp HTTP/1.1"); assertHeadersEqual( httpMethod, - "Accept: application/vnd.vmware.vcloud.task+xml\nContent-Length: 459\nContent-Type: application/vnd.vmware.vcloud.cloneVAppParams+xml\n"); + "Accept: application/vnd.vmware.vcloud.task+xml\nContent-Length: 461\nContent-Type: application/vnd.vmware.vcloud.cloneVAppParams+xml\n"); assertPayloadEquals(httpMethod, Utils.toStringAndClose(getClass().getResourceAsStream( "/cloneVApp.xml"))); @@ -161,7 +161,8 @@ public class VCloudAsyncClientTest extends RestClientTest { checkFilters(httpMethod); } - public void testDefaultOrganization() throws SecurityException, NoSuchMethodException, IOException { + public void testDefaultOrganization() throws SecurityException, NoSuchMethodException, + IOException { Method method = VCloudAsyncClient.class.getMethod("getDefaultOrganization"); GeneratedHttpRequest httpMethod = processor.createRequest(method); @@ -175,7 +176,7 @@ public class VCloudAsyncClientTest extends RestClientTest { checkFilters(httpMethod); } - + public void testOrganization() throws SecurityException, NoSuchMethodException, IOException { Method method = VCloudAsyncClient.class.getMethod("getOrganization", String.class); GeneratedHttpRequest httpMethod = processor.createRequest(method, "1"); @@ -189,7 +190,7 @@ public class VCloudAsyncClientTest extends RestClientTest { assertExceptionParserClassEquals(method, null); checkFilters(httpMethod); - } + } public void testDefaultCatalog() throws SecurityException, NoSuchMethodException, IOException { Method method = VCloudAsyncClient.class.getMethod("getDefaultCatalog"); @@ -205,10 +206,10 @@ public class VCloudAsyncClientTest extends RestClientTest { checkFilters(httpMethod); } - + public void testCatalog() throws SecurityException, NoSuchMethodException, IOException { - Method method = VCloudAsyncClient.class.getMethod("getCatalog", String.class); - GeneratedHttpRequest httpMethod = processor.createRequest(method, "1"); + Method method = VCloudAsyncClient.class.getMethod("getCatalog", String.class); + GeneratedHttpRequest httpMethod = processor.createRequest(method, "1"); assertRequestLineEquals(httpMethod, "GET http://vcloud/catalog/1 HTTP/1.1"); assertHeadersEqual(httpMethod, "Accept: application/vnd.vmware.vcloud.catalog+xml\n"); diff --git a/vcloud/core/src/test/resources/cloneVApp-default.xml b/vcloud/core/src/test/resources/cloneVApp-default.xml index cfb6cb4568..fdd50cb91d 100644 --- a/vcloud/core/src/test/resources/cloneVApp-default.xml +++ b/vcloud/core/src/test/resources/cloneVApp-default.xml @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/vcloud/core/src/test/resources/cloneVApp.xml b/vcloud/core/src/test/resources/cloneVApp.xml index 9704aa1386..366a84f43c 100644 --- a/vcloud/core/src/test/resources/cloneVApp.xml +++ b/vcloud/core/src/test/resources/cloneVApp.xml @@ -1 +1 @@ -The description of the new vApp \ No newline at end of file +The description of the new vApp \ No newline at end of file diff --git a/vcloud/core/src/test/resources/newvapp-hosting.xml b/vcloud/core/src/test/resources/newvapp-hosting.xml index b7a92e3f74..0ae6d0cfb5 100644 --- a/vcloud/core/src/test/resources/newvapp-hosting.xml +++ b/vcloud/core/src/test/resources/newvapp-hosting.xml @@ -1 +1 @@ -allowInOutfalse \ No newline at end of file +allowInOutfalse \ No newline at end of file diff --git a/vcloud/core/src/test/resources/newvapp-hostingcpumemdisk.xml b/vcloud/core/src/test/resources/newvapp-hostingcpumemdisk.xml index 6533a55c3a..0941335da3 100644 --- a/vcloud/core/src/test/resources/newvapp-hostingcpumemdisk.xml +++ b/vcloud/core/src/test/resources/newvapp-hostingcpumemdisk.xml @@ -1 +1 @@ -131245129171024allowInOutfalse \ No newline at end of file +131245129171024allowInOutfalse \ No newline at end of file diff --git a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/TerremarkVCloudPropertiesBuilder.java b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/TerremarkVCloudPropertiesBuilder.java index e5d12c7f32..8b961b6ced 100644 --- a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/TerremarkVCloudPropertiesBuilder.java +++ b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/TerremarkVCloudPropertiesBuilder.java @@ -21,7 +21,6 @@ package org.jclouds.vcloud.terremark; import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_CPUCOUNT; import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_MEMORY; import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_ENDPOINT; -import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE; import java.net.URI; import java.util.Properties; @@ -39,7 +38,6 @@ public class TerremarkVCloudPropertiesBuilder extends VCloudPropertiesBuilder { Properties properties = super.defaultProperties(); properties.setProperty(PROPERTY_VCLOUD_DEFAULT_CPUCOUNT, "1"); properties.setProperty(PROPERTY_VCLOUD_DEFAULT_MEMORY, "512"); - properties.setProperty(PROPERTY_VCLOUD_XML_NAMESPACE, "http://www.vmware.com/vcloud/v1"); properties.setProperty(PROPERTY_VCLOUD_ENDPOINT, "https://services.vcloudexpress.terremark.com/api"); return properties; diff --git a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/binders/TerremarkBindInstantiateVAppTemplateParamsToXmlPayload.java b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/binders/TerremarkBindInstantiateVAppTemplateParamsToXmlPayload.java index b23ee000d5..88f571d108 100644 --- a/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/binders/TerremarkBindInstantiateVAppTemplateParamsToXmlPayload.java +++ b/vcloud/terremark/src/main/java/org/jclouds/vcloud/terremark/binders/TerremarkBindInstantiateVAppTemplateParamsToXmlPayload.java @@ -75,8 +75,7 @@ public class TerremarkBindInstantiateVAppTemplateParamsToXmlPayload extends protected void addPropertiesifPresent(XMLBuilder instantiationParamsBuilder, Map properties) { if (properties.size() == 0) { // terremark requires the product section. - instantiationParamsBuilder.e("ProductSection").a("xmlns:q1", - "http://www.vmware.com/vcloud/v1").a("xmlns:ovf", + instantiationParamsBuilder.e("ProductSection").a("xmlns:q1", ns).a("xmlns:ovf", "http://schemas.dmtf.org/ovf/envelope/1"); } else { super.addPropertiesifPresent(instantiationParamsBuilder, properties); diff --git a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/TerremarkVCloudAsyncClientTest.java b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/TerremarkVCloudAsyncClientTest.java index 7dc6b06657..eab8ee4873 100644 --- a/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/TerremarkVCloudAsyncClientTest.java +++ b/vcloud/terremark/src/test/java/org/jclouds/vcloud/terremark/TerremarkVCloudAsyncClientTest.java @@ -160,7 +160,7 @@ public class TerremarkVCloudAsyncClientTest extends RestClientTest13124512allowInOutfalse \ No newline at end of file +13124512allowInOutfalse \ No newline at end of file diff --git a/vcloud/terremark/src/test/resources/terremark/InstantiateVAppTemplateParams-test.xml b/vcloud/terremark/src/test/resources/terremark/InstantiateVAppTemplateParams-test.xml index 9d72f40449..abe9905675 100644 --- a/vcloud/terremark/src/test/resources/terremark/InstantiateVAppTemplateParams-test.xml +++ b/vcloud/terremark/src/test/resources/terremark/InstantiateVAppTemplateParams-test.xml @@ -1 +1 @@ -13124512allowInOutfalse \ No newline at end of file +13124512allowInOutfalse \ No newline at end of file diff --git a/vcloud/terremark/src/test/resources/terremark/configureVApp.xml b/vcloud/terremark/src/test/resources/terremark/configureVApp.xml index 8cc55fb06e..b98d3244aa 100644 --- a/vcloud/terremark/src/test/resources/terremark/configureVApp.xml +++ b/vcloud/terremark/src/test/resources/terremark/configureVApp.xml @@ -1 +1 @@ -
Virtual Hardware13224102401048576917209152
\ No newline at end of file +
Virtual Hardware13224102401048576917209152
\ No newline at end of file