You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ra...@apache.org on 2014/11/25 16:39:26 UTC
[01/18] stratos git commit: Jclouds vcloud api 1.8.1 clone with
custom changes
Repository: stratos
Updated Branches:
refs/heads/master ae5425eee -> 6573fbed3
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vdc-nonet.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vdc-nonet.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vdc-nonet.xml
new file mode 100644
index 0000000..eebf132
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vdc-nonet.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Vdc href="http://10.150.4.49/api/v0.8/vdc/4" name="DWPCloud"
+ xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8 http://10.150.4.49/api/v0.8/schemas/vcloud/vcloud/vdc.xsd"
+ xmlns="http://www.vmware.com/vcloud/v0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <Link rel="add" href="http://10.150.4.49/api/v0.8/vdc/4/vApps"
+ type="application/vnd.vmware.vcloud.vApp+xml" />
+ <Link rel="add" href="http://10.150.4.49/api/v0.8/vdc/4/vAppTemplates"
+ type="application/vnd.vmware.vcloud.vAppTemplate+xml" />
+ <Link rel="add" href="http://10.150.4.49/api/v0.8/vdc/4/media"
+ type="application/vnd.vmware.vcloud.media+xml" />
+ <Description>Workand Pension Apps</Description>
+ <ResourceEntities>
+ <ResourceEntity href="http://10.150.4.49/api/v0.8/vAppTemplate/1"
+ type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="ttylinux-4-ESX3" />
+ <ResourceEntity href="http://10.150.4.49/api/v0.8/vAppTemplate/3"
+ type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Win2K3" />
+ <ResourceEntity href="http://10.150.4.49/api/v0.8/vApp/7"
+ type="application/vnd.vmware.vcloud.vApp+xml" name="OracleRAC" />
+ <ResourceEntity href="http://10.150.4.49/api/v0.8/vApp/4"
+ type="application/vnd.vmware.vcloud.vApp+xml" name="Oracle" />
+ </ResourceEntities>
+</Vdc>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vdc.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vdc.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vdc.xml
new file mode 100644
index 0000000..d5df92f
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vdc.xml
@@ -0,0 +1,36 @@
+<Vdc href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32" type="application/vnd.vmware.vcloud.vdc+xml" name="Miami Environment 1" xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <Link rel="down" href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog" type="application/vnd.vmware.vcloud.catalog+xml" name="Miami Environment 1"/>
+ <Link rel="down" href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/publicIps" type="application/xml" name="Public IPs"/>
+ <Link rel="down" href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/internetServices" type="application/xml" name="Internet Services"/>
+ <Description/>
+ <StorageCapacity>
+ <Units>bytes * 10^9</Units>
+ <Allocated>100</Allocated>
+ <Used>8</Used>
+ </StorageCapacity>
+ <ComputeCapacity>
+ <Cpu>
+ <Units>hz * 10^6</Units>
+ <Allocated>5000</Allocated>
+ </Cpu>
+ <Memory>
+ <Units>bytes * 2^20</Units>
+ <Allocated>10240</Allocated>
+ </Memory>
+ <InstantiatedVmsQuota>
+ <Limit>-1</Limit>
+ <Used>-1</Used>
+ </InstantiatedVmsQuota>
+ <DeployedVmsQuota>
+ <Limit>-1</Limit>
+ <Used>-1</Used>
+ </DeployedVmsQuota>
+ </ComputeCapacity>
+ <ResourceEntities>
+ <ResourceEntity href="https://services.vcloudexpress.terremark.com/api/v0.8/vapp/15124" type="application/vnd.vmware.vcloud.vApp+xml" name="adriantest"/>
+ <ResourceEntity href="https://services.vcloudexpress.terremark.com/api/v0.8/vapp/15120" type="application/vnd.vmware.vcloud.vApp+xml" name="centos-53"/>
+ </ResourceEntities>
+ <AvailableNetworks>
+ <Network href="https://services.vcloudexpress.terremark.com/api/v0.8/network/1708" type="application/vnd.vmware.vcloud.network+xml" name="10.114.34.128/26"/>
+ </AvailableNetworks>
+</Vdc>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vdc1.0-vcd15.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vdc1.0-vcd15.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vdc1.0-vcd15.xml
new file mode 100644
index 0000000..d705891
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vdc1.0-vcd15.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Vdc xmlns="http://www.vmware.com/vcloud/v1" status="1" name="orgVDC-jclouds-Tier1-PAYG" type="application/vnd.vmware.vcloud.vdc+xml" href="https://zone.myvcloud.com/api/v1.0/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 https://zone.myvcloud.com/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.org+xml" href="https://zone.myvcloud.com/api/v1.0/org/c076f90a-397a-49fa-89b8-b294c1599cd0"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml" href="https://zone.myvcloud.com/api/v1.0/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/uploadVAppTemplate"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.media+xml" href="https://zone.myvcloud.com/api/v1.0/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/media"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml" href="https://zone.myvcloud.com/api/v1.0/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/instantiateVAppTemplate"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.cloneVAppParams+xml" href="https://zone.myvcloud.com/api/v1.0/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneVApp"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml" href="https://zone.myvcloud.com/api/v1.0/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneVAppTemplate"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.cloneMediaParams+xml" href="https://zone.myvcloud.com/api/v1.0/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneMedia"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.captureVAppParams+xml" href="https://zone.myvcloud.com/api/v1.0/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/captureVApp"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.composeVAppParams+xml" href="https://zone.myvcloud.com/api/v1.0/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/composeVApp"/>
+ <Description>Pay As You go resources for organization jclouds </Description>
+ <AllocationModel>AllocationVApp</AllocationModel>
+ <StorageCapacity>
+ <Units>MB</Units>
+ <Allocated>0</Allocated>
+ <Limit>0</Limit>
+ <Used>14336</Used>
+ <Overhead>0</Overhead>
+ </StorageCapacity>
+ <ComputeCapacity>
+ <Cpu>
+ <Units>MHz</Units>
+ <Allocated>0</Allocated>
+ <Limit>0</Limit>
+ <Used>0</Used>
+ <Overhead>0</Overhead>
+ </Cpu>
+ <Memory>
+ <Units>MB</Units>
+ <Allocated>0</Allocated>
+ <Limit>0</Limit>
+ <Used>0</Used>
+ <Overhead>0</Overhead>
+ </Memory>
+ </ComputeCapacity>
+ <ResourceEntities>
+ <ResourceEntity type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="UbuntuServer-x64-2GB" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728"/>
+ </ResourceEntities>
+ <AvailableNetworks>
+ <Network type="application/vnd.vmware.vcloud.network+xml" name="orgNet-jclouds-External" href="https://zone.myvcloud.com/api/v1.0/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1"/>
+ </AvailableNetworks>
+ <NicQuota>0</NicQuota>
+ <NetworkQuota>10</NetworkQuota>
+ <VmQuota>10</VmQuota>
+ <IsEnabled>true</IsEnabled>
+</Vdc>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/versions-vcd15.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/versions-vcd15.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/versions-vcd15.xml
new file mode 100644
index 0000000..ed24d3a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/versions-vcd15.xml
@@ -0,0 +1,906 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SupportedVersions xmlns="http://www.vmware.com/vcloud/versions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/versions https://zone.myvcloud.com/api/versions/schema/versions.xsd">
+ <VersionInfo>
+ <Version>1.0</Version>
+ <LoginUrl>https://zone.myvcloud.com/api/v1.0/login</LoginUrl>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.customizationSection+xml</MediaType>
+ <ComplexTypeName>CustomizationSectionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.catalogItem+xml</MediaType>
+ <ComplexTypeName>CatalogItemType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.networkConnectionSection+xml</MediaType>
+ <ComplexTypeName>NetworkConnectionSectionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.owner+xml</MediaType>
+ <ComplexTypeName>OwnerType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.licensingReportList+xml</MediaType>
+ <ComplexTypeName>LicensingReportListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.group+xml</MediaType>
+ <ComplexTypeName>GroupType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vdc+xml</MediaType>
+ <ComplexTypeName>AdminVdcType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.licensingReport+xml</MediaType>
+ <ComplexTypeName>LicensingReportType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.importVmAsVAppTemplateParams+xml</MediaType>
+ <ComplexTypeName>ImportVmAsVAppTemplateParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwVimServerReferences+xml</MediaType>
+ <ComplexTypeName>VMWVimServerReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vm+xml</MediaType>
+ <ComplexTypeName>VmType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml</MediaType>
+ <ComplexTypeName>UploadVAppTemplateParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.composeVAppParams+xml</MediaType>
+ <ComplexTypeName>ComposeVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.orgList+xml</MediaType>
+ <ComplexTypeName>OrgListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.cloneMediaParams+xml</MediaType>
+ <ComplexTypeName>CloneMediaParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vmPendingQuestion+xml</MediaType>
+ <ComplexTypeName>VmPendingQuestionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwHostReferences+xml</MediaType>
+ <ComplexTypeName>VMWHostReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.undeployVAppParams+xml</MediaType>
+ <ComplexTypeName>UndeployVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.leaseSettingsSection+xml</MediaType>
+ <ComplexTypeName>LeaseSettingsSectionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.network+xml</MediaType>
+ <ComplexTypeName>OrgNetworkType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.deployVAppParams+xml</MediaType>
+ <ComplexTypeName>DeployVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml</MediaType>
+ <ComplexTypeName>CloneVAppTemplateParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.media+xml</MediaType>
+ <ComplexTypeName>MediaType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwprovidervdc+xml</MediaType>
+ <ComplexTypeName>VMWProviderVdcType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vAppTemplate+xml</MediaType>
+ <ComplexTypeName>VAppTemplateType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.org+xml</MediaType>
+ <ComplexTypeName>OrgType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vApp+xml</MediaType>
+ <ComplexTypeName>VAppType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.catalog+xml</MediaType>
+ <ComplexTypeName>CatalogType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwNetworkPool+xml</MediaType>
+ <ComplexTypeName>VMWNetworkPoolType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.tasksList+xml</MediaType>
+ <ComplexTypeName>TasksListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vdcReferences+xml</MediaType>
+ <ComplexTypeName>VdcReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.screenTicket+xml</MediaType>
+ <ComplexTypeName>ScreenTicketType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.prepareHostParams+xml</MediaType>
+ <ComplexTypeName>PrepareHostParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vcloud+xml</MediaType>
+ <ComplexTypeName>VCloudType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.publishCatalogParams+xml</MediaType>
+ <ComplexTypeName>PublishCatalogParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.networkConfigSection+xml</MediaType>
+ <ComplexTypeName>NetworkConfigSectionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.resourcePoolList+xml</MediaType>
+ <ComplexTypeName>ResourcePoolListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.right+xml</MediaType>
+ <ComplexTypeName>RightType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwExtension+xml</MediaType>
+ <ComplexTypeName>VMWExtensionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.importVmAsVAppParams+xml</MediaType>
+ <ComplexTypeName>ImportVmAsVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwvirtualcenter+xml</MediaType>
+ <ComplexTypeName>VimServerType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmsObjectRefsList+xml</MediaType>
+ <ComplexTypeName>VmObjectRefsListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.controlAccess+xml</MediaType>
+ <ComplexTypeName>ControlAccessParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vdc+xml</MediaType>
+ <ComplexTypeName>VdcType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.role+xml</MediaType>
+ <ComplexTypeName>RoleType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.cloneVAppParams+xml</MediaType>
+ <ComplexTypeName>CloneVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.host+xml</MediaType>
+ <ComplexTypeName>HostType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.organization+xml</MediaType>
+ <ComplexTypeName>AdminOrgType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.providervdc+xml</MediaType>
+ <ComplexTypeName>ProviderVdcType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.user+xml</MediaType>
+ <ComplexTypeName>UserType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwProviderVdcReferences+xml</MediaType>
+ <ComplexTypeName>VMWProviderVdcReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml</MediaType>
+ <ComplexTypeName>MediaInsertOrEjectParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml</MediaType>
+ <ComplexTypeName>InstantiateVAppTemplateParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.rasdItemsList+xml</MediaType>
+ <ComplexTypeName>RasdItemsListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.task+xml</MediaType>
+ <ComplexTypeName>TaskType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwNetworkPoolReferences+xml</MediaType>
+ <ComplexTypeName>VMWNetworkPoolReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.guestCustomizationSection+xml</MediaType>
+ <ComplexTypeName>GuestCustomizationSectionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.recomposeVAppParams+xml</MediaType>
+ <ComplexTypeName>RecomposeVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.importMediaParams+xml</MediaType>
+ <ComplexTypeName>ImportMediaParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwExternalNetworkReferences+xml</MediaType>
+ <ComplexTypeName>VMWExternalNetworkReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwexternalnet+xml</MediaType>
+ <ComplexTypeName>VMWExternalNetworkType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.captureVAppParams+xml</MediaType>
+ <ComplexTypeName>CaptureVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vmPendingAnswer+xml</MediaType>
+ <ComplexTypeName>VmQuestionAnswerType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.registerVimServerParams+xml</MediaType>
+ <ComplexTypeName>RegisterVimServerParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.rasdItem+xml</MediaType>
+ <ComplexTypeName>RASD_Type</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.0/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.startupSection+xml</MediaType>
+ <ComplexTypeName>StartupSection_Type</ComplexTypeName>
+ <SchemaLocation>http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.virtualHardwareSection+xml</MediaType>
+ <ComplexTypeName>VirtualHardwareSection_Type</ComplexTypeName>
+ <SchemaLocation>http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.operatingSystemSection+xml</MediaType>
+ <ComplexTypeName>OperatingSystemSection_Type</ComplexTypeName>
+ <SchemaLocation>http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.networkSection+xml</MediaType>
+ <ComplexTypeName>NetworkSection_Type</ComplexTypeName>
+ <SchemaLocation>http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ </VersionInfo>
+ <VersionInfo>
+ <Version>1.5</Version>
+ <LoginUrl>https://zone.myvcloud.com/api/sessions</LoginUrl>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml</MediaType>
+ <ComplexTypeName>InstantiateVAppTemplateParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwProviderVdcReferences+xml</MediaType>
+ <ComplexTypeName>VMWProviderVdcReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.customizationSection+xml</MediaType>
+ <ComplexTypeName>CustomizationSectionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.prepareHostParams+xml</MediaType>
+ <ComplexTypeName>PrepareHostParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.relocateVmParams+xml</MediaType>
+ <ComplexTypeName>RelocateParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.org+xml</MediaType>
+ <ComplexTypeName>OrgType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwExternalNetworkReferences+xml</MediaType>
+ <ComplexTypeName>VMWExternalNetworkReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.networkConnectionSection+xml</MediaType>
+ <ComplexTypeName>NetworkConnectionSectionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.host+xml</MediaType>
+ <ComplexTypeName>HostType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.catalogItem+xml</MediaType>
+ <ComplexTypeName>CatalogItemType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.owner+xml</MediaType>
+ <ComplexTypeName>OwnerType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vdc+xml</MediaType>
+ <ComplexTypeName>VdcType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vdc+xml</MediaType>
+ <ComplexTypeName>AdminVdcType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.catalog+xml</MediaType>
+ <ComplexTypeName>AdminCatalogType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.recomposeVAppParams+xml</MediaType>
+ <ComplexTypeName>RecomposeVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.importVmIntoExistingVAppParams+xml</MediaType>
+ <ComplexTypeName>ImportVmIntoExistingVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.taskExtensionRequestUpdateProgressOperationParams+xml</MediaType>
+ <ComplexTypeName>TaskExtensionRequestUpdateProgressParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.catalog+xml</MediaType>
+ <ComplexTypeName>CatalogType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml</MediaType>
+ <ComplexTypeName>CloneVAppTemplateParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.providervdc+xml</MediaType>
+ <ComplexTypeName>ProviderVdcType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmsObjectRefsList+xml</MediaType>
+ <ComplexTypeName>VmObjectRefsListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.undeployVAppParams+xml</MediaType>
+ <ComplexTypeName>UndeployVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vdcReferences+xml</MediaType>
+ <ComplexTypeName>VdcReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.systemPasswordPolicySettings+xml</MediaType>
+ <ComplexTypeName>SystemPasswordPolicySettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vApp+xml</MediaType>
+ <ComplexTypeName>VAppType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.taskExtensionRequest+xml</MediaType>
+ <ComplexTypeName>TaskExtensionRequestType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vimServerNetworks+xml</MediaType>
+ <ComplexTypeName>VimObjectRefListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwprovidervdc+xml</MediaType>
+ <ComplexTypeName>VMWProviderVdcType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.orgSettings+xml</MediaType>
+ <ComplexTypeName>OrgSettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.captureVAppParams+xml</MediaType>
+ <ComplexTypeName>CaptureVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.screenTicket+xml</MediaType>
+ <ComplexTypeName>ScreenTicketType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.runtimeInfoSection+xml</MediaType>
+ <ComplexTypeName>RuntimeInfoSectionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.tasksList+xml</MediaType>
+ <ComplexTypeName>TasksListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.amqpSettingsTest+xml</MediaType>
+ <ComplexTypeName>AmqpSettingsTestType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.extensionSettings+xml</MediaType>
+ <ComplexTypeName>TaskExtensionSettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.importVmAsVAppTemplateParams+xml</MediaType>
+ <ComplexTypeName>ImportVmAsVAppTemplateParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.organizationGeneralSettings+xml</MediaType>
+ <ComplexTypeName>OrgGeneralSettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.registerVimServerParams+xml</MediaType>
+ <ComplexTypeName>RegisterVimServerParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.network+xml</MediaType>
+ <ComplexTypeName>OrgNetworkType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml</MediaType>
+ <ComplexTypeName>UploadVAppTemplateParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.datastore+xml</MediaType>
+ <ComplexTypeName>DatastoreType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.metadata+xml</MediaType>
+ <ComplexTypeName>MetadataType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.licensingReportList+xml</MediaType>
+ <ComplexTypeName>LicensingReportListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwNetworkPool+xml</MediaType>
+ <ComplexTypeName>VMWNetworkPoolType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.systemSettings+xml</MediaType>
+ <ComplexTypeName>SystemSettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwHostReferences+xml</MediaType>
+ <ComplexTypeName>VMWHostReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.taskExtensionRequestOperationParams+xml</MediaType>
+ <ComplexTypeName>TaskExtensionRequestOperationParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.metadata.value+xml</MediaType>
+ <ComplexTypeName>MetadataValueType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.taskOperationList+xml</MediaType>
+ <ComplexTypeName>TaskOperationListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.media+xml</MediaType>
+ <ComplexTypeName>MediaType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.productSections+xml</MediaType>
+ <ComplexTypeName>ProductSectionListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.amqpSettings+xml</MediaType>
+ <ComplexTypeName>AmqpSettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vAppTemplate+xml</MediaType>
+ <ComplexTypeName>VAppTemplateType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.deployVAppParams+xml</MediaType>
+ <ComplexTypeName>DeployVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.importVmIntoExistingVAppTemplateParams+xml</MediaType>
+ <ComplexTypeName>ImportVmIntoExistingVAppTemplateParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.resourcePoolList+xml</MediaType>
+ <ComplexTypeName>ResourcePoolListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.networkConfigSection+xml</MediaType>
+ <ComplexTypeName>NetworkConfigSectionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.OrganizationVdcResourcePoolSet+xml</MediaType>
+ <ComplexTypeName>OrganizationResourcePoolSetType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.organizationPasswordPolicySettings+xml</MediaType>
+ <ComplexTypeName>OrgPasswordPolicySettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.publishCatalogParams+xml</MediaType>
+ <ComplexTypeName>PublishCatalogParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwExtension+xml</MediaType>
+ <ComplexTypeName>VMWExtensionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml</MediaType>
+ <ComplexTypeName>MediaInsertOrEjectParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vmPendingQuestion+xml</MediaType>
+ <ComplexTypeName>VmPendingQuestionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.notificationsSettings+xml</MediaType>
+ <ComplexTypeName>NotificationsSettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.ldapUserSettings+xml</MediaType>
+ <ComplexTypeName>LdapUserAttributesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.right+xml</MediaType>
+ <ComplexTypeName>RightType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.ldapSettings+xml</MediaType>
+ <ComplexTypeName>LdapSettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.organization+xml</MediaType>
+ <ComplexTypeName>AdminOrgType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.orgList+xml</MediaType>
+ <ComplexTypeName>OrgListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vAppTemplateLeaseSettings+xml</MediaType>
+ <ComplexTypeName>OrgVAppTemplateLeaseSettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwVimServerReferences+xml</MediaType>
+ <ComplexTypeName>VMWVimServerReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwexternalnet+xml</MediaType>
+ <ComplexTypeName>VMWExternalNetworkType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.entity+xml</MediaType>
+ <ComplexTypeName>EntityType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.cloneMediaParams+xml</MediaType>
+ <ComplexTypeName>CloneMediaParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.licensingReport+xml</MediaType>
+ <ComplexTypeName>LicensingReportType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.importMediaParams+xml</MediaType>
+ <ComplexTypeName>ImportMediaParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.resourcePoolSetUpdateParams+xml</MediaType>
+ <ComplexTypeName>UpdateResourcePoolSetParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.taskExtensionRequestList+xml</MediaType>
+ <ComplexTypeName>ReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vmPendingAnswer+xml</MediaType>
+ <ComplexTypeName>VmQuestionAnswerType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.rasdItemsList+xml</MediaType>
+ <ComplexTypeName>RasdItemsListType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.generalSettings+xml</MediaType>
+ <ComplexTypeName>GeneralSettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwNetworkPoolReferences+xml</MediaType>
+ <ComplexTypeName>VMWNetworkPoolReferencesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.group+xml</MediaType>
+ <ComplexTypeName>GroupType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.controlAccess+xml</MediaType>
+ <ComplexTypeName>ControlAccessParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.ldapGroupSettings+xml</MediaType>
+ <ComplexTypeName>LdapGroupAttributesType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.user+xml</MediaType>
+ <ComplexTypeName>UserType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vcloud+xml</MediaType>
+ <ComplexTypeName>VCloudType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.uberAdminSettings+xml</MediaType>
+ <ComplexTypeName>UberAdminSettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwvirtualcenter+xml</MediaType>
+ <ComplexTypeName>VimServerType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.leaseSettingsSection+xml</MediaType>
+ <ComplexTypeName>LeaseSettingsSectionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.composeVAppParams+xml</MediaType>
+ <ComplexTypeName>ComposeVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.organizationEmailSettings+xml</MediaType>
+ <ComplexTypeName>OrgEmailSettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vm+xml</MediaType>
+ <ComplexTypeName>VmType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwProviderVdcResourcePoolSet+xml</MediaType>
+ <ComplexTypeName>VMWProviderVdcResourcePoolSetType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.cloneVAppParams+xml</MediaType>
+ <ComplexTypeName>CloneVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.guestCustomizationSection+xml</MediaType>
+ <ComplexTypeName>GuestCustomizationSectionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.task+xml</MediaType>
+ <ComplexTypeName>TaskType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.session+xml</MediaType>
+ <ComplexTypeName>SessionType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vAppLeaseSettings+xml</MediaType>
+ <ComplexTypeName>OrgLeaseSettingsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.importVmAsVAppParams+xml</MediaType>
+ <ComplexTypeName>ImportVmAsVAppParamsType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.role+xml</MediaType>
+ <ComplexTypeName>RoleType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.rasdItem+xml</MediaType>
+ <ComplexTypeName>RASD_Type</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.startupSection+xml</MediaType>
+ <ComplexTypeName>StartupSection_Type</ComplexTypeName>
+ <SchemaLocation>http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.virtualHardwareSection+xml</MediaType>
+ <ComplexTypeName>VirtualHardwareSection_Type</ComplexTypeName>
+ <SchemaLocation>http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.operatingSystemSection+xml</MediaType>
+ <ComplexTypeName>OperatingSystemSection_Type</ComplexTypeName>
+ <SchemaLocation>http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.networkSection+xml</MediaType>
+ <ComplexTypeName>NetworkSection_Type</ComplexTypeName>
+ <SchemaLocation>http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.vAppNetwork+xml</MediaType>
+ <ComplexTypeName>VAppNetworkType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.network+xml</MediaType>
+ <ComplexTypeName>NetworkType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.vcloud.orgNetwork+xml</MediaType>
+ <ComplexTypeName>OrgNetworkType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/master.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ <MediaTypeMapping>
+ <MediaType>application/vnd.vmware.admin.vmwexternalnet+xml</MediaType>
+ <ComplexTypeName>VMWExternalNetworkType</ComplexTypeName>
+ <SchemaLocation>https://zone.myvcloud.com/api/v1.5/schema/vmwextensions.xsd</SchemaLocation>
+ </MediaTypeMapping>
+ </VersionInfo>
+</SupportedVersions>
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/versions.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/versions.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/versions.xml
new file mode 100644
index 0000000..4651754
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/versions.xml
@@ -0,0 +1,7 @@
+<SupportedVersions xmlns="http://www.vmware.com/vcloud/versions"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <VersionInfo>
+ <Version>0.8</Version>
+ <LoginUrl>https://services.vcloudexpress.terremark.com/api/v0.8/login</LoginUrl>
+ </VersionInfo>
+</SupportedVersions>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/virtualhardwaresection.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/virtualhardwaresection.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/virtualhardwaresection.xml
new file mode 100644
index 0000000..24a0dd6
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/virtualhardwaresection.xml
@@ -0,0 +1,118 @@
+
+<ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1"
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/"
+ vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
+ <ovf:Info>Virtual hardware requirements</ovf:Info>
+ <ovf:System>
+ <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+ <vssd:InstanceID>0</vssd:InstanceID>
+ <vssd:VirtualSystemIdentifier>RHEL5</vssd:VirtualSystemIdentifier>
+ <vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
+ </ovf:System>
+ <ovf:Item>
+ <rasd:Address>00:50:56:01:01:f2</rasd:Address>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
+ <rasd:Connection vcloud:ipAddress="174.47.101.164"
+ vcloud:primaryNetworkConnection="true"
+ vcloud:ipAddressingMode="POOL">internet01</rasd:Connection>
+ <rasd:Description>PCNet32 ethernet adapter</rasd:Description>
+ <rasd:ElementName>Network adapter 0</rasd:ElementName>
+ <rasd:InstanceID>1</rasd:InstanceID>
+ <rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>SCSI Controller</rasd:Description>
+ <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
+ <rasd:InstanceID>2</rasd:InstanceID>
+ <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
+ <rasd:ResourceType>6</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:Description>Hard disk</rasd:Description>
+ <rasd:ElementName>Hard disk 1</rasd:ElementName>
+ <rasd:HostResource vcloud:capacity="30720"
+ vcloud:busType="6" vcloud:busSubType="lsilogic" />
+ <rasd:InstanceID>2000</rasd:InstanceID>
+ <rasd:Parent>2</rasd:Parent>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>IDE Controller</rasd:Description>
+ <rasd:ElementName>IDE Controller 0</rasd:ElementName>
+ <rasd:InstanceID>3</rasd:InstanceID>
+ <rasd:ResourceType>5</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>CD/DVD Drive</rasd:Description>
+ <rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
+ <rasd:HostResource />
+ <rasd:InstanceID>3002</rasd:InstanceID>
+ <rasd:Parent>3</rasd:Parent>
+ <rasd:ResourceType>15</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>Floppy Drive</rasd:Description>
+ <rasd:ElementName>Floppy Drive 1</rasd:ElementName>
+ <rasd:HostResource />
+ <rasd:InstanceID>8000</rasd:InstanceID>
+ <rasd:ResourceType>14</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu"
+ vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+ <rasd:Description>Number of Virtual CPUs</rasd:Description>
+ <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
+ <rasd:InstanceID>4</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu" />
+ </ovf:Item>
+ <ovf:Item
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory"
+ vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:ElementName>384 MB of memory</rasd:ElementName>
+ <rasd:InstanceID>5</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:VirtualQuantity>384</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory" />
+ </ovf:Item>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.virtualHardwareSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/" />
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu" />
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu" />
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory" />
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory" />
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/disks" />
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/disks" />
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/media" />
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/networkCards" />
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/networkCards" />
+</ovf:VirtualHardwareSection>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vm-rhel-off-static.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vm-rhel-off-static.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vm-rhel-off-static.xml
new file mode 100644
index 0000000..1df38a3
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vm-rhel-off-static.xml
@@ -0,0 +1,197 @@
+<Vm xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
+ xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"
+ xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"
+ deployed="false" status="8" name="RHEL5"
+ type="application/vnd.vmware.vcloud.vm+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
+ <Link rel="power:powerOn"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/power/action/powerOn" />
+ <Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/action/deploy" />
+ <Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320" />
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248" />
+ <Link rel="remove"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248" />
+ <Link rel="screen:thumbnail"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/screen" />
+ <Link rel="screen:acquireTicket"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/screen/action/acquireTicket" />
+ <Link rel="media:insertMedia"
+ type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/media/action/insertMedia" />
+ <Link rel="media:ejectMedia"
+ type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/media/action/ejectMedia" />
+ <Description />
+ <ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1"
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/"
+ vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
+ <ovf:Info>Virtual hardware requirements</ovf:Info>
+ <ovf:System>
+ <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+ <vssd:InstanceID>0</vssd:InstanceID>
+ <vssd:VirtualSystemIdentifier>RHEL5</vssd:VirtualSystemIdentifier>
+ <vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
+ </ovf:System>
+ <ovf:Item>
+ <rasd:Address>00:50:56:01:01:f2</rasd:Address>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
+ <rasd:Connection vcloud:ipAddress="174.47.101.164"
+ vcloud:primaryNetworkConnection="true"
+ vcloud:ipAddressingMode="POOL">internet01</rasd:Connection>
+ <rasd:Description>PCNet32 ethernet adapter</rasd:Description>
+ <rasd:ElementName>Network adapter 0</rasd:ElementName>
+ <rasd:InstanceID>1</rasd:InstanceID>
+ <rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>SCSI Controller</rasd:Description>
+ <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
+ <rasd:InstanceID>2</rasd:InstanceID>
+ <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
+ <rasd:ResourceType>6</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:Description>Hard disk</rasd:Description>
+ <rasd:ElementName>Hard disk 1</rasd:ElementName>
+ <rasd:HostResource vcloud:capacity="30720"
+ vcloud:busType="6" vcloud:busSubType="lsilogic" />
+ <rasd:InstanceID>2000</rasd:InstanceID>
+ <rasd:Parent>2</rasd:Parent>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>IDE Controller</rasd:Description>
+ <rasd:ElementName>IDE Controller 0</rasd:ElementName>
+ <rasd:InstanceID>3</rasd:InstanceID>
+ <rasd:ResourceType>5</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>CD/DVD Drive</rasd:Description>
+ <rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
+ <rasd:HostResource />
+ <rasd:InstanceID>3002</rasd:InstanceID>
+ <rasd:Parent>3</rasd:Parent>
+ <rasd:ResourceType>15</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>Floppy Drive</rasd:Description>
+ <rasd:ElementName>Floppy Drive 1</rasd:ElementName>
+ <rasd:HostResource />
+ <rasd:InstanceID>8000</rasd:InstanceID>
+ <rasd:ResourceType>14</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu"
+ vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+ <rasd:Description>Number of Virtual CPUs</rasd:Description>
+ <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
+ <rasd:InstanceID>4</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu" />
+ </ovf:Item>
+ <ovf:Item
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory"
+ vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:ElementName>384 MB of memory</rasd:ElementName>
+ <rasd:InstanceID>5</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:VirtualQuantity>384</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory" />
+ </ovf:Item>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.virtualHardwareSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/" />
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu" />
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu" />
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory" />
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory" />
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/disks" />
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/disks" />
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/media" />
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/networkCards" />
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/networkCards" />
+ </ovf:VirtualHardwareSection>
+ <ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1"
+ xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="80"
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/operatingSystemSection/"
+ vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml"
+ vmw:osType="rhel5_64Guest">
+ <ovf:Info>Specifies the operating system installed</ovf:Info>
+ <ovf:Description>Red Hat Enterprise Linux 5 (64-bit)</ovf:Description>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.operatingSystemSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/operatingSystemSection/" />
+ </ovf:OperatingSystemSection>
+ <NetworkConnectionSection
+ type="application/vnd.vmware.vcloud.networkConnectionSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/networkConnectionSection/"
+ ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
+ <NetworkConnection network="internet01">
+ <NetworkConnectionIndex>0</NetworkConnectionIndex>
+ <IpAddress>174.47.101.164</IpAddress>
+ <IsConnected>true</IsConnected>
+ <MACAddress>00:50:56:01:01:f2</MACAddress>
+ <IpAddressAllocationMode>POOL</IpAddressAllocationMode>
+ </NetworkConnection>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.networkConnectionSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/networkConnectionSection/" />
+ </NetworkConnectionSection>
+ <GuestCustomizationSection
+ type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/guestCustomizationSection/"
+ ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <Enabled>true</Enabled>
+ <ChangeSid>false</ChangeSid>
+ <VirtualMachineId>2087535248</VirtualMachineId>
+ <JoinDomainEnabled>false</JoinDomainEnabled>
+ <UseOrgSettings>false</UseOrgSettings>
+ <AdminPasswordEnabled>true</AdminPasswordEnabled>
+ <AdminPasswordAuto>true</AdminPasswordAuto>
+ <ResetPasswordRequired>false</ResetPasswordRequired>
+ <CustomizationScript>cat > /root/foo.txt<<EOF
+I '"love"' {asc|!}*&
+EOF
+</CustomizationScript>
+ <ComputerName>RHEL5</ComputerName>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/guestCustomizationSection/" />
+ </GuestCustomizationSection>
+ <VAppScopedLocalId>10_rhel_template</VAppScopedLocalId>
+</Vm>
\ No newline at end of file
[11/18] stratos git commit: Jclouds vcloud api 1.8.1 clone with
custom changes
Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppTemplateApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppTemplateApi.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppTemplateApi.java
new file mode 100644
index 0000000..8f4aa29
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppTemplateApi.java
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.jclouds.vcloud.VCloudMediaType.TASK_XML;
+import static org.jclouds.vcloud.VCloudMediaType.VAPPTEMPLATE_XML;
+import static org.jclouds.vcloud.VCloudMediaType.VAPP_XML;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.Fallbacks;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.ovf.Envelope;
+import org.jclouds.ovf.xml.EnvelopeHandler;
+import org.jclouds.predicates.validators.DnsNameValidator;
+import org.jclouds.rest.annotations.EndpointParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.ParamValidators;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.PayloadParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.XMLResponseParser;
+import org.jclouds.vcloud.binders.BindCaptureVAppParamsToXmlPayload;
+import org.jclouds.vcloud.binders.BindCloneVAppTemplateParamsToXmlPayload;
+import org.jclouds.vcloud.binders.BindInstantiateVAppTemplateParamsToXmlPayload;
+import org.jclouds.vcloud.binders.OrgNameCatalogNameVAppTemplateNameToEndpoint;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
+import org.jclouds.vcloud.options.CaptureVAppOptions;
+import org.jclouds.vcloud.options.CloneVAppTemplateOptions;
+import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
+import org.jclouds.vcloud.xml.TaskHandler;
+import org.jclouds.vcloud.xml.VAppHandler;
+import org.jclouds.vcloud.xml.VAppTemplateHandler;
+
+
+/**
+ * Provides access to VApp Template functionality in vCloud
+ * <p/>
+ *
+ * @see <a href="http://communities.vmware.com/community/developer/forums/vcloudapi" />
+ */
+@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
+public interface VAppTemplateApi {
+ /**
+ * returns the vapp template corresponding to a catalog item in the catalog associated with the
+ * specified name. Note that the org and catalog parameters can be null to choose default.
+ *
+ * @param orgName
+ * organization name, or null for the default
+ * @param catalogName
+ * catalog name, or null for the default
+ * @param itemName
+ * item you wish to lookup
+ *
+ * @throws NoSuchElementException
+ * if you specified an org, catalog, or catalog item name that isn't present
+ */
+ @GET
+ @Consumes(VAPPTEMPLATE_XML)
+ @XMLResponseParser(VAppTemplateHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @MapBinder(OrgNameCatalogNameVAppTemplateNameToEndpoint.class)
+ VAppTemplate findVAppTemplateInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName,
+ @Nullable @PayloadParam("catalogName") String catalogName,
+ @PayloadParam("itemName") String itemName);
+
+ /**
+ */
+ @POST
+ @Path("/action/instantiateVAppTemplate")
+ @Produces("application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")
+ @Consumes(VAPP_XML)
+ @XMLResponseParser(VAppHandler.class)
+ @MapBinder(BindInstantiateVAppTemplateParamsToXmlPayload.class)
+ VApp createVAppInVDCByInstantiatingTemplate(
+ @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String appName, @EndpointParam URI vdc,
+ @PayloadParam("template") URI template, InstantiateVAppTemplateOptions... options);
+
+ @POST
+ @Path("/action/cloneVAppTemplate")
+ @Produces("application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml")
+ @Consumes(TASK_XML)
+ @XMLResponseParser(TaskHandler.class)
+ @MapBinder(BindCloneVAppTemplateParamsToXmlPayload.class)
+ Task copyVAppTemplateToVDCAndName(@PayloadParam("Source") URI sourceVAppTemplate,
+ @EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName,
+ CloneVAppTemplateOptions... options);
+
+ @POST
+ @Path("/action/cloneVAppTemplate")
+ @Produces("application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml")
+ @Consumes(TASK_XML)
+ @XMLResponseParser(TaskHandler.class)
+ @PayloadParams(keys = "IsSourceDelete", values = "true")
+ @MapBinder(BindCloneVAppTemplateParamsToXmlPayload.class)
+ Task moveVAppTemplateToVDCAndRename(@PayloadParam("Source") URI toClone,
+ @EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName,
+ CloneVAppTemplateOptions... options);
+
+ /**
+ * The captureVApp request creates a vApp template from an instantiated vApp. <h4>Note</h4>
+ * Before it can be captured, a vApp must be undeployed
+ *
+ * @param targetVdcHref
+ * @param sourceVAppHref
+ * @param newTemplateName
+ * @param options
+ * @return template in progress
+ */
+ @POST
+ @Path("/action/captureVApp")
+ @Produces("application/vnd.vmware.vcloud.captureVAppParams+xml")
+ @Consumes(VAPPTEMPLATE_XML)
+ @XMLResponseParser(VAppTemplateHandler.class)
+ @MapBinder(BindCaptureVAppParamsToXmlPayload.class)
+ VAppTemplate captureVAppAsTemplateInVDC(@PayloadParam("vApp") URI toCapture,
+ @PayloadParam("templateName") @ParamValidators(DnsNameValidator.class) String templateName,
+ @EndpointParam URI vdc, CaptureVAppOptions... options);
+
+ @GET
+ @Consumes(VAPPTEMPLATE_XML)
+ @XMLResponseParser(VAppTemplateHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ VAppTemplate getVAppTemplate(@EndpointParam URI vAppTemplate);
+
+ @GET
+ @Consumes(MediaType.TEXT_XML)
+ @Path("/ovf")
+ @XMLResponseParser(EnvelopeHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ Envelope getOvfEnvelopeForVAppTemplate(@EndpointParam URI href);
+
+ /**
+ * delete a vAppTemplate, vApp, or media image. You cannot delete an object if it is in use. Any
+ * object that is being copied or moved is in use. Other criteria that determine whether an
+ * object is in use depend on the object type.
+ * <ul>
+ * <li>A vApptemplate is in use if it is being instantiated. After instantiation is complete, the
+ * template is no longer in use.</li>
+ * <li>A vApp is in use if it is deployed.</li>
+ * <li>A media image is in use if it is inserted in a Vm.</li>
+ * </ul>
+ *
+ * @param id
+ * href of the vApp
+ * @return task of the operation in progress
+ */
+ @DELETE
+ @Consumes(TASK_XML)
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ @XMLResponseParser(TaskHandler.class)
+ Task deleteVAppTemplate(@EndpointParam URI href);
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VDCApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VDCApi.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VDCApi.java
new file mode 100644
index 0000000..7b02798
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VDCApi.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.jclouds.vcloud.VCloudMediaType.VDC_XML;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+
+import org.jclouds.Fallbacks;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.rest.annotations.EndpointParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.XMLResponseParser;
+import org.jclouds.vcloud.binders.OrgNameAndVDCNameToEndpoint;
+import org.jclouds.vcloud.domain.VDC;
+import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
+import org.jclouds.vcloud.xml.VDCHandler;
+
+
+/**
+ * Provides access to VDC functionality in vCloud
+ * <p/>
+ */
+@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
+public interface VDCApi {
+ @GET
+ @XMLResponseParser(VDCHandler.class)
+ @Consumes(VDC_XML)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ VDC getVDC(@EndpointParam URI vdc);
+
+ /**
+ * returns the VDC in the organization associated with the specified name. Note that both
+ * parameters can be null to choose default.
+ *
+ * @param orgName
+ * organization name, or null for the default
+ * @param vdcName
+ * catalog name, or null for the default
+ * @throws NoSuchElementException
+ * if you specified an org or vdc name that isn't present
+ */
+ @GET
+ @XMLResponseParser(VDCHandler.class)
+ @Consumes(VDC_XML)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @MapBinder(OrgNameAndVDCNameToEndpoint.class)
+ VDC findVDCInOrgNamed(@Nullable @PayloadParam("orgName") String orgName,
+ @Nullable @PayloadParam("vdcName") String vdcName);
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VmApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VmApi.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VmApi.java
new file mode 100644
index 0000000..8aa186e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VmApi.java
@@ -0,0 +1,293 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.jclouds.vcloud.VCloudMediaType.DEPLOYVAPPPARAMS_XML;
+import static org.jclouds.vcloud.VCloudMediaType.GUESTCUSTOMIZATIONSECTION_XML;
+import static org.jclouds.vcloud.VCloudMediaType.NETWORKCONNECTIONSECTION_XML;
+import static org.jclouds.vcloud.VCloudMediaType.RASDITEM_XML;
+import static org.jclouds.vcloud.VCloudMediaType.TASK_XML;
+import static org.jclouds.vcloud.VCloudMediaType.UNDEPLOYVAPPPARAMS_XML;
+import static org.jclouds.vcloud.VCloudMediaType.VM_XML;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+import org.jclouds.Fallbacks;
+import org.jclouds.rest.annotations.BinderParam;
+import org.jclouds.rest.annotations.EndpointParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.PayloadParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.XMLResponseParser;
+import org.jclouds.vcloud.binders.BindCPUCountToXmlPayload;
+import org.jclouds.vcloud.binders.BindDeployVAppParamsToXmlPayload;
+import org.jclouds.vcloud.binders.BindGuestCustomizationSectionToXmlPayload;
+import org.jclouds.vcloud.binders.BindMemoryToXmlPayload;
+import org.jclouds.vcloud.binders.BindNetworkConnectionSectionToXmlPayload;
+import org.jclouds.vcloud.binders.BindUndeployVAppParamsToXmlPayload;
+import org.jclouds.vcloud.domain.GuestCustomizationSection;
+import org.jclouds.vcloud.domain.NetworkConnectionSection;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
+import org.jclouds.vcloud.xml.TaskHandler;
+import org.jclouds.vcloud.xml.VmHandler;
+
+
+/**
+ * Provides access to VM functionality in vCloud
+ * <p/>
+ */
+@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
+public interface VmApi {
+
+ @GET
+ @Consumes(VM_XML)
+ @XMLResponseParser(VmHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ Vm getVm(@EndpointParam URI href);
+
+ /**
+ * To deploy a vApp, the client makes a request to its action/deploy URL. Deploying a vApp
+ * automatically deploys all of the virtual machines it contains. To deploy a virtual machine,
+ * the client makes a request to its action/deploy URL.
+ * <p/>
+ * Deploying a Vm implicitly deploys the parent vApp if that vApp is not already deployed.
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Produces(DEPLOYVAPPPARAMS_XML)
+ @Path("/action/deploy")
+ @MapBinder(BindDeployVAppParamsToXmlPayload.class)
+ @XMLResponseParser(TaskHandler.class)
+ Task deployVm(@EndpointParam URI href);
+
+ /**
+ * like {@link #deploy(URI)}, except deploy transitions to power on state
+ *
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Produces(DEPLOYVAPPPARAMS_XML)
+ @Path("/action/deploy")
+ @MapBinder(BindDeployVAppParamsToXmlPayload.class)
+ @PayloadParams(keys = "powerOn", values = "true")
+ @XMLResponseParser(TaskHandler.class)
+ Task deployAndPowerOnVm(@EndpointParam URI href);
+
+ /**
+ * Undeploying a vApp powers off or suspends any running virtual machines it contains, then frees
+ * the resources reserved for the vApp and sets the vApp’s deploy attribute to a value of false
+ * to indicate that it is not deployed.
+ * <p/>
+ * Undeploying a virtual machine powers off or suspends the virtual machine, then frees the
+ * resources reserved for it and sets the its deploy attribute to a value of false to indicate
+ * that it is not deployed. This operation has no effect on the containing vApp.
+ * <h4>NOTE</h4>
+ * Using this method will simply power off the vms. In order to save their state, use
+ * {@link #undeployAndSaveStateOf}
+ *
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Produces(UNDEPLOYVAPPPARAMS_XML)
+ @Path("/action/undeploy")
+ @MapBinder(BindUndeployVAppParamsToXmlPayload.class)
+ @XMLResponseParser(TaskHandler.class)
+ Task undeployVm(@EndpointParam URI href);
+
+ /**
+ * like {@link #undeploy(URI)}, where the undeployed virtual machines are suspended and their
+ * suspend state saved
+ *
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Produces(UNDEPLOYVAPPPARAMS_XML)
+ @Path("/action/undeploy")
+ @MapBinder(BindUndeployVAppParamsToXmlPayload.class)
+ @PayloadParams(keys = "saveState", values = "true")
+ @XMLResponseParser(TaskHandler.class)
+ Task undeployAndSaveStateOfVm(@EndpointParam URI href);
+
+ /**
+ * A powerOn request to a vApp URL powers on all of the virtual machines in the vApp, as
+ * specified in the vApp’s StartupSection field.
+ * <p/>
+ * A powerOn request to a virtual machine URL powers on the specified virtual machine and forces
+ * deployment of the parent vApp.
+ * <p/>
+ * <h4>NOTE</h4> A powerOn request to a vApp or virtual machine that is undeployed forces
+ * deployment.
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Path("/power/action/powerOn")
+ @XMLResponseParser(TaskHandler.class)
+ Task powerOnVm(@EndpointParam URI href);
+
+ /**
+ * A powerOff request to a vApp URL powers off all of the virtual machines in the vApp, as
+ * specified in its StartupSection field.
+ * <p/>
+ * A powerOff request to a virtual machine URL powers off the specified virtual machine.
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Path("/power/action/powerOff")
+ @XMLResponseParser(TaskHandler.class)
+ Task powerOffVm(@EndpointParam URI href);
+
+ /**
+ * A shutdown request to a vApp URL shuts down all of the virtual machines in the vApp, as
+ * specified in its StartupSection field.
+ * <p/>
+ * A shutdown request to a virtual machine URL shuts down the specified virtual machine.
+ * <p/>
+ * <h4>NOTE</h4Because this request sends a signal to the guest OS, the vCloud API cannot track
+ * the progress or verify the result of the requested operation. Hence, void is returned
+ */
+ @POST
+ @Path("/power/action/shutdown")
+ void shutdownVm(@EndpointParam URI href);
+
+ /**
+ * A reset request to a vApp URL resets all of the virtual machines in the vApp, as specified in
+ * its StartupSection field.
+ * <p/>
+ * A reset request to a virtual machine URL resets the specified virtual machine.
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Path("/power/action/reset")
+ @XMLResponseParser(TaskHandler.class)
+ Task resetVm(@EndpointParam URI href);
+
+ /**
+ * A reboot request to a vApp URL reboots all of the virtual machines in the vApp, as specified
+ * in its StartupSection field.
+ * <p/>
+ * A reboot request to a virtual machine URL reboots the specified virtual machine.
+ * <p/>
+ * <h4>NOTE</h4> Because this request sends a signal to the guest OS, the vCloud API cannot track
+ * the progress or verify the result of the requested operation. Hence, void is returned
+ */
+ @POST
+ @Path("/power/action/reboot")
+ void rebootVm(@EndpointParam URI href);
+
+ /**
+ * A suspend request to a vApp URL suspends all of the virtual machines in the vApp, as specified
+ * in its StartupSection field.
+ * <p/>
+ * A suspend request to a virtual machine URL suspends the specified virtual machine.
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Path("/power/action/suspend")
+ @XMLResponseParser(TaskHandler.class)
+ Task suspendVm(@EndpointParam URI href);
+
+ /**
+ * Get a Screen Thumbnail for a Virtual Machine
+ *
+ * @param href
+ * to snapshot
+ */
+ @GET
+ @Path("/screen")
+ @Consumes("image/png")
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ InputStream getScreenThumbnailForVm(@EndpointParam URI vm);
+
+ /**
+ * Modify the Guest Customization Section of a Virtual Machine
+ *
+ * @param href
+ * uri to modify
+ * @param updated
+ * guestCustomizationSection
+ * @return task in progress
+ */
+ @PUT
+ @Consumes(TASK_XML)
+ @Produces(GUESTCUSTOMIZATIONSECTION_XML)
+ @Path("/guestCustomizationSection")
+ @XMLResponseParser(TaskHandler.class)
+ Task updateGuestCustomizationOfVm(
+ @BinderParam(BindGuestCustomizationSectionToXmlPayload.class) GuestCustomizationSection guestCustomizationSection,
+ @EndpointParam URI href);
+
+ /**
+ * Modify the Network Connection Section of a Virtual Machine
+ *
+ * @param href
+ * uri to modify
+ * @param updated
+ * networkConnectionSection
+ * @return task in progress
+ */
+ @PUT
+ @Consumes(TASK_XML)
+ @Produces(NETWORKCONNECTIONSECTION_XML)
+ @Path("/networkConnectionSection")
+ @XMLResponseParser(TaskHandler.class)
+ Task updateNetworkConnectionOfVm(
+ @BinderParam(BindNetworkConnectionSectionToXmlPayload.class) NetworkConnectionSection networkConnectionSection,
+ @EndpointParam URI href);
+
+ /**
+ * update the cpuCount of an existing VM
+ *
+ * @param href
+ * to update
+ * @param cpuCount
+ * count to change the primary cpu to
+ */
+ @PUT
+ @Consumes(TASK_XML)
+ @Produces(RASDITEM_XML)
+ @Path("/virtualHardwareSection/cpu")
+ @XMLResponseParser(TaskHandler.class)
+ Task updateCPUCountOfVm(@BinderParam(BindCPUCountToXmlPayload.class) int cpuCount,
+ @EndpointParam URI href);
+
+ /**
+ * update the memoryInMB of an existing VM
+ *
+ * @param href
+ * to update
+ * @param memoryInMB
+ * memory in MB to assign to the VM
+ */
+ @PUT
+ @Consumes(TASK_XML)
+ @Produces(RASDITEM_XML)
+ @Path("/virtualHardwareSection/memory")
+ @XMLResponseParser(TaskHandler.class)
+ Task updateMemoryMBOfVm(@BinderParam(BindMemoryToXmlPayload.class) int memoryInMB,
+ @EndpointParam URI href);
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequest.java
new file mode 100644
index 0000000..1d3ba5d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequest.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.filters;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpException;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpRequestFilter;
+import org.jclouds.rest.annotations.ApiVersion;
+import org.jclouds.vcloud.VCloudToken;
+
+import com.google.common.base.Supplier;
+import com.google.common.collect.ImmutableMultimap;
+import com.google.common.net.HttpHeaders;
+
+/**
+ * Adds the VCloud Token to the request as a cookie
+ */
+@Singleton
+public class AddVCloudAuthorizationAndCookieToRequest implements HttpRequestFilter {
+ private Supplier<String> vcloudTokenProvider;
+ private final String apiVersion;
+
+ @Inject
+ public AddVCloudAuthorizationAndCookieToRequest(@VCloudToken Supplier<String> authTokenProvider, @ApiVersion final String apiVersion) {
+ this.vcloudTokenProvider = authTokenProvider;
+ this.apiVersion = apiVersion;
+ }
+
+ @Override
+ public HttpRequest filter(HttpRequest request) throws HttpException {
+ String token = vcloudTokenProvider.get();
+ String acceptType = request.getFirstHeaderOrNull(HttpHeaders.ACCEPT) == null
+ ? "application/*+xml"
+ : request.getFirstHeaderOrNull(HttpHeaders.ACCEPT);
+ String version = ";version=" + apiVersion;
+ String acceptHeader = acceptType + version;
+ return request.toBuilder()
+ .replaceHeaders(ImmutableMultimap.of(HttpHeaders.ACCEPT,
+ acceptHeader, "x-vcloud-authorization", token,
+ HttpHeaders.COOKIE, "vcloud-token=" +
+ token)).build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInCatalog.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInCatalog.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInCatalog.java
new file mode 100644
index 0000000..db18f9e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInCatalog.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.functions;
+
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Iterables.transform;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Catalog;
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.domain.ReferenceType;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+
+@Singleton
+public class CatalogItemsInCatalog implements Function<Catalog, Iterable<CatalogItem>> {
+ @Resource
+ public Logger logger = Logger.NULL;
+
+ private final VCloudApi aclient;
+
+ @Inject
+ CatalogItemsInCatalog(VCloudApi aclient) {
+ this.aclient = aclient;
+ }
+
+ @Override
+ public Iterable<CatalogItem> apply(Catalog from) {
+ return transform(filter(from.values(), new Predicate<ReferenceType>() {
+ public boolean apply(ReferenceType input) {
+ return input.getType().equals(VCloudMediaType.CATALOGITEM_XML);
+ }
+ }), new Function<ReferenceType, CatalogItem>() {
+ public CatalogItem apply(ReferenceType from) {
+ return aclient.getCatalogApi().getCatalogItem(from.getHref());
+ }
+ });
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInOrg.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInOrg.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInOrg.java
new file mode 100644
index 0000000..f6ccf7d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogItemsInOrg.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.functions;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.vcloud.domain.Catalog;
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.domain.Org;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Iterables;
+
+@Singleton
+public class CatalogItemsInOrg implements Function<Org, Iterable<CatalogItem>> {
+
+ private final Function<Org, Iterable<Catalog>> allCatalogsInOrg;
+
+ private final Function<Catalog, Iterable<CatalogItem>> allCatalogItemsInCatalog;
+
+ @Inject
+ CatalogItemsInOrg(Function<Org, Iterable<Catalog>> allCatalogsInOrg,
+ Function<Catalog, Iterable<CatalogItem>> allCatalogItemsInCatalog) {
+ this.allCatalogsInOrg = allCatalogsInOrg;
+ this.allCatalogItemsInCatalog = allCatalogItemsInCatalog;
+ }
+
+ @Override
+ public Iterable<CatalogItem> apply(Org from) {
+ return Iterables.concat(Iterables.transform(allCatalogsInOrg.apply(from),
+ new Function<Catalog, Iterable<? extends CatalogItem>>() {
+ @Override
+ public Iterable<? extends CatalogItem> apply(Catalog from) {
+ return allCatalogItemsInCatalog.apply(from);
+ }
+
+ }));
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogsInOrg.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogsInOrg.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogsInOrg.java
new file mode 100644
index 0000000..917f651
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/CatalogsInOrg.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.functions;
+
+import static com.google.common.collect.Iterables.transform;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.ImmutableSet;
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.domain.Catalog;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+
+import com.google.common.base.Function;
+
+import java.util.Collection;
+
+@Singleton
+public class CatalogsInOrg implements Function<Org, Iterable<Catalog>> {
+ @Resource
+ public Logger logger = Logger.NULL;
+
+ private final VCloudApi aclient;
+
+ @Inject
+ CatalogsInOrg(VCloudApi aclient) {
+ this.aclient = aclient;
+ }
+
+ @Override
+ public Iterable<Catalog> apply(final Org org) {
+ Collection<ReferenceType> filtered = Collections2.filter(
+ org.getCatalogs().values(), new Predicate<ReferenceType>() {
+ @Override
+ public boolean apply(ReferenceType type) {
+ if (type == null) {
+ return false;
+ }
+ return !ImmutableSet.of("add", "remove").contains(type.getRelationship());
+ }
+ });
+
+ return transform(filtered, new Function<ReferenceType, Catalog>() {
+ public Catalog apply(ReferenceType from) {
+ return aclient.getCatalogApi().getCatalog(from.getHref());
+ }
+ });
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/DefaultNetworkNameInTemplate.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/DefaultNetworkNameInTemplate.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/DefaultNetworkNameInTemplate.java
new file mode 100644
index 0000000..eeecb8d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/DefaultNetworkNameInTemplate.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.functions;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.collect.Iterables.get;
+
+import java.util.Set;
+
+import javax.annotation.Resource;
+import javax.inject.Singleton;
+
+import org.jclouds.logging.Logger;
+import org.jclouds.ovf.Network;
+import org.jclouds.vcloud.domain.VAppTemplate;
+
+import com.google.common.base.Function;
+
+@Singleton
+public class DefaultNetworkNameInTemplate implements Function<VAppTemplate, String> {
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ @Override
+ public String apply(VAppTemplate vAppTemplate) {
+ checkArgument(vAppTemplate != null, "vAppTemplate was null!");
+ Set<Network> networks = vAppTemplate.getNetworkSection().getNetworks();
+ checkArgument(networks.size() > 0, "no networks found in vAppTemplate %s", vAppTemplate);
+ if (networks.size() > 1)
+ logger.warn("multiple networks found for %s, choosing first from: %s", vAppTemplate.getName(), networks);
+ return get(networks, 0).getName();
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/NetworksInOrg.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/NetworksInOrg.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/NetworksInOrg.java
new file mode 100644
index 0000000..25c18a1
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/NetworksInOrg.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.functions;
+
+import static com.google.common.collect.Iterables.transform;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.network.OrgNetwork;
+
+import com.google.common.base.Function;
+
+@Singleton
+public class NetworksInOrg implements Function<Org, Iterable<OrgNetwork>> {
+ @Resource
+ public Logger logger = Logger.NULL;
+
+ private final VCloudApi aclient;
+
+ @Inject
+ NetworksInOrg(VCloudApi aclient) {
+ this.aclient = aclient;
+ }
+
+ @Override
+ public Iterable<OrgNetwork> apply(final Org org) {
+ return transform(org.getNetworks().values(), new Function<ReferenceType, OrgNetwork>() {
+ public OrgNetwork apply(ReferenceType from) {
+ return aclient.getNetworkApi().getNetwork(from.getHref());
+ }
+ });
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgNameToEndpoint.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgNameToEndpoint.java
new file mode 100644
index 0000000..bc762a5
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgNameToEndpoint.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.functions;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.Org;
+
+import com.google.common.base.Function;
+import com.google.common.base.Supplier;
+
+@Singleton
+public class OrgNameToEndpoint implements Function<Object, URI> {
+ private final Supplier<Map<String, ReferenceType>> orgNameToEndpointSupplier;
+ private final Supplier<ReferenceType> defaultOrg;
+
+ @Inject
+ public OrgNameToEndpoint(@Org Supplier<Map<String, ReferenceType>> orgNameToEndpointSupplier,
+ @Org Supplier<ReferenceType> defaultOrg) {
+ this.orgNameToEndpointSupplier = orgNameToEndpointSupplier;
+ this.defaultOrg = defaultOrg;
+ }
+
+ public URI apply(Object from) {
+ try {
+ Map<String, ReferenceType> orgNameToEndpoint = orgNameToEndpointSupplier.get();
+ return from == null ? defaultOrg.get().getHref() : orgNameToEndpoint.get(from).getHref();
+ } catch (NullPointerException e) {
+ throw new NoSuchElementException("org " + from + " not found in " + orgNameToEndpointSupplier.get().keySet());
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgNameToTasksListEndpoint.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgNameToTasksListEndpoint.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgNameToTasksListEndpoint.java
new file mode 100644
index 0000000..1d3fc4a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgNameToTasksListEndpoint.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.TasksList;
+
+import com.google.common.base.Function;
+import com.google.common.base.Supplier;
+
+@Singleton
+public class OrgNameToTasksListEndpoint implements Function<Object, URI> {
+ private final Supplier<Map<String, Org>> orgMap;
+ private final Supplier<ReferenceType> defaultTasksList;
+
+ @Inject
+ public OrgNameToTasksListEndpoint(Supplier<Map<String, Org>> orgMap,
+ @TasksList Supplier<ReferenceType> defaultTasksList) {
+ this.orgMap = orgMap;
+ this.defaultTasksList = defaultTasksList;
+ }
+
+ public URI apply(Object from) {
+ Object org = from;
+ if (org == null)
+ return defaultTasksList.get().getHref();
+ try {
+ return checkNotNull(orgMap.get().get(org)).getTasksList().getHref();
+ } catch (NullPointerException e) {
+ throw new NoSuchElementException(org + " not found in " + orgMap.get());
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java
new file mode 100644
index 0000000..72be2f6
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.functions;
+
+import static com.google.common.collect.Iterables.transform;
+
+import java.net.URI;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.domain.Org;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.collect.FluentIterable;
+
+@Singleton
+public class OrgsForLocations implements Function<Iterable<Location>, Iterable<Org>> {
+ @Resource
+ public Logger logger = Logger.NULL;
+ private final VCloudApi aclient;
+
+ @Inject
+ OrgsForLocations(VCloudApi aclient) {
+ this.aclient = aclient;
+ }
+
+ /**
+ * Zones are assignable, but we want regions. so we look for zones, whose
+ * parent is region. then, we use a set to extract the unique set.
+ */
+ @Override
+ public Iterable<Org> apply(Iterable<Location> from) {
+ FluentIterable<URI> uris = FluentIterable.from(from).filter(new Predicate<Location>() {
+ public boolean apply(Location input) {
+ return input.getScope() == LocationScope.ZONE;
+ }
+ }).transform(new Function<Location, URI>() {
+ public URI apply(Location from) {
+ return URI.create(from.getParent().getId());
+ }
+ });
+ return transform(uris, new Function<URI, Org>() {
+ public Org apply(URI from) {
+ return aclient.getOrgApi().getOrg(from);
+ }
+ });
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgsForNames.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgsForNames.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgsForNames.java
new file mode 100644
index 0000000..ce3cd9e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/OrgsForNames.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.functions;
+
+import static com.google.common.collect.Iterables.transform;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.domain.Org;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicates;
+import com.google.common.collect.Iterables;
+
+@Singleton
+public class OrgsForNames implements Function<Iterable<String>, Iterable<Org>> {
+ @Resource
+ public Logger logger = Logger.NULL;
+ private final VCloudApi aclient;
+
+ @Inject
+ OrgsForNames(VCloudApi aclient) {
+ this.aclient = aclient;
+ }
+
+ @Override
+ public Iterable<Org> apply(Iterable<String> from) {
+ return Iterables.filter(transform(from, new Function<String, Org>() {
+ public Org apply(String from) {
+ return aclient.getOrgApi().findOrgNamed(from);
+ }
+ }), Predicates.notNull());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeaders.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeaders.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeaders.java
new file mode 100644
index 0000000..d9900fd
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeaders.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.functions;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.http.HttpUtils.releasePayload;
+
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.inject.Inject;
+import javax.inject.Provider;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.HttpResponseException;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.vcloud.VCloudToken;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VCloudSession;
+import org.jclouds.vcloud.endpoints.Org;
+import org.jclouds.vcloud.xml.OrgListHandler;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicates;
+import com.google.common.collect.Iterables;
+import com.google.common.net.HttpHeaders;
+
+/**
+ * This parses {@link VCloudSession} from HTTP headers.
+ */
+@Singleton
+public class ParseLoginResponseFromHeaders implements Function<HttpResponse, VCloudSession> {
+ static final Pattern pattern = Pattern.compile("(vcloud-token)=?([^;]+)(;.*)?");
+
+ private final ParseSax.Factory factory;
+ private final Provider<OrgListHandler> orgHandlerProvider;
+
+ @Inject
+ private ParseLoginResponseFromHeaders(Factory factory, Provider<OrgListHandler> orgHandlerProvider) {
+ this.factory = factory;
+ this.orgHandlerProvider = orgHandlerProvider;
+ }
+
+ /**
+ * parses the http response headers to create a new {@link VCloudSession} object.
+ */
+ public VCloudSession apply(HttpResponse from) {
+ try {
+ final String token = parseTokenFromHeaders(from);
+ final Map<String, ReferenceType> org = factory.create(orgHandlerProvider.get()).parse(
+ checkNotNull(from.getPayload().getInput(), "no payload in http response to login request %s", from));
+
+ return new VCloudSession() {
+ @VCloudToken
+ public String getVCloudToken() {
+ return token;
+ }
+
+ @Org
+ public Map<String, ReferenceType> getOrgs() {
+ return org;
+ }
+ };
+ } finally {
+ releasePayload(from);
+ }
+ }
+
+ public String parseTokenFromHeaders(HttpResponse from) {
+ String cookieHeader = from.getFirstHeaderOrNull("x-vcloud-authorization");
+ if (cookieHeader != null) {
+ Matcher matcher = pattern.matcher(cookieHeader);
+ return matcher.find() ? matcher.group(2) : cookieHeader;
+ } else {
+ try {
+ cookieHeader = Iterables.find(from.getHeaders().get(HttpHeaders.SET_COOKIE), Predicates.contains(pattern));
+ Matcher matcher = pattern.matcher(cookieHeader);
+ matcher.find();
+ return matcher.group(2);
+ } catch (NoSuchElementException e) {
+ throw new HttpResponseException(String.format("Header %s or %s must be present", "x-vcloud-authorization",
+ HttpHeaders.SET_COOKIE), null, from);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java
new file mode 100644
index 0000000..d3a6a9b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.functions;
+
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Iterables.transform;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.domain.VAppTemplate;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
+
+@Singleton
+public class VAppTemplatesForCatalogItems implements Function<Iterable<CatalogItem>, Iterable<VAppTemplate>> {
+ @Resource
+ @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+ private Logger logger = Logger.NULL;
+ private final VCloudApi aclient;
+
+ @Inject
+ VAppTemplatesForCatalogItems(VCloudApi aclient) {
+ this.aclient = aclient;
+ }
+
+ @Override
+ public Iterable<VAppTemplate> apply(Iterable<CatalogItem> from) {
+ return filter(transform(filter(from, new Predicate<CatalogItem>() {
+ public boolean apply(CatalogItem input) {
+ return input.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML);
+ }
+ }), new Function<CatalogItem, VAppTemplate>() {
+ public VAppTemplate apply(CatalogItem from) {
+ return aclient.getVAppTemplateApi().getVAppTemplate(from.getEntity().getHref());
+ }
+ }), Predicates.notNull());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesInOrg.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesInOrg.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesInOrg.java
new file mode 100644
index 0000000..992c2af
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesInOrg.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.functions;
+
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.notNull;
+import static com.google.common.collect.Iterables.filter;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.VAppTemplate;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.collect.ImmutableSet;
+
+@Singleton
+public class VAppTemplatesInOrg implements Function<Org, Iterable<VAppTemplate>> {
+
+ private final Function<Org, Iterable<CatalogItem>> allCatalogItemsInOrg;
+ private final Function<Iterable<CatalogItem>, Iterable<VAppTemplate>> vAppTemplatesForCatalogItems;
+
+ @Inject
+ VAppTemplatesInOrg(Function<Org, Iterable<CatalogItem>> allCatalogItemsInOrg,
+ Function<Iterable<CatalogItem>, Iterable<VAppTemplate>> vAppTemplatesForCatalogItems) {
+ this.allCatalogItemsInOrg = allCatalogItemsInOrg;
+ this.vAppTemplatesForCatalogItems = vAppTemplatesForCatalogItems;
+ }
+
+ @Override
+ public Iterable<VAppTemplate> apply(Org from) {
+ Iterable<CatalogItem> catalogs = allCatalogItemsInOrg.apply(from);
+ Iterable<VAppTemplate> vAppTemplates = vAppTemplatesForCatalogItems.apply(catalogs);
+ return filter(vAppTemplates, and(notNull(), new Predicate<VAppTemplate>() {
+ @Override
+ public boolean apply(VAppTemplate input) {
+ if (input == null)
+ return false;
+ return ImmutableSet.of(Status.RESOLVED, Status.OFF).contains(input.getStatus());
+ }
+ }));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/VDCsInOrg.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/VDCsInOrg.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/VDCsInOrg.java
new file mode 100644
index 0000000..4457233
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/functions/VDCsInOrg.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.functions;
+
+import static com.google.common.collect.Iterables.transform;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VDC;
+
+import com.google.common.base.Function;
+
+@Singleton
+public class VDCsInOrg implements Function<Org, Iterable<VDC>> {
+ @Resource
+ public Logger logger = Logger.NULL;
+
+ private final VCloudApi aclient;
+
+ @Inject
+ VDCsInOrg(VCloudApi aclient) {
+ this.aclient = aclient;
+ }
+
+ @Override
+ public Iterable<VDC> apply(final Org org) {
+ return transform(org.getVDCs().values(), new Function<ReferenceType, VDC>() {
+ public VDC apply(ReferenceType from) {
+ return aclient.getVDCApi().getVDC(from.getHref());
+ }
+ });
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponse.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponse.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponse.java
new file mode 100644
index 0000000..2c9f96f
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponse.java
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.handlers;
+
+import static org.jclouds.http.HttpUtils.releasePayload;
+
+import java.io.IOException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpCommand;
+import org.jclouds.http.HttpErrorHandler;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.HttpResponseException;
+import org.jclouds.logging.Logger;
+import org.jclouds.rest.AuthorizationException;
+import org.jclouds.rest.ResourceNotFoundException;
+import org.jclouds.util.Strings2;
+import org.jclouds.vcloud.VCloudResponseException;
+import org.jclouds.vcloud.domain.VCloudError;
+import org.jclouds.vcloud.domain.VCloudError.MinorCode;
+import org.jclouds.vcloud.util.VCloudUtils;
+
+/**
+ * This will parse and set an appropriate exception on the command object.
+ */
+@Singleton
+public class ParseVCloudErrorFromHttpResponse implements HttpErrorHandler {
+ @Resource
+ protected Logger logger = Logger.NULL;
+ public static final Pattern RESOURCE_PATTERN = Pattern.compile(".*/v[^/]+/([^/]+)/([0-9]+)");
+ private final VCloudUtils utils;
+
+ @Inject
+ public ParseVCloudErrorFromHttpResponse(VCloudUtils utils) {
+ this.utils = utils;
+ }
+
+ public void handleError(HttpCommand command, HttpResponse response) {
+ HttpRequest request = command.getCurrentRequest();
+ Exception exception = new HttpResponseException(command, response);
+ try {
+ VCloudError error = null;
+ String message = null;
+ if (response.getPayload() != null) {
+ try {
+ error = utils.parseErrorFromContent(request, response);
+ if (error != null) {
+ message = error.getMessage();
+ exception = new VCloudResponseException(command, response, error);
+ } else {
+ message = Strings2.toStringAndClose(response.getPayload().openStream());
+ exception = message != null ? new HttpResponseException(command, response, message) : exception;
+ }
+ } catch (IOException e) {
+ } finally {
+ response.getPayload().release();
+ }
+ }
+ message = message != null ? message : String.format("%s -> %s", request.getRequestLine(), response
+ .getStatusLine());
+
+ switch (response.getStatusCode()) {
+ case 400:
+ if (error != null
+ && ((error.getMinorErrorCode() != null && error.getMinorErrorCode() == MinorCode.BUSY_ENTITY)
+ || (error.getMessage() != null && error.getMessage().indexOf("is not running") != -1)))
+ exception = new IllegalStateException(message, exception);
+ else
+ exception = new IllegalArgumentException(message, exception);
+ break;
+ case 401:
+ case 403:
+ if (error != null
+ && ((error.getMinorErrorCode() != null && error.getMinorErrorCode() == MinorCode.ACCESS_TO_RESOURCE_IS_FORBIDDEN)
+ || (error.getMessage() != null && error.getMessage().indexOf("No access to entity") != -1)))
+ exception = new ResourceNotFoundException(message, exception);
+ else
+ exception = new AuthorizationException(exception.getMessage(), exception);
+ break;
+ case 404:
+ if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
+ String path = command.getCurrentRequest().getEndpoint().getPath();
+ Matcher matcher = RESOURCE_PATTERN.matcher(path);
+ if (matcher.find()) {
+ message = String.format("%s %s not found", matcher.group(1), matcher.group(2));
+ } else {
+ message = path;
+ }
+ exception = new ResourceNotFoundException(message);
+ }
+ break;
+ }
+ } finally {
+ releasePayload(response);
+ command.setException(exception);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/http/filters/VCloudBasicAuthentication.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/http/filters/VCloudBasicAuthentication.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/http/filters/VCloudBasicAuthentication.java
new file mode 100644
index 0000000..a333874
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/http/filters/VCloudBasicAuthentication.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.http.filters;
+
+import com.google.common.base.Preconditions;
+import com.google.common.base.Supplier;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import org.jclouds.domain.Credentials;
+import org.jclouds.http.HttpException;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpRequest.Builder;
+import org.jclouds.http.HttpRequestFilter;
+import org.jclouds.http.filters.BasicAuthentication;
+import org.jclouds.location.Provider;
+import org.jclouds.rest.annotations.ApiVersion;
+
+@Singleton
+public class VCloudBasicAuthentication implements HttpRequestFilter
+{
+ private final Supplier<Credentials> creds;
+ private final String apiVersion;
+
+ @Inject
+ public VCloudBasicAuthentication(@Provider Supplier<Credentials> creds, @ApiVersion String apiVersion)
+ {
+ this.creds = ((Supplier)Preconditions.checkNotNull(creds, "creds"));
+ this.apiVersion = apiVersion;
+ }
+
+ public HttpRequest filter(HttpRequest request) throws HttpException
+ {
+ Credentials currentCreds = (Credentials)Preconditions.checkNotNull(this.creds.get(), "credential supplier returned null");
+ String acceptType = request.getFirstHeaderOrNull("Accept") == null ? "application/*+xml" : request.getFirstHeaderOrNull("Accept");
+
+ String version = ";version=" + this.apiVersion;
+ String acceptHeader = acceptType + version;
+
+ request = ((HttpRequest.Builder)request.toBuilder().replaceHeader("Accept", new String[] { acceptHeader })).build();
+
+ return ((HttpRequest.Builder)request.toBuilder().replaceHeader("Authorization", new String[] { BasicAuthentication.basic(currentCreds.identity, currentCreds.credential) })).build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/http/filters/VCloudSupportedVersions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/http/filters/VCloudSupportedVersions.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/http/filters/VCloudSupportedVersions.java
new file mode 100644
index 0000000..3769fda
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/http/filters/VCloudSupportedVersions.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.http.filters;
+
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpException;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpRequestFilter;
+
+@Singleton
+public class VCloudSupportedVersions implements HttpRequestFilter
+{
+ @SuppressWarnings("rawtypes")
+public HttpRequest filter(HttpRequest request)
+ throws HttpException
+ {
+ return ((HttpRequest.Builder)request.toBuilder().replaceHeader("Accept", new String[] { "*/*" })).build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/internal/VCloudLoginApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/internal/VCloudLoginApi.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/internal/VCloudLoginApi.java
new file mode 100644
index 0000000..74a7be4
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/internal/VCloudLoginApi.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.internal;
+
+import java.io.Closeable;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+
+import org.jclouds.http.filters.BasicAuthentication;
+import org.jclouds.rest.annotations.Endpoint;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.ResponseParser;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.VCloudSession;
+import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders;
+import org.jclouds.vcloud.http.filters.VCloudBasicAuthentication;
+
+@Endpoint(org.jclouds.vcloud.endpoints.VCloudLogin.class)
+@RequestFilters(VCloudBasicAuthentication.class)
+public interface VCloudLoginApi extends Closeable {
+
+ /**
+ * This request returns a token to use in subsequent requests. After 30 minutes of inactivity,
+ * the token expires and you have to request a new token with this call.
+ */
+ @POST
+ @ResponseParser(ParseLoginResponseFromHeaders.class)
+ @Consumes({VCloudMediaType.SESSION_XML,VCloudMediaType.ORGLIST_XML})
+ VCloudSession login();
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/loaders/OVFLoader.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/loaders/OVFLoader.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/loaders/OVFLoader.java
new file mode 100644
index 0000000..f004f97
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/loaders/OVFLoader.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.loaders;
+
+import java.net.URI;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.logging.Logger;
+import org.jclouds.ovf.Envelope;
+import org.jclouds.vcloud.VCloudApi;
+
+import com.google.common.cache.CacheLoader;
+
+@Singleton
+public class OVFLoader extends CacheLoader<URI, Envelope> {
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ private final VCloudApi client;
+
+ @Inject
+ OVFLoader(VCloudApi client) {
+ this.client = client;
+ }
+
+ @Override
+ public Envelope load(URI template) {
+ return client.getVAppTemplateApi().getOvfEnvelopeForVAppTemplate(template);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/loaders/VAppTemplateLoader.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/loaders/VAppTemplateLoader.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/loaders/VAppTemplateLoader.java
new file mode 100644
index 0000000..ee707db
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/loaders/VAppTemplateLoader.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.loaders;
+
+import java.net.URI;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.domain.VAppTemplate;
+
+import com.google.common.cache.CacheLoader;
+
+@Singleton
+public class VAppTemplateLoader extends CacheLoader<URI, VAppTemplate> {
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ private final VCloudApi client;
+
+ @Inject
+ VAppTemplateLoader(VCloudApi client) {
+ this.client = client;
+ }
+
+ @Override
+ public VAppTemplate load(URI template) {
+ return client.getVAppTemplateApi().getVAppTemplate(template);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/location/DefaultVDC.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/location/DefaultVDC.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/location/DefaultVDC.java
new file mode 100644
index 0000000..38fb340
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/location/DefaultVDC.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.location;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.collect.Iterables.find;
+
+import java.util.Set;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.collect.Memoized;
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.location.suppliers.ImplicitLocationSupplier;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.VDC;
+
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+
+@Singleton
+public class DefaultVDC implements ImplicitLocationSupplier {
+ private final Supplier<Set<? extends Location>> locationsSupplier;
+ private final IsDefaultVDC isDefaultVDC;
+
+ @Inject
+ DefaultVDC(@Memoized Supplier<Set<? extends Location>> locationsSupplier, IsDefaultVDC isDefaultVDC) {
+ this.locationsSupplier = checkNotNull(locationsSupplier, "locationsSupplierSupplier");
+ this.isDefaultVDC = checkNotNull(isDefaultVDC, "isDefaultVDC");
+ }
+
+ @Override
+ public Location get() {
+ return find(locationsSupplier.get(), isDefaultVDC);
+ }
+
+
+ @Singleton
+ public static class IsDefaultVDC implements Predicate<Location> {
+ private final Supplier<ReferenceType> defaultVDCSupplier;
+
+ @Inject
+ IsDefaultVDC(@VDC Supplier<ReferenceType> defaultVDCSupplier) {
+ this.defaultVDCSupplier = checkNotNull(defaultVDCSupplier, "defaultVDCSupplier");
+ }
+
+ @Override
+ public boolean apply(Location input) {
+ ReferenceType defaultVDC = defaultVDCSupplier.get();
+ return input.getScope() == LocationScope.ZONE && input.getId().equals(defaultVDC.getHref().toASCIIString());
+ }
+
+ @Override
+ public String toString() {
+ return "isDefaultVDC()";
+ }
+ }
+}
[12/18] stratos git commit: Jclouds vcloud api 1.8.1 clone with
custom changes
Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/EditableResourceAllocationSettingData.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/EditableResourceAllocationSettingData.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/EditableResourceAllocationSettingData.java
new file mode 100644
index 0000000..b12be86
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/EditableResourceAllocationSettingData.java
@@ -0,0 +1,298 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.ovf;
+
+import java.util.List;
+
+import org.jclouds.cim.ResourceAllocationSettingData;
+import org.jclouds.vcloud.domain.ReferenceType;
+
+public class EditableResourceAllocationSettingData extends ResourceAllocationSettingData {
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder toBuilder() {
+ return builder().fromEditableResourceAllocationSettingData(this);
+ }
+
+ public static class Builder extends ResourceAllocationSettingData.Builder {
+ private ReferenceType edit;
+
+ /**
+ * @see EditableResourceAllocationSettingData#getEdit
+ */
+ public Builder edit(ReferenceType edit) {
+ this.edit = edit;
+ return this;
+ }
+
+ public EditableResourceAllocationSettingData build() {
+ return new EditableResourceAllocationSettingData(elementName, instanceID, caption, description, address,
+ addressOnParent, allocationUnits, automaticAllocation, automaticDeallocation, consumerVisibility, limit,
+ mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType,
+ virtualQuantity, virtualQuantityUnits, weight, connections, hostResources, edit);
+ }
+
+ public Builder fromEditableResourceAllocationSettingData(EditableResourceAllocationSettingData in) {
+ return edit(in.getEdit()).fromResourceAllocationSettingData(in);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder caption(String caption) {
+ return Builder.class.cast(super.caption(caption));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder description(String description) {
+ return Builder.class.cast(super.description(description));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder elementName(String elementName) {
+ return Builder.class.cast(super.elementName(elementName));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder instanceID(String instanceID) {
+ return Builder.class.cast(super.instanceID(instanceID));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder address(String address) {
+ return Builder.class.cast(super.address(address));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder addressOnParent(String addressOnParent) {
+ return Builder.class.cast(super.addressOnParent(addressOnParent));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder allocationUnits(String allocationUnits) {
+ return Builder.class.cast(super.allocationUnits(allocationUnits));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder automaticAllocation(Boolean automaticAllocation) {
+ return Builder.class.cast(super.automaticAllocation(automaticAllocation));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder automaticDeallocation(Boolean automaticDeallocation) {
+ return Builder.class.cast(super.automaticDeallocation(automaticDeallocation));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder connection(String connection) {
+ return Builder.class.cast(super.connection(connection));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder connections(List<String> connections) {
+ return Builder.class.cast(super.connections(connections));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder consumerVisibility(ConsumerVisibility consumerVisibility) {
+ return Builder.class.cast(super.consumerVisibility(consumerVisibility));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder hostResource(String hostResource) {
+ return Builder.class.cast(super.hostResource(hostResource));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder hostResources(List<String> hostResources) {
+ return Builder.class.cast(super.hostResources(hostResources));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder limit(Long limit) {
+ return Builder.class.cast(super.limit(limit));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder mappingBehavior(MappingBehavior mappingBehavior) {
+ return Builder.class.cast(super.mappingBehavior(mappingBehavior));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder otherResourceType(String otherResourceType) {
+ return Builder.class.cast(super.otherResourceType(otherResourceType));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder parent(String parent) {
+ return Builder.class.cast(super.parent(parent));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder poolID(String poolID) {
+ return Builder.class.cast(super.poolID(poolID));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder reservation(Long reservation) {
+ return Builder.class.cast(super.reservation(reservation));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder resourceSubType(String resourceSubType) {
+ return Builder.class.cast(super.resourceSubType(resourceSubType));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder resourceType(org.jclouds.cim.ResourceAllocationSettingData.ResourceType resourceType) {
+ return Builder.class.cast(super.resourceType(resourceType));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder virtualQuantity(Long virtualQuantity) {
+ return Builder.class.cast(super.virtualQuantity(virtualQuantity));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder virtualQuantityUnits(String virtualQuantityUnits) {
+ return Builder.class.cast(super.virtualQuantityUnits(virtualQuantityUnits));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder weight(Integer weight) {
+ return Builder.class.cast(super.weight(weight));
+ }
+
+ @Override
+ public Builder fromResourceAllocationSettingData(ResourceAllocationSettingData in) {
+ return Builder.class.cast(super.fromResourceAllocationSettingData(in));
+ }
+
+ }
+
+ private final ReferenceType edit;
+
+ public EditableResourceAllocationSettingData(String elementName, String instanceID, String caption,
+ String description, String address, String addressOnParent, String allocationUnits,
+ Boolean automaticAllocation, Boolean automaticDeallocation, ConsumerVisibility consumerVisibility, Long limit,
+ MappingBehavior mappingBehavior, String otherResourceType, String parent, String poolID, Long reservation,
+ String resourceSubType, org.jclouds.cim.ResourceAllocationSettingData.ResourceType resourceType,
+ Long virtualQuantity, String virtualQuantityUnits, Integer weight, List<String> connections,
+ List<String> hostResources, ReferenceType edit) {
+ super(elementName, instanceID, caption, description, address, addressOnParent, allocationUnits,
+ automaticAllocation, automaticDeallocation, consumerVisibility, limit, mappingBehavior, otherResourceType,
+ parent, poolID, reservation, resourceSubType, resourceType, virtualQuantity, virtualQuantityUnits, weight,
+ connections, hostResources);
+ this.edit = edit;
+ }
+
+ public ReferenceType getEdit() {
+ return edit;
+ }
+
+ @Override
+ public String toString() {
+ return String
+ .format(
+ "[elementName=%s, instanceID=%s, caption=%s, description=%s, address=%s, addressOnParent=%s, allocationUnits=%s, automaticAllocation=%s, automaticDeallocation=%s, connections=%s, consumerVisibility=%s, hostResources=%s, limit=%s, mappingBehavior=%s, otherResourceType=%s, parent=%s, poolID=%s, reservation=%s, resourceSubType=%s, resourceType=%s, virtualQuantity=%s, virtualQuantityUnits=%s, weight=%s, edit=%s]",
+ elementName, instanceID, caption, description, address, addressOnParent, allocationUnits,
+ automaticAllocation, automaticDeallocation, connections, consumerVisibility, hostResources, limit,
+ mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType,
+ virtualQuantity, virtualQuantityUnits, weight, edit);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudHardDisk.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudHardDisk.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudHardDisk.java
new file mode 100644
index 0000000..b281785
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudHardDisk.java
@@ -0,0 +1,326 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.ovf;
+
+import java.util.List;
+
+import org.jclouds.cim.ResourceAllocationSettingData;
+
+public class VCloudHardDisk extends ResourceAllocationSettingData {
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder toBuilder() {
+ return builder().fromVCloudHardDisk(this);
+ }
+
+ public static class Builder extends ResourceAllocationSettingData.Builder {
+ private long capacity;
+ private int busType;
+ private String busSubType;
+
+ /**
+ * @see VCloudHardDisk#getCapacity
+ */
+ public Builder capacity(long capacity) {
+ this.capacity = capacity;
+ return this;
+ }
+
+ /**
+ * @see VCloudHardDisk#getBusType
+ */
+ public Builder busType(int busType) {
+ this.busType = busType;
+ return this;
+ }
+
+ /**
+ * @see VCloudHardDisk#getBusSubType
+ */
+ public Builder busSubType(String busSubType) {
+ this.busSubType = busSubType;
+ return this;
+ }
+
+ public VCloudHardDisk build() {
+ return new VCloudHardDisk(elementName, instanceID, caption, description, address, addressOnParent,
+ allocationUnits, automaticAllocation, automaticDeallocation, consumerVisibility, limit, mappingBehavior,
+ otherResourceType, parent, poolID, reservation, resourceSubType, resourceType, virtualQuantity,
+ virtualQuantityUnits, weight, connections, hostResources, capacity, busType, busSubType);
+ }
+
+ public Builder fromVCloudHardDisk(VCloudHardDisk in) {
+ return capacity(in.getCapacity()).busType(in.getBusType()).busSubType(in.getBusSubType())
+ .fromResourceAllocationSettingData(in);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder caption(String caption) {
+ return Builder.class.cast(super.caption(caption));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder description(String description) {
+ return Builder.class.cast(super.description(description));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder elementName(String elementName) {
+ return Builder.class.cast(super.elementName(elementName));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder instanceID(String instanceID) {
+ return Builder.class.cast(super.instanceID(instanceID));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder address(String address) {
+ return Builder.class.cast(super.address(address));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder addressOnParent(String addressOnParent) {
+ return Builder.class.cast(super.addressOnParent(addressOnParent));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder allocationUnits(String allocationUnits) {
+ return Builder.class.cast(super.allocationUnits(allocationUnits));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder automaticAllocation(Boolean automaticAllocation) {
+ return Builder.class.cast(super.automaticAllocation(automaticAllocation));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder automaticDeallocation(Boolean automaticDeallocation) {
+ return Builder.class.cast(super.automaticDeallocation(automaticDeallocation));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder connection(String connection) {
+ return Builder.class.cast(super.connection(connection));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder connections(List<String> connections) {
+ return Builder.class.cast(super.connections(connections));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder consumerVisibility(ConsumerVisibility consumerVisibility) {
+ return Builder.class.cast(super.consumerVisibility(consumerVisibility));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder hostResource(String hostResource) {
+ return Builder.class.cast(super.hostResource(hostResource));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder hostResources(List<String> hostResources) {
+ return Builder.class.cast(super.hostResources(hostResources));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder limit(Long limit) {
+ return Builder.class.cast(super.limit(limit));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder mappingBehavior(MappingBehavior mappingBehavior) {
+ return Builder.class.cast(super.mappingBehavior(mappingBehavior));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder otherResourceType(String otherResourceType) {
+ return Builder.class.cast(super.otherResourceType(otherResourceType));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder parent(String parent) {
+ return Builder.class.cast(super.parent(parent));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder poolID(String poolID) {
+ return Builder.class.cast(super.poolID(poolID));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder reservation(Long reservation) {
+ return Builder.class.cast(super.reservation(reservation));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder resourceSubType(String resourceSubType) {
+ return Builder.class.cast(super.resourceSubType(resourceSubType));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder resourceType(org.jclouds.cim.ResourceAllocationSettingData.ResourceType resourceType) {
+ return Builder.class.cast(super.resourceType(resourceType));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder virtualQuantity(Long virtualQuantity) {
+ return Builder.class.cast(super.virtualQuantity(virtualQuantity));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder virtualQuantityUnits(String virtualQuantityUnits) {
+ return Builder.class.cast(super.virtualQuantityUnits(virtualQuantityUnits));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder weight(Integer weight) {
+ return Builder.class.cast(super.weight(weight));
+ }
+
+ @Override
+ public Builder fromResourceAllocationSettingData(ResourceAllocationSettingData in) {
+ return Builder.class.cast(super.fromResourceAllocationSettingData(in));
+ }
+ }
+
+ private final long capacity;
+ private final int busType;
+ private final String busSubType;
+
+ public VCloudHardDisk(String elementName, String instanceID, String caption, String description, String address,
+ String addressOnParent, String allocationUnits, Boolean automaticAllocation, Boolean automaticDeallocation,
+ ConsumerVisibility consumerVisibility, Long limit, MappingBehavior mappingBehavior, String otherResourceType,
+ String parent, String poolID, Long reservation, String resourceSubType,
+ org.jclouds.cim.ResourceAllocationSettingData.ResourceType resourceType, Long virtualQuantity,
+ String virtualQuantityUnits, Integer weight, List<String> connections, List<String> hostResources,
+ long capacity, int busType, String busSubType) {
+ super(elementName, instanceID, caption, description, address, addressOnParent, allocationUnits,
+ automaticAllocation, automaticDeallocation, consumerVisibility, limit, mappingBehavior, otherResourceType,
+ parent, poolID, reservation, resourceSubType, resourceType, virtualQuantity, virtualQuantityUnits, weight,
+ connections, hostResources);
+ this.capacity = capacity;
+ this.busType = busType;
+ this.busSubType = busSubType;
+ }
+
+ public long getCapacity() {
+ return capacity;
+ }
+
+ public int getBusType() {
+ return busType;
+ }
+
+ public String getBusSubType() {
+ return busSubType;
+ }
+
+ @Override
+ public String toString() {
+ return String
+ .format(
+ "[elementName=%s, instanceID=%s, caption=%s, description=%s, address=%s, addressOnParent=%s, allocationUnits=%s, automaticAllocation=%s, automaticDeallocation=%s, connections=%s, consumerVisibility=%s, hostResources=%s, limit=%s, mappingBehavior=%s, otherResourceType=%s, parent=%s, poolID=%s, reservation=%s, resourceSubType=%s, resourceType=%s, virtualQuantity=%s, virtualQuantityUnits=%s, weight=%s, busSubType=%s, busType=%s, capacity=%s]",
+ elementName, instanceID, caption, description, address, addressOnParent, allocationUnits,
+ automaticAllocation, automaticDeallocation, connections, consumerVisibility, hostResources, limit,
+ mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType,
+ virtualQuantity, virtualQuantityUnits, weight, busSubType, busType, capacity);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudNetworkAdapter.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudNetworkAdapter.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudNetworkAdapter.java
new file mode 100644
index 0000000..7a48916
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudNetworkAdapter.java
@@ -0,0 +1,328 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.ovf;
+
+import java.util.List;
+
+import org.jclouds.cim.ResourceAllocationSettingData;
+
+public class VCloudNetworkAdapter extends ResourceAllocationSettingData {
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder toBuilder() {
+ return builder().fromVCloudNetworkAdapter(this);
+ }
+
+ public static class Builder extends ResourceAllocationSettingData.Builder {
+ private String ipAddress;
+ private boolean primaryNetworkConnection;
+ private String ipAddressingMode;
+
+ /**
+ * @see VCloudNetworkAdapter#getCapacity
+ */
+ public Builder ipAddress(String ipAddress) {
+ this.ipAddress = ipAddress;
+ return this;
+ }
+
+ /**
+ * @see VCloudNetworkAdapter#getBusType
+ */
+ public Builder primaryNetworkConnection(boolean primaryNetworkConnection) {
+ this.primaryNetworkConnection = primaryNetworkConnection;
+ return this;
+ }
+
+ /**
+ * @see VCloudNetworkAdapter#getBusSubType
+ */
+ public Builder ipAddressingMode(String ipAddressingMode) {
+ this.ipAddressingMode = ipAddressingMode;
+ return this;
+ }
+
+ public VCloudNetworkAdapter build() {
+ return new VCloudNetworkAdapter(elementName, instanceID, caption, description, address, addressOnParent,
+ allocationUnits, automaticAllocation, automaticDeallocation, consumerVisibility, limit,
+ mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType,
+ virtualQuantity, virtualQuantityUnits, weight, connections, hostResources, ipAddress,
+ primaryNetworkConnection, ipAddressingMode);
+ }
+
+ public Builder fromVCloudNetworkAdapter(VCloudNetworkAdapter in) {
+ return ipAddress(in.getIpAddress()).primaryNetworkConnection(in.isPrimaryNetworkConnection())
+ .ipAddressingMode(in.getIpAddressingMode()).fromResourceAllocationSettingData(in);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder caption(String caption) {
+ return Builder.class.cast(super.caption(caption));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder description(String description) {
+ return Builder.class.cast(super.description(description));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder elementName(String elementName) {
+ return Builder.class.cast(super.elementName(elementName));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder instanceID(String instanceID) {
+ return Builder.class.cast(super.instanceID(instanceID));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder address(String address) {
+ return Builder.class.cast(super.address(address));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder addressOnParent(String addressOnParent) {
+ return Builder.class.cast(super.addressOnParent(addressOnParent));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder allocationUnits(String allocationUnits) {
+ return Builder.class.cast(super.allocationUnits(allocationUnits));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder automaticAllocation(Boolean automaticAllocation) {
+ return Builder.class.cast(super.automaticAllocation(automaticAllocation));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder automaticDeallocation(Boolean automaticDeallocation) {
+ return Builder.class.cast(super.automaticDeallocation(automaticDeallocation));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder connection(String connection) {
+ return Builder.class.cast(super.connection(connection));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder connections(List<String> connections) {
+ return Builder.class.cast(super.connections(connections));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder consumerVisibility(ConsumerVisibility consumerVisibility) {
+ return Builder.class.cast(super.consumerVisibility(consumerVisibility));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder hostResource(String hostResource) {
+ return Builder.class.cast(super.hostResource(hostResource));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder hostResources(List<String> hostResources) {
+ return Builder.class.cast(super.hostResources(hostResources));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder limit(Long limit) {
+ return Builder.class.cast(super.limit(limit));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder mappingBehavior(MappingBehavior mappingBehavior) {
+ return Builder.class.cast(super.mappingBehavior(mappingBehavior));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder otherResourceType(String otherResourceType) {
+ return Builder.class.cast(super.otherResourceType(otherResourceType));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder parent(String parent) {
+ return Builder.class.cast(super.parent(parent));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder poolID(String poolID) {
+ return Builder.class.cast(super.poolID(poolID));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder reservation(Long reservation) {
+ return Builder.class.cast(super.reservation(reservation));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder resourceSubType(String resourceSubType) {
+ return Builder.class.cast(super.resourceSubType(resourceSubType));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder resourceType(org.jclouds.cim.ResourceAllocationSettingData.ResourceType resourceType) {
+ return Builder.class.cast(super.resourceType(resourceType));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder virtualQuantity(Long virtualQuantity) {
+ return Builder.class.cast(super.virtualQuantity(virtualQuantity));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder virtualQuantityUnits(String virtualQuantityUnits) {
+ return Builder.class.cast(super.virtualQuantityUnits(virtualQuantityUnits));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder weight(Integer weight) {
+ return Builder.class.cast(super.weight(weight));
+ }
+
+ @Override
+ public Builder fromResourceAllocationSettingData(ResourceAllocationSettingData in) {
+ return Builder.class.cast(super.fromResourceAllocationSettingData(in));
+ }
+ }
+
+ private final String ipAddress;
+ private final boolean primaryNetworkConnection;
+ private final String ipAddressingMode;
+
+ public VCloudNetworkAdapter(String elementName, String instanceID, String caption, String description,
+ String address, String addressOnParent, String allocationUnits, Boolean automaticAllocation,
+ Boolean automaticDeallocation, ConsumerVisibility consumerVisibility, Long limit,
+ MappingBehavior mappingBehavior, String otherResourceType, String parent, String poolID, Long reservation,
+ String resourceSubType, org.jclouds.cim.ResourceAllocationSettingData.ResourceType resourceType,
+ Long virtualQuantity, String virtualQuantityUnits, Integer weight, List<String> connections,
+ List<String> hostResources, String ipAddress, boolean primaryNetworkConnection, String ipAddressingMode) {
+ super(elementName, instanceID, caption, description, address, addressOnParent, allocationUnits,
+ automaticAllocation, automaticDeallocation, consumerVisibility, limit, mappingBehavior,
+ otherResourceType, parent, poolID, reservation, resourceSubType, resourceType, virtualQuantity,
+ virtualQuantityUnits, weight, connections, hostResources);
+ this.ipAddress = ipAddress;
+ this.primaryNetworkConnection = primaryNetworkConnection;
+ this.ipAddressingMode = ipAddressingMode;
+ }
+
+ public String getIpAddress() {
+ return ipAddress;
+ }
+
+ public boolean isPrimaryNetworkConnection() {
+ return primaryNetworkConnection;
+ }
+
+ public String getIpAddressingMode() {
+ return ipAddressingMode;
+ }
+
+ @Override
+ public String toString() {
+ return String
+ .format(
+ "[elementName=%s, instanceID=%s, caption=%s, description=%s, address=%s, addressOnParent=%s, allocationUnits=%s, automaticAllocation=%s, automaticDeallocation=%s, connections=%s, consumerVisibility=%s, hostResources=%s, limit=%s, mappingBehavior=%s, otherResourceType=%s, parent=%s, poolID=%s, reservation=%s, resourceSubType=%s, resourceType=%s, virtualQuantity=%s, virtualQuantityUnits=%s, weight=%s, ipAddressingMode=%s, primaryNetworkConnection=%s, ipAddress=%s]",
+ elementName, instanceID, caption, description, address, addressOnParent, allocationUnits,
+ automaticAllocation, automaticDeallocation, connections, consumerVisibility, hostResources,
+ limit, mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType,
+ resourceType, virtualQuantity, virtualQuantityUnits, weight, ipAddressingMode,
+ primaryNetworkConnection, ipAddress);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudNetworkSection.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudNetworkSection.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudNetworkSection.java
new file mode 100644
index 0000000..64dddc5
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudNetworkSection.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.ovf;
+
+import java.net.URI;
+
+import org.jclouds.ovf.Network;
+import org.jclouds.ovf.NetworkSection;
+
+/**
+ * VCloud extension
+ */
+public class VCloudNetworkSection extends NetworkSection {
+ protected final String type;
+ protected final URI href;
+
+ public VCloudNetworkSection(String type, URI href, String info, Iterable<Network> networks) {
+ super(info, networks);
+ this.type = type;
+ this.href = href;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public URI getHref() {
+ return href;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((href == null) ? 0 : href.hashCode());
+ result = prime * result + ((type == null) ? 0 : type.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ VCloudNetworkSection other = (VCloudNetworkSection) obj;
+ if (href == null) {
+ if (other.href != null)
+ return false;
+ } else if (!href.equals(other.href))
+ return false;
+ if (type == null) {
+ if (other.type != null)
+ return false;
+ } else if (!type.equals(other.type))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "[href=" + getHref() + ", type=" + getType() + ", info=" + getInfo() + ", networks=" + getNetworks() + "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudOperatingSystemSection.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudOperatingSystemSection.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudOperatingSystemSection.java
new file mode 100644
index 0000000..052eadd
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudOperatingSystemSection.java
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.ovf;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.ovf.OperatingSystemSection;
+import org.jclouds.vcloud.domain.ReferenceType;
+
+/**
+ * A description of the operating system supported by a virtual machine.
+ */
+public class VCloudOperatingSystemSection extends OperatingSystemSection {
+ protected final String type;
+ protected final URI href;
+ @Nullable
+ protected final String vmwOsType;
+ protected final ReferenceType edit;
+
+ public VCloudOperatingSystemSection(@Nullable Integer id, @Nullable String info, @Nullable String description, String type,
+ URI href, @Nullable String vmwOsType, ReferenceType edit) {
+ super(id, info, description);
+ this.type = type;
+ this.href = href;
+ this.vmwOsType = vmwOsType;
+ this.edit = checkNotNull(edit, "edit");
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public URI getHref() {
+ return href;
+ }
+
+ /**
+ *
+ * @return VMware osType, if running on VMware
+ */
+ public String getVmwOsType() {
+ return vmwOsType;
+ }
+
+ /**
+ *
+ * @return edit link
+ */
+ public ReferenceType getEdit() {
+ return edit;
+ }
+
+ @Override
+ public String toString() {
+ return "[href=" + getHref() + ", type=" + getType() + ", id=" + getId() + ", vmwOsType=" + getVmwOsType()
+ + ", description=" + getDescription() + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((edit == null) ? 0 : edit.hashCode());
+ result = prime * result + ((href == null) ? 0 : href.hashCode());
+ result = prime * result + ((type == null) ? 0 : type.hashCode());
+ result = prime * result + ((vmwOsType == null) ? 0 : vmwOsType.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ VCloudOperatingSystemSection other = (VCloudOperatingSystemSection) obj;
+ if (edit == null) {
+ if (other.edit != null)
+ return false;
+ } else if (!edit.equals(other.edit))
+ return false;
+ if (href == null) {
+ if (other.href != null)
+ return false;
+ } else if (!href.equals(other.href))
+ return false;
+ if (type == null) {
+ if (other.type != null)
+ return false;
+ } else if (!type.equals(other.type))
+ return false;
+ if (vmwOsType == null) {
+ if (other.vmwOsType != null)
+ return false;
+ } else if (!vmwOsType.equals(other.vmwOsType))
+ return false;
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudVirtualHardwareSection.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudVirtualHardwareSection.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudVirtualHardwareSection.java
new file mode 100644
index 0000000..6d89b95
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ovf/VCloudVirtualHardwareSection.java
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.ovf;
+
+import java.net.URI;
+
+import org.jclouds.cim.ResourceAllocationSettingData;
+import org.jclouds.cim.VirtualSystemSettingData;
+import org.jclouds.ovf.Section;
+import org.jclouds.ovf.VirtualHardwareSection;
+
+/**
+ * A description of the virtual hardware supported by a virtual machine.
+ */
+public class VCloudVirtualHardwareSection extends VirtualHardwareSection {
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder toBuilder() {
+ return builder().fromVCloudVirtualHardwareSection(this);
+ }
+
+ public static class Builder extends VirtualHardwareSection.Builder {
+ protected String type;
+ protected URI href;
+
+ /**
+ * @see VCloudVirtualHardware#getType
+ */
+ public Builder type(String type) {
+ this.type = type;
+ return this;
+ }
+
+ /**
+ * @see VCloudVirtualHardware#getHref
+ */
+ public Builder href(URI href) {
+ this.href = href;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder system(VirtualSystemSettingData virtualSystem) {
+ return Builder.class.cast(super.system(virtualSystem));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder transport(String transport) {
+ return Builder.class.cast(super.transport(transport));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder transports(Iterable<String> transports) {
+ return Builder.class.cast(super.transports(transports));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder item(ResourceAllocationSettingData item) {
+ return Builder.class.cast(super.item(item));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder items(Iterable<? extends ResourceAllocationSettingData> items) {
+ return Builder.class.cast(super.items(items));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public VCloudVirtualHardwareSection build() {
+ return new VCloudVirtualHardwareSection(type, href, info, transports, virtualSystem, items);
+ }
+
+ public Builder fromVCloudVirtualHardwareSection(VCloudVirtualHardwareSection in) {
+ return fromVirtualHardwareSection(in).type(in.getType()).href(in.getHref());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder fromVirtualHardwareSection(VirtualHardwareSection in) {
+ return Builder.class.cast(super.fromVirtualHardwareSection(in));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder fromSection(Section<VirtualHardwareSection> in) {
+ return Builder.class.cast(super.fromSection(in));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder info(String info) {
+ return Builder.class.cast(super.info(info));
+ }
+ }
+
+ protected final String type;
+ protected final URI href;
+
+ public VCloudVirtualHardwareSection(String type, URI href, String info, Iterable<String> transports,
+ VirtualSystemSettingData virtualSystem, Iterable<? extends ResourceAllocationSettingData> resourceAllocations) {
+ super(info, transports, virtualSystem, resourceAllocations);
+ this.type = type;
+ this.href = href;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public URI getHref() {
+ return href;
+ }
+
+ @Override
+ public int hashCode() {
+ return href.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ VCloudVirtualHardwareSection other = (VCloudVirtualHardwareSection) obj;
+ return href.equals(other.href);
+ }
+
+ @Override
+ public String toString() {
+ return "[href=" + getHref() + ", type=" + getType() + ", info=" + getInfo() + ", virtualSystem=" + getSystem()
+ + "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Catalog.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Catalog.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Catalog.java
new file mode 100644
index 0000000..7b59d1e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Catalog.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.endpoints;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * Related to a VCloud Catalog.
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
+@Qualifier
+public @interface Catalog {
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Network.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Network.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Network.java
new file mode 100644
index 0000000..f30162e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Network.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.endpoints;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * Related to a VCloud Network.
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
+@Qualifier
+public @interface Network {
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Org.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Org.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Org.java
new file mode 100644
index 0000000..167b1ee
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/Org.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.endpoints;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * Related to a VCloud express Org.
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
+@Qualifier
+public @interface Org {
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/OrgList.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/OrgList.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/OrgList.java
new file mode 100644
index 0000000..5e0caab
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/OrgList.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.endpoints;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * Related to a VCloud express Org List.
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
+@Qualifier
+public @interface OrgList {
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/TasksList.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/TasksList.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/TasksList.java
new file mode 100644
index 0000000..333a39f
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/TasksList.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.endpoints;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * Related to a VCloud express Task List.
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
+@Qualifier
+public @interface TasksList {
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/VCloudLogin.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/VCloudLogin.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/VCloudLogin.java
new file mode 100644
index 0000000..7d3124b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/VCloudLogin.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.endpoints;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * Represents a component related to vCloud.
+ *
+ * @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx" />
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
+@Qualifier
+public @interface VCloudLogin {
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/VDC.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/VDC.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/VDC.java
new file mode 100644
index 0000000..193eb74
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/endpoints/VDC.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.endpoints;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * Related to a VCloud express Catalog.
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = {ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
+@Qualifier
+public @interface VDC {
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/CatalogApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/CatalogApi.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/CatalogApi.java
new file mode 100644
index 0000000..1aa660e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/CatalogApi.java
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.jclouds.vcloud.VCloudMediaType.CATALOGITEM_XML;
+import static org.jclouds.vcloud.VCloudMediaType.CATALOG_XML;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+import org.jclouds.Fallbacks;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.rest.annotations.EndpointParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.XMLResponseParser;
+import org.jclouds.vcloud.binders.BindCatalogItemToXmlPayload;
+import org.jclouds.vcloud.binders.OrgNameAndCatalogNameToEndpoint;
+import org.jclouds.vcloud.binders.OrgNameCatalogNameItemNameToEndpoint;
+import org.jclouds.vcloud.domain.Catalog;
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
+import org.jclouds.vcloud.options.CatalogItemOptions;
+import org.jclouds.vcloud.xml.CatalogHandler;
+import org.jclouds.vcloud.xml.CatalogItemHandler;
+
+
+/**
+ * Provides access to Catalog functionality in vCloud
+ * <p/>
+ *
+ * @see <a href="http://communities.vmware.com/community/developer/forums/vcloudapi" />
+ */
+@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
+public interface CatalogApi {
+
+ @GET
+ @XMLResponseParser(CatalogHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @Consumes(CATALOG_XML)
+ Catalog getCatalog(@EndpointParam URI catalogId);
+
+ /**
+ * returns the catalog in the organization associated with the specified name. Note that both
+ * parameters can be null to choose default.
+ *
+ * @param orgName
+ * organization name, or null for the default
+ * @param catalogName
+ * catalog name, or null for the default
+ * @throws NoSuchElementException
+ * if you specified an org or catalog name that isn't present
+ */
+ @GET
+ @XMLResponseParser(CatalogHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @Consumes(CATALOG_XML)
+ @MapBinder(OrgNameAndCatalogNameToEndpoint.class)
+ Catalog findCatalogInOrgNamed(@Nullable @PayloadParam("orgName") String orgName,
+ @Nullable @PayloadParam("catalogName") String catalogName);
+
+ @GET
+ @Consumes(CATALOGITEM_XML)
+ @XMLResponseParser(CatalogItemHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ CatalogItem getCatalogItem(@EndpointParam URI catalogItem);
+
+ /**
+ * returns the catalog item in the catalog associated with the specified name. Note that the org
+ * and catalog parameters can be null to choose default.
+ *
+ * @param orgName
+ * organization name, or null for the default
+ * @param catalogName
+ * catalog name, or null for the default
+ * @param itemName
+ * item you wish to lookup
+ *
+ * @throws NoSuchElementException
+ * if you specified an org, catalog, or catalog item name that isn't present
+ */
+ @GET
+ @Consumes(CATALOGITEM_XML)
+ @XMLResponseParser(CatalogItemHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @MapBinder(OrgNameCatalogNameItemNameToEndpoint.class)
+ CatalogItem findCatalogItemInOrgCatalogNamed(@Nullable @PayloadParam("orgName") String orgName,
+ @Nullable @PayloadParam("catalogName") String catalogName,
+ @PayloadParam("itemName") String itemName);
+
+ /**
+ * A catalog can contain references to vApp templates and media images that have been uploaded to
+ * any vDC in an organization. A vApp template or media image can be listed in at most one
+ * catalog.
+ *
+ * @param entity
+ * the reference to the vApp templates and media image
+ * @param catalog
+ * URI of the catalog to add the resourceEntity from
+ * @param name
+ * name of the entry in the catalog
+ *
+ * @param options
+ * options such as description or properties
+ * @return the new catalog item
+ */
+ @POST
+ @Path("/catalogItems")
+ @Consumes(CATALOGITEM_XML)
+ @Produces(CATALOGITEM_XML)
+ @MapBinder(BindCatalogItemToXmlPayload.class)
+ @XMLResponseParser(CatalogItemHandler.class)
+ CatalogItem addVAppTemplateOrMediaImageToCatalogAndNameItem(@PayloadParam("Entity") URI entity,
+ @EndpointParam URI catalog,
+ @PayloadParam("name") String name,
+ CatalogItemOptions... options);
+
+ @DELETE
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ void deleteCatalogItem(@EndpointParam URI href);
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/NetworkApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/NetworkApi.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/NetworkApi.java
new file mode 100644
index 0000000..d36e471
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/NetworkApi.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.jclouds.vcloud.VCloudMediaType.NETWORK_XML;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+
+import org.jclouds.Fallbacks;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.rest.annotations.EndpointParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.XMLResponseParser;
+import org.jclouds.vcloud.binders.OrgNameVDCNameNetworkNameToEndpoint;
+import org.jclouds.vcloud.domain.network.OrgNetwork;
+import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
+import org.jclouds.vcloud.xml.OrgNetworkHandler;
+
+/**
+ * Provides access to Network functionality in vCloud
+ * <p/>
+ */
+@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
+public interface NetworkApi {
+
+ @GET
+ @Consumes(NETWORK_XML)
+ @XMLResponseParser(OrgNetworkHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @MapBinder(OrgNameVDCNameNetworkNameToEndpoint.class)
+ OrgNetwork findNetworkInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName,
+ @Nullable @PayloadParam("vdcName") String vdcName,
+ @PayloadParam("resourceName") String networkName);
+
+ @GET
+ @Consumes(NETWORK_XML)
+ @XMLResponseParser(OrgNetworkHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ OrgNetwork getNetwork(@EndpointParam URI network);
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/OrgApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/OrgApi.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/OrgApi.java
new file mode 100644
index 0000000..3b7cf3a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/OrgApi.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.jclouds.vcloud.VCloudMediaType.ORG_XML;
+
+import java.net.URI;
+import java.util.Map;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+
+import org.jclouds.Fallbacks;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.rest.annotations.Endpoint;
+import org.jclouds.rest.annotations.EndpointParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.XMLResponseParser;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.OrgList;
+import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
+import org.jclouds.vcloud.functions.OrgNameToEndpoint;
+import org.jclouds.vcloud.xml.OrgHandler;
+import org.jclouds.vcloud.xml.OrgListHandler;
+
+
+/**
+ * Provides access to Org functionality in vCloud
+ * <p/>
+ */
+@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
+public interface OrgApi {
+
+ /**
+ * The response to a login request includes a list of the organizations to which the
+ * authenticated user has access.
+ *
+ * @return organizations indexed by name
+ */
+ @GET
+ @Endpoint(OrgList.class)
+ @XMLResponseParser(OrgListHandler.class)
+ @Consumes(VCloudMediaType.ORGLIST_XML)
+ Map<String, ReferenceType> listOrgs();
+
+ @GET
+ @XMLResponseParser(OrgHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @Consumes(ORG_XML)
+ Org getOrg(@EndpointParam URI orgId);
+
+ /**
+ * This call returns a list of all vCloud Data Centers (vdcs), catalogs, and task lists within
+ * the organization.
+ *
+ * @param name
+ * organization name, or null for the default
+ * @throws NoSuchElementException
+ * if you specified an org name that isn't present
+ */
+ @GET
+ @XMLResponseParser(OrgHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @Consumes(ORG_XML)
+ Org findOrgNamed(@Nullable @EndpointParam(parser = OrgNameToEndpoint.class) String orgName);
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/TaskApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/TaskApi.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/TaskApi.java
new file mode 100644
index 0000000..b9a60a6
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/TaskApi.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.jclouds.vcloud.VCloudMediaType.TASKSLIST_XML;
+import static org.jclouds.vcloud.VCloudMediaType.TASK_XML;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+
+import org.jclouds.Fallbacks;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.rest.annotations.EndpointParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.XMLResponseParser;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.TasksList;
+import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
+import org.jclouds.vcloud.functions.OrgNameToTasksListEndpoint;
+import org.jclouds.vcloud.xml.TaskHandler;
+import org.jclouds.vcloud.xml.TasksListHandler;
+
+/**
+ * Provides access to Task functionality in vCloud
+ * <p/>
+ */
+@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
+public interface TaskApi {
+
+ @GET
+ @Consumes(TASKSLIST_XML)
+ @XMLResponseParser(TasksListHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ TasksList getTasksList(@EndpointParam URI tasksListId);
+
+ @GET
+ @Consumes(TASKSLIST_XML)
+ @XMLResponseParser(TasksListHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ TasksList findTasksListInOrgNamed(@Nullable @EndpointParam(parser = OrgNameToTasksListEndpoint.class) String orgName);
+
+ /**
+ * Whenever the result of a request cannot be returned immediately, the server creates a Task
+ * object and includes it in the response, as a member of the Tasks container in the response
+ * body. Each Task has an href value, which is a URL that the client can use to retrieve the Task
+ * element alone, without the rest of the response in which it was contained. All information
+ * about the task is included in the Task element when it is returned in the response’s Tasks
+ * container, so a client does not need to make an additional request to the Task URL unless it
+ * wants to follow the progress of a task that was incomplete.
+ */
+ @GET
+ @Consumes(TASK_XML)
+ @XMLResponseParser(TaskHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ Task getTask(@EndpointParam URI taskId);
+
+ @POST
+ @Path("/action/cancel")
+ void cancelTask(@EndpointParam URI taskId);
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppApi.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppApi.java
new file mode 100644
index 0000000..af44c3e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/features/VAppApi.java
@@ -0,0 +1,260 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.jclouds.vcloud.VCloudMediaType.DEPLOYVAPPPARAMS_XML;
+import static org.jclouds.vcloud.VCloudMediaType.TASK_XML;
+import static org.jclouds.vcloud.VCloudMediaType.UNDEPLOYVAPPPARAMS_XML;
+import static org.jclouds.vcloud.VCloudMediaType.VAPP_XML;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+import org.jclouds.Fallbacks;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.predicates.validators.DnsNameValidator;
+import org.jclouds.rest.annotations.EndpointParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.ParamValidators;
+import org.jclouds.rest.annotations.PayloadParam;
+import org.jclouds.rest.annotations.PayloadParams;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.XMLResponseParser;
+import org.jclouds.vcloud.binders.BindCloneVAppParamsToXmlPayload;
+import org.jclouds.vcloud.binders.BindDeployVAppParamsToXmlPayload;
+import org.jclouds.vcloud.binders.BindUndeployVAppParamsToXmlPayload;
+import org.jclouds.vcloud.binders.OrgNameVDCNameResourceEntityNameToEndpoint;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
+import org.jclouds.vcloud.options.CloneVAppOptions;
+import org.jclouds.vcloud.xml.TaskHandler;
+import org.jclouds.vcloud.xml.VAppHandler;
+
+
+/**
+ * Provides access to VApp functionality in vCloud
+ * <p/>
+ *
+ * @see <a href="http://communities.vmware.com/community/developer/forums/vcloudapi" />
+ */
+@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
+public interface VAppApi {
+ @GET
+ @Consumes(VAPP_XML)
+ @XMLResponseParser(VAppHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ @MapBinder(OrgNameVDCNameResourceEntityNameToEndpoint.class)
+ VApp findVAppInOrgVDCNamed(@Nullable @PayloadParam("orgName") String orgName,
+ @Nullable @PayloadParam("vdcName") String vdcName, @PayloadParam("resourceName") String vAppName);
+
+ @POST
+ @Path("/action/cloneVApp")
+ @Produces("application/vnd.vmware.vcloud.cloneVAppParams+xml")
+ @Consumes(TASK_XML)
+ @XMLResponseParser(TaskHandler.class)
+ @MapBinder(BindCloneVAppParamsToXmlPayload.class)
+ Task copyVAppToVDCAndName(@PayloadParam("Source") URI sourceVApp,
+ @EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName,
+ CloneVAppOptions... options);
+
+ @POST
+ @Path("/action/cloneVApp")
+ @Produces("application/vnd.vmware.vcloud.cloneVAppParams+xml")
+ @Consumes(TASK_XML)
+ @XMLResponseParser(TaskHandler.class)
+ @PayloadParams(keys = "IsSourceDelete", values = "true")
+ @MapBinder(BindCloneVAppParamsToXmlPayload.class)
+ Task moveVAppToVDCAndRename(@PayloadParam("Source") URI sourceVApp,
+ @EndpointParam URI vdc, @PayloadParam("name") @ParamValidators(DnsNameValidator.class) String newName,
+ CloneVAppOptions... options);
+
+ @GET
+ @Consumes(VAPP_XML)
+ @XMLResponseParser(VAppHandler.class)
+ @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+ VApp getVApp(@EndpointParam URI href);
+
+ /**
+ * To deploy a vApp, the client makes a request to its action/deploy URL. Deploying a vApp
+ * automatically deploys all of the virtual machines it contains. To deploy a virtual machine,
+ * the client makes a request to its action/deploy URL.
+ * <p/>
+ * Deploying a Vm implicitly deploys the parent vApp if that vApp is not already deployed.
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Produces(DEPLOYVAPPPARAMS_XML)
+ @Path("/action/deploy")
+ @MapBinder(BindDeployVAppParamsToXmlPayload.class)
+ @XMLResponseParser(TaskHandler.class)
+ Task deployVApp(@EndpointParam URI href);
+
+ /**
+ * like {@link #deployVApp(URI)}, except deploy transitions to power on state
+ *
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Produces(DEPLOYVAPPPARAMS_XML)
+ @Path("/action/deploy")
+ @MapBinder(BindDeployVAppParamsToXmlPayload.class)
+ @PayloadParams(keys = "powerOn", values = "true")
+ @XMLResponseParser(TaskHandler.class)
+ Task deployAndPowerOnVApp(@EndpointParam URI href);
+
+ /**
+ * Undeploying a vApp powers off or suspends any running virtual machines it contains, then frees
+ * the resources reserved for the vApp and sets the vApp’s deploy attribute to a value of false
+ * to indicate that it is not deployed.
+ * <p/>
+ * Undeploying a virtual machine powers off or suspends the virtual machine, then frees the
+ * resources reserved for it and sets the its deploy attribute to a value of false to indicate
+ * that it is not deployed. This operation has no effect on the containing vApp.
+ * <h4>NOTE</h4>
+ * Using this method will simply power off the vms. In order to save their state, use
+ * {@link #undeployAndSaveStateOf}
+ *
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Produces(UNDEPLOYVAPPPARAMS_XML)
+ @Path("/action/undeploy")
+ @MapBinder(BindUndeployVAppParamsToXmlPayload.class)
+ @XMLResponseParser(TaskHandler.class)
+ Task undeployVApp(@EndpointParam URI href);
+
+ /**
+ * like {@link #undeployVApp(URI)}, where the undeployed virtual machines are suspended and their
+ * suspend state saved
+ *
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Produces(UNDEPLOYVAPPPARAMS_XML)
+ @Path("/action/undeploy")
+ @MapBinder(BindUndeployVAppParamsToXmlPayload.class)
+ @PayloadParams(keys = "saveState", values = "true")
+ @XMLResponseParser(TaskHandler.class)
+ Task undeployAndSaveStateOfVApp(@EndpointParam URI href);
+
+ /**
+ * A powerOn request to a vApp URL powers on all of the virtual machines in the vApp, as
+ * specified in the vApp’s StartupSection field.
+ * <p/>
+ * A powerOn request to a virtual machine URL powers on the specified virtual machine and forces
+ * deployment of the parent vApp.
+ * <p/>
+ * <h4>NOTE</h4> A powerOn request to a vApp or virtual machine that is undeployed forces
+ * deployment.
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Path("/power/action/powerOn")
+ @XMLResponseParser(TaskHandler.class)
+ Task powerOnVApp(@EndpointParam URI href);
+
+ /**
+ * A powerOff request to a vApp URL powers off all of the virtual machines in the vApp, as
+ * specified in its StartupSection field.
+ * <p/>
+ * A powerOff request to a virtual machine URL powers off the specified virtual machine.
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Path("/power/action/powerOff")
+ @XMLResponseParser(TaskHandler.class)
+ Task powerOffVApp(@EndpointParam URI href);
+
+ /**
+ * A shutdown request to a vApp URL shuts down all of the virtual machines in the vApp, as
+ * specified in its StartupSection field.
+ * <p/>
+ * A shutdown request to a virtual machine URL shuts down the specified virtual machine.
+ * <p/>
+ * <h4>NOTE</h4Because this request sends a signal to the guest OS, the vCloud API cannot track
+ * the progress or verify the result of the requested operation. Hence, void is returned
+ */
+ @POST
+ @Path("/power/action/shutdown")
+ void shutdownVApp(@EndpointParam URI href);
+
+ /**
+ * A reset request to a vApp URL resets all of the virtual machines in the vApp, as specified in
+ * its StartupSection field.
+ * <p/>
+ * A reset request to a virtual machine URL resets the specified virtual machine.
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Path("/power/action/reset")
+ @XMLResponseParser(TaskHandler.class)
+ Task resetVApp(@EndpointParam URI href);
+
+ /**
+ * A reboot request to a vApp URL reboots all of the virtual machines in the vApp, as specified
+ * in its StartupSection field.
+ * <p/>
+ * A reboot request to a virtual machine URL reboots the specified virtual machine.
+ * <p/>
+ * <h4>NOTE</h4> Because this request sends a signal to the guest OS, the vCloud API cannot track
+ * the progress or verify the result of the requested operation. Hence, void is returned
+ */
+ @POST
+ @Path("/power/action/reboot")
+ void rebootVApp(@EndpointParam URI href);
+
+ /**
+ * A suspend request to a vApp URL suspends all of the virtual machines in the vApp, as specified
+ * in its StartupSection field.
+ * <p/>
+ * A suspend request to a virtual machine URL suspends the specified virtual machine.
+ */
+ @POST
+ @Consumes(TASK_XML)
+ @Path("/power/action/suspend")
+ @XMLResponseParser(TaskHandler.class)
+ Task suspendVApp(@EndpointParam URI href);
+
+ /**
+ * delete a vAppTemplate, vApp, or media image. You cannot delete an object if it is in use. Any
+ * object that is being copied or moved is in use. Other criteria that determine whether an
+ * object is in use depend on the object type.
+ * <ul>
+ * <li>A vApptemplate is in use if it is being instantiated. After instantiation is complete, the
+ * template is no longer in use.</li>
+ * <li>A vApp is in use if it is deployed.</li>
+ * <li>A media image is in use if it is inserted in a Vm.</li>
+ * </ul>
+ *
+ * @param href
+ * href of the vApp
+ * @return task of the operation in progress
+ */
+ @DELETE
+ @Consumes(TASK_XML)
+ @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
+ @XMLResponseParser(TaskHandler.class)
+ Task deleteVApp(@EndpointParam URI href);
+}
[04/18] stratos git commit: Jclouds vcloud api 1.8.1 clone with
custom changes
Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalogItem-carrenza-with-default-namespace.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalogItem-carrenza-with-default-namespace.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalogItem-carrenza-with-default-namespace.xml
new file mode 100644
index 0000000..88fec20
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalogItem-carrenza-with-default-namespace.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CatalogItem xmlns="http://www.vmware.com/vcloud/v1" name="ubuntu10.10x64" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://myvdc.carrenza.net/api/v1.0/catalogItem/ecd4d3a0-0d12-4195-a6d2-14cdf9f925a3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://myvdc.carrenza.net/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.catalog+xml" href="https://myvdc.carrenza.net/api/v1.0/catalog/5d2c147a-d26d-487a-9a05-577ee175186b"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://myvdc.carrenza.net/api/v1.0/catalogItem/ecd4d3a0-0d12-4195-a6d2-14cdf9f925a3"/>
+ <Link rel="remove" href="https://myvdc.carrenza.net/api/v1.0/catalogItem/ecd4d3a0-0d12-4195-a6d2-14cdf9f925a3"/>
+ <Description> </Description>
+ <Entity type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="ubuntu10.10x64" href="https://myvdc.carrenza.net/api/v1.0/vAppTemplate/vappTemplate-123766ea-2b55-482c-8adf-735ab1952834"/>
+</CatalogItem>
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalogItem-carrenza-with-vcloud-namespace.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalogItem-carrenza-with-vcloud-namespace.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalogItem-carrenza-with-vcloud-namespace.xml
new file mode 100644
index 0000000..917c143
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalogItem-carrenza-with-vcloud-namespace.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<vcloud:CatalogItem xmlns:vcloud="http://www.vmware.com/vcloud/v1" name="ubuntu10.10x64" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://myvdc.carrenza.net/api/v1.0/catalogItem/ecd4d3a0-0d12-4195-a6d2-14cdf9f925a3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://myvdc.carrenza.net/api/v1.0/schema/master.xsd">
+ <vcloud:Link rel="up" type="application/vnd.vmware.vcloud.catalog+xml" href="https://myvdc.carrenza.net/api/v1.0/catalog/5d2c147a-d26d-487a-9a05-577ee175186b"/>
+ <vcloud:Link rel="edit" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://myvdc.carrenza.net/api/v1.0/catalogItem/ecd4d3a0-0d12-4195-a6d2-14cdf9f925a3"/>
+ <vcloud:Link rel="remove" href="https://myvdc.carrenza.net/api/v1.0/catalogItem/ecd4d3a0-0d12-4195-a6d2-14cdf9f925a3"/>
+ <vcloud:Description> </vcloud:Description>
+ <vcloud:Entity type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="ubuntu10.10x64" href="https://myvdc.carrenza.net/api/v1.0/vAppTemplate/vappTemplate-123766ea-2b55-482c-8adf-735ab1952834"/>
+</vcloud:CatalogItem>
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalogItem-hosting.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalogItem-hosting.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalogItem-hosting.xml
new file mode 100644
index 0000000..6f88d04
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalogItem-hosting.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CatalogItem
+ href="https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"
+ name="Windows 2008 Datacenter 64 Bit"
+ xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8 catalogItem.xsd"
+ xmlns="http://www.vmware.com/vcloud/v0.8"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <Description>Windows 2008 Datacenter 64 Bit</Description>
+ <Entity href="https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2"
+ type="application/vnd.vmware.vcloud.vAppTemplate+xml"
+ name="Windows 2008 Datacenter 64 Bit" />
+ <Property key="Foo">Bar</Property>
+ <Property key="Hello">World</Property>
+</CatalogItem>
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalogItem-terremark.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalogItem-terremark.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalogItem-terremark.xml
new file mode 100644
index 0000000..feb8b82
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalogItem-terremark.xml
@@ -0,0 +1,16 @@
+<CatalogItem
+ href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/22"
+ type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows Web Server 2008 R2 (64-bit)"
+ xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <Link rel="down"
+ href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/22/options/compute"
+ type="application/xml" name="Compute Options" />
+ <Link rel="down"
+ href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/22/options/customization"
+ type="application/xml" name="Customization Options" />
+ <Entity
+ href="https://services.vcloudexpress.terremark.com/api/v0.8/vAppTemplate/22"
+ type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows Web Server 2008 R2 (64-bit)" />
+ <Property key="LicensingCost">0</Property>
+</CatalogItem>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalogItem1.0-vcd15.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalogItem1.0-vcd15.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalogItem1.0-vcd15.xml
new file mode 100644
index 0000000..b344071
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalogItem1.0-vcd15.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CatalogItem xmlns="http://www.vmware.com/vcloud/v1" name="UbuntuServer-x64-2GB" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://zone.myvcloud.com/api/v1.0/catalogItem/ceb369f7-1d07-4e32-9dbd-ebb5aa6ca55c" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 https://zone.myvcloud.com/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.catalog+xml" href="https://zone.myvcloud.com/api/v1.0/catalog/3155f393-1e1d-4572-8c9c-d76f72ddb658"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://zone.myvcloud.com/api/v1.0/catalogItem/ceb369f7-1d07-4e32-9dbd-ebb5aa6ca55c"/>
+ <Link rel="remove" href="https://zone.myvcloud.com/api/v1.0/catalogItem/ceb369f7-1d07-4e32-9dbd-ebb5aa6ca55c"/>
+ <Description> </Description>
+ <Entity type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="UbuntuServer-x64-2GB" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728"/>
+</CatalogItem>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/copyVApp-default.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/copyVApp-default.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/copyVApp-default.xml
new file mode 100644
index 0000000..0e8ba8d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/copyVApp-default.xml
@@ -0,0 +1 @@
+<CloneVAppParams xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" deploy="false" name="my-vapp" powerOn="false" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcloud.safesecureweb.com/ns/vcloud.xsd"><Source href="https://vcenterprise.bluelock.com/api/v1.0/vapp/4181" type="application/vnd.vmware.vcloud.vApp+xml"/></CloneVAppParams>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/copyVApp.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/copyVApp.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/copyVApp.xml
new file mode 100644
index 0000000..b6cd733
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/copyVApp.xml
@@ -0,0 +1 @@
+<CloneVAppParams xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" deploy="true" name="new-linux-server" powerOn="true" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcloud.safesecureweb.com/ns/vcloud.xsd"><Description>The description of the new vApp</Description><Source href="https://vcenterprise.bluelock.com/api/v1.0/vapp/201" type="application/vnd.vmware.vcloud.vApp+xml"/></CloneVAppParams>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/copyVAppTemplate-default.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/copyVAppTemplate-default.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/copyVAppTemplate-default.xml
new file mode 100644
index 0000000..00b11e7
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/copyVAppTemplate-default.xml
@@ -0,0 +1 @@
+<CloneVAppTemplateParams xmlns="http://vcloud.safesecureweb.com/ns/vcloud.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="my-vapptemplate" xsi:schemaLocation="http://vcloud.safesecureweb.com/ns/vcloud.xsd http://vcloud.safesecureweb.com/ns/vcloud.xsd"><Source href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/4181" type="application/vnd.vmware.vcloud.vAppTemplate+xml"/></CloneVAppTemplateParams>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/copyVAppTemplate.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/copyVAppTemplate.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/copyVAppTemplate.xml
new file mode 100644
index 0000000..e612b98
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/copyVAppTemplate.xml
@@ -0,0 +1 @@
+<CloneVAppTemplateParams xmlns="http://vcloud.safesecureweb.com/ns/vcloud.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="new-linux-server" xsi:schemaLocation="http://vcloud.safesecureweb.com/ns/vcloud.xsd http://vcloud.safesecureweb.com/ns/vcloud.xsd"><Description>The description of the new vAppTemplate</Description><Source href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/201" type="application/vnd.vmware.vcloud.vAppTemplate+xml"/></CloneVAppTemplateParams>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/cpuItem.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/cpuItem.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/cpuItem.xml
new file mode 100644
index 0000000..d5e437b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/cpuItem.xml
@@ -0,0 +1 @@
+<Item xmlns="http://www.vmware.com/vcloud/v1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"><rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits><rasd:Description>Number of Virtual CPUs</rasd:Description><rasd:ElementName>2 virtual CPU(s)</rasd:ElementName><rasd:InstanceID>4</rasd:InstanceID><rasd:ResourceType>3</rasd:ResourceType><rasd:VirtualQuantity>2</rasd:VirtualQuantity><rasd:Weight>0</rasd:Weight></Item>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/guestCustomization.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/guestCustomization.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/guestCustomization.xml
new file mode 100644
index 0000000..644720f
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/guestCustomization.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<GuestCustomizationSection
+ type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/guestCustomizationSection/"
+ ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <Enabled>true</Enabled>
+ <ChangeSid>false</ChangeSid>
+ <VirtualMachineId>2087535248</VirtualMachineId>
+ <JoinDomainEnabled>false</JoinDomainEnabled>
+ <UseOrgSettings>false</UseOrgSettings>
+ <AdminPasswordEnabled>true</AdminPasswordEnabled>
+ <AdminPasswordAuto>true</AdminPasswordAuto>
+ <ResetPasswordRequired>false</ResetPasswordRequired>
+ <CustomizationScript>cat > /root/foo.txt<<EOF
+I '"love"' {asc|!}*&
+EOF
+</CustomizationScript>
+ <ComputerName>RHEL5</ComputerName>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/guestCustomizationSection/" />
+</GuestCustomizationSection>
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/guestCustomizationSection.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/guestCustomizationSection.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/guestCustomizationSection.xml
new file mode 100644
index 0000000..2fadb53
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/guestCustomizationSection.xml
@@ -0,0 +1,3 @@
+<GuestCustomizationSection xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" href="http://vcloud.example.com/api/v1.0/vApp/vm-12/guestCustomizationSection" ovf:required="false" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"><ovf:Info>Specifies Guest OS Customization Settings</ovf:Info><CustomizationScript>cat > /tmp/foo.txt<<EOF
+I love candy
+EOF</CustomizationScript></GuestCustomizationSection>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/instantiatedvapp.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/instantiatedvapp.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/instantiatedvapp.xml
new file mode 100644
index 0000000..9d98c2d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/instantiatedvapp.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<VApp xmlns="http://www.vmware.com/vcloud/v1" deployed="false" status="0" name="vcds-a47" type="application/vnd.vmware.vcloud.vApp+xml" href="https://zone01.bluelock.com/api/v1.0/vApp/vapp-dba20113-1a4a-4ec9-a5ad-52dc69ee0825" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://zone01.bluelock.com/api/v1.0/schema/master.xsd">
+ <Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://zone01.bluelock.com/api/v1.0/vApp/vapp-dba20113-1a4a-4ec9-a5ad-52dc69ee0825/controlAccess/"/>
+ <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml" href="https://zone01.bluelock.com/api/v1.0/vdc/9db4ee77-33e7-4b83-96be-eee9925eaa9b"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.owner+xml" href="https://zone01.bluelock.com/api/v1.0/vApp/vapp-dba20113-1a4a-4ec9-a5ad-52dc69ee0825/owner"/>
+ <Description>OS-Ubuntu10.04_x64</Description>
+ <Tasks>
+ <Task status="running" startTime="2012-07-11T20:37:49.521-04:00" operation="Creating Virtual Application vcds-a47(dba20113-1a4a-4ec9-a5ad-52dc69ee0825)" expiryTime="2012-08-25T20:37:49.521-04:00" type="application/vnd.vmware.vcloud.task+xml" href="https://zone01.bluelock.com/api/v1.0/task/fee48ffc-8ba2-452e-a57f-ada0cd2eda31">
+ <Link rel="task:cancel" href="https://zone01.bluelock.com/api/v1.0/task/fee48ffc-8ba2-452e-a57f-ada0cd2eda31/action/cancel"/>
+ <Owner type="application/vnd.vmware.vcloud.vApp+xml" name="vcds-a47" href="https://zone01.bluelock.com/api/v1.0/vApp/vapp-dba20113-1a4a-4ec9-a5ad-52dc69ee0825"/>
+ </Task>
+ </Tasks>
+</VApp>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/instantiationparams-description.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/instantiationparams-description.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/instantiationparams-description.xml
new file mode 100644
index 0000000..6728290
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/instantiationparams-description.xml
@@ -0,0 +1 @@
+<InstantiateVAppTemplateParams xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" deploy="true" name="my-vapp" powerOn="true"><Description>my foo</Description><InstantiationParams><NetworkConfigSection><ovf:Info>Configuration parameters for logical networks</ovf:Info><NetworkConfig networkName="vAppNet-vApp Internal"><Configuration><ParentNetwork href="https://vcenterprise.bluelock.com/api/v1.0/network/1990"/><FenceMode>bridged</FenceMode></Configuration></NetworkConfig></NetworkConfigSection></InstantiationParams><Source href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3"/><AllEULAsAccepted>true</AllEULAsAccepted></InstantiateVAppTemplateParams>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/instantiationparams-network.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/instantiationparams-network.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/instantiationparams-network.xml
new file mode 100644
index 0000000..e3bcb58
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/instantiationparams-network.xml
@@ -0,0 +1 @@
+<InstantiateVAppTemplateParams xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" deploy="true" name="my-vapp" powerOn="true"><InstantiationParams><NetworkConfigSection><ovf:Info>Configuration parameters for logical networks</ovf:Info><NetworkConfig networkName="aloha"><Configuration><ParentNetwork href="https://vcenterprise.bluelock.com/api/v1.0/network/1991"/><FenceMode>natRouted</FenceMode></Configuration></NetworkConfig></NetworkConfigSection></InstantiationParams><Source href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3"/><AllEULAsAccepted>true</AllEULAsAccepted></InstantiateVAppTemplateParams>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/instantiationparams.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/instantiationparams.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/instantiationparams.xml
new file mode 100644
index 0000000..9df9961
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/instantiationparams.xml
@@ -0,0 +1 @@
+<InstantiateVAppTemplateParams xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" deploy="true" name="my-vapp" powerOn="true"><InstantiationParams><NetworkConfigSection><ovf:Info>Configuration parameters for logical networks</ovf:Info><NetworkConfig networkName="vAppNet-vApp Internal"><Configuration><ParentNetwork href="https://vcenterprise.bluelock.com/api/v1.0/network/1990"/><FenceMode>bridged</FenceMode></Configuration></NetworkConfig></NetworkConfigSection></InstantiationParams><Source href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3"/><AllEULAsAccepted>true</AllEULAsAccepted></InstantiateVAppTemplateParams>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/log4j.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/log4j.xml
new file mode 100644
index 0000000..63810d3
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/log4j.xml
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+ <!--
+ For more configuration infromation and examples see the Apache
+ Log4j website: http://logging.apache.org/log4j/
+ -->
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
+ debug="false">
+
+ <!-- A time/date based rolling appender -->
+ <appender name="WIREFILE" class="org.apache.log4j.DailyRollingFileAppender">
+ <param name="File" value="target/test-data/jclouds-wire.log" />
+ <param name="Append" value="true" />
+
+ <!-- Rollover at midnight each day -->
+ <param name="DatePattern" value="'.'yyyy-MM-dd" />
+
+ <param name="Threshold" value="TRACE" />
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
+
+ <!--
+ The full pattern: Date MS Priority [Category]
+ (Thread:NDC) Message\n <param name="ConversionPattern"
+ value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+ -->
+ </layout>
+ </appender>
+
+ <!-- A time/date based rolling appender -->
+ <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
+ <param name="File" value="target/test-data/jclouds.log" />
+ <param name="Append" value="true" />
+
+ <!-- Rollover at midnight each day -->
+ <param name="DatePattern" value="'.'yyyy-MM-dd" />
+
+ <param name="Threshold" value="TRACE" />
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
+
+ <!--
+ The full pattern: Date MS Priority [Category]
+ (Thread:NDC) Message\n <param name="ConversionPattern"
+ value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+ -->
+ </layout>
+ </appender>
+
+ <!-- A time/date based rolling appender -->
+ <appender name="COMPUTEFILE" class="org.apache.log4j.DailyRollingFileAppender">
+ <param name="File" value="target/test-data/jclouds-compute.log" />
+ <param name="Append" value="true" />
+
+ <!-- Rollover at midnight each day -->
+ <param name="DatePattern" value="'.'yyyy-MM-dd" />
+
+ <param name="Threshold" value="TRACE" />
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
+
+ <!--
+ The full pattern: Date MS Priority [Category]
+ (Thread:NDC) Message\n <param name="ConversionPattern"
+ value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+ -->
+ </layout>
+ </appender>
+
+ <!-- A time/date based rolling appender -->
+ <appender name="SSHFILE" class="org.apache.log4j.DailyRollingFileAppender">
+ <param name="File" value="target/test-data/jclouds-ssh.log" />
+ <param name="Append" value="true" />
+
+ <!-- Rollover at midnight each day -->
+ <param name="DatePattern" value="'.'yyyy-MM-dd" />
+
+ <param name="Threshold" value="TRACE" />
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
+
+ <!--
+ The full pattern: Date MS Priority [Category]
+ (Thread:NDC) Message\n <param name="ConversionPattern"
+ value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+ -->
+ </layout>
+ </appender>
+
+ <appender name="ASYNCCOMPUTE" class="org.apache.log4j.AsyncAppender">
+ <appender-ref ref="COMPUTEFILE" />
+ </appender>
+
+ <appender name="ASYNCSSH" class="org.apache.log4j.AsyncAppender">
+ <appender-ref ref="SSHFILE" />
+ </appender>
+
+ <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
+ <appender-ref ref="FILE" />
+ </appender>
+
+ <appender name="ASYNCWIRE" class="org.apache.log4j.AsyncAppender">
+ <appender-ref ref="WIREFILE" />
+ </appender>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <category name="org.jclouds">
+ <priority value="DEBUG" />
+ <appender-ref ref="ASYNC" />
+ </category>
+
+ <category name="jclouds.headers">
+ <priority value="DEBUG" />
+ <appender-ref ref="ASYNCWIRE" />
+ </category>
+
+ <category name="jclouds.ssh">
+ <priority value="DEBUG" />
+ <appender-ref ref="ASYNCSSH" />
+ </category>
+
+ <category name="jclouds.wire">
+ <priority value="DEBUG" />
+ <appender-ref ref="ASYNCWIRE" />
+ </category>
+
+ <category name="jclouds.compute">
+ <priority value="TRACE" />
+ <appender-ref ref="ASYNCCOMPUTE" />
+ </category>
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <priority value="WARN" />
+ </root>
+
+</log4j:configuration>
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/memoryItem.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/memoryItem.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/memoryItem.xml
new file mode 100644
index 0000000..df35b83
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/memoryItem.xml
@@ -0,0 +1 @@
+<Item xmlns="http://www.vmware.com/vcloud/v1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"><rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits><rasd:Description>Memory Size</rasd:Description><rasd:ElementName>512 MB of memory</rasd:ElementName><rasd:InstanceID>5</rasd:InstanceID><rasd:Reservation>0</rasd:Reservation><rasd:ResourceType>4</rasd:ResourceType><rasd:VirtualQuantity>512</rasd:VirtualQuantity><rasd:Weight>0</rasd:Weight></Item>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/moveVApp.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/moveVApp.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/moveVApp.xml
new file mode 100644
index 0000000..919d136
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/moveVApp.xml
@@ -0,0 +1 @@
+<CloneVAppParams xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" deploy="true" name="new-linux-server" powerOn="true" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcloud.safesecureweb.com/ns/vcloud.xsd"><Description>The description of the new vApp</Description><Source href="https://vcenterprise.bluelock.com/api/v1.0/vapp/201" type="application/vnd.vmware.vcloud.vApp+xml"/><IsSourceDelete>true</IsSourceDelete></CloneVAppParams>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/moveVAppTemplate.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/moveVAppTemplate.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/moveVAppTemplate.xml
new file mode 100644
index 0000000..2f72f2b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/moveVAppTemplate.xml
@@ -0,0 +1 @@
+<CloneVAppTemplateParams xmlns="http://vcloud.safesecureweb.com/ns/vcloud.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="new-linux-server" xsi:schemaLocation="http://vcloud.safesecureweb.com/ns/vcloud.xsd http://vcloud.safesecureweb.com/ns/vcloud.xsd"><Description>The description of the new vAppTemplate</Description><Source href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/201" type="application/vnd.vmware.vcloud.vAppTemplate+xml"/><IsSourceDelete>true</IsSourceDelete></CloneVAppTemplateParams>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/networkconnection.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/networkconnection.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/networkconnection.xml
new file mode 100644
index 0000000..5400fc7
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/networkconnection.xml
@@ -0,0 +1,7 @@
+<NetworkConnection network="internet01">
+ <NetworkConnectionIndex>0</NetworkConnectionIndex>
+ <IpAddress>174.47.101.164</IpAddress>
+ <IsConnected>true</IsConnected>
+ <MACAddress>00:50:56:01:01:f2</MACAddress>
+ <IpAddressAllocationMode>POOL</IpAddressAllocationMode>
+</NetworkConnection>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/networkconnectionsection.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/networkconnectionsection.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/networkconnectionsection.xml
new file mode 100644
index 0000000..9550ef6
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/networkconnectionsection.xml
@@ -0,0 +1,18 @@
+<NetworkConnectionSection
+ type="application/vnd.vmware.vcloud.networkConnectionSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/networkConnectionSection/"
+ ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
+ <NetworkConnection network="internet01">
+ <NetworkConnectionIndex>0</NetworkConnectionIndex>
+ <IpAddress>174.47.101.164</IpAddress>
+ <IsConnected>true</IsConnected>
+ <MACAddress>00:50:56:01:01:f2</MACAddress>
+ <IpAddressAllocationMode>POOL</IpAddressAllocationMode>
+ </NetworkConnection>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.networkConnectionSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/networkConnectionSection/" />
+</NetworkConnectionSection>
+
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/org-1.0.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/org-1.0.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/org-1.0.xml
new file mode 100644
index 0000000..af9803f
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/org-1.0.xml
@@ -0,0 +1,24 @@
+<Org name="ExampleOrg" type="application/vnd.vmware.vcloud.org+xml"
+ href="http://vcloud.example.com/api/v1.0/org/5" >
+ <Link type="application/vnd.vmware.vcloud.catalog+xml" rel="down"
+ href="http://vcloud.example.com/api/v1.0/catalog/32" name="Main Catalog" />
+ <Link type="application/vnd.vmware.vcloud.controlAccess+xml" rel="down"
+ href="http://vcloud.example.com/api/v1.0/catalog/32/controlAccess" />
+ <Link type="application/vnd.vmware.vcloud.controlAccess+xml" rel="controlAccess"
+ href="http://vcloud.example.com/api/v1.0/catalog/32/action/controlAccess" />
+ <Link type="application/vnd.vmware.vcloud.catalog+xml" rel="down"
+ href="http://vcloud.example.com/api/v1.0/catalog/37" name="Shared Catalog" />
+ <Link type="application/vnd.vmware.vcloud.controlAccess+xml" rel="down"
+ href="http://vcloud.example.com/api/v1.0/catalog/37/controlAccess" />
+ <Link type="application/vnd.vmware.vcloud.controlAccess+xml" rel="controlAccess"
+ href="http://vcloud.example.com/api/v1.0/catalog/37/action/controlAccess" />
+ <Link type="application/vnd.vmware.vcloud.vdc+xml" rel="down"
+ href="http://vcloud.example.com/api/v1.0/vdc/5" name="ExampleVdc01" />
+ <Link type="application/vnd.vmware.vcloud.tasksList+xml" rel="down"
+ href="http://vcloud.example.com/api/v1.0/tasksList/5" />
+ <Link type="application/vnd.vmware.vcloud.network+xml" rel="down"
+ href="http://vcloud.example.com/api/v1.0/network/14" name="TestNetwork" />
+ <Link type="application/vnd.vmware.vcloud.network+xml" rel="down"
+ href="http://vcloud.example.com/api/v1.0/network/54" name="ProductionNetwork" />
+ <Description>Example Corp's Primary Organization.</Description>
+</Org>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/org-hosting.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/org-hosting.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/org-hosting.xml
new file mode 100644
index 0000000..3bd9842
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/org-hosting.xml
@@ -0,0 +1,12 @@
+<Org href="https://vcloud.safesecureweb.com/api/v0.8/org/188849"
+ name="Customer 188849" xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8/organization.xsd"
+ xmlns="http://www.vmware.com/vcloud/v0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <Link rel="down" href="https://vcloud.safesecureweb.com/api/v0.8/catalog/1"
+ type="application/vnd.vmware.vcloud.catalog+xml" name="HMS Shared Catalog" />
+ <Link rel="down"
+ href="https://vcloud.safesecureweb.com/api/v0.8/vdc/188849"
+ type="application/vnd.vmware.vcloud.vdc+xml" name="188849 Virtual DataCenter" />
+ <Link rel="down"
+ href="https://vcloud.safesecureweb.com/api/v0.8/tasksList/188849"
+ type="application/vnd.vmware.vcloud.tasksList+xml" name="188849 Task List" />
+</Org>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/org-savvis.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/org-savvis.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/org-savvis.xml
new file mode 100644
index 0000000..c2517c7
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/org-savvis.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<vApp:Org xmlns:vApp="http://www.vmware.com/vcloud/v0.8"
+ xmlns:common="http://schemas.dmtf.org/wbem/wscim/1/common"
+ xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
+ xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"
+ xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"
+ name="607968.0">
+ <vApp:Link
+ href="https://api.symphonyVPDC.savvis.net/rest/api/v0.8/org/607968.0/vdc/2826"
+ name="GravDataCenter1(Saved)" rel="down"
+ type="application/vnd.vmware.vcloud.vdc+xml" />
+ <vApp:Description>Gravitant Inc</vApp:Description>
+</vApp:Org>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/org.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/org.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/org.xml
new file mode 100644
index 0000000..1728721
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/org.xml
@@ -0,0 +1,5 @@
+<Org href="https://services.vcloudexpress.terremark.com/api/v0.8/org/48" name="adrian@jclouds.org" xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <Link rel="down" href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32" type="application/vnd.vmware.vcloud.vdc+xml" name="Miami Environment 1"/>
+ <Link rel="down" href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog" type="application/vnd.vmware.vcloud.catalog+xml" name="Miami Environment 1 Catalog"/>
+ <Link rel="down" href="https://services.vcloudexpress.terremark.com/api/v0.8/tasksList/32" type="application/vnd.vmware.vcloud.tasksList+xml" name="Miami Environment 1 Tasks List"/>
+</Org>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/org1.0-vcd15.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/org1.0-vcd15.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/org1.0-vcd15.xml
new file mode 100644
index 0000000..d0ca5b7
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/org1.0-vcd15.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Org xmlns="http://www.vmware.com/vcloud/v1" name="jclouds" type="application/vnd.vmware.vcloud.org+xml" href="https://zone.myvcloud.com/api/v1.0/org/c076f90a-397a-49fa-89b8-b294c1599cd0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 https://zone.myvcloud.com/api/v1.0/schema/master.xsd">
+ <Link rel="down" type="application/vnd.vmware.vcloud.vdc+xml" name="orgVDC-jclouds-Tier1-PAYG" href="https://zone.myvcloud.com/api/v1.0/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.tasksList+xml" href="https://zone.myvcloud.com/api/v1.0/tasksList/c076f90a-397a-49fa-89b8-b294c1599cd0"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.catalog+xml" name="jclouds" href="https://zone.myvcloud.com/api/v1.0/catalog/3155f393-1e1d-4572-8c9c-d76f72ddb658"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://zone.myvcloud.com/api/v1.0/org/c076f90a-397a-49fa-89b8-b294c1599cd0/catalog/3155f393-1e1d-4572-8c9c-d76f72ddb658/controlAccess/"/>
+ <Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://zone.myvcloud.com/api/v1.0/org/c076f90a-397a-49fa-89b8-b294c1599cd0/catalog/3155f393-1e1d-4572-8c9c-d76f72ddb658/action/controlAccess"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.network+xml" name="orgNet-jclouds-External" href="https://zone.myvcloud.com/api/v1.0/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1"/>
+ <Description>Customer jclouds</Description>
+ <FullName>jclouds</FullName>
+</Org>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/orgList1.0-vcd15.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/orgList1.0-vcd15.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/orgList1.0-vcd15.xml
new file mode 100644
index 0000000..40f3cbe
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/orgList1.0-vcd15.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<OrgList xmlns="http://www.vmware.com/vcloud/v1" type="application/vnd.vmware.vcloud.orgList+xml" href="https://zone.myvcloud.com/api/v1.0/org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 https://zone.myvcloud.com/api/v1.0/schema/master.xsd">
+ <Org type="application/vnd.vmware.vcloud.org+xml" name="jclouds" href="https://zone.myvcloud.com/api/v1.0/org/c076f90a-397a-49fa-89b8-b294c1599cd0"/>
+</OrgList>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/orglist-savvis.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/orglist-savvis.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/orglist-savvis.xml
new file mode 100644
index 0000000..4de503b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/orglist-savvis.xml
@@ -0,0 +1,3 @@
+<vApp:OrgList xmlns:vApp="http://www.vmware.com/vcloud/v0.8">
+<vApp:Org name="SAVVISStation Integration Testing" type="application/vnd.vmware.vcloud.org+xml" href="https://api.sandbox.symphonyvpdc.savvis.net/rest/api/v0.8/org/100000.0"/>
+</vApp:OrgList>
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/orglist.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/orglist.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/orglist.xml
new file mode 100644
index 0000000..e6117b3
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/orglist.xml
@@ -0,0 +1,3 @@
+<OrgList xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+<Org href="https://services.vcloudexpress.terremark.com/api/v0.8/org/48" type="application/vnd.vmware.vcloud.org+xml" name="adrian@jclouds.org"/>
+</OrgList>
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/orgnetwork-bridged.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/orgnetwork-bridged.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/orgnetwork-bridged.xml
new file mode 100644
index 0000000..cb2a0d3
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/orgnetwork-bridged.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<OrgNetwork xmlns="http://www.vmware.com/vcloud/v1" name="internet01" type="application/vnd.vmware.vcloud.network+xml" href="https://vcenterprise.bluelock.com/api/v1.0/network/758634723" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.org+xml" href="https://vcenterprise.bluelock.com/api/v1.0/org/9566014"/>
+ <Description/>
+ <Configuration>
+ <IpScope>
+ <IsInherited>true</IsInherited>
+ <Gateway>174.47.101.161</Gateway>
+ <Netmask>255.255.255.224</Netmask>
+ <Dns1>24.172.173.113</Dns1>
+ <IpRanges>
+ <IpRange>
+ <StartAddress>174.47.101.164</StartAddress>
+ <EndAddress>174.47.101.190</EndAddress>
+ </IpRange>
+ </IpRanges>
+ </IpScope>
+ <FenceMode>bridged</FenceMode>
+ </Configuration>
+</OrgNetwork>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/orgnetwork-isolated.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/orgnetwork-isolated.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/orgnetwork-isolated.xml
new file mode 100644
index 0000000..ac3a66a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/orgnetwork-isolated.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<OrgNetwork xmlns="http://www.vmware.com/vcloud/v1" name="isolation01" type="application/vnd.vmware.vcloud.network+xml" href="https://vcenterprise.bluelock.com/api/v1.0/network/990419644" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.org+xml" href="https://vcenterprise.bluelock.com/api/v1.0/org/9566014"/>
+ <Description/>
+ <Configuration>
+ <IpScope>
+ <IsInherited>false</IsInherited>
+ <Gateway>192.168.15.1</Gateway>
+ <Netmask>255.255.255.0</Netmask>
+ <Dns1>23.172.173.113</Dns1>
+ <IpRanges>
+ <IpRange>
+ <StartAddress>192.168.15.100</StartAddress>
+ <EndAddress>192.168.15.199</EndAddress>
+ </IpRange>
+ </IpRanges>
+ </IpScope>
+ <FenceMode>isolated</FenceMode>
+ <Features>
+ <DhcpService>
+ <IsEnabled>false</IsEnabled>
+ <DefaultLeaseTime>3600</DefaultLeaseTime>
+ <MaxLeaseTime>7200</MaxLeaseTime>
+ <IpRange>
+ <StartAddress>192.168.15.2</StartAddress>
+ <EndAddress>192.168.15.99</EndAddress>
+ </IpRange>
+ </DhcpService>
+ </Features>
+ </Configuration>
+</OrgNetwork>
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/os.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/os.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/os.xml
new file mode 100644
index 0000000..3196a27
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/os.xml
@@ -0,0 +1,11 @@
+<ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1"
+ xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="80"
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/operatingSystemSection/"
+ vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml"
+ vmw:osType="rhel5_64Guest">
+ <ovf:Info>Specifies the operating system installed</ovf:Info>
+ <ovf:Description>Red Hat Enterprise Linux 5 (64-bit)</ovf:Description>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.operatingSystemSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/operatingSystemSection/" />
+</ovf:OperatingSystemSection>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/ovf-multi-vm.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/ovf-multi-vm.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/ovf-multi-vm.xml
new file mode 100644
index 0000000..fa4bb37
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/ovf-multi-vm.xml
@@ -0,0 +1,285 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ovf:Envelope xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://www.vmware.com/vcloud/v1 http://zone.myvcloud.com/api/v1.0/schema/master.xsd">
+ <ovf:References/>
+ <ovf:NetworkSection>
+ <ovf:Info>The list of logical networks</ovf:Info>
+ <ovf:Network ovf:name="vapp net">
+ <ovf:Description/>
+ </ovf:Network>
+ </ovf:NetworkSection>
+ <vcloud:NetworkConfigSection ovf:required="false">
+ <ovf:Info>The configuration parameters for logical networks</ovf:Info>
+ <vcloud:NetworkConfig networkName="vapp net">
+ <vcloud:Description/>
+ <vcloud:Configuration>
+ <vcloud:IpScope>
+ <vcloud:IsInherited>false</vcloud:IsInherited>
+ <vcloud:Gateway>192.168.2.1</vcloud:Gateway>
+ <vcloud:Netmask>255.255.255.0</vcloud:Netmask>
+ <vcloud:Dns1>195.225.219.131</vcloud:Dns1>
+ <vcloud:IpRanges>
+ <vcloud:IpRange>
+ <vcloud:StartAddress>192.168.2.100</vcloud:StartAddress>
+ <vcloud:EndAddress>192.168.2.199</vcloud:EndAddress>
+ </vcloud:IpRange>
+ </vcloud:IpRanges>
+ </vcloud:IpScope>
+ <vcloud:FenceMode>isolated</vcloud:FenceMode>
+ <vcloud:Features>
+ <vcloud:DhcpService>
+ <vcloud:IsEnabled>false</vcloud:IsEnabled>
+ <vcloud:DefaultLeaseTime>7200</vcloud:DefaultLeaseTime>
+ <vcloud:MaxLeaseTime>7200</vcloud:MaxLeaseTime>
+ <vcloud:IpRange/>
+ </vcloud:DhcpService>
+ </vcloud:Features>
+ </vcloud:Configuration>
+ <vcloud:IsDeployed>false</vcloud:IsDeployed>
+ </vcloud:NetworkConfig>
+ </vcloud:NetworkConfigSection>
+ <vcloud:LeaseSettingsSection ovf:required="false">
+ <ovf:Info>Lease settings section</ovf:Info>
+ <vcloud:DeploymentLeaseInSeconds>0</vcloud:DeploymentLeaseInSeconds>
+ <vcloud:StorageLeaseInSeconds>0</vcloud:StorageLeaseInSeconds>
+ </vcloud:LeaseSettingsSection>
+ <vcloud:CustomizationSection ovf:required="false">
+ <ovf:Info>VApp template customization section</ovf:Info>
+ <vcloud:CustomizeOnInstantiate>true</vcloud:CustomizeOnInstantiate>
+ </vcloud:CustomizationSection>
+ <ovf:VirtualSystemCollection ovf:id="centos-web/db-5.5">
+ <ovf:Info>A collection of virtual machines: </ovf:Info>
+ <ovf:Name>centos-web/db-5.5</ovf:Name>
+ <ovf:StartupSection>
+ <ovf:Info>VApp startup section</ovf:Info>
+ <ovf:Item ovf:stopDelay="0" ovf:stopAction="powerOff" ovf:startDelay="0" ovf:startAction="powerOn" ovf:order="0" ovf:id="centos-web"/>
+ <ovf:Item ovf:stopDelay="0" ovf:stopAction="powerOff" ovf:startDelay="0" ovf:startAction="powerOn" ovf:order="0" ovf:id="centos-db"/>
+ </ovf:StartupSection>
+ <ovf:VirtualSystem ovf:id="centos-db">
+ <ovf:Info>A virtual machine: </ovf:Info>
+ <ovf:Name>centos-db</ovf:Name>
+ <ovf:OperatingSystemSection xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="100" vmw:osType="other26xLinux64Guest">
+ <ovf:Info>Specifies the operating system installed</ovf:Info>
+ <ovf:Description>Other 2.6x Linux (64-bit)</ovf:Description>
+ </ovf:OperatingSystemSection>
+ <ovf:VirtualHardwareSection>
+ <ovf:Info>Virtual hardware requirements</ovf:Info>
+ <ovf:System>
+ <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+ <vssd:InstanceID>0</vssd:InstanceID>
+ <vssd:VirtualSystemIdentifier>centos-db</vssd:VirtualSystemIdentifier>
+ <vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
+ </ovf:System>
+ <ovf:Item>
+ <rasd:Address>00:50:56:01:06:81</rasd:Address>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
+ <rasd:Connection vcloud:ipAddress="192.168.2.100" vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="POOL">vapp net</rasd:Connection>
+
+ <rasd:Description>PCNet32 ethernet adapter</rasd:Description>
+ <rasd:ElementName>Network adapter 0</rasd:ElementName>
+ <rasd:InstanceID>1</rasd:InstanceID>
+ <rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>SCSI Controller</rasd:Description>
+ <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
+ <rasd:InstanceID>2</rasd:InstanceID>
+ <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
+ <rasd:ResourceType>6</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:Description>Hard disk</rasd:Description>
+ <rasd:ElementName>Hard disk 1</rasd:ElementName>
+ <rasd:HostResource vcloud:capacity="8192" vcloud:busType="6" vcloud:busSubType="lsilogic"/>
+ <rasd:InstanceID>2000</rasd:InstanceID>
+ <rasd:Parent>2</rasd:Parent>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>IDE Controller</rasd:Description>
+ <rasd:ElementName>IDE Controller 0</rasd:ElementName>
+ <rasd:InstanceID>3</rasd:InstanceID>
+ <rasd:ResourceType>5</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>CD/DVD Drive</rasd:Description>
+ <rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>3000</rasd:InstanceID>
+ <rasd:Parent>3</rasd:Parent>
+ <rasd:ResourceType>15</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>Floppy Drive</rasd:Description>
+ <rasd:ElementName>Floppy Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>8000</rasd:InstanceID>
+ <rasd:ResourceType>14</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+ <rasd:Description>Number of Virtual CPUs</rasd:Description>
+ <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
+ <rasd:InstanceID>4</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:ElementName>2048 MB of memory</rasd:ElementName>
+ <rasd:InstanceID>5</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:VirtualQuantity>2048</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ </ovf:Item>
+ </ovf:VirtualHardwareSection>
+ <vcloud:NetworkConnectionSection ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <vcloud:PrimaryNetworkConnectionIndex>0</vcloud:PrimaryNetworkConnectionIndex>
+ <vcloud:NetworkConnection network="vapp net">
+ <vcloud:NetworkConnectionIndex>0</vcloud:NetworkConnectionIndex>
+ <vcloud:IpAddress>192.168.2.100</vcloud:IpAddress>
+ <vcloud:IsConnected>true</vcloud:IsConnected>
+ <vcloud:MACAddress>00:50:56:01:06:81</vcloud:MACAddress>
+ <vcloud:IpAddressAllocationMode>POOL</vcloud:IpAddressAllocationMode>
+ </vcloud:NetworkConnection>
+ </vcloud:NetworkConnectionSection>
+ <vcloud:GuestCustomizationSection ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <vcloud:Enabled>true</vcloud:Enabled>
+ <vcloud:ChangeSid>false</vcloud:ChangeSid>
+ <vcloud:JoinDomainEnabled>false</vcloud:JoinDomainEnabled>
+ <vcloud:UseOrgSettings>false</vcloud:UseOrgSettings>
+ <vcloud:AdminPasswordEnabled>false</vcloud:AdminPasswordEnabled>
+ <vcloud:AdminPasswordAuto>true</vcloud:AdminPasswordAuto>
+ <vcloud:ResetPasswordRequired>false</vcloud:ResetPasswordRequired>
+ <vcloud:ComputerName>centos-db</vcloud:ComputerName>
+ </vcloud:GuestCustomizationSection>
+ </ovf:VirtualSystem>
+ <ovf:VirtualSystem ovf:id="centos-web">
+ <ovf:Info>A virtual machine: </ovf:Info>
+ <ovf:Name>centos-web</ovf:Name>
+ <ovf:OperatingSystemSection xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="100" vmw:osType="other26xLinux64Guest">
+ <ovf:Info>Specifies the operating system installed</ovf:Info>
+ <ovf:Description>Other 2.6x Linux (64-bit)</ovf:Description>
+ </ovf:OperatingSystemSection>
+ <ovf:VirtualHardwareSection>
+ <ovf:Info>Virtual hardware requirements</ovf:Info>
+ <ovf:System>
+ <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+ <vssd:InstanceID>0</vssd:InstanceID>
+ <vssd:VirtualSystemIdentifier>centos-web</vssd:VirtualSystemIdentifier>
+ <vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
+ </ovf:System>
+ <ovf:Item>
+ <rasd:Address>00:50:56:01:06:82</rasd:Address> <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
+ <rasd:Connection vcloud:ipAddress="192.168.2.101" vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="POOL">vapp net</rasd:Connection>
+
+ <rasd:Description>PCNet32 ethernet adapter</rasd:Description>
+ <rasd:ElementName>Network adapter 0</rasd:ElementName>
+ <rasd:InstanceID>1</rasd:InstanceID>
+ <rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>SCSI Controller</rasd:Description>
+ <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
+ <rasd:InstanceID>2</rasd:InstanceID>
+ <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
+ <rasd:ResourceType>6</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:Description>Hard disk</rasd:Description>
+ <rasd:ElementName>Hard disk 1</rasd:ElementName>
+ <rasd:HostResource vcloud:capacity="8192" vcloud:busType="6" vcloud:busSubType="lsilogic"/>
+ <rasd:InstanceID>2000</rasd:InstanceID>
+ <rasd:Parent>2</rasd:Parent>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>IDE Controller</rasd:Description>
+ <rasd:ElementName>IDE Controller 0</rasd:ElementName>
+ <rasd:InstanceID>3</rasd:InstanceID>
+ <rasd:ResourceType>5</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>CD/DVD Drive</rasd:Description>
+ <rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>3000</rasd:InstanceID>
+ <rasd:Parent>3</rasd:Parent>
+ <rasd:ResourceType>15</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>Floppy Drive</rasd:Description>
+ <rasd:ElementName>Floppy Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>8000</rasd:InstanceID>
+ <rasd:ResourceType>14</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+ <rasd:Description>Number of Virtual CPUs</rasd:Description>
+ <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
+ <rasd:InstanceID>4</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:ElementName>2048 MB of memory</rasd:ElementName>
+ <rasd:InstanceID>5</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:VirtualQuantity>2048</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ </ovf:Item>
+ </ovf:VirtualHardwareSection>
+ <vcloud:NetworkConnectionSection ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <vcloud:PrimaryNetworkConnectionIndex>0</vcloud:PrimaryNetworkConnectionIndex>
+ <vcloud:NetworkConnection network="vapp net">
+ <vcloud:NetworkConnectionIndex>0</vcloud:NetworkConnectionIndex>
+ <vcloud:IpAddress>192.168.2.101</vcloud:IpAddress>
+ <vcloud:IsConnected>true</vcloud:IsConnected>
+ <vcloud:MACAddress>00:50:56:01:06:82</vcloud:MACAddress>
+ <vcloud:IpAddressAllocationMode>POOL</vcloud:IpAddressAllocationMode>
+ </vcloud:NetworkConnection>
+ </vcloud:NetworkConnectionSection>
+ <vcloud:GuestCustomizationSection ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <vcloud:Enabled>true</vcloud:Enabled>
+ <vcloud:ChangeSid>false</vcloud:ChangeSid>
+ <vcloud:JoinDomainEnabled>false</vcloud:JoinDomainEnabled>
+ <vcloud:UseOrgSettings>false</vcloud:UseOrgSettings>
+ <vcloud:AdminPasswordEnabled>false</vcloud:AdminPasswordEnabled>
+ <vcloud:AdminPasswordAuto>true</vcloud:AdminPasswordAuto>
+ <vcloud:ResetPasswordRequired>false</vcloud:ResetPasswordRequired>
+ <vcloud:ComputerName>centos-web</vcloud:ComputerName>
+ </vcloud:GuestCustomizationSection>
+ </ovf:VirtualSystem>
+ </ovf:VirtualSystemCollection>
+</ovf:Envelope>
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/ovf-ubuntu64.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/ovf-ubuntu64.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/ovf-ubuntu64.xml
new file mode 100644
index 0000000..7679573
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/ovf-ubuntu64.xml
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ovf:Envelope xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://www.vmware.com/vcloud/v1 https://zone.myvcloud.com/api/v1.0/schema/master.xsd">
+ <ovf:References/>
+ <ovf:NetworkSection>
+ <ovf:Info>The list of logical networks</ovf:Info>
+ <ovf:Network ovf:name="none">
+ <ovf:Description>This is a special place-holder used for disconnected network interfaces.</ovf:Description>
+ </ovf:Network>
+ </ovf:NetworkSection>
+ <vcloud:NetworkConfigSection ovf:required="false">
+ <ovf:Info>The configuration parameters for logical networks</ovf:Info>
+ <vcloud:NetworkConfig networkName="none">
+ <vcloud:Description>This is a special place-holder used for disconnected network interfaces.</vcloud:Description>
+ <vcloud:Configuration>
+ <vcloud:IpScope>
+ <vcloud:IsInherited>false</vcloud:IsInherited>
+ <vcloud:Gateway>196.254.254.254</vcloud:Gateway>
+ <vcloud:Netmask>255.255.0.0</vcloud:Netmask>
+ <vcloud:Dns1>196.254.254.254</vcloud:Dns1>
+ </vcloud:IpScope>
+ <vcloud:FenceMode>isolated</vcloud:FenceMode>
+ </vcloud:Configuration>
+ <vcloud:IsDeployed>false</vcloud:IsDeployed>
+ </vcloud:NetworkConfig>
+ </vcloud:NetworkConfigSection>
+ <vcloud:LeaseSettingsSection ovf:required="false">
+ <ovf:Info>Lease settings section</ovf:Info>
+ <vcloud:DeploymentLeaseInSeconds>0</vcloud:DeploymentLeaseInSeconds>
+ <vcloud:StorageLeaseInSeconds>5184000</vcloud:StorageLeaseInSeconds>
+ <vcloud:StorageLeaseExpiration>2012-03-12T17:40:44.491-06:00</vcloud:StorageLeaseExpiration>
+ </vcloud:LeaseSettingsSection>
+ <vcloud:CustomizationSection ovf:required="false">
+ <ovf:Info>VApp template customization section</ovf:Info>
+ <vcloud:CustomizeOnInstantiate>true</vcloud:CustomizeOnInstantiate>
+ </vcloud:CustomizationSection>
+ <ovf:VirtualSystem ovf:id="UbuntuServer-x64-2GB">
+ <ovf:Info>A virtual machine: </ovf:Info>
+ <ovf:Name>UbuntuServer-x64-2GB</ovf:Name>
+ <ovf:OperatingSystemSection xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="94" vmw:osType="ubuntu64Guest">
+ <ovf:Info>Specifies the operating system installed</ovf:Info>
+ <ovf:Description>Ubuntu Linux (64-bit)</ovf:Description>
+ </ovf:OperatingSystemSection>
+ <ovf:VirtualHardwareSection>
+ <ovf:Info>Virtual hardware requirements</ovf:Info>
+ <ovf:System>
+ <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+ <vssd:InstanceID>0</vssd:InstanceID>
+ <vssd:VirtualSystemIdentifier>UbuntuServer-x64-2GB</vssd:VirtualSystemIdentifier>
+ <vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
+ </ovf:System>
+ <ovf:Item>
+ <rasd:Address>00:50:56:01:02:9f</rasd:Address>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Connection vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="NONE">none</rasd:Connection>
+ <rasd:Description>PCNet32 ethernet adapter</rasd:Description>
+ <rasd:ElementName>Network adapter 0</rasd:ElementName>
+ <rasd:InstanceID>1</rasd:InstanceID>
+ <rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>SCSI Controller</rasd:Description>
+ <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
+ <rasd:InstanceID>2</rasd:InstanceID>
+ <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
+ <rasd:ResourceType>6</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:Description>Hard disk</rasd:Description>
+ <rasd:ElementName>Hard disk 1</rasd:ElementName>
+ <rasd:HostResource vcloud:capacity="2048" vcloud:busType="6" vcloud:busSubType="lsilogic"/>
+ <rasd:InstanceID>2000</rasd:InstanceID>
+ <rasd:Parent>2</rasd:Parent>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>IDE Controller</rasd:Description>
+ <rasd:ElementName>IDE Controller 0</rasd:ElementName>
+ <rasd:InstanceID>3</rasd:InstanceID>
+ <rasd:ResourceType>5</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>CD/DVD Drive</rasd:Description>
+ <rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>3000</rasd:InstanceID>
+ <rasd:Parent>3</rasd:Parent>
+ <rasd:ResourceType>15</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>Floppy Drive</rasd:Description>
+ <rasd:ElementName>Floppy Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>8000</rasd:InstanceID>
+ <rasd:ResourceType>14</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+ <rasd:Description>Number of Virtual CPUs</rasd:Description>
+ <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
+ <rasd:InstanceID>4</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:ElementName>256 MB of memory</rasd:ElementName>
+ <rasd:InstanceID>5</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:VirtualQuantity>256</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ </ovf:Item>
+ </ovf:VirtualHardwareSection>
+ <vcloud:NetworkConnectionSection ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <vcloud:PrimaryNetworkConnectionIndex>0</vcloud:PrimaryNetworkConnectionIndex>
+ <vcloud:NetworkConnection network="none">
+ <vcloud:NetworkConnectionIndex>0</vcloud:NetworkConnectionIndex>
+ <vcloud:IsConnected>false</vcloud:IsConnected>
+ <vcloud:MACAddress>00:50:56:01:02:9f</vcloud:MACAddress>
+ <vcloud:IpAddressAllocationMode>NONE</vcloud:IpAddressAllocationMode>
+ </vcloud:NetworkConnection>
+ </vcloud:NetworkConnectionSection>
+ <vcloud:GuestCustomizationSection ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <vcloud:Enabled>true</vcloud:Enabled>
+ <vcloud:ChangeSid>false</vcloud:ChangeSid>
+ <vcloud:JoinDomainEnabled>false</vcloud:JoinDomainEnabled>
+ <vcloud:UseOrgSettings>false</vcloud:UseOrgSettings>
+ <vcloud:AdminPasswordEnabled>true</vcloud:AdminPasswordEnabled>
+ <vcloud:AdminPasswordAuto>true</vcloud:AdminPasswordAuto>
+ <vcloud:ResetPasswordRequired>false</vcloud:ResetPasswordRequired>
+ <vcloud:ComputerName>UbuntuServer</vcloud:ComputerName>
+ </vcloud:GuestCustomizationSection>
+ </ovf:VirtualSystem>
+</ovf:Envelope>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/task-1.0.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/task-1.0.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/task-1.0.xml
new file mode 100644
index 0000000..20fde3f
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/task-1.0.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Task status="running" startTime="2010-08-23T02:09:52.443-04:00"
+ operation="Creating Virtual Application vApp_acole_2(607806320)"
+ expiryTime="2010-11-21T02:09:52.443-05:00" endTime="9999-12-31T23:59:59.999-05:00"
+ type="application/vnd.vmware.vcloud.task+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/task/3cc08ir8oczbze3n1a3">
+ <Owner type="application/vnd.vmware.vcloud.vApp+xml" name="vApp_acole_2"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320" />
+</Task>
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/task-error.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/task-error.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/task-error.xml
new file mode 100644
index 0000000..77147f8
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/task-error.xml
@@ -0,0 +1,9 @@
+<Task href="http://10.150.4.49/api/v0.8/task/23" type="application/vnd.vmware.vcloud.task+xml"
+ status="error" startTime="2009-12-07T19:05:02" endTime="2009-12-10T14:40:32">
+ <Owner href="http://10.150.4.49/api/v0.8/org/1" type="application/vnd.vmware.vcloud.org+xml"
+ name="APIOrg" />
+ <Result href="http://10.150.4.49/api/v0.8/vapp/1" type="application/vnd.vmware.vcloud.vApp+xml"
+ name="testapp1" />
+ <Error message="Error processing job" majorErrorCode="500"
+ minorErrorCode=" Error in runDailySummaries date used:2009-12-09 19:40:30.577326+00:00" />
+</Task>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/task-hosting.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/task-hosting.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/task-hosting.xml
new file mode 100644
index 0000000..f4af4a2
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/task-hosting.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Task href="https://vcloud.safesecureweb.com/api/v0.8/task/97806" xmlns="http://www.vmware.com/vcloud/v0.8"
+ xmlns:common="http://www.vmware.com/vcloud/common"
+ xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8/task
+ https://vcloud.safesecureweb.com/ns/vcloud/task-1.0.xsd
+ http://www.vmware.com/vcloud/common
+ https://vcloud.safesecureweb.com/ns/vcloud/common-1.0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ status="success" startTime="2010-01-14T20:04:51Z" endTime="2010-01-14T20:05:02Z" expiryTime="2010-01-15T20:05:02Z">
+
+ <Owner href="https://vcloud.safesecureweb.com/api/v0.8/vapp/188849-96" type="application/vnd.vmware.vcloud.vApp+xml" name="188849-96" />
+</Task>
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/task-self.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/task-self.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/task-self.xml
new file mode 100644
index 0000000..4a17424
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/task-self.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Task xmlns="http://www.vmware.com/vcloud/v0.8" xmlns:common="http://www/vmware.com/vcloud/common"
+ xsi:schemaLocation="http://www/vmware.com/vcloud/task
+ https://vcloud.safesecureweb.com/ns/vcloud/task-1.0.xsd
+ http://www.vmware.com/vcloud/common
+ https://vcloud.safesecureweb.com/ns/vcloud/common-1.0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" status="queued">
+ <Link rel="self"
+ href="https://vcloud.safesecureweb.com/api/v0.8/task/d188849-78"
+ type="application/vnd.vmware.vcloud.task+xml" />
+</Task>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/task-vcd15.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/task-vcd15.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/task-vcd15.xml
new file mode 100644
index 0000000..452287d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/task-vcd15.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<vcloud:Task xmlns:vcloud="http://www.vmware.com/vcloud/v1" status="running" startTime="2012-03-15T22:47:02.058-06:00" operation="Updating Virtual Machine UbuntuServer-x64-2GB(c9004a47-5e21-4cf1-860c-670d8965b24a)" expiryTime="2012-06-13T22:47:02.058-06:00" type="application/vnd.vmware.vcloud.task+xml" href="https://mycloud.greenhousedata.com/api/v1.0/task/77a33fd4-3401-423c-8167-6711fc51ee9a" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://mycloud.greenhousedata.com/api/v1.0/schema/master.xsd">
+ <vcloud:Link rel="task:cancel" href="https://mycloud.greenhousedata.com/api/v1.0/task/77a33fd4-3401-423c-8167-6711fc51ee9a/action/cancel"/>
+ <vcloud:Owner type="application/vnd.vmware.vcloud.vm+xml" name="UbuntuServer-x64-2GB" href="https://mycloud.greenhousedata.com/api/v1.0/vApp/vm-c9004a47-5e21-4cf1-860c-670d8965b24a"/>
+</vcloud:Task>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/task.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/task.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/task.xml
new file mode 100644
index 0000000..bd0514e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/task.xml
@@ -0,0 +1,8 @@
+<Task href="https://services.vcloudexpress.terremark.com/api/v0.8/task/3299"
+ status="success" startTime="2009-08-24T21:29:32.983Z" endTime="2009-08-24T21:29:44.65Z">
+ <Owner href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/1"
+ type="application/vnd.vmware.vcloud.vdc+xml" name="VDC Name" />
+ <Result
+ href="https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012"
+ type="application/vnd.vmware.vcloud.vApp+xml" name="Server1" />
+</Task>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/taskslist-hosting.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/taskslist-hosting.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/taskslist-hosting.xml
new file mode 100644
index 0000000..1511d13
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/taskslist-hosting.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tasks xmlns="http://www.vmware.com/vcloud/tasks" xmlns:common="http://www.vmware.com/vcloud/v0.8"
+ xmlns:task="http://www.vmware.com/vcloud/task"
+ xsi:schemaLocation="http://www.vmware.com/vcloud/tasks
+ https://vcloud.safesecureweb.com/ns/vcloud/tasks-1.0.xsd
+ http://www.vmware.com/vcloud/v0.8
+ https://vcloud.safesecureweb.com/ns/vcloud/common-1.0.xsd
+ http://www.vmware.com/vcloud/task
+ https://vcloud.safesecureweb.com/ns/vcloud/task-1.0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <Link rel="self"
+ href="https://vcloud.safesecureweb.com/api/v0.8/tasksList/188849"
+ type="application/vnd.vmware.vcloud.tasksList+xml" />
+</tasks>
\ No newline at end of file
[02/18] stratos git commit: Jclouds vcloud api 1.8.1 clone with
custom changes
Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-pool.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-pool.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-pool.xml
new file mode 100644
index 0000000..1ac8ff3
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-pool.xml
@@ -0,0 +1,227 @@
+<VApp xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" deployed="true" status="4" name="my-appExample" type="application/vnd.vmware.vcloud.vApp+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://www.vmware.com/vcloud/v1 http://1.1.1.1/api/v1.0/sch
ema/master.xsd">
+ <Link rel="power:powerOff" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/powerOff"/>
+ <Link rel="power:reboot" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/reboot"/>
+ <Link rel="power:reset" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/reset"/>
+ <Link rel="power:shutdown" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/shutdown"/>
+ <Link rel="power:suspend" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/suspend"/>
+ <Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/action/deploy"/>
+ <Link rel="undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/action/undeploy"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/controlAccess/"/>
+ <Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/action/controlAccess"/>
+ <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml" href="https://1.1.1.1/api/v1.0/vdc/1"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vApp+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1"/>
+ <Description>Example FTP Server vApp</Description>
+ <LeaseSettingsSection type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/leaseSettingsSection/" ovf:required="false">
+ <ovf:Info>Lease settings section</ovf:Info>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/leaseSettingsSection/"/>
+ <DeploymentLeaseInSeconds>0</DeploymentLeaseInSeconds>
+ <StorageLeaseInSeconds>0</StorageLeaseInSeconds>
+ </LeaseSettingsSection>
+ <ovf:StartupSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://1.1.1.1/api/v1.0/vApp/vapp-1/startupSection/" vcloud:type="application/vnd.vmware.vcloud.startupSection+xml">
+ <ovf:Info>VApp startup section</ovf:Info>
+ <ovf:Item ovf:stopDelay="0" ovf:stopAction="powerOff" ovf:startDelay="0" ovf:startAction="powerOn" ovf:order="0" ovf:id="my-app"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.startupSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/startupSection/"/>
+ </ovf:StartupSection>
+ <ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://1.1.1.1/api/v1.0/vApp/vapp-1/networkSection/" vcloud:type="application/vnd.vmware.vcloud.networkSection+xml">
+ <ovf:Info>The list of logical networks</ovf:Info>
+ <ovf:Network ovf:name="Direct">
+ <ovf:Description/>
+ </ovf:Network>
+ </ovf:NetworkSection>
+ <NetworkConfigSection type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/networkConfigSection/" ovf:required="false">
+ <ovf:Info>The configuration parameters for logical networks</ovf:Info>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/networkConfigSection/"/>
+ <NetworkConfig networkName="Direct">
+ <Description/>
+ <Configuration>
+ <IpScope>
+ <IsInherited>true</IsInherited>
+ <Gateway>172.16.7.1</Gateway>
+ <Netmask>255.255.255.0</Netmask>
+ <Dns1>1.1.1.2</Dns1>
+ <Dns2>1.1.1.3</Dns2>
+ <IpRanges>
+ <IpRange>
+ <StartAddress>172.16.7.230</StartAddress>
+ <EndAddress>172.16.7.239</EndAddress>
+ </IpRange>
+ </IpRanges>
+ </IpScope>
+ <ParentNetwork type="application/vnd.vmware.vcloud.network+xml" name="Direct" href="https://1.1.1.1/api/v1.0/network/282371363"/>
+ <FenceMode>bridged</FenceMode>
+ <Features>
+ <DhcpService>
+ <IsEnabled>false</IsEnabled>
+ <DefaultLeaseTime>3600</DefaultLeaseTime>
+ <MaxLeaseTime>7200</MaxLeaseTime>
+ <IpRange>
+ <StartAddress>172.16.7.2</StartAddress>
+ <EndAddress>172.16.7.229</EndAddress>
+ </IpRange>
+ </DhcpService>
+ <FirewallService>
+ <IsEnabled>true</IsEnabled>
+ </FirewallService>
+ <NatService>
+ <IsEnabled>true</IsEnabled>
+ <NatType>ipTranslation</NatType>
+ <Policy>allowTraffic</Policy>
+ <NatRule>
+ <OneToOneVmRule>
+ <MappingMode>automatic</MappingMode>
+ <VAppScopedVmId>100c208b-4f43-40bb-98d6-a046f6e48c3a</VAppScopedVmId>
+ <VmNicId>0</VmNicId>
+ </OneToOneVmRule>
+ </NatRule>
+ </NatService>
+ </Features>
+ </Configuration>
+ <IsDeployed>true</IsDeployed>
+ </NetworkConfig>
+ </NetworkConfigSection>
+ <Children>
+ <Vm deployed="true" status="4" name="my-app" type="application/vnd.vmware.vcloud.vm+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1">
+ <Link rel="power:powerOff" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/powerOff"/>
+ <Link rel="power:reboot" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/reboot"/>
+ <Link rel="power:reset" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/reset"/>
+ <Link rel="power:shutdown" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/shutdown"/>
+ <Link rel="power:suspend" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/suspend"/>
+ <Link rel="undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/action/undeploy"/>
+ <Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1"/>
+ <Link rel="screen:thumbnail" href="https://1.1.1.1/api/v1.0/vApp/vm-1/screen"/>
+ <Link rel="screen:acquireTicket" href="https://1.1.1.1/api/v1.0/vApp/vm-1/screen/action/acquireTicket"/>
+ <Link rel="media:insertMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/media/action/insertMedia"/>
+ <Link rel="media:ejectMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/media/action/ejectMedia"/>
+ <Description/>
+ <ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/" vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
+ <ovf:Info>Virtual hardware requirements</ovf:Info>
+ <ovf:System>
+ <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+ <vssd:InstanceID>0</vssd:InstanceID>
+ <vssd:VirtualSystemIdentifier>my-app</vssd:VirtualSystemIdentifier>
+ <vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
+ </ovf:System>
+ <ovf:Item>
+ <rasd:Address>00:50:56:01:02:33</rasd:Address>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
+ <rasd:Connection vcloud:ipAddress="172.16.7.230" vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="POOL">Direct</rasd:Connection>
+ <rasd:Description>PCNet32 ethernet adapter</rasd:Description>
+ <rasd:ElementName>Network adapter 0</rasd:ElementName>
+ <rasd:InstanceID>1</rasd:InstanceID>
+ <rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>SCSI Controller</rasd:Description>
+ <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
+ <rasd:InstanceID>2</rasd:InstanceID>
+ <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
+ <rasd:ResourceType>6</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:Description>Hard disk</rasd:Description>
+ <rasd:ElementName>Hard disk 1</rasd:ElementName>
+ <rasd:HostResource vcloud:capacity="15360" vcloud:busType="6" vcloud:busSubType="lsilogic"/>
+ <rasd:InstanceID>2000</rasd:InstanceID>
+ <rasd:Parent>2</rasd:Parent>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>IDE Controller</rasd:Description>
+ <rasd:ElementName>IDE Controller 0</rasd:ElementName>
+ <rasd:InstanceID>3</rasd:InstanceID>
+ <rasd:ResourceType>5</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>CD/DVD Drive</rasd:Description>
+ <rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>3002</rasd:InstanceID>
+ <rasd:Parent>3</rasd:Parent>
+ <rasd:ResourceType>15</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>Floppy Drive</rasd:Description>
+ <rasd:ElementName>Floppy Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>8000</rasd:InstanceID>
+ <rasd:ResourceType>14</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item vcloud:href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+ <rasd:Description>Number of Virtual CPUs</rasd:Description>
+ <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
+ <rasd:InstanceID>4</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
+ </ovf:Item>
+ <ovf:Item vcloud:href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/memory" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:ElementName>2048 MB of memory</rasd:ElementName>
+ <rasd:InstanceID>5</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:VirtualQuantity>2048</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
+ </ovf:Item>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/disks"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/disks"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/media"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/networkCards"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/networkCards"/>
+ </ovf:VirtualHardwareSection>
+ <ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="80" vcloud:href="https://1.1.1.1/api/v1.0/vApp/vm-1/operatingSystemSection/" vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml" vmw:osType="rhel5_64Guest">
+ <ovf:Info>Specifies the operating system installed</ovf:Info>
+ <ovf:Description>Red Hat Enterprise Linux 5 (64-bit)</ovf:Description>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.operatingSystemSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/operatingSystemSection/"/>
+ </ovf:OperatingSystemSection>
+ <NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/networkConnectionSection/" ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
+ <NetworkConnection network="Direct">
+ <NetworkConnectionIndex>0</NetworkConnectionIndex>
+ <IpAddress>172.16.7.230</IpAddress>
+ <IsConnected>true</IsConnected>
+ <MACAddress>00:50:56:01:02:33</MACAddress>
+ <IpAddressAllocationMode>POOL</IpAddressAllocationMode>
+ </NetworkConnection>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/networkConnectionSection/"/>
+ </NetworkConnectionSection>
+ <GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/guestCustomizationSection/" ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <Enabled>true</Enabled>
+ <ChangeSid>false</ChangeSid>
+ <VirtualMachineId>1</VirtualMachineId>
+ <JoinDomainEnabled>false</JoinDomainEnabled>
+ <UseOrgSettings>false</UseOrgSettings>
+ <AdminPasswordEnabled>true</AdminPasswordEnabled>
+ <AdminPasswordAuto>true</AdminPasswordAuto>
+ <AdminPassword>Favor</AdminPassword>
+ <ResetPasswordRequired>false</ResetPasswordRequired>
+ <CustomizationScript/>
+ <ComputerName>my-app</ComputerName>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/guestCustomizationSection/"/>
+ </GuestCustomizationSection>
+ <VAppScopedLocalId>100c208b-4f43-40bb-98d6-a046f6e48c3a</VAppScopedLocalId>
+ </Vm>
+ </Children>
+</VApp>
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-rhel-off-static.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-rhel-off-static.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-rhel-off-static.xml
new file mode 100644
index 0000000..7e29ffc
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-rhel-off-static.xml
@@ -0,0 +1,325 @@
+<VApp xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
+ xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"
+ xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"
+ deployed="false" status="8" name="vApp_acole_2"
+ type="application/vnd.vmware.vcloud.vApp+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
+ <Link rel="power:powerOn"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/power/action/powerOn" />
+ <Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/action/deploy" />
+ <Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/controlAccess/" />
+ <Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/action/controlAccess" />
+ <Link rel="recompose"
+ type="application/vnd.vmware.vcloud.recomposeVAppParams+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/action/recomposeVApp" />
+ <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439" />
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vApp+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320" />
+ <Link rel="remove"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320" />
+ <Description>foo</Description>
+ <LeaseSettingsSection
+ type="application/vnd.vmware.vcloud.leaseSettingsSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/leaseSettingsSection/"
+ ovf:required="false">
+ <ovf:Info>Lease settings section</ovf:Info>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.leaseSettingsSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/leaseSettingsSection/" />
+ <DeploymentLeaseInSeconds>0</DeploymentLeaseInSeconds>
+ <StorageLeaseInSeconds>0</StorageLeaseInSeconds>
+ </LeaseSettingsSection>
+ <ovf:StartupSection xmlns:vcloud="http://www.vmware.com/vcloud/v1"
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/startupSection/"
+ vcloud:type="application/vnd.vmware.vcloud.startupSection+xml">
+ <ovf:Info>VApp startup section</ovf:Info>
+ <ovf:Item ovf:stopDelay="0" ovf:stopAction="powerOff"
+ ovf:startDelay="0" ovf:startAction="powerOn" ovf:order="0"
+ ovf:id="RHEL5" />
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.startupSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/startupSection/" />
+ </ovf:StartupSection>
+ <ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1"
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/networkSection/"
+ vcloud:type="application/vnd.vmware.vcloud.networkSection+xml">
+ <ovf:Info>The list of logical networks</ovf:Info>
+ <ovf:Network ovf:name="internet01">
+ <ovf:Description />
+ </ovf:Network>
+ </ovf:NetworkSection>
+ <NetworkConfigSection
+ type="application/vnd.vmware.vcloud.networkConfigSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/networkConfigSection/"
+ ovf:required="false">
+ <ovf:Info>The configuration parameters for logical networks</ovf:Info>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.networkConfigSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320/networkConfigSection/" />
+ <NetworkConfig networkName="internet01">
+ <Description />
+ <Configuration>
+ <IpScope>
+ <IsInherited>true</IsInherited>
+ <Gateway>174.47.101.161</Gateway>
+ <Netmask>255.255.255.224</Netmask>
+ <Dns1>24.172.173.113</Dns1>
+ <IpRanges>
+ <IpRange>
+ <StartAddress>174.47.101.164</StartAddress>
+ <EndAddress>174.47.101.190</EndAddress>
+ </IpRange>
+ </IpRanges>
+ </IpScope>
+ <ParentNetwork
+ type="application/vnd.vmware.vcloud.network+xml"
+ name="internet01"
+ href="https://vcenterprise.bluelock.com/api/v1.0/network/758634723" />
+ <FenceMode>bridged</FenceMode>
+ <Features>
+ <DhcpService>
+ <IsEnabled>false</IsEnabled>
+ <DefaultLeaseTime>3600</DefaultLeaseTime>
+ <MaxLeaseTime>7200</MaxLeaseTime>
+ <IpRange>
+ <StartAddress>174.47.101.162</StartAddress>
+ <EndAddress>174.47.101.163</EndAddress>
+ </IpRange>
+ </DhcpService>
+ <FirewallService>
+ <IsEnabled>true</IsEnabled>
+ </FirewallService>
+ <NatService>
+ <IsEnabled>true</IsEnabled>
+ <NatType>ipTranslation</NatType>
+ <Policy>allowTraffic</Policy>
+ <NatRule>
+ <OneToOneVmRule>
+ <MappingMode>automatic</MappingMode>
+ <VAppScopedVmId>10_rhel_template</VAppScopedVmId>
+ <VmNicId>0</VmNicId>
+ </OneToOneVmRule>
+ </NatRule>
+ </NatService>
+ </Features>
+ </Configuration>
+ <IsDeployed>false</IsDeployed>
+ </NetworkConfig>
+ </NetworkConfigSection>
+ <Children>
+ <Vm deployed="false" status="8" name="RHEL5"
+ type="application/vnd.vmware.vcloud.vm+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248">
+ <Link rel="power:powerOn"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/power/action/powerOn" />
+ <Link rel="deploy"
+ type="application/vnd.vmware.vcloud.deployVAppParams+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/action/deploy" />
+ <Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320" />
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248" />
+ <Link rel="remove"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248" />
+ <Link rel="screen:thumbnail"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/screen" />
+ <Link rel="screen:acquireTicket"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/screen/action/acquireTicket" />
+ <Link rel="media:insertMedia"
+ type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/media/action/insertMedia" />
+ <Link rel="media:ejectMedia"
+ type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/media/action/ejectMedia" />
+ <Description />
+ <ovf:VirtualHardwareSection
+ xmlns:vcloud="http://www.vmware.com/vcloud/v1"
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/"
+ vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
+ <ovf:Info>Virtual hardware requirements</ovf:Info>
+ <ovf:System>
+ <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+ <vssd:InstanceID>0</vssd:InstanceID>
+ <vssd:VirtualSystemIdentifier>RHEL5</vssd:VirtualSystemIdentifier>
+ <vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
+ </ovf:System>
+ <ovf:Item>
+ <rasd:Address>00:50:56:01:01:f2</rasd:Address>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
+ <rasd:Connection vcloud:ipAddress="174.47.101.164"
+ vcloud:primaryNetworkConnection="true"
+ vcloud:ipAddressingMode="POOL">internet01</rasd:Connection>
+ <rasd:Description>PCNet32 ethernet adapter</rasd:Description>
+ <rasd:ElementName>Network adapter 0</rasd:ElementName>
+ <rasd:InstanceID>1</rasd:InstanceID>
+ <rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>SCSI Controller</rasd:Description>
+ <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
+ <rasd:InstanceID>2</rasd:InstanceID>
+ <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
+ <rasd:ResourceType>6</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:Description>Hard disk</rasd:Description>
+ <rasd:ElementName>Hard disk 1</rasd:ElementName>
+ <rasd:HostResource
+ vcloud:capacity="30720" vcloud:busType="6"
+ vcloud:busSubType="lsilogic" />
+ <rasd:InstanceID>2000</rasd:InstanceID>
+ <rasd:Parent>2</rasd:Parent>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>IDE Controller</rasd:Description>
+ <rasd:ElementName>IDE Controller 0</rasd:ElementName>
+ <rasd:InstanceID>3</rasd:InstanceID>
+ <rasd:ResourceType>5</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>CD/DVD Drive</rasd:Description>
+ <rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
+ <rasd:HostResource />
+ <rasd:InstanceID>3002</rasd:InstanceID>
+ <rasd:Parent>3</rasd:Parent>
+ <rasd:ResourceType>15</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>Floppy Drive</rasd:Description>
+ <rasd:ElementName>Floppy Drive 1</rasd:ElementName>
+ <rasd:HostResource />
+ <rasd:InstanceID>8000</rasd:InstanceID>
+ <rasd:ResourceType>14</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu"
+ vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+ <rasd:Description>Number of Virtual CPUs</rasd:Description>
+ <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
+ <rasd:InstanceID>4</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu" />
+ </ovf:Item>
+ <ovf:Item
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory"
+ vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:ElementName>384 MB of memory</rasd:ElementName>
+ <rasd:InstanceID>5</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:VirtualQuantity>384</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory" />
+ </ovf:Item>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.virtualHardwareSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/" />
+ <Link rel="down"
+ type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu" />
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu" />
+ <Link rel="down"
+ type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory" />
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.rasdItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory" />
+ <Link rel="down"
+ type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/disks" />
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/disks" />
+ <Link rel="down"
+ type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/media" />
+ <Link rel="down"
+ type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/networkCards" />
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.rasdItemsList+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/networkCards" />
+ </ovf:VirtualHardwareSection>
+ <ovf:OperatingSystemSection
+ xmlns:vcloud="http://www.vmware.com/vcloud/v1"
+ xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="80"
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/operatingSystemSection/"
+ vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml"
+ vmw:osType="rhel5_64Guest">
+ <ovf:Info>Specifies the operating system installed</ovf:Info>
+ <ovf:Description>Red Hat Enterprise Linux 5 (64-bit)</ovf:Description>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.operatingSystemSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/operatingSystemSection/" />
+ </ovf:OperatingSystemSection>
+ <NetworkConnectionSection
+ type="application/vnd.vmware.vcloud.networkConnectionSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/networkConnectionSection/"
+ ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
+ <NetworkConnection network="internet01">
+ <NetworkConnectionIndex>0</NetworkConnectionIndex>
+ <IpAddress>174.47.101.164</IpAddress>
+ <IsConnected>true</IsConnected>
+ <MACAddress>00:50:56:01:01:f2</MACAddress>
+ <IpAddressAllocationMode>POOL</IpAddressAllocationMode>
+ </NetworkConnection>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.networkConnectionSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/networkConnectionSection/" />
+ </NetworkConnectionSection>
+ <GuestCustomizationSection
+ type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/guestCustomizationSection/"
+ ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <Enabled>true</Enabled>
+ <ChangeSid>false</ChangeSid>
+ <VirtualMachineId>2087535248</VirtualMachineId>
+ <JoinDomainEnabled>false</JoinDomainEnabled>
+ <UseOrgSettings>false</UseOrgSettings>
+ <AdminPasswordEnabled>true</AdminPasswordEnabled>
+ <AdminPasswordAuto>true</AdminPasswordAuto>
+ <ResetPasswordRequired>false</ResetPasswordRequired>
+ <CustomizationScript>cat > /root/foo.txt<<EOF
+I '"love"' {asc|!}*&
+EOF
+</CustomizationScript>
+ <ComputerName>RHEL5</ComputerName>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/guestCustomizationSection/" />
+ </GuestCustomizationSection>
+ <VAppScopedLocalId>10_rhel_template</VAppScopedLocalId>
+ </Vm>
+ </Children>
+</VApp>
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-ubuntu-off-dhcp.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-ubuntu-off-dhcp.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-ubuntu-off-dhcp.xml
new file mode 100644
index 0000000..d8406fc
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-ubuntu-off-dhcp.xml
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<VApp xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" deployed="false" status="8" name="vApp_acole_1" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://www.vmware.com/vcloud/v1
http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
+ <Link rel="power:powerOn" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/power/action/powerOn"/>
+ <Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/action/deploy"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/controlAccess/"/>
+ <Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/action/controlAccess"/>
+ <Link rel="recompose" type="application/vnd.vmware.vcloud.recomposeVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/action/recomposeVApp"/>
+ <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721"/>
+ <Link rel="remove" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721"/>
+ <Description/>
+ <LeaseSettingsSection type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/leaseSettingsSection/" ovf:required="false">
+ <ovf:Info>Lease settings section</ovf:Info>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/leaseSettingsSection/"/>
+ <DeploymentLeaseInSeconds>0</DeploymentLeaseInSeconds>
+ <StorageLeaseInSeconds>0</StorageLeaseInSeconds>
+ </LeaseSettingsSection>
+ <ovf:StartupSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/startupSection/" vcloud:type="application/vnd.vmware.vcloud.startupSection+xml">
+ <ovf:Info>VApp startup section</ovf:Info>
+ <ovf:Item ovf:stopDelay="0" ovf:stopAction="powerOff" ovf:startDelay="0" ovf:startAction="powerOn" ovf:order="0" ovf:id="Ubuntu1004"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.startupSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/startupSection/"/>
+ </ovf:StartupSection>
+ <ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/networkSection/" vcloud:type="application/vnd.vmware.vcloud.networkSection+xml">
+ <ovf:Info>The list of logical networks</ovf:Info>
+ <ovf:Network ovf:name="internet01">
+ <ovf:Description/>
+ </ovf:Network>
+ </ovf:NetworkSection>
+ <NetworkConfigSection type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/networkConfigSection/" ovf:required="false">
+ <ovf:Info>The configuration parameters for logical networks</ovf:Info>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721/networkConfigSection/"/>
+ <NetworkConfig networkName="internet01">
+ <Description/>
+ <Configuration>
+ <IpScope>
+ <IsInherited>true</IsInherited>
+ <Gateway>174.47.101.161</Gateway>
+ <Netmask>255.255.255.224</Netmask>
+ <Dns1>24.172.173.113</Dns1>
+ <IpRanges>
+ <IpRange>
+ <StartAddress>174.47.101.164</StartAddress>
+ <EndAddress>174.47.101.190</EndAddress>
+ </IpRange>
+ </IpRanges>
+ </IpScope>
+ <ParentNetwork type="application/vnd.vmware.vcloud.network+xml" name="internet01" href="https://vcenterprise.bluelock.com/api/v1.0/network/758634723"/>
+ <FenceMode>bridged</FenceMode>
+ <Features>
+ <DhcpService>
+ <IsEnabled>false</IsEnabled>
+ <DefaultLeaseTime>3600</DefaultLeaseTime>
+ <MaxLeaseTime>7200</MaxLeaseTime>
+ <IpRange>
+ <StartAddress>174.47.101.162</StartAddress>
+ <EndAddress>174.47.101.163</EndAddress>
+ </IpRange>
+ </DhcpService>
+ <FirewallService>
+ <IsEnabled>true</IsEnabled>
+ </FirewallService>
+ <NatService>
+ <IsEnabled>true</IsEnabled>
+ <NatType>ipTranslation</NatType>
+ <Policy>allowTraffic</Policy>
+ </NatService>
+ </Features>
+ </Configuration>
+ <IsDeployed>false</IsDeployed>
+ </NetworkConfig>
+ </NetworkConfigSection>
+ <Children>
+ <Vm deployed="false" status="8" name="Ubuntu1004" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975">
+ <Link rel="power:powerOn" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/power/action/powerOn"/>
+ <Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/action/deploy"/>
+ <Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-1701205721"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975"/>
+ <Link rel="remove" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975"/>
+ <Link rel="screen:thumbnail" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/screen"/>
+ <Link rel="screen:acquireTicket" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/screen/action/acquireTicket"/>
+ <Link rel="media:insertMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/media/action/insertMedia"/>
+ <Link rel="media:ejectMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/media/action/ejectMedia"/>
+ <Description/>
+ <ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/" vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
+ <ovf:Info>Virtual hardware requirements</ovf:Info>
+ <ovf:System>
+ <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+ <vssd:InstanceID>0</vssd:InstanceID>
+ <vssd:VirtualSystemIdentifier>Ubuntu1004</vssd:VirtualSystemIdentifier>
+ <vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
+ </ovf:System>
+ <ovf:Item>
+ <rasd:Address>00:50:56:01:01:f1</rasd:Address>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
+ <rasd:Connection vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="DHCP">internet01</rasd:Connection>
+ <rasd:Description>PCNet32 ethernet adapter</rasd:Description>
+ <rasd:ElementName>Network adapter 0</rasd:ElementName>
+ <rasd:InstanceID>1</rasd:InstanceID>
+ <rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>SCSI Controller</rasd:Description>
+ <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
+ <rasd:InstanceID>2</rasd:InstanceID>
+ <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
+ <rasd:ResourceType>6</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:Description>Hard disk</rasd:Description>
+ <rasd:ElementName>Hard disk 1</rasd:ElementName>
+ <rasd:HostResource vcloud:capacity="30720" vcloud:busType="6" vcloud:busSubType="lsilogic"/>
+ <rasd:InstanceID>2000</rasd:InstanceID>
+ <rasd:Parent>2</rasd:Parent>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>IDE Controller</rasd:Description>
+ <rasd:ElementName>IDE Controller 0</rasd:ElementName>
+ <rasd:InstanceID>3</rasd:InstanceID>
+ <rasd:ResourceType>5</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>CD/DVD Drive</rasd:Description>
+ <rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>3002</rasd:InstanceID>
+ <rasd:Parent>3</rasd:Parent>
+ <rasd:ResourceType>15</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>Floppy Drive</rasd:Description>
+ <rasd:ElementName>Floppy Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>8000</rasd:InstanceID>
+ <rasd:ResourceType>14</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/cpu" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+ <rasd:Description>Number of Virtual CPUs</rasd:Description>
+ <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
+ <rasd:InstanceID>4</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/cpu"/>
+ </ovf:Item>
+ <ovf:Item vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/memory" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:ElementName>512 MB of memory</rasd:ElementName>
+ <rasd:InstanceID>5</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:VirtualQuantity>512</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/memory"/>
+ </ovf:Item>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/cpu"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/cpu"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/memory"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/memory"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/disks"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/disks"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/media"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/networkCards"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/virtualHardwareSection/networkCards"/>
+ </ovf:VirtualHardwareSection>
+ <ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="94" vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/operatingSystemSection/" vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml" vmw:osType="ubuntu64Guest">
+ <ovf:Info>Specifies the operating system installed</ovf:Info>
+ <ovf:Description>Ubuntu Linux (64-bit)</ovf:Description>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.operatingSystemSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/operatingSystemSection/"/>
+ </ovf:OperatingSystemSection>
+ <NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/networkConnectionSection/" ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
+ <NetworkConnection network="internet01">
+ <NetworkConnectionIndex>0</NetworkConnectionIndex>
+ <IsConnected>true</IsConnected>
+ <MACAddress>00:50:56:01:01:f1</MACAddress>
+ <IpAddressAllocationMode>DHCP</IpAddressAllocationMode>
+ </NetworkConnection>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/networkConnectionSection/"/>
+ </NetworkConnectionSection>
+ <GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/guestCustomizationSection/" ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <Enabled>true</Enabled>
+ <ChangeSid>false</ChangeSid>
+ <VirtualMachineId>2093098975</VirtualMachineId>
+ <JoinDomainEnabled>false</JoinDomainEnabled>
+ <UseOrgSettings>false</UseOrgSettings>
+ <AdminPasswordEnabled>true</AdminPasswordEnabled>
+ <AdminPasswordAuto>true</AdminPasswordAuto>
+ <AdminPassword>%3eD%gmF</AdminPassword>
+ <ResetPasswordRequired>false</ResetPasswordRequired>
+ <CustomizationScript>#regenerate keys /bin/rm /etc/ssh/ssh_host_* /usr/sbin/dpkg-reconfigure openssh-server</CustomizationScript>
+ <ComputerName>Ubuntu1004</ComputerName>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2093098975/guestCustomizationSection/"/>
+ </GuestCustomizationSection>
+ <VAppScopedLocalId>02_ubuntu_template</VAppScopedLocalId>
+ </Vm>
+ </Children>
+</VApp>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-unresolved.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-unresolved.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-unresolved.xml
new file mode 100644
index 0000000..995bc29
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-unresolved.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<VApp xmlns="http://www.vmware.com/vcloud/v1" deployed="false"
+ status="0" name="vApp_acole_2" type="application/vnd.vmware.vcloud.vApp+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439" />
+ <Description />
+ <Tasks>
+ <Task status="running" startTime="2010-08-23T02:09:52.443-04:00"
+ operation="Creating Virtual Application vApp_acole_2(607806320)"
+ expiryTime="2010-11-21T02:09:52.443-05:00" endTime="9999-12-31T23:59:59.999-05:00"
+ type="application/vnd.vmware.vcloud.task+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/task/3cc08ir8oczbze3n1a3">
+ <Owner type="application/vnd.vmware.vcloud.vApp+xml"
+ name="vApp_acole_2"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320" />
+ </Task>
+ </Tasks>
+</VApp>
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-win-off-static.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-win-off-static.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-win-off-static.xml
new file mode 100644
index 0000000..6282766
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-win-off-static.xml
@@ -0,0 +1,219 @@
+<VApp xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" deployed="false" status="8" name="vApp_acole_4" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://www.vmware.com/vcloud/v1 h
ttp://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
+ <Link rel="power:powerOn" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/power/action/powerOn"/>
+ <Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/action/deploy"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/controlAccess/"/>
+ <Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/action/controlAccess"/>
+ <Link rel="recompose" type="application/vnd.vmware.vcloud.recomposeVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/action/recomposeVApp"/>
+ <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903"/>
+ <Link rel="remove" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903"/>
+ <Description/>
+ <LeaseSettingsSection type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/leaseSettingsSection/" ovf:required="false">
+ <ovf:Info>Lease settings section</ovf:Info>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/leaseSettingsSection/"/>
+ <DeploymentLeaseInSeconds>0</DeploymentLeaseInSeconds>
+ <StorageLeaseInSeconds>0</StorageLeaseInSeconds>
+ </LeaseSettingsSection>
+ <ovf:StartupSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/startupSection/" vcloud:type="application/vnd.vmware.vcloud.startupSection+xml">
+ <ovf:Info>VApp startup section</ovf:Info>
+ <ovf:Item ovf:stopDelay="0" ovf:stopAction="powerOff" ovf:startDelay="0" ovf:startAction="powerOn" ovf:order="0" ovf:id="Windows2008R2"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.startupSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/startupSection/"/>
+ </ovf:StartupSection>
+ <ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/networkSection/" vcloud:type="application/vnd.vmware.vcloud.networkSection+xml">
+ <ovf:Info>The list of logical networks</ovf:Info>
+ <ovf:Network ovf:name="internet01">
+ <ovf:Description/>
+ </ovf:Network>
+ </ovf:NetworkSection>
+ <NetworkConfigSection type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/networkConfigSection/" ovf:required="false">
+ <ovf:Info>The configuration parameters for logical networks</ovf:Info>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903/networkConfigSection/"/>
+ <NetworkConfig networkName="internet01">
+ <Description/>
+ <Configuration>
+ <IpScope>
+ <IsInherited>true</IsInherited>
+ <Gateway>174.47.101.161</Gateway>
+ <Netmask>255.255.255.224</Netmask>
+ <Dns1>24.172.173.113</Dns1>
+ <IpRanges>
+ <IpRange>
+ <StartAddress>174.47.101.164</StartAddress>
+ <EndAddress>174.47.101.190</EndAddress>
+ </IpRange>
+ </IpRanges>
+ </IpScope>
+ <ParentNetwork type="application/vnd.vmware.vcloud.network+xml" name="internet01" href="https://vcenterprise.bluelock.com/api/v1.0/network/758634723"/>
+ <FenceMode>bridged</FenceMode>
+ <Features>
+ <DhcpService>
+ <IsEnabled>false</IsEnabled>
+ <DefaultLeaseTime>3600</DefaultLeaseTime>
+ <MaxLeaseTime>7200</MaxLeaseTime>
+ <IpRange>
+ <StartAddress>174.47.101.162</StartAddress>
+ <EndAddress>174.47.101.163</EndAddress>
+ </IpRange>
+ </DhcpService>
+ <FirewallService>
+ <IsEnabled>true</IsEnabled>
+ </FirewallService>
+ <NatService>
+ <IsEnabled>true</IsEnabled>
+ <NatType>ipTranslation</NatType>
+ <Policy>allowTraffic</Policy>
+ <NatRule>
+ <OneToOneVmRule>
+ <MappingMode>automatic</MappingMode>
+ <VAppScopedVmId>04_windows_template</VAppScopedVmId>
+ <VmNicId>0</VmNicId>
+ </OneToOneVmRule>
+ </NatRule>
+ </NatService>
+ </Features>
+ </Configuration>
+ <IsDeployed>false</IsDeployed>
+ </NetworkConfig>
+ </NetworkConfigSection>
+ <Children>
+ <Vm deployed="false" status="8" name="Windows2008R2" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461">
+ <Link rel="power:powerOn" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/power/action/powerOn"/>
+ <Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/action/deploy"/>
+ <Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-972626903"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461"/>
+ <Link rel="remove" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461"/>
+ <Link rel="screen:thumbnail" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/screen"/>
+ <Link rel="screen:acquireTicket" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/screen/action/acquireTicket"/>
+ <Link rel="media:insertMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/media/action/insertMedia"/>
+ <Link rel="media:ejectMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/media/action/ejectMedia"/>
+ <Description/>
+ <ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/" vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
+ <ovf:Info>Virtual hardware requirements</ovf:Info>
+ <ovf:System>
+ <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+ <vssd:InstanceID>0</vssd:InstanceID>
+ <vssd:VirtualSystemIdentifier>Windows2008R2</vssd:VirtualSystemIdentifier>
+ <vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
+ </ovf:System>
+ <ovf:Item>
+ <rasd:Address>00:50:56:01:02:33</rasd:Address>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
+ <rasd:Connection vcloud:ipAddress="174.47.101.165" vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="POOL">internet01</rasd:Connection>
+ <rasd:Description>PCNet32 ethernet adapter</rasd:Description>
+ <rasd:ElementName>Network adapter 0</rasd:ElementName>
+ <rasd:InstanceID>1</rasd:InstanceID>
+ <rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>SCSI Controller</rasd:Description>
+ <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
+ <rasd:InstanceID>2</rasd:InstanceID>
+ <rasd:ResourceSubType>lsilogicsas</rasd:ResourceSubType>
+ <rasd:ResourceType>6</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:Description>Hard disk</rasd:Description>
+ <rasd:ElementName>Hard disk 1</rasd:ElementName>
+ <rasd:HostResource vcloud:capacity="40960" vcloud:busType="6" vcloud:busSubType="lsilogicsas"/>
+ <rasd:InstanceID>2000</rasd:InstanceID>
+ <rasd:Parent>2</rasd:Parent>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>IDE Controller</rasd:Description>
+ <rasd:ElementName>IDE Controller 0</rasd:ElementName>
+ <rasd:InstanceID>3</rasd:InstanceID>
+ <rasd:ResourceType>5</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>CD/DVD Drive</rasd:Description>
+ <rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>3002</rasd:InstanceID>
+ <rasd:Parent>3</rasd:Parent>
+ <rasd:ResourceType>15</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>Floppy Drive</rasd:Description>
+ <rasd:ElementName>Floppy Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>8000</rasd:InstanceID>
+ <rasd:ResourceType>14</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/cpu" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+ <rasd:Description>Number of Virtual CPUs</rasd:Description>
+ <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
+ <rasd:InstanceID>4</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/cpu"/>
+ </ovf:Item>
+ <ovf:Item vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/memory" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:ElementName>4096 MB of memory</rasd:ElementName>
+ <rasd:InstanceID>5</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:VirtualQuantity>4096</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/memory"/>
+ </ovf:Item>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/cpu"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/cpu"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/memory"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/memory"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/disks"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/disks"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/media"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/networkCards"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/virtualHardwareSection/networkCards"/>
+ </ovf:VirtualHardwareSection>
+ <ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="102" vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/operatingSystemSection/" vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml" vmw:osType="windows7Server64Guest">
+ <ovf:Info>Specifies the operating system installed</ovf:Info>
+ <ovf:Description>Microsoft Windows Server 2008 R2 (64-bit)</ovf:Description>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.operatingSystemSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/operatingSystemSection/"/>
+ </ovf:OperatingSystemSection>
+ <NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/networkConnectionSection/" ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
+ <NetworkConnection network="internet01">
+ <NetworkConnectionIndex>0</NetworkConnectionIndex>
+ <IpAddress>174.47.101.165</IpAddress>
+ <IsConnected>true</IsConnected>
+ <MACAddress>00:50:56:01:02:33</MACAddress>
+ <IpAddressAllocationMode>POOL</IpAddressAllocationMode>
+ </NetworkConnection>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/networkConnectionSection/"/>
+ </NetworkConnectionSection>
+ <GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/guestCustomizationSection/" ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <Enabled>true</Enabled>
+ <ChangeSid>true</ChangeSid>
+ <VirtualMachineId>904484461</VirtualMachineId>
+ <JoinDomainEnabled>false</JoinDomainEnabled>
+ <UseOrgSettings>false</UseOrgSettings>
+ <AdminPasswordEnabled>true</AdminPasswordEnabled>
+ <AdminPasswordAuto>true</AdminPasswordAuto>
+ <ResetPasswordRequired>false</ResetPasswordRequired>
+ <CustomizationScript/>
+ <ComputerName>Windows2008R2</ComputerName>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-904484461/guestCustomizationSection/"/>
+ </GuestCustomizationSection>
+ <VAppScopedLocalId>04_windows_template</VAppScopedLocalId>
+ </Vm>
+ </Children>
+</VApp>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vdc-1.0.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vdc-1.0.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vdc-1.0.xml
new file mode 100644
index 0000000..286e42c
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vdc-1.0.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Vdc xmlns="http://www.vmware.com/vcloud/v1" status="1" name="Jclouds-Commit-compG1xstorA01" type="application/vnd.vmware.vcloud.vdc+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://
+vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.org+xml" href="https://vcenterprise.bluelock.com/api/v1.0/org/9566014"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439/action/uploadVAppTemplate"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.media+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439/media"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439/action/instantiateVAppTemplate"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.cloneVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439/action/cloneVApp"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439/action/cloneVAppTemplate"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.cloneMediaParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439/action/cloneMedia"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.captureVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439/action/captureVApp"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.composeVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439/action/composeVApp"/>
+ <Link rel="move" type="application/vnd.vmware.vcloud.moveMediaParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439/action/moveMedia"/>
+ <Link rel="move" type="application/vnd.vmware.vcloud.moveVAppParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439/action/moveVApp"/>
+ <Link rel="move" type="application/vnd.vmware.vcloud.moveVAppTemplateParams+xml" href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439/action/moveVAppTemplate"/>
+ <AllocationModel>AllocationPool</AllocationModel>
+ <StorageCapacity>
+ <Units>MB</Units>
+ <Allocated>1024000</Allocated>
+ <Limit>1024000</Limit>
+ <Used>0</Used>
+ <Overhead>0</Overhead>
+ </StorageCapacity>
+ <ComputeCapacity>
+ <Cpu>
+ <Units>MHz</Units>
+ <Allocated>20000</Allocated>
+ <Limit>20000</Limit>
+ <Used>0</Used>
+ <Overhead>0</Overhead>
+ </Cpu>
+ <Memory>
+ <Units>MB</Units>
+ <Allocated>30720</Allocated>
+ <Limit>30720</Limit>
+ <Used>0</Used>
+ <Overhead>0</Overhead>
+ </Memory>
+ </ComputeCapacity>
+ <ResourceEntities/>
+ <AvailableNetworks>
+ <Network type="application/vnd.vmware.vcloud.network+xml" name="isolation01" href="https://vcenterprise.bluelock.com/api/v1.0/network/990419644"/>
+ <Network type="application/vnd.vmware.vcloud.network+xml" name="internet01" href="https://vcenterprise.bluelock.com/api/v1.0/network/758634723"/>
+ </AvailableNetworks>
+ <NicQuota>0</NicQuota>
+ <NetworkQuota>100</NetworkQuota>
+ <VmQuota>50</VmQuota>
+ <IsEnabled>true</IsEnabled>
+</Vdc>
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vdc-hosting.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vdc-hosting.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vdc-hosting.xml
new file mode 100644
index 0000000..6254112
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vdc-hosting.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Vdc href="https://vcloud.safesecureweb.com/api/v0.8/vdc/188849"
+ name="vDC Name" xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8/vdc.xsd"
+ xmlns="http://www.vmware.com/vcloud/v0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <Link rel="add"
+ href="https://vcloud.safesecureweb.com/api/v0.8/vdc/188849/vApps"
+ type="application/vnd.vmware.vcloud.vApp+xml" />
+ <Link rel="add"
+ href="https://vcloud.safesecureweb.com/api/v0.8/vdc/188849/vAppTemplates"
+ type="application/vnd.vmware.vcloud.catalogItem+xml" />
+ <Link rel="add"
+ href="https://vcloud.safesecureweb.com/api/v0.8/vdc/188849/media"
+ type="application/vnd.vmware.vcloud.media+xml" />
+ <Description>vDC Name</Description>
+ <StorageCapacity>
+ <Units>bytes * 10^9</Units>
+ <Allocated>0</Allocated>
+ <Used>40960</Used>
+ </StorageCapacity>
+ <ComputeCapacity>
+ <Cpu>
+ <Units>hz * 10^6</Units>
+ <Allocated>0</Allocated>
+ <Used>2400</Used>
+ </Cpu>
+ <Memory>
+ <Units>bytes * 10^9</Units>
+ <Allocated>0</Allocated>
+ <Used>2</Used>
+ </Memory>
+ <InstantiatedVmsQuota>
+ <Limit>0</Limit>
+ <Used>2</Used>
+ </InstantiatedVmsQuota>
+ <DeployedVmsQuota>
+ <Limit>0</Limit>
+ <Used>2</Used>
+ </DeployedVmsQuota>
+ </ComputeCapacity>
+ <ResourceEntities>
+ <ResourceEntity
+ href="https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/1"
+ type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Plesk (Linux) 64-bit Template" />
+ <ResourceEntity
+ href="https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2"
+ type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Windows 2008 Datacenter 64 Bit Template" />
+ <ResourceEntity
+ href="https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/3"
+ type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="Cent OS 64 Bit Template" />
+ <ResourceEntity
+ href="https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/4"
+ type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="cPanel (Linux) 64 Bit Template" />
+ <ResourceEntity
+ href="https://vcloud.safesecureweb.com/api/v0.8/vApp/188849-1"
+ type="application/vnd.vmware.vcloud.vApp+xml" name="188849-1" />
+ <ResourceEntity
+ href="https://vcloud.safesecureweb.com/api/v0.8/vApp/188849-2"
+ type="application/vnd.vmware.vcloud.vApp+xml" name="188849-2" />
+ </ResourceEntities>
+</Vdc>
[06/18] stratos git commit: Jclouds vcloud api 1.8.1 clone with
custom changes
Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VmApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VmApiTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VmApiTest.java
new file mode 100644
index 0000000..b8e786c
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VmApiTest.java
@@ -0,0 +1,318 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ReleasePayloadAndReturn;
+import org.jclouds.http.functions.ReturnInputStream;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.util.Strings2;
+import org.jclouds.vcloud.domain.GuestCustomizationSection;
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.utils.TestUtils;
+import org.jclouds.vcloud.xml.TaskHandler;
+import org.jclouds.vcloud.xml.VmHandler;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+/**
+ * Tests behavior of {@code VmApi}
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "VmApiTest")
+public class VmApiTest extends BaseVCloudApiTest<VmApi> {
+
+ public void testGetThumbnailOfVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "getScreenThumbnailForVm", URI.class);
+ GeneratedHttpRequest request = processor
+ .createRequest(method, ImmutableList.<Object> of(URI.create("http://vcloud.example.com/api/v1.0/vApp/vm-12")));
+
+ assertRequestLineEquals(request, "GET http://vcloud.example.com/api/v1.0/vApp/vm-12/screen HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: image/png\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReturnInputStream.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ @Test(dataProvider = "ignoreOnWindows", description = "see http://code.google.com/p/jclouds/issues/detail?id=402")
+ public void testUpdateGuestConfiguration() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "updateGuestCustomizationOfVm", GuestCustomizationSection.class,
+ URI.class);
+ GuestCustomizationSection guest = new GuestCustomizationSection(URI
+ .create("http://vcloud.example.com/api/v1.0/vApp/vm-12/guestCustomizationSection"));
+ guest.setCustomizationScript("cat > /tmp/foo.txt<<EOF\nI love candy\nEOF");
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(guest, URI
+ .create("http://vcloud.example.com/api/v1.0/vApp/vm-12")));
+
+ assertRequestLineEquals(request,
+ "PUT http://vcloud.example.com/api/v1.0/vApp/vm-12/guestCustomizationSection HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream(
+ "/guestCustomizationSection.xml")), "application/vnd.vmware.vcloud.guestCustomizationSection+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testUpdateCPUCountOfVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "updateCPUCountOfVm", int.class, URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, URI
+ .create("http://vcloud.example.com/api/v1.0/vApp/vm-12")));
+
+ assertRequestLineEquals(request,
+ "PUT http://vcloud.example.com/api/v1.0/vApp/vm-12/virtualHardwareSection/cpu HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/cpuItem.xml")),
+ "application/vnd.vmware.vcloud.rasdItem+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testUpdateMemoryMBOfVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "updateMemoryMBOfVm", int.class, URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(512, URI
+ .create("http://vcloud.example.com/api/v1.0/vApp/vm-12")));
+
+ assertRequestLineEquals(request,
+ "PUT http://vcloud.example.com/api/v1.0/vApp/vm-12/virtualHardwareSection/memory HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/memoryItem.xml")),
+ "application/vnd.vmware.vcloud.rasdItem+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testDeployVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "deployVm", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/deploy HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>",
+ "application/vnd.vmware.vcloud.deployVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testDeployAndPowerOnVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "deployAndPowerOnVm", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/deploy HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" powerOn=\"true\"/>",
+ "application/vnd.vmware.vcloud.deployVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testGetVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "getVm", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vm/1")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vm/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vm+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, VmHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testRebootVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "rebootVm", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/reboot HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testUndeployVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "undeployVm", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/undeploy HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, "<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>",
+ "application/vnd.vmware.vcloud.undeployVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testUndeployAndSaveStateOfVmSaveState() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "undeployAndSaveStateOfVm", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/undeploy HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request,
+ "<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" saveState=\"true\"/>",
+ "application/vnd.vmware.vcloud.undeployVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testPowerOnVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "powerOnVm", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/powerOn HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testPowerOffVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "powerOffVm", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/powerOff HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testResetVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "resetVm", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/reset HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testSuspendVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "suspendVm", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/suspend HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testShutdownVm() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VmApi.class, "shutdownVm", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/shutdown HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ @DataProvider
+ public Object[][] ignoreOnWindows() {
+ return TestUtils.isWindowsOs() ? TestUtils.NO_INVOCATIONS
+ : TestUtils.SINGLE_NO_ARG_INVOCATION;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequestTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequestTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequestTest.java
new file mode 100644
index 0000000..40d1fd5
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/filters/AddVCloudAuthorizationAndCookieToRequestTest.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.filters;
+
+import static org.testng.Assert.assertEquals;
+
+import org.jclouds.http.HttpRequest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Supplier;
+import com.google.common.net.HttpHeaders;
+
+@Test(testName = "AddVCloudAuthorizationAndCookieToRequestTest")
+public class AddVCloudAuthorizationAndCookieToRequestTest {
+
+ private AddVCloudAuthorizationAndCookieToRequest filter;
+
+ @BeforeTest
+ void setUp() {
+ filter = new AddVCloudAuthorizationAndCookieToRequest(new Supplier<String>() {
+ public String get() {
+ return "token";
+ }
+ }, "1.0");
+ }
+
+ @Test
+ public void testApply() {
+ HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://localhost").build();
+ request = filter.filter(request);
+ assertEquals(request.getHeaders().size(), 3);
+ assertEquals(request.getFirstHeaderOrNull(HttpHeaders.COOKIE), "vcloud-token=token");
+ assertEquals(request.getFirstHeaderOrNull("x-vcloud-authorization"), "token");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeadersTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeadersTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeadersTest.java
new file mode 100644
index 0000000..66a4f4a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/functions/ParseLoginResponseFromHeadersTest.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.functions;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.HttpResponseException;
+import org.jclouds.http.functions.BaseHandlerTest;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.VCloudSession;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * Tests behavior of {@code ParseLoginResponseFromHeaders}
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "ParseLoginResponseFromHeadersTest")
+public class ParseLoginResponseFromHeadersTest extends BaseHandlerTest {
+
+ private ParseLoginResponseFromHeaders parser;
+
+ @BeforeTest
+ void setUp() {
+ parser = injector.getInstance(ParseLoginResponseFromHeaders.class);
+ }
+
+ @Test
+ public void testApply() {
+ HttpResponse response = HttpResponse.builder().statusCode(200).message("OK")
+ .payload(getClass().getResourceAsStream("/orglist.xml"))
+ .addHeader("x-vcloud-authorization", "vcloud-token=9er4d061-4bff-48fa-84b1-5da7166764d2; path=/").build();
+ response.getPayload().getContentMetadata().setContentType("Content-Type: application/xml; charset=utf-8");
+ response.getPayload().getContentMetadata().setContentLength(307l);
+
+ VCloudSession reply = parser.apply(response);
+ assertEquals(reply.getVCloudToken(), "9er4d061-4bff-48fa-84b1-5da7166764d2");
+ assertEquals(reply.getOrgs(), ImmutableMap.of("adrian@jclouds.org", new ReferenceTypeImpl("adrian@jclouds.org",
+ VCloudMediaType.ORG_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"))));
+
+ }
+
+ @Test
+ public void testApplyBlueLock() {
+ HttpResponse response = HttpResponse.builder().statusCode(200).message("OK")
+ .payload(getClass().getResourceAsStream("/orglist.xml"))
+ .addHeader("x-vcloud-authorization", "MUKOJ2HoAfoMmLnHRp4esNb2MtWscCLLhVysnsIsCG0=").build();
+ response.getPayload().getContentMetadata().setContentType("Content-Type: application/xml; charset=utf-8");
+ response.getPayload().getContentMetadata().setContentLength(307l);
+
+ VCloudSession reply = parser.apply(response);
+ assertEquals(reply.getVCloudToken(), "MUKOJ2HoAfoMmLnHRp4esNb2MtWscCLLhVysnsIsCG0=");
+ assertEquals(reply.getOrgs(), ImmutableMap.of("adrian@jclouds.org", new ReferenceTypeImpl("adrian@jclouds.org",
+ VCloudMediaType.ORG_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"))));
+
+ }
+
+ @Test
+ public void testApplyTerremark() {
+ HttpResponse response = HttpResponse.builder().statusCode(200).message("OK")
+ .payload(getClass().getResourceAsStream("/orglist.xml"))
+ .addHeader("Set-Cookie", "vcloud-token=37ce2715-9aba-4f48-8e45-2db8a8da702d; path=/").build();
+ response.getPayload().getContentMetadata().setContentType("Content-Type: application/xml; charset=utf-8");
+ response.getPayload().getContentMetadata().setContentLength(307l);
+
+ VCloudSession reply = parser.apply(response);
+ assertEquals(reply.getVCloudToken(), "37ce2715-9aba-4f48-8e45-2db8a8da702d");
+ assertEquals(reply.getOrgs(), ImmutableMap.of("adrian@jclouds.org", new ReferenceTypeImpl("adrian@jclouds.org",
+ VCloudMediaType.ORG_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"))));
+
+ }
+
+ @Test
+ public void testApplyTerremarkMultipleCookies() {
+ HttpResponse response = HttpResponse.builder().statusCode(200).message("OK")
+ .payload(getClass().getResourceAsStream("/orglist.xml"))
+ .addHeader("Set-Cookie", "NSC_ESUO_21654_72.46.239.132_443=fooo;expires=Thu, 02-Jun-2011 17:19:26 GMT;path=/;secure;httponly")
+ .addHeader("Set-Cookie", "vcloud-token=37ce2715-9aba-4f48-8e45-2db8a8da702d; path=/").build();
+ response.getPayload().getContentMetadata().setContentType("Content-Type: application/xml; charset=utf-8");
+ response.getPayload().getContentMetadata().setContentLength(307l);
+
+ VCloudSession reply = parser.apply(response);
+ assertEquals(reply.getVCloudToken(), "37ce2715-9aba-4f48-8e45-2db8a8da702d");
+ assertEquals(reply.getOrgs(), ImmutableMap.of("adrian@jclouds.org", new ReferenceTypeImpl("adrian@jclouds.org",
+ VCloudMediaType.ORG_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"))));
+
+ }
+
+ @Test(expectedExceptions = HttpResponseException.class)
+ public void testUnmatchedCookieThrowsHttpResponseException() {
+ HttpResponse response = HttpResponse.builder().statusCode(200).message("OK")
+ .payload(getClass().getResourceAsStream("/orglist.xml"))
+ .addHeader("Set-Cookie", "NSC_ESUO_21654_72.46.239.132_443=fooo;expires=Thu, 02-Jun-2011 17:19:26 GMT;path=/;secure;httponly").build();
+ response.getPayload().getContentMetadata().setContentType("Content-Type: application/xml; charset=utf-8");
+ response.getPayload().getContentMetadata().setContentLength(307l);
+
+ parser.apply(response);
+ }
+
+ @Test(expectedExceptions = HttpResponseException.class)
+ public void testNoThrowsHttpResponseException() {
+ HttpResponse response = HttpResponse.builder().statusCode(200).message("OK")
+ .payload(getClass().getResourceAsStream("/orglist.xml")).build();
+ response.getPayload().getContentMetadata().setContentType("Content-Type: application/xml; charset=utf-8");
+ response.getPayload().getContentMetadata().setContentLength(307l);
+
+ parser.apply(response);
+ }
+
+ @Test
+ public void testApplyVirtacore() {
+ HttpResponse response = HttpResponse.builder().statusCode(200).message("OK")
+ .payload(getClass().getResourceAsStream("/orglist.xml"))
+ .addHeader("x-vcloud-authorization", "vcloud-token=IPy0w7UGD4lwtdWAK/ZVzfuLK+dztxGRqsOhWqV0i48=").build();
+ response.getPayload().getContentMetadata().setContentType("Content-Type: application/xml; charset=utf-8");
+ response.getPayload().getContentMetadata().setContentLength(307l);
+
+ VCloudSession reply = parser.apply(response);
+ assertEquals(reply.getVCloudToken(), "IPy0w7UGD4lwtdWAK/ZVzfuLK+dztxGRqsOhWqV0i48=");
+ assertEquals(reply.getOrgs(), ImmutableMap.of("adrian@jclouds.org", new ReferenceTypeImpl("adrian@jclouds.org",
+ VCloudMediaType.ORG_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"))));
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponseTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponseTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponseTest.java
new file mode 100644
index 0000000..9466191
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/handlers/ParseVCloudErrorFromHttpResponseTest.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.handlers;
+
+import java.net.URI;
+
+import org.jclouds.http.BaseHttpErrorHandlerTest;
+import org.jclouds.http.HttpErrorHandler;
+import org.jclouds.http.HttpResponseException;
+import org.jclouds.rest.AuthorizationException;
+import org.jclouds.rest.ResourceNotFoundException;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.testng.annotations.Test;
+
+@Test(groups = { "unit" })
+public class ParseVCloudErrorFromHttpResponseTest extends BaseHttpErrorHandlerTest {
+
+ @Test
+ public void testGet404SetsResourceNotFoundException() {
+ assertCodeMakes("GET", URI.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32"), 404,
+ "", "", ResourceNotFoundException.class);
+ }
+
+ @Test
+ public void testGet403NoAcessToEntitySetsResourceNotFoundException() {
+ assertCodeMakes(
+ "GET",
+ URI.create("https://zone01.bluelock.com/api/v1.0/vApp/vapp-1535788985"),
+ 403,
+ "HTTP/1.1 403",
+ VCloudMediaType.ERROR_XML,
+ "<Error xmlns=\"http://www.vmware.com/vcloud/v1\" minorErrorCode=\"ACCESS_TO_RESOURCE_IS_FORBIDDEN\" message=\"No access to entity "(com.vmware.vcloud.entity.vapp:1535788985)".\" majorErrorCode=\"403\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd\"></Error>\n",
+ ResourceNotFoundException.class);
+ }
+
+ @Test
+ public void testGet403NoAcessToEntitySetsResourceNotFoundExceptionOnAPI1_0AgainstVCD1_5() {
+ assertCodeMakes(
+ "GET",
+ URI.create("https://mycloud.greenhousedata.com/api/v1.0/vApp/vapp-d3a1f2cd-d07b-4ddc-bf7b-fb7468b4d95a"),
+ 403,
+ "HTTP/1.1 403",
+ // NOTE VCD 1.5 appends the api version to the media type
+ VCloudMediaType.ERROR_XML + ";1.0",
+ "<Error xmlns=\"http://www.vmware.com/vcloud/v1\" minorErrorCode=\"ACCESS_TO_RESOURCE_IS_FORBIDDEN\" message=\"No access to entity "(com.vmware.vcloud.entity.vapp:d3a1f2cd-d07b-4ddc-bf7b-fb7468b4d95a)".\" majorErrorCode=\"403\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.vmware.com/vcloud/v1 http://mycloud.greenhousedata.com/api/v1.0/schema/master.xsd\"></Error>",
+ ResourceNotFoundException.class);
+ }
+
+ @Test
+ public void testDelete404SetsHttpResponseException() {
+ assertCodeMakes("DELETE", URI.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32"),
+ 404, "", "", HttpResponseException.class);
+ }
+
+ @Test
+ public void testPOSTNotRunningSetsIllegalStateException() {
+ assertCodeMakes(
+ "POST",
+ URI.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-138351019/action/undeploy"),
+ 400,
+ "HTTP/1.1 400 Bad Request",
+ VCloudMediaType.ERROR_XML,
+ "<Error xmlns=\"http://www.vmware.com/vcloud/v1\" minorErrorCode=\"BAD_REQUEST\" message=\"The requested operation could not be executed since vApp "adriancolecap-78c" is not running"\" majorErrorCode=\"400\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd\"></Error>\n",
+ IllegalStateException.class);
+ }
+
+ @Test
+ public void test401SetsAuthorizationException() {
+ assertCodeMakes("GET", URI.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/vdc/32"), 401,
+ "", "", AuthorizationException.class);
+ }
+
+ @Override
+ protected Class<? extends HttpErrorHandler> getHandlerClass() {
+ return ParseVCloudErrorFromHttpResponse.class;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/internal/BasePayloadTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/internal/BasePayloadTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/internal/BasePayloadTest.java
new file mode 100644
index 0000000..4ffe512
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/internal/BasePayloadTest.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.internal;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import java.net.URI;
+import java.util.List;
+
+import org.jclouds.reflect.Invocation;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.VCloudApiMetadata;
+import org.nnsoft.guice.rocoto.Rocoto;
+import org.nnsoft.guice.rocoto.configuration.ConfigurationModule;
+
+import com.google.common.base.Throwables;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+public class BasePayloadTest {
+
+ protected Injector injector = Guice.createInjector(Rocoto.expandVariables(new ConfigurationModule() {
+ protected void bindConfigurations() {
+ bindProperties(new VCloudApiMetadata().getDefaultProperties());
+ }
+ }));
+
+ protected GeneratedHttpRequest requestForArgs(List<Object> args) {
+ try {
+ Invocation invocation = Invocation.create(method(String.class, "toString"), args);
+ return GeneratedHttpRequest.builder().method("POST").endpoint(URI.create("http://localhost/key"))
+ .invocation(invocation).build();
+ } catch (SecurityException e) {
+ throw Throwables.propagate(e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiLiveTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiLiveTest.java
new file mode 100644
index 0000000..a4db473
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiLiveTest.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.internal;
+
+import org.jclouds.compute.ComputeService;
+import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
+import org.jclouds.sshj.config.SshjSshClientModule;
+import org.jclouds.vcloud.VCloudApi;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import com.google.inject.Module;
+
+@Test(groups = "live", enabled = true, singleThreaded = true)
+public abstract class BaseVCloudApiLiveTest extends BaseComputeServiceContextLiveTest {
+
+ // username is too long for name constraints
+ protected String prefix = "vcd";
+
+ protected ComputeService client;
+
+ public BaseVCloudApiLiveTest() {
+ provider = "vcloud";
+ }
+
+ protected VCloudApi getVCloudApi() {
+ return view.unwrapApi(VCloudApi.class);
+ }
+
+ @Override
+ @BeforeClass(groups = { "integration", "live" })
+ public void setupContext() {
+ super.setupContext();
+ client = view.getComputeService();
+ }
+
+ @Override
+ protected Module getSshModule() {
+ return new SshjSshClientModule();
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiTest.java
new file mode 100644
index 0000000..feeec7c
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/internal/BaseVCloudApiTest.java
@@ -0,0 +1,270 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.internal;
+
+import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.ovf.Envelope;
+import org.jclouds.ovf.xml.EnvelopeHandlerTest;
+import org.jclouds.providers.AnonymousProviderMetadata;
+import org.jclouds.providers.ProviderMetadata;
+import org.jclouds.rest.AuthorizationException;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
+import org.jclouds.vcloud.VCloudApiMetadata;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.VCloudVersionsApi;
+import org.jclouds.vcloud.config.VCloudHttpApiModule;
+import org.jclouds.vcloud.domain.AllocationModel;
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.domain.VCloudSession;
+import org.jclouds.vcloud.domain.VDC;
+import org.jclouds.vcloud.domain.VDCStatus;
+import org.jclouds.vcloud.domain.internal.CatalogImpl;
+import org.jclouds.vcloud.domain.internal.CatalogItemImpl;
+import org.jclouds.vcloud.domain.internal.OrgImpl;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.domain.internal.VDCImpl;
+import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
+import org.jclouds.vcloud.xml.VAppTemplateHandlerTest;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Functions;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.cache.CacheLoader;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.AbstractModule;
+import com.google.inject.Module;
+import com.google.inject.TypeLiteral;
+
+/**
+ * Tests behavior of {@code VCloudApi}
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "BaseVCloudApiTest")
+public abstract class BaseVCloudApiTest<T> extends BaseRestAnnotationProcessingTest<T> {
+
+ @Override
+ protected void checkFilters(HttpRequest request) {
+ assertEquals(request.getFilters().size(), 1);
+ assertEquals(request.getFilters().get(0).getClass(), AddVCloudAuthorizationAndCookieToRequest.class);
+ }
+
+ @Override
+ protected Module createModule() {
+ return new VCloudHttpApiModuleExtension();
+ }
+
+ @Override
+ protected ProviderMetadata createProviderMetadata() {
+ return AnonymousProviderMetadata.forApiWithEndpoint(new VCloudApiMetadata(), "https://vcenterprise.bluelock.com/api/v1.0");
+ }
+
+ protected static final ReferenceTypeImpl ORG_REF = new ReferenceTypeImpl("org", VCloudMediaType.ORG_XML,
+ URI.create("https://vcenterprise.bluelock.com/api/v1.0/org/1"));
+
+ protected static final ReferenceTypeImpl CATALOG_REF = new ReferenceTypeImpl("catalog", VCloudMediaType.CATALOG_XML,
+ URI.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"));
+
+ protected static final ReferenceTypeImpl TASKSLIST_REF = new ReferenceTypeImpl("tasksList",
+ VCloudMediaType.TASKSLIST_XML, URI.create("https://vcenterprise.bluelock.com/api/v1.0/tasksList/1"));
+
+ protected static final ReferenceTypeImpl VDC_REF = new ReferenceTypeImpl("vdc", VCloudMediaType.VDC_XML,
+ URI.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"));
+
+ protected static final ReferenceTypeImpl NETWORK_REF = new ReferenceTypeImpl("network", VCloudMediaType.NETWORK_XML,
+ URI.create("https://vcloud.safesecureweb.com/network/1990"));
+
+ protected static final Org ORG = new OrgImpl(ORG_REF.getName(), ORG_REF.getType(), ORG_REF.getHref(), "org", null,
+ ImmutableMap.<String, ReferenceType> of(CATALOG_REF.getName(), CATALOG_REF),
+ ImmutableMap.<String, ReferenceType> of(VDC_REF.getName(), VDC_REF), ImmutableMap.<String, ReferenceType> of(
+ NETWORK_REF.getName(), NETWORK_REF), TASKSLIST_REF, ImmutableList.<Task> of());
+
+ protected static final VDC VDC = new VDCImpl(VDC_REF.getName(), VDC_REF.getType(), VDC_REF.getHref(),
+ VDCStatus.READY, null, "description", ImmutableSet.<Task> of(), AllocationModel.ALLOCATION_POOL, null, null,
+ null, ImmutableMap.<String, ReferenceType> of(
+ "vapp",
+ new ReferenceTypeImpl("vapp", "application/vnd.vmware.vcloud.vApp+xml", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/188849-1")),
+ "network",
+ new ReferenceTypeImpl("network", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdcItem/2"))),
+ ImmutableMap.<String, ReferenceType> of(NETWORK_REF.getName(), NETWORK_REF), 0, 0, 0, false);
+
+ @ConfiguresHttpApi
+ public static class VCloudHttpApiModuleExtension extends VCloudHttpApiModule {
+
+ @Override
+ protected Supplier<URI> provideAuthenticationURI(VCloudVersionsApi versionService, String version) {
+ return Suppliers.ofInstance(URI.create("https://vcenterprise.bluelock.com/api/v1.0/login"));
+ }
+
+ @Override
+ protected Supplier<Org> provideOrg(Supplier<Map<String, Org>> orgSupplier,
+ @org.jclouds.vcloud.endpoints.Org Supplier<ReferenceType> defaultOrg) {
+ return Suppliers.ofInstance(ORG);
+ }
+
+ @Override
+ protected void installDefaultVCloudEndpointsModule() {
+ install(new AbstractModule() {
+
+ @Override
+ protected void configure() {
+ TypeLiteral<Supplier<ReferenceType>> refTypeSupplier = new TypeLiteral<Supplier<ReferenceType>>() {
+ };
+ bind(refTypeSupplier).annotatedWith(org.jclouds.vcloud.endpoints.Org.class).toInstance(
+ Suppliers.<ReferenceType> ofInstance(ORG_REF));
+ bind(refTypeSupplier).annotatedWith(org.jclouds.vcloud.endpoints.Catalog.class).toInstance(
+ Suppliers.<ReferenceType> ofInstance(CATALOG_REF));
+ bind(refTypeSupplier).annotatedWith(org.jclouds.vcloud.endpoints.TasksList.class).toInstance(
+ Suppliers.<ReferenceType> ofInstance(TASKSLIST_REF));
+ bind(refTypeSupplier).annotatedWith(org.jclouds.vcloud.endpoints.VDC.class).toInstance(
+ Suppliers.<ReferenceType> ofInstance(VDC_REF));
+ bind(refTypeSupplier).annotatedWith(org.jclouds.vcloud.endpoints.Network.class).toInstance(
+ Suppliers.<ReferenceType> ofInstance(NETWORK_REF));
+ }
+
+ });
+ }
+
+ @Override
+ protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
+ AtomicReference<AuthorizationException> authException, final VCloudLoginApi login) {
+ return Suppliers.<VCloudSession> ofInstance(new VCloudSession() {
+
+ @Override
+ public Map<String, ReferenceType> getOrgs() {
+ return ImmutableMap.<String, ReferenceType> of(ORG_REF.getName(), ORG_REF);
+ }
+
+ @Override
+ public String getVCloudToken() {
+ return "token";
+ }
+
+ });
+
+ }
+
+ @Override
+ protected void configure() {
+ super.configure();
+ bind(OrgMapSupplier.class).to(TestOrgMapSupplier.class);
+ bind(OrgCatalogSupplier.class).to(TestOrgCatalogSupplier.class);
+ bind(OrgCatalogItemSupplier.class).to(TestOrgCatalogItemSupplier.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void bindCacheLoaders() {
+ bind(new TypeLiteral<CacheLoader<URI, VAppTemplate>>() {
+ }).toInstance(CacheLoader.class.cast(CacheLoader.from(Functions.constant(VAppTemplateHandlerTest.parseTemplate()))));
+
+ bind(new TypeLiteral<CacheLoader<URI, Envelope>>() {
+ }).toInstance(CacheLoader.class.cast(CacheLoader.from(Functions.constant(EnvelopeHandlerTest.parseEnvelope()))));
+ }
+
+ @Override
+ protected Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.VDC>>> provideOrgVDCSupplierCache(
+ @Named(PROPERTY_SESSION_INTERVAL) long seconds, AtomicReference<AuthorizationException> authException,
+ OrgVDCSupplier supplier) {
+ return Suppliers.<Map<String, Map<String, org.jclouds.vcloud.domain.VDC>>> ofInstance(ImmutableMap
+ .<String, Map<String, org.jclouds.vcloud.domain.VDC>> of(ORG_REF.getName(),
+ ImmutableMap.<String, org.jclouds.vcloud.domain.VDC> of(VDC.getName(), VDC)));
+ }
+
+ @Singleton
+ public static class TestOrgMapSupplier extends OrgMapSupplier {
+
+ @Inject
+ protected TestOrgMapSupplier() {
+ super(null, null);
+ }
+
+ @Override
+ public Map<String, Org> get() {
+ return ImmutableMap.<String, Org> of(ORG.getName(), ORG);
+ }
+ }
+
+ @Singleton
+ public static class TestOrgCatalogSupplier extends OrgCatalogSupplier {
+ @Inject
+ protected TestOrgCatalogSupplier() {
+ super(null, null);
+ }
+
+ @Override
+ public Map<String, Map<String, org.jclouds.vcloud.domain.Catalog>> get() {
+ return ImmutableMap.<String, Map<String, org.jclouds.vcloud.domain.Catalog>> of(
+ ORG_REF.getName(), ImmutableMap.<String, org.jclouds.vcloud.domain.Catalog> of(
+ CATALOG_REF.getName(),
+ new CatalogImpl(CATALOG_REF.getName(), CATALOG_REF.getType(), CATALOG_REF.getHref(), null,
+ "description", ImmutableMap.<String, ReferenceType> of(
+ "item",
+ new ReferenceTypeImpl("item", "application/vnd.vmware.vcloud.catalogItem+xml", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/1")),
+ "template",
+ new ReferenceTypeImpl("template", "application/vnd.vmware.vcloud.vAppTemplate+xml",
+ URI.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"))),
+ ImmutableList.<Task> of(), true, false)));
+ }
+ }
+
+ @Singleton
+ public static class TestOrgCatalogItemSupplier extends OrgCatalogItemSupplier {
+ protected TestOrgCatalogItemSupplier() {
+ super(null, null);
+ }
+
+ @Override
+ public Map<String, Map<String, Map<String, CatalogItem>>> get() {
+ return ImmutableMap.<String, Map<String, Map<String, CatalogItem>>> of(
+ ORG_REF.getName(), ImmutableMap
+ .<String, Map<String, CatalogItem>> of(CATALOG_REF
+ .getName(), ImmutableMap.<String, CatalogItem> of(
+ "template",
+ new CatalogItemImpl("template", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"), "description",
+ new ReferenceTypeImpl("template", "application/vnd.vmware.vcloud.vAppTemplate+xml",
+ URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2")),
+ ImmutableMap.<String, String> of()))));
+
+ }
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/internal/VCloudLoginApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/internal/VCloudLoginApiTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/internal/VCloudLoginApiTest.java
new file mode 100644
index 0000000..b97cdf0
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/internal/VCloudLoginApiTest.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.internal;
+
+import static org.jclouds.reflect.Reflection2.method;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.filters.BasicAuthentication;
+import org.jclouds.location.Provider;
+import org.jclouds.providers.AnonymousProviderMetadata;
+import org.jclouds.providers.ProviderMetadata;
+import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.endpoints.VCloudLogin;
+import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders;
+import org.jclouds.vcloud.http.filters.VCloudBasicAuthentication;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Supplier;
+import com.google.common.collect.ImmutableList;
+import com.google.common.net.HttpHeaders;
+import com.google.common.reflect.Invokable;
+import com.google.inject.Binder;
+import com.google.inject.Module;
+import com.google.inject.Provides;
+/**
+ * Tests behavior of {@code VCloudLoginApi}
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "VCloudLoginApiTest")
+public class VCloudLoginApiTest extends BaseRestAnnotationProcessingTest<VCloudLoginApi> {
+
+ public void testLogin() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VCloudLoginApi.class, "login");
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
+
+ assertEquals(request.getRequestLine(), "POST http://localhost:8080/login HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": application/vnd.vmware.vcloud.orgList+xml\n" + HttpHeaders.ACCEPT + ": application/vnd.vmware.vcloud.session+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseLoginResponseFromHeaders.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ @Override
+ protected void checkFilters(HttpRequest request) {
+ assertEquals(request.getFilters().size(), 1);
+ assertEquals(request.getFilters().get(0).getClass(), VCloudBasicAuthentication.class);
+ }
+
+ @Override
+ protected Module createModule() {
+ return new Module() {
+
+ @Override
+ public void configure(Binder binder) {
+ }
+
+ @Provides
+ @VCloudLogin
+ Supplier<URI> provideURI(@Provider Supplier<URI> uri) {
+ return uri;
+ }
+
+ };
+ }
+
+ @Override
+ protected ProviderMetadata createProviderMetadata() {
+ return AnonymousProviderMetadata.forApiOnEndpoint(VCloudLoginApi.class,
+ "http://localhost:8080/login");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/options/InstantiateVAppTemplateOptionsTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/options/InstantiateVAppTemplateOptionsTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/options/InstantiateVAppTemplateOptionsTest.java
new file mode 100644
index 0000000..8994284
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/options/InstantiateVAppTemplateOptionsTest.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.options;
+
+import static org.jclouds.vcloud.options.InstantiateVAppTemplateOptions.Builder.addNetworkConfig;
+import static org.jclouds.vcloud.options.InstantiateVAppTemplateOptions.Builder.description;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.domain.network.NetworkConfig;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.Iterables;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code InstantiateVAppTemplateOptions}
+ */
+@Test(groups = "unit")
+public class InstantiateVAppTemplateOptionsTest {
+
+ Injector injector = Guice.createInjector(new SaxParserModule());
+
+ @Test
+ public void testAddNetworkConfig() {
+ InstantiateVAppTemplateOptions options = new InstantiateVAppTemplateOptions();
+ options.addNetworkConfig(new NetworkConfig("default", URI.create("http://localhost"), FenceMode.BRIDGED));
+ assertEquals(Iterables.get(options.getNetworkConfig(), 0).getNetworkName(), "default");
+ assertEquals(Iterables.get(options.getNetworkConfig(), 0).getParentNetwork(), URI.create("http://localhost"));
+ assertEquals(Iterables.get(options.getNetworkConfig(), 0).getFenceMode(), FenceMode.BRIDGED);
+ }
+
+ @Test
+ public void testAddNetworkConfigStatic() {
+ InstantiateVAppTemplateOptions options = addNetworkConfig(new NetworkConfig("default",
+ URI.create("http://localhost"), FenceMode.BRIDGED));
+ assertEquals(Iterables.get(options.getNetworkConfig(), 0).getNetworkName(), "default");
+ assertEquals(Iterables.get(options.getNetworkConfig(), 0).getParentNetwork(), URI.create("http://localhost"));
+ assertEquals(Iterables.get(options.getNetworkConfig(), 0).getFenceMode(), FenceMode.BRIDGED);
+ }
+
+ @Test
+ public void testDescription() {
+ InstantiateVAppTemplateOptions options = new InstantiateVAppTemplateOptions();
+ options.description("foo");
+ assertEquals(options.getDescription(), "foo");
+ }
+
+ @Test
+ public void testDescriptionStatic() {
+ InstantiateVAppTemplateOptions options = description("foo");
+ assertEquals(options.getDescription(), "foo");
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/suppliers/OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefaultTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/suppliers/OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefaultTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/suppliers/OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefaultTest.java
new file mode 100644
index 0000000..4bdb5b8
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/suppliers/OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefaultTest.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.suppliers;
+
+import static org.easymock.EasyMock.createMock;
+import static org.testng.Assert.assertEquals;
+
+import java.util.NoSuchElementException;
+
+import org.jclouds.config.ValueOfConfigurationKeyOrNull;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Predicates;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.AbstractModule;
+import com.google.inject.Guice;
+import com.google.inject.name.Names;
+
+/**
+ * Tests behavior of
+ * {@code OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault}
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefaultTest")
+public class OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefaultTest {
+ ValueOfConfigurationKeyOrNull valueOfConfigurationKeyOrNull = Guice.createInjector().getInstance(
+ ValueOfConfigurationKeyOrNull.class);
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void testIllegalArgumentWhenResourcesEmpty() {
+ new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(valueOfConfigurationKeyOrNull, "foo",
+ Predicates.<ReferenceType> alwaysTrue()).apply(ImmutableSet.<ReferenceType> of());
+ }
+
+ @Test
+ public void testReturnsOnlyResource() {
+ ReferenceType reference = createMock(ReferenceType.class);
+
+ assertEquals(new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(valueOfConfigurationKeyOrNull,
+ "foo", Predicates.<ReferenceType> alwaysTrue()).apply(ImmutableSet.<ReferenceType> of(reference)),
+ reference);
+
+ }
+
+ @Test
+ public void testReturnsFirstResourceWhenConfigurationUnspecified() {
+ ReferenceType reference1 = createMock(ReferenceType.class);
+ ReferenceType reference2 = createMock(ReferenceType.class);
+
+ assertEquals(new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(valueOfConfigurationKeyOrNull,
+ "foo", Predicates.<ReferenceType> alwaysTrue()).apply(ImmutableList.<ReferenceType> of(reference1,
+ reference2)), reference1);
+
+ }
+
+ @Test
+ public void testReturnsResourceMatchingDefaultPredicateWhenConfigurationUnspecified() {
+ ReferenceType reference1 = createMock(ReferenceType.class);
+ ReferenceType reference2 = createMock(ReferenceType.class);
+
+ assertEquals(new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(valueOfConfigurationKeyOrNull,
+ "foo", Predicates.equalTo(reference2)).apply(ImmutableList.<ReferenceType> of(reference1, reference2)),
+ reference2);
+
+ }
+
+ @Test
+ public void testReturnsResourceWithNameMatchingConfigurationKey() {
+ ReferenceType reference1 = new ReferenceTypeImpl("travis tritt", null, null);
+ ReferenceType reference2 = new ReferenceTypeImpl("hail mary", null, null);
+
+ assertEquals(
+ new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(Guice.createInjector(
+ new AbstractModule() {
+ protected void configure() {
+ bindConstant().annotatedWith(Names.named("foo")).to(".*mary.*");
+ }
+ }).getInstance(ValueOfConfigurationKeyOrNull.class), "foo", Predicates.<ReferenceType> alwaysTrue()).apply(ImmutableList
+ .<ReferenceType> of(reference1, reference2)), reference2);
+
+ }
+
+ @Test(expectedExceptions = NoSuchElementException.class)
+ public void testThrowsNoSuchElementWhenNoneMatchConfigurationKey() {
+ ReferenceType reference1 = new ReferenceTypeImpl("travis tritt", null, null);
+ ReferenceType reference2 = new ReferenceTypeImpl("hail mary", null, null);
+
+ new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(Guice.createInjector(new AbstractModule() {
+ protected void configure() {
+ bindConstant().annotatedWith(Names.named("foo")).to(".*happy.*");
+ }
+ }).getInstance(ValueOfConfigurationKeyOrNull.class), "foo", Predicates.<ReferenceType> alwaysTrue())
+ .apply(ImmutableList.<ReferenceType> of(reference1, reference2));
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/utils/TestUtils.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/utils/TestUtils.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/utils/TestUtils.java
new file mode 100644
index 0000000..9a844ed
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/utils/TestUtils.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.utils;
+
+
+/**
+ * Utility class for test
+ */
+public class TestUtils {
+ public static final Object[][] NO_INVOCATIONS = new Object[0][0];
+ public static final Object[][] SINGLE_NO_ARG_INVOCATION = { new Object[0] };
+
+ public static boolean isWindowsOs() {
+ return System.getProperty("os.name", "").toLowerCase().contains("windows");
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/CatalogHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/CatalogHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/CatalogHandlerTest.java
new file mode 100644
index 0000000..2a883e6
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/CatalogHandlerTest.java
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.jclouds.vcloud.VCloudMediaType.CATALOGITEM_XML;
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.vcloud.domain.Catalog;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.internal.CatalogImpl;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code CatalogHandler}
+ */
+@Test(groups = "unit")
+public class CatalogHandlerTest {
+
+ private Injector injector;
+
+ private Factory factory;
+
+ public void testVCloud1_0() {
+ InputStream is = getClass().getResourceAsStream("/catalog-blank.xml");
+ injector = Guice.createInjector(new SaxParserModule());
+ factory = injector.getInstance(ParseSax.Factory.class);
+ Catalog result = factory.create(injector.getInstance(CatalogHandler.class)).parse(is);
+ assertEquals(result, new CatalogImpl("Jclouds-private", "application/vnd.vmware.vcloud.catalog+xml", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/catalog/921222081"), new ReferenceTypeImpl(null,
+ "application/vnd.vmware.vcloud.org+xml", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/org/9566014")), null, ImmutableMap
+ .<String, ReferenceType> of(), ImmutableList.<Task> of(), false, false));
+ }
+
+ public void testTerremark() {
+ InputStream is = getClass().getResourceAsStream("/catalog.xml");
+ injector = Guice.createInjector(new SaxParserModule());
+ factory = injector.getInstance(ParseSax.Factory.class);
+ Catalog result = factory.create(injector.getInstance(CatalogHandler.class)).parse(is);
+ assertEquals(result.getName(), "Miami Environment 1");
+ assert result.getDescription() == null;
+
+ assertEquals(result.getHref(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog"));
+ assertEquals(result.get("CentOS 5.3 (32-bit)"), new ReferenceTypeImpl("CentOS 5.3 (32-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/5")));
+ assertEquals(result.get("CentOS 5.3 (64-bit)"), new ReferenceTypeImpl("CentOS 5.3 (64-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/6")));
+ assertEquals(result.get("RHEL 5.3 (32-bit)"), new ReferenceTypeImpl("RHEL 5.3 (32-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/7")));
+ assertEquals(result.get("RHEL 5.3 (64-bit)"), new ReferenceTypeImpl("RHEL 5.3 (64-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/8")));
+ assertEquals(result.get("Ubuntu JeOS 9.04 (32-bit)"), new ReferenceTypeImpl("Ubuntu JeOS 9.04 (32-bit)",
+ CATALOGITEM_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/11")));
+ assertEquals(result.get("Ubuntu JeOS 9.04 (64-bit)"), new ReferenceTypeImpl("Ubuntu JeOS 9.04 (64-bit)",
+ CATALOGITEM_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/12")));
+ assertEquals(result.get("Ubuntu Server 9.04 (32-bit)"), new ReferenceTypeImpl("Ubuntu Server 9.04 (32-bit)",
+ CATALOGITEM_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/9")));
+ assertEquals(result.get("Ubuntu Server 9.04 (64-bit)"), new ReferenceTypeImpl("Ubuntu Server 9.04 (64-bit)",
+ CATALOGITEM_XML, URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/10")));
+ assertEquals(result.get("Windows 2003 Enterprise R2 (32-bit)"), new ReferenceTypeImpl(
+ "Windows 2003 Enterprise R2 (32-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/1")));
+ assertEquals(result.get("Windows 2003 Enterprise R2 (64-bit)"), new ReferenceTypeImpl(
+ "Windows 2003 Enterprise R2 (64-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/2")));
+ assertEquals(result.get("Windows 2003 Standard R2 (32-bit)"), new ReferenceTypeImpl(
+ "Windows 2003 Standard R2 (32-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/3")));
+ assertEquals(result.get("Windows 2003 Standard R2 (64-bit)"), new ReferenceTypeImpl(
+ "Windows 2003 Standard R2 (64-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/4")));
+ assertEquals(result.get("Windows 2003 Standard R2 w.SQL 2008 Web (64-bit)"), new ReferenceTypeImpl(
+ "Windows 2003 Standard R2 w.SQL 2008 Web (64-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/23")));
+ assertEquals(result.get("Windows Server 2008 Enterprise (32-bit)"), new ReferenceTypeImpl(
+ "Windows Server 2008 Enterprise (32-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/13")));
+ assertEquals(result.get("Windows Server 2008 Enterprise (64-bit)"), new ReferenceTypeImpl(
+ "Windows Server 2008 Enterprise (64-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/15")));
+ assertEquals(result.get("Windows Server 2008 Enterprise R2 (64-bit)"), new ReferenceTypeImpl(
+ "Windows Server 2008 Enterprise R2 (64-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/16")));
+ assertEquals(result.get("Windows Server 2008 Standard (32-bit)"), new ReferenceTypeImpl(
+ "Windows Server 2008 Standard (32-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/17")));
+ assertEquals(result.get("Windows Server 2008 Standard (64-bit)"), new ReferenceTypeImpl(
+ "Windows Server 2008 Standard (64-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/18")));
+ assertEquals(result.get("Windows Server 2008 Standard R2 (64-bit)"), new ReferenceTypeImpl(
+ "Windows Server 2008 Standard R2 (64-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/19")));
+ assertEquals(result.get("Windows Server 2008 Standard w.SQL 2008 Web (64-bit)"), new ReferenceTypeImpl(
+ "Windows Server 2008 Standard w.SQL 2008 Web (64-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/14")));
+ assertEquals(result.get("Windows Web Server 2008 (32-bit)"), new ReferenceTypeImpl(
+ "Windows Web Server 2008 (32-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/20")));
+ assertEquals(result.get("Windows Web Server 2008 (64-bit)"), new ReferenceTypeImpl(
+ "Windows Web Server 2008 (64-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/21")));
+ assertEquals(result.get("Windows Web Server 2008 R2 (64-bit)"), new ReferenceTypeImpl(
+ "Windows Web Server 2008 R2 (64-bit)", CATALOGITEM_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/22")));
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/CatalogItemHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/CatalogItemHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/CatalogItemHandlerTest.java
new file mode 100644
index 0000000..6f2b100
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/CatalogItemHandlerTest.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.domain.internal.CatalogItemImpl;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSortedMap;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code CatalogItemHandler}
+ */
+@Test(groups = "unit")
+public class CatalogItemHandlerTest {
+
+ public void testApplyInputStream() {
+ InputStream is = getClass().getResourceAsStream("/catalogItem-hosting.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ CatalogItem result = factory.create(injector.getInstance(CatalogItemHandler.class)).parse(is);
+
+ assertEquals(result, new CatalogItemImpl("Windows 2008 Datacenter 64 Bit", URI
+ .create("https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"), "Windows 2008 Datacenter 64 Bit",
+ new ReferenceTypeImpl("Windows 2008 Datacenter 64 Bit",
+ "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
+ .create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2")),
+ ImmutableSortedMap.of("Foo", "Bar", "Hello", "World"
+
+ )));
+
+ }
+
+ public void testApplyInputStreamWithNamespaceUsingVcloud() {
+ InputStream is = getClass().getResourceAsStream("/catalogItem-carrenza-with-vcloud-namespace.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ CatalogItem result = factory.create(injector.getInstance(CatalogItemHandler.class)).parse(is);
+
+ assertEquals(result, new CatalogItemImpl("ubuntu10.10x64",
+ URI.create("https://myvdc.carrenza.net/api/v1.0/catalogItem/ecd4d3a0-0d12-4195-a6d2-14cdf9f925a3"),
+ null, new ReferenceTypeImpl("ubuntu10.10x64", "application/vnd.vmware.vcloud.vAppTemplate+xml",
+ URI.create("https://myvdc.carrenza.net/api/v1.0/vAppTemplate/vappTemplate-123766ea-2b55-482c-8adf-735ab1952834")),
+ ImmutableSortedMap.<String, String>of()));
+ }
+
+ public void testApplyInputStreamWithNamespaceUsingDefault() {
+ InputStream is = getClass().getResourceAsStream("/catalogItem-carrenza-with-default-namespace.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ CatalogItem result = factory.create(injector.getInstance(CatalogItemHandler.class)).parse(is);
+
+ assertEquals(result, new CatalogItemImpl("ubuntu10.10x64",
+ URI.create("https://myvdc.carrenza.net/api/v1.0/catalogItem/ecd4d3a0-0d12-4195-a6d2-14cdf9f925a3"),
+ null, new ReferenceTypeImpl("ubuntu10.10x64", "application/vnd.vmware.vcloud.vAppTemplate+xml",
+ URI.create("https://myvdc.carrenza.net/api/v1.0/vAppTemplate/vappTemplate-123766ea-2b55-482c-8adf-735ab1952834")),
+ ImmutableSortedMap.<String, String>of()));
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/GuestCustomizationSectionHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/GuestCustomizationSectionHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/GuestCustomizationSectionHandlerTest.java
new file mode 100644
index 0000000..503611e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/GuestCustomizationSectionHandlerTest.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.net.UnknownHostException;
+
+import org.jclouds.http.functions.BaseHandlerTest;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.GuestCustomizationSection;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.testng.annotations.Test;
+
+/**
+ * Tests behavior of {@code GuestCustomizationSectionHandler}
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "GuestCustomizationSectionHandlerTest")
+public class GuestCustomizationSectionHandlerTest extends BaseHandlerTest {
+
+ public void testDefault() throws UnknownHostException {
+ InputStream is = getClass().getResourceAsStream("/guestCustomization.xml");
+
+ GuestCustomizationSection result = factory.create(injector.getInstance(GuestCustomizationSectionHandler.class))
+ .parse(is);
+
+ checkGuestCustomization(result);
+
+ }
+
+ @Test(enabled = false)
+ public static void checkGuestCustomization(GuestCustomizationSection result) {
+ assertEquals(result.getType(), VCloudMediaType.GUESTCUSTOMIZATIONSECTION_XML);
+ assertEquals(result.getHref(),
+ URI.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/guestCustomizationSection/"));
+ assertEquals(result.getInfo(), "Specifies Guest OS Customization Settings");
+ assertEquals(result.isEnabled(), Boolean.TRUE);
+ assertEquals(result.shouldChangeSid(), Boolean.FALSE);
+ assertEquals(result.getVirtualMachineId(), "2087535248");
+ assertEquals(result.isJoinDomainEnabled(), Boolean.FALSE);
+ assertEquals(result.useOrgSettings(), Boolean.FALSE);
+ assertEquals(result.getDomainName(), null);
+ assertEquals(result.getDomainUserName(), null);
+ assertEquals(result.getDomainUserPassword(), null);
+ assertEquals(result.isAdminPasswordEnabled(), Boolean.TRUE);
+ assertEquals(result.isAdminPasswordAuto(), Boolean.TRUE);
+ assertEquals(result.getAdminPassword(), null);
+ assertEquals(result.isResetPasswordRequired(), Boolean.FALSE);
+ assertEquals(result.getCustomizationScript(), "cat > /root/foo.txt<<EOF\nI '\"love\"' {asc|!}*&\nEOF\n");
+ assertEquals(result.getComputerName(), "RHEL5");
+ assertEquals(
+ result.getEdit(),
+ new ReferenceTypeImpl(null, VCloudMediaType.GUESTCUSTOMIZATIONSECTION_XML, URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/guestCustomizationSection/")));
+ }
+}
[14/18] stratos git commit: Jclouds vcloud api 1.8.1 clone with
custom changes
Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VApp.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VApp.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VApp.java
new file mode 100644
index 0000000..98efea2
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VApp.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain;
+
+import java.util.List;
+import java.util.Set;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.ovf.VCloudNetworkSection;
+
+/**
+ * A VApp is the result of instantiation of a {@link VAppTemplate}. <h2>note</h2>
+ * <p/>
+ * When the {@link #getStatus} is {@link Status#UNRESOLVED}, there will be a task present for the
+ * instantiation of the VApp.
+ */
+public interface VApp extends ReferenceType {
+ /**
+ * Reference to the vdc containing this vApp.
+ *
+ * @since vcloud api 1.0
+ * @return vdc, or null if this is a version before 1.0 where the org isn't present
+ */
+ ReferenceType getVDC();
+
+ /**
+ * The creation status of the vDC
+ *
+ * @since vcloud api 1.0
+ */
+ Status getStatus();
+
+ /**
+ * optional description
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ String getDescription();
+
+ /**
+ *
+ * @return true if the OVF descriptor for the template has been uploaded to the containing vDC.
+ * @since vcloud api 1.0
+ */
+ boolean isOvfDescriptorUploaded();
+
+ /**
+ * read‐only container for Task elements. Each element in the container represents a queued,
+ * running, or failed task owned by this object.
+ *
+ * @since vcloud api 1.0
+ */
+ List<Task> getTasks();
+
+ /**
+ * container for Vm elements representing virtual machines
+ *
+ * @since vcloud api 1.0
+ */
+ Set<Vm> getChildren();
+
+ /**
+ * description of the predefined vApp internal networks in this template
+ *
+ * @return null if the vApp is not yet instantiated
+ * @since vcloud api 1.0
+ */
+ @Nullable
+ VCloudNetworkSection getNetworkSection();
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VAppTemplate.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VAppTemplate.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VAppTemplate.java
new file mode 100644
index 0000000..8fdd6fb
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VAppTemplate.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain;
+
+import java.util.List;
+import java.util.Set;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.internal.VAppTemplateImpl;
+import org.jclouds.vcloud.domain.ovf.VCloudNetworkSection;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * A VAppTemplate is an abstract description of a vApp. It is created when you upload an OVF package
+ * to a vDC.
+ */
+@ImplementedBy(VAppTemplateImpl.class)
+public interface VAppTemplate extends ReferenceType {
+ /**
+ * Reference to the VDC containing this template.
+ *
+ * @since vcloud api 1.0
+ * @return org, or null if this is a version before 1.0 where the vdc isn't present
+ */
+ ReferenceType getVDC();
+
+ /**
+ * @return creation status of the VAppTemplate.
+ *
+ * @since vcloud api 1.0
+ */
+ Status getStatus();
+
+ /**
+ * optional description
+ *
+ * @since vcloud api 1.0
+ */
+ @Nullable
+ String getDescription();
+
+ /**
+ * read-only container for Task elements. Each element in the container represents a queued,
+ * running, or failed task owned by this object.
+ *
+ * @since vcloud api 1.0
+ */
+ List<Task> getTasks();
+
+ /**
+ *
+ * @return true if the OVF descriptor for the template has been uploaded to the containing vDC.
+ * @since vcloud api 1.0
+ */
+ boolean isOvfDescriptorUploaded();
+
+ /**
+ * read-only identifier created on import
+ *
+ * @since vcloud api 1.0
+ */
+ @Nullable
+ String getVAppScopedLocalId();
+
+ /**
+ * container for Vm elements representing virtual machines
+ *
+ * @since vcloud api 1.0
+ */
+ Set<Vm> getChildren();
+
+ /**
+ * description of the predefined vApp internal networks in this template
+ *
+ * @return null if the vAppTemplate is still copying
+ * @since vcloud api 1.0
+ */
+ @Nullable
+ VCloudNetworkSection getNetworkSection();
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VCloudError.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VCloudError.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VCloudError.java
new file mode 100644
index 0000000..3fa88b6
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VCloudError.java
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.internal.ErrorImpl;
+
+import com.google.inject.ImplementedBy;
+
+@ImplementedBy(ErrorImpl.class)
+public interface VCloudError {
+ public static enum MinorCode {
+ /**
+ * The request was made by a user who had insufficient rights to the object or operation.
+ */
+ ACCESS_TO_RESOURCE_IS_FORBIDDEN,
+ /**
+ * The request could not be validated or contained invalid XML.
+ */
+ BAD_REQUEST,
+ /**
+ * A conflict was detected between sections of an OVF descriptor.
+ */
+ CONFLICT,
+ /**
+ * The entity is busy
+ */
+ BUSY_ENTITY,
+ /**
+ * An attempt to instantiate a vAppTemplate or use a vAppTemplate or a Vm in a composition did
+ * not include an AllEULAsAccepted element with a value of true.
+ */
+ EULA_NOT_ACCEPTED,
+ /**
+ * Returned for any failure that cannot be matched to another minor error code.
+ */
+ INTERNAL_SERVER_ERROR,
+ /**
+ * One or more references (href attribute values) supplied in the request could not be
+ * resolved to an object.
+ */
+ INVALID_REFERENCE,
+ /**
+ * The HTTP method (GET, PUT, POST, DELETE) is not allowed for the request.
+ */
+ METHOD_NOT_ALLOWED,
+ /**
+ * One or more references (href attribute values) supplied in the request could not be
+ * resolved to an object, or the Content‐type of the request was incorrect.
+ */
+ RESOURCE_NOT_FOUND,
+ /**
+ * The request raised an exception that did not match any HTTP status code.
+ */
+ UNKNOWN,
+ /**
+ * The wrong content type was specified for the request.
+ */
+ UNSUPPORTED_MEDIA_TYPE, UNRECOGNIZED;
+
+ public static MinorCode fromValue(String minorCode) {
+ try {
+ return valueOf(checkNotNull(minorCode, "minorCode"));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+ }
+
+ /**
+ *
+ * @return message describing the error
+ */
+ String getMessage();
+
+ /**
+ *
+ * @return matches the HTTP status code
+ */
+ int getMajorErrorCode();
+
+ /**
+ *
+ * @return error code specific to the failed operation or null if vcloud <0.9
+ */
+ @Nullable
+ MinorCode getMinorErrorCode();
+
+ /**
+ *
+ * @return optional additional information about the source of the error
+ */
+ @Nullable
+ String getVendorSpecificErrorCode();
+
+ /**
+ *
+ * @return stack trace of the error, if available. This attribute is returned only when a request
+ * is made by the system administrator.
+ */
+ String getStackTrace();
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VCloudSession.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VCloudSession.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VCloudSession.java
new file mode 100644
index 0000000..01acd91
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VCloudSession.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain;
+
+import java.util.Map;
+
+public interface VCloudSession {
+ String getVCloudToken();
+
+ Map<String, ReferenceType> getOrgs();
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VDC.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VDC.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VDC.java
new file mode 100644
index 0000000..c741d26
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VDC.java
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain;
+
+import java.util.List;
+import java.util.Map;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.internal.VDCImpl;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * A vDC is a deployment environment for vApps. A Vdc element provides a user view of a vDC.
+ */
+@org.jclouds.vcloud.endpoints.VDC
+@ImplementedBy(VDCImpl.class)
+public interface VDC extends ReferenceType {
+ /**
+ * Reference to the org containing this vDC.
+ *
+ * @since vcloud api 1.0
+ * @return org, or null if this is a version before 1.0 where the org isn't present
+ */
+ ReferenceType getOrg();
+
+ /**
+ * The creation status of the vDC
+ *
+ * @since vcloud api 1.0
+ */
+ VDCStatus getStatus();
+
+ /**
+ * optional description
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ String getDescription();
+
+ /**
+ * read‐only container for Task elements. Each element in the container represents a queued,
+ * running, or failed task owned by this object.
+ *
+ * @since vcloud api 1.0
+ */
+ List<Task> getTasks();
+
+ /**
+ * defines how resources are allocated by the vDC. The value of this element is set by the
+ * administrator who created the vDC. It is read‐only to users.
+ *
+ * @since vcloud api 1.0
+ */
+ AllocationModel getAllocationModel();
+
+ /**
+ * defines the storage capacity available in the vDC
+ *
+ * @since vcloud api 0.8
+ * @return null if the provider doesn't support storage capacity
+ */
+ @Nullable
+ Capacity getStorageCapacity();
+
+ /**
+ * reports CPU resource consumption in a vDC
+ *
+ * @since vcloud api 0.8
+ * @return null if the provider doesn't support cpu capacity
+ */
+ @Nullable
+ Capacity getCpuCapacity();
+
+ /**
+ * reports memory resource consumption in a vDC
+ *
+ * @since vcloud api 0.8
+ * @return null if the provider doesn't support memory capacity
+ */
+ @Nullable
+ Capacity getMemoryCapacity();
+
+ /**
+ * container for ResourceEntity elements
+ *
+ * @since vcloud api 0.8
+ */
+ Map<String, ReferenceType> getResourceEntities();
+
+ /**
+ * container for OrgNetwork elements that represent organization networks contained by the vDC
+ *
+ * @since vcloud api 0.8
+ */
+ Map<String, ReferenceType> getAvailableNetworks();
+
+ /**
+ * maximum number of virtual NICs allowed in this vDC. Defaults to 0, which specifies an
+ * unlimited number.
+ *
+ * @since vcloud api 1.0
+ */
+ int getNicQuota();
+
+ /**
+ * maximum number of OrgNetwork objects that can be deployed in this vDC. Defaults to 0, which
+ * specifies an unlimited number.
+ *
+ * @since vcloud api 1.0
+ */
+ int getNetworkQuota();
+
+ /**
+ * maximum number of virtual machines that can be deployed in this vDC. Defaults to 0, which
+ * specifies an unlimited number.
+ *
+ * @since vcloud api 0.8
+ */
+ int getVmQuota();
+
+ /**
+ * true if this vDC is enabled
+ *
+ * @since vcloud api 1.0
+ */
+ boolean isEnabled();
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VDCStatus.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VDCStatus.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VDCStatus.java
new file mode 100644
index 0000000..81b25d9
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/VDCStatus.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain;
+
+/**
+ * The creation status of the vDC
+ *
+ * @see VDC#getStatus
+ */
+public enum VDCStatus {
+
+ CREATION_FAILED, NOT_READY, READY, UNKNOWN, UNRECOGNIZED;
+
+ public int value() {
+ switch (this) {
+ case CREATION_FAILED:
+ return -1;
+ case NOT_READY:
+ return 0;
+ case READY:
+ return 1;
+ case UNKNOWN:
+ return 2;
+ default:
+ return 3;
+ }
+ }
+
+ public static VDCStatus fromValue(int status) {
+ switch (status) {
+ case -1:
+ return CREATION_FAILED;
+ case 0:
+ return NOT_READY;
+ case 1:
+ return READY;
+ case 2:
+ return UNKNOWN;
+ default:
+ return UNRECOGNIZED;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Vm.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Vm.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Vm.java
new file mode 100644
index 0000000..79657b1
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Vm.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain;
+
+import java.util.List;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.internal.VmImpl;
+import org.jclouds.vcloud.domain.ovf.VCloudOperatingSystemSection;
+import org.jclouds.vcloud.domain.ovf.VCloudVirtualHardwareSection;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * A Vm represents a virtual machine, a member of a vApp’s Children container. <h2>note</h2>
+ * <p/>
+ * When the {@link #getStatus} is {@link Status#UNRESOLVED}, there will be a task present for the
+ * instantiation of the VApp.
+ */
+@ImplementedBy(VmImpl.class)
+public interface Vm extends ReferenceType {
+ /**
+ * Reference to the {@link VApp} or {@link VAppTemplate} containing this vm.
+ *
+ * @since vcloud api 1.0
+ */
+ ReferenceType getParent();
+
+ /**
+ * @return creation status of the Vm or null, if a part of a VAppTemplate
+ *
+ * @since vcloud api 1.0
+ */
+ @Nullable
+ Status getStatus();
+
+ /**
+ * optional description
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ String getDescription();
+
+ /**
+ * read‐only container for Task elements. Each element in the container represents a queued,
+ * running, or failed task owned by this object.
+ *
+ * @since vcloud api 1.0
+ */
+ List<Task> getTasks();
+
+ /**
+ * @return virtual hardware that comprises this VM, or null, if part of a vApp template
+ *
+ * @since vcloud api 1.0
+ */
+ @Nullable
+ VCloudVirtualHardwareSection getVirtualHardwareSection();
+
+ /**
+ * @return operating system on this VM, or null, if part of a vApp template
+ *
+ * @since vcloud api 1.0
+ */
+ @Nullable
+ VCloudOperatingSystemSection getOperatingSystemSection();
+
+ /**
+ * @return network connections for this VM, or null if it doesn't exist
+ *
+ * @since vcloud api 1.0
+ */
+ @Nullable
+ NetworkConnectionSection getNetworkConnectionSection();
+
+ /**
+ * @return guest customization section for this VM, or null if it doesn't exist
+ *
+ * @since vcloud api 1.0
+ */
+ @Nullable
+ GuestCustomizationSection getGuestCustomizationSection();
+
+ /**
+ * read-only identifier created on import
+ *
+ * @since vcloud api 1.0
+ */
+ @Nullable
+ String getVAppScopedLocalId();
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/CatalogImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/CatalogImpl.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/CatalogImpl.java
new file mode 100644
index 0000000..03d1532
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/CatalogImpl.java
@@ -0,0 +1,189 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.Catalog;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
+/**
+ * Locations of resources in vCloud
+ */
+public class CatalogImpl extends LinkedHashMap<String, ReferenceType> implements Catalog {
+
+ private final String name;
+ private final String type;
+ private final URI href;
+ private final ReferenceType org;
+ @Nullable
+ private final String description;
+ private final List<Task> tasks = Lists.newArrayList();
+ private final boolean published;
+ private final boolean readOnly;
+
+ public CatalogImpl(String name, String type, URI href, ReferenceType org, @Nullable String description,
+ Map<String, ReferenceType> contents, Iterable<Task> tasks, boolean published, boolean readOnly) {
+ this.name = checkNotNull(name, "name");
+ this.type = checkNotNull(type, "type");
+ this.org = org;// TODO: once <1.0 is killed check not null
+ this.description = description;
+ this.href = checkNotNull(href, "href");
+ putAll(checkNotNull(contents, "contents"));
+ Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
+ this.published = published;
+ this.readOnly = readOnly;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public URI getHref() {
+ return href;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ReferenceType getOrg() {
+ return org;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<Task> getTasks() {
+ return tasks;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isPublished() {
+ return published;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isReadOnly() {
+ return readOnly;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((description == null) ? 0 : description.hashCode());
+ result = prime * result + ((href == null) ? 0 : href.hashCode());
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((org == null) ? 0 : org.hashCode());
+ result = prime * result + ((tasks == null) ? 0 : tasks.hashCode());
+ result = prime * result + ((type == null) ? 0 : type.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ CatalogImpl other = (CatalogImpl) obj;
+ if (description == null) {
+ if (other.description != null)
+ return false;
+ } else if (!description.equals(other.description))
+ return false;
+ if (href == null) {
+ if (other.href != null)
+ return false;
+ } else if (!href.equals(other.href))
+ return false;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ if (org == null) {
+ if (other.org != null)
+ return false;
+ } else if (!org.equals(other.org))
+ return false;
+ if (tasks == null) {
+ if (other.tasks != null)
+ return false;
+ } else if (!tasks.equals(other.tasks))
+ return false;
+ if (type == null) {
+ if (other.type != null)
+ return false;
+ } else if (!type.equals(other.type))
+ return false;
+ return true;
+ }
+
+ @Override
+ public int compareTo(ReferenceType o) {
+ return (this == o) ? 0 : getHref().compareTo(o.getHref());
+ }
+
+ @Override
+ public String getRelationship() {
+ throw new UnsupportedOperationException();
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/CatalogItemImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/CatalogItemImpl.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/CatalogItemImpl.java
new file mode 100644
index 0000000..5cac6ab
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/CatalogItemImpl.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.Map;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.domain.ReferenceType;
+
+import com.google.common.collect.Maps;
+
+public class CatalogItemImpl extends ReferenceTypeImpl implements CatalogItem {
+
+ private final String description;
+ private final ReferenceType entity;
+ private final Map<String, String> properties = Maps.newLinkedHashMap();
+
+ public CatalogItemImpl(String name, URI id, @Nullable String description, ReferenceType entity,
+ Map<String, String> properties) {
+ super(name, VCloudMediaType.CATALOGITEM_XML, id);
+ this.description = description;
+ this.entity = checkNotNull(entity, "entity");
+ this.properties.putAll(checkNotNull(properties, "properties"));
+ }
+
+ @Override
+ public String getType() {
+ return VCloudMediaType.CATALOGITEM_XML;
+ }
+
+ public ReferenceType getEntity() {
+ return entity;
+ }
+
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
+ @Override
+ public String toString() {
+ return "CatalogItemImpl [id=" + getHref() + ", name=" + getName() + ", type=" + getType() + ", description="
+ + getDescription() + ", entity=" + entity + ", properties=" + properties + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((description == null) ? 0 : description.hashCode());
+ result = prime * result + ((entity == null) ? 0 : entity.hashCode());
+ result = prime * result + ((properties == null) ? 0 : properties.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ CatalogItemImpl other = (CatalogItemImpl) obj;
+ if (description == null) {
+ if (other.description != null)
+ return false;
+ } else if (!description.equals(other.description))
+ return false;
+ if (entity == null) {
+ if (other.entity != null)
+ return false;
+ } else if (!entity.equals(other.entity))
+ return false;
+ if (properties == null) {
+ if (other.properties != null)
+ return false;
+ } else if (!properties.equals(other.properties))
+ return false;
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/ErrorImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/ErrorImpl.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/ErrorImpl.java
new file mode 100644
index 0000000..2550f1b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/ErrorImpl.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.VCloudError;
+
+public class ErrorImpl implements VCloudError {
+ private final String message;
+ private final int majorErrorCode;
+ private final MinorCode minorErrorCode;
+ @Nullable
+ private final String vendorSpecificErrorCode;
+ @Nullable
+ private final String stackTrace;
+
+ public ErrorImpl(String message, int majorErrorCode, @Nullable MinorCode minorErrorCode,
+ @Nullable String vendorSpecificErrorCode, @Nullable String stackTrace) {
+ this.message = checkNotNull(message, "message");
+ this.majorErrorCode = majorErrorCode;
+ this.minorErrorCode = minorErrorCode; // check null after 0.8 is gone
+ this.vendorSpecificErrorCode = vendorSpecificErrorCode;
+ this.stackTrace = stackTrace;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public int getMajorErrorCode() {
+ return majorErrorCode;
+ }
+
+ public MinorCode getMinorErrorCode() {
+ return minorErrorCode;
+ }
+
+ public String getVendorSpecificErrorCode() {
+ return vendorSpecificErrorCode;
+ }
+
+ public String getStackTrace() {
+ return stackTrace;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + majorErrorCode;
+ result = prime * result + ((message == null) ? 0 : message.hashCode());
+ result = prime * result + ((minorErrorCode == null) ? 0 : minorErrorCode.hashCode());
+ result = prime * result + ((stackTrace == null) ? 0 : stackTrace.hashCode());
+ result = prime * result + ((vendorSpecificErrorCode == null) ? 0 : vendorSpecificErrorCode.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ErrorImpl other = (ErrorImpl) obj;
+ if (majorErrorCode != other.majorErrorCode)
+ return false;
+ if (message == null) {
+ if (other.message != null)
+ return false;
+ } else if (!message.equals(other.message))
+ return false;
+ if (minorErrorCode == null) {
+ if (other.minorErrorCode != null)
+ return false;
+ } else if (!minorErrorCode.equals(other.minorErrorCode))
+ return false;
+ if (stackTrace == null) {
+ if (other.stackTrace != null)
+ return false;
+ } else if (!stackTrace.equals(other.stackTrace))
+ return false;
+ if (vendorSpecificErrorCode == null) {
+ if (other.vendorSpecificErrorCode != null)
+ return false;
+ } else if (!vendorSpecificErrorCode.equals(other.vendorSpecificErrorCode))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "[majorErrorCode=" + majorErrorCode + ", message=" + message + ", minorErrorCode=" + minorErrorCode
+ + ", stackTrace=" + stackTrace + ", vendorSpecificErrorCode=" + vendorSpecificErrorCode + "]";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/OrgImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/OrgImpl.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/OrgImpl.java
new file mode 100644
index 0000000..87327d1
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/OrgImpl.java
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+/**
+ * Locations of resources in vCloud
+ */
+public class OrgImpl extends ReferenceTypeImpl implements Org {
+ private final String fullName;
+ @Nullable
+ private final String description;
+ private final Map<String, ReferenceType> catalogs = Maps.newLinkedHashMap();
+ private final Map<String, ReferenceType> vdcs = Maps.newLinkedHashMap();
+ private final Map<String, ReferenceType> networks = Maps.newLinkedHashMap();
+ private final ReferenceType tasksList;
+ private final List<Task> tasks = Lists.newArrayList();
+
+ public OrgImpl(String name, String type, URI id, String fullName, String description,
+ Map<String, ReferenceType> catalogs, Map<String, ReferenceType> vdcs, Map<String, ReferenceType> networks,
+ @Nullable ReferenceType tasksList, Iterable<Task> tasks) {
+ super(name, type, id);
+ this.fullName = checkNotNull(fullName, "fullName");
+ this.description = description;
+ this.catalogs.putAll(checkNotNull(catalogs, "catalogs"));
+ this.vdcs.putAll(checkNotNull(vdcs, "vdcs"));
+ this.networks.putAll(checkNotNull(networks, "networks"));
+ this.tasksList = tasksList;
+ Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
+ }
+
+ @Override
+ public String getFullName() {
+ return fullName;
+ }
+
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ @Override
+ public Map<String, ReferenceType> getCatalogs() {
+ return catalogs;
+ }
+
+ @Override
+ public Map<String, ReferenceType> getVDCs() {
+ return vdcs;
+ }
+
+ @Override
+ public Map<String, ReferenceType> getNetworks() {
+ return networks;
+ }
+
+ @Override
+ public ReferenceType getTasksList() {
+ return tasksList;
+ }
+
+ @Override
+ public List<Task> getTasks() {
+ return tasks;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((catalogs == null) ? 0 : catalogs.hashCode());
+ result = prime * result + ((description == null) ? 0 : description.hashCode());
+ result = prime * result + ((fullName == null) ? 0 : fullName.hashCode());
+ result = prime * result + ((networks == null) ? 0 : networks.hashCode());
+ result = prime * result + ((tasks == null) ? 0 : tasks.hashCode());
+ result = prime * result + ((tasksList == null) ? 0 : tasksList.hashCode());
+ result = prime * result + ((vdcs == null) ? 0 : vdcs.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ OrgImpl other = (OrgImpl) obj;
+ if (catalogs == null) {
+ if (other.catalogs != null)
+ return false;
+ } else if (!catalogs.equals(other.catalogs))
+ return false;
+ if (description == null) {
+ if (other.description != null)
+ return false;
+ } else if (!description.equals(other.description))
+ return false;
+ if (fullName == null) {
+ if (other.fullName != null)
+ return false;
+ } else if (!fullName.equals(other.fullName))
+ return false;
+ if (networks == null) {
+ if (other.networks != null)
+ return false;
+ } else if (!networks.equals(other.networks))
+ return false;
+ if (tasks == null) {
+ if (other.tasks != null)
+ return false;
+ } else if (!tasks.equals(other.tasks))
+ return false;
+ if (tasksList == null) {
+ if (other.tasksList != null)
+ return false;
+ } else if (!tasksList.equals(other.tasksList))
+ return false;
+ if (vdcs == null) {
+ if (other.vdcs != null)
+ return false;
+ } else if (!vdcs.equals(other.vdcs))
+ return false;
+ return true;
+ }
+
+ @Override
+ public int compareTo(ReferenceType o) {
+ return (this == o) ? 0 : getHref().compareTo(o.getHref());
+ }
+
+ @Override
+ public String toString() {
+ return "[href=" + getHref() + ", name=" + getName() + ", type=" + getType() + ", fullName=" + fullName
+ + ", description=" + description + ", catalogs=" + catalogs + ", networks=" + networks + ", tasksList="
+ + tasksList + ", vdcs=" + vdcs + ", tasks=" + tasks + "]";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/ReferenceTypeImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/ReferenceTypeImpl.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/ReferenceTypeImpl.java
new file mode 100644
index 0000000..fa128f9
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/ReferenceTypeImpl.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.internal;
+
+import static com.google.common.base.Objects.equal;
+
+import java.net.URI;
+
+import org.jclouds.vcloud.domain.ReferenceType;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * Location of a Rest resource
+ */
+public class ReferenceTypeImpl implements ReferenceType {
+ private final String name;
+ private final String type;
+ private final URI href;
+ private final String relationship;
+
+ public ReferenceTypeImpl(String name, String type, URI href) {
+ this.name = name;
+ this.type = type;
+ this.href = href;
+ this.relationship = null;
+ }
+
+ public ReferenceTypeImpl(String name, String type, URI href, String relationship) {
+ this.name = name;
+ this.type = type;
+ this.href = href;
+ this.relationship = relationship;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public String getType() {
+ return type;
+ }
+
+ @Override
+ public URI getHref() {
+ return href;
+ }
+
+ @Override
+ public int compareTo(ReferenceType that) {
+ return (this == that) ? 0 : getHref().compareTo(that.getHref());
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ ReferenceTypeImpl that = ReferenceTypeImpl.class.cast(o);
+ return equal(this.href, that.href);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(href);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper("").omitNullValues().add("href", href).add("name", name).add("type", type).add("relationship", relationship);
+ }
+
+ @Override
+ public String getRelationship() {
+ return relationship;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/TaskImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/TaskImpl.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/TaskImpl.java
new file mode 100644
index 0000000..70815a1
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/TaskImpl.java
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.Date;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.TaskStatus;
+import org.jclouds.vcloud.domain.VCloudError;
+
+import com.google.common.base.Objects;
+
+public class TaskImpl extends ReferenceTypeImpl implements Task {
+
+ private final String operation;
+ private final TaskStatus status;
+ private final Date startTime;
+ @Nullable
+ private final Date endTime;
+ @Nullable
+ private final Date expiryTime;
+ private final ReferenceType owner;
+ @Nullable
+ private final VCloudError error;
+
+ public TaskImpl(URI id, String operation, TaskStatus status, Date startTime, @Nullable Date endTime,
+ @Nullable Date expiryTime, ReferenceType owner, VCloudError error) {
+ super(null, VCloudMediaType.TASK_XML, id);
+ this.operation = operation;
+ this.status = checkNotNull(status, "status");
+ this.startTime = startTime;
+ this.endTime = endTime;
+ this.expiryTime = expiryTime;
+ this.owner = owner;
+ this.error = error;
+ }
+
+ @Override
+ public TaskStatus getStatus() {
+ return status;
+ }
+
+ @Override
+ public Date getStartTime() {
+ return startTime;
+ }
+
+ @Override
+ public ReferenceType getOwner() {
+ return owner;
+ }
+
+ @Override
+ public Date getEndTime() {
+ return endTime;
+ }
+
+ @Override
+ public VCloudError getError() {
+ return error;
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("href", getHref()).add("name", getName())
+ .add("owner", owner).add("operation", operation).add("startTime", startTime).add("endTime", endTime)
+ .add("expiryTime", expiryTime).add("error", error).toString();
+ }
+
+ public Date getExpiryTime() {
+ return expiryTime;
+ }
+
+ @Override
+ public String getOperation() {
+ return operation;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((endTime == null) ? 0 : endTime.hashCode());
+ result = prime * result + ((error == null) ? 0 : error.hashCode());
+ result = prime * result + ((expiryTime == null) ? 0 : expiryTime.hashCode());
+ result = prime * result + ((operation == null) ? 0 : operation.hashCode());
+ result = prime * result + ((owner == null) ? 0 : owner.hashCode());
+ result = prime * result + ((startTime == null) ? 0 : startTime.hashCode());
+ result = prime * result + ((status == null) ? 0 : status.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ TaskImpl other = (TaskImpl) obj;
+ if (endTime == null) {
+ if (other.endTime != null)
+ return false;
+ } else if (!endTime.equals(other.endTime))
+ return false;
+ if (error == null) {
+ if (other.error != null)
+ return false;
+ } else if (!error.equals(other.error))
+ return false;
+ if (expiryTime == null) {
+ if (other.expiryTime != null)
+ return false;
+ } else if (!expiryTime.equals(other.expiryTime))
+ return false;
+ if (operation == null) {
+ if (other.operation != null)
+ return false;
+ } else if (!operation.equals(other.operation))
+ return false;
+ if (owner == null) {
+ if (other.owner != null)
+ return false;
+ } else if (!owner.equals(other.owner))
+ return false;
+ if (startTime == null) {
+ if (other.startTime != null)
+ return false;
+ } else if (!startTime.equals(other.startTime))
+ return false;
+ if (status == null) {
+ if (other.status != null)
+ return false;
+ } else if (!status.equals(other.status))
+ return false;
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/TasksListImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/TasksListImpl.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/TasksListImpl.java
new file mode 100644
index 0000000..4c8b2c8
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/TasksListImpl.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.internal;
+
+import java.net.URI;
+import java.util.SortedSet;
+
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.TasksList;
+
+/**
+ * Locations of resources in vCloud
+ */
+public class TasksListImpl implements TasksList {
+ private final SortedSet<Task> tasks;
+ private final URI id;
+
+ public TasksListImpl(URI id, SortedSet<Task> tasks) {
+ this.id = id;
+ this.tasks = tasks;
+ }
+
+ @Override
+ public SortedSet<Task> getTasks() {
+ return tasks;
+ }
+
+ @Override
+ public URI getLocation() {
+ return id;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ result = prime * result + ((tasks == null) ? 0 : tasks.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ TasksListImpl other = (TasksListImpl) obj;
+ if (id == null) {
+ if (other.id != null)
+ return false;
+ } else if (!id.equals(other.id))
+ return false;
+ if (tasks == null) {
+ if (other.tasks != null)
+ return false;
+ } else if (!tasks.equals(other.tasks))
+ return false;
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VAppImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VAppImpl.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VAppImpl.java
new file mode 100644
index 0000000..7b032bc
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VAppImpl.java
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Set;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.ovf.VCloudNetworkSection;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+/**
+ * Locations of resources in vCloud
+ */
+public class VAppImpl extends ReferenceTypeImpl implements VApp {
+
+ private final Status status;
+ private final ReferenceType vdc;
+ @Nullable
+ private final String description;
+ private final List<Task> tasks = Lists.newArrayList();
+ private final boolean ovfDescriptorUploaded;
+ private final Set<Vm> children = Sets.newLinkedHashSet();
+ @Nullable
+ private final VCloudNetworkSection networkSection;
+
+ public VAppImpl(String name, String type, URI id, Status status, ReferenceType vdc, @Nullable String description,
+ Iterable<Task> tasks, boolean ovfDescriptorUploaded, Iterable<Vm> children,
+ @Nullable VCloudNetworkSection networkSection) {
+ super(name, type, id);
+ this.status = checkNotNull(status, "status");
+ this.vdc = vdc;// TODO: once <1.0 is killed check not null
+ this.description = description;
+ Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
+ this.ovfDescriptorUploaded = ovfDescriptorUploaded;
+ Iterables.addAll(this.children, checkNotNull(children, "children"));
+ this.networkSection = networkSection; // can be null when copying
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Status getStatus() {
+ return status;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ReferenceType getVDC() {
+ return vdc;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<Task> getTasks() {
+ return tasks;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isOvfDescriptorUploaded() {
+ return ovfDescriptorUploaded;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<Vm> getChildren() {
+ return children;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public VCloudNetworkSection getNetworkSection() {
+ return networkSection;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((description == null) ? 0 : description.hashCode());
+ result = prime * result + (ovfDescriptorUploaded ? 1231 : 1237);
+ result = prime * result + ((status == null) ? 0 : status.hashCode());
+ result = prime * result + ((tasks == null) ? 0 : tasks.hashCode());
+ result = prime * result + ((vdc == null) ? 0 : vdc.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ VAppImpl other = (VAppImpl) obj;
+ if (description == null) {
+ if (other.description != null)
+ return false;
+ } else if (!description.equals(other.description))
+ return false;
+ if (ovfDescriptorUploaded != other.ovfDescriptorUploaded)
+ return false;
+ if (vdc == null) {
+ if (other.vdc != null)
+ return false;
+ } else if (!vdc.equals(other.vdc))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "[id=" + getHref() + ", name=" + getName() + ", vdc=" + vdc + ", description=" + description + ", status="
+ + status + "]";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VAppTemplateImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VAppTemplateImpl.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VAppTemplateImpl.java
new file mode 100644
index 0000000..fa480c7
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VAppTemplateImpl.java
@@ -0,0 +1,202 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Set;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.ovf.VCloudNetworkSection;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+/**
+ * Locations of resources in vCloud
+ */
+public class VAppTemplateImpl extends ReferenceTypeImpl implements VAppTemplate {
+
+ private final Status status;
+ private final ReferenceType vdc;
+ @Nullable
+ private final String description;
+ private final List<Task> tasks = Lists.newArrayList();
+ private final boolean ovfDescriptorUploaded;
+ private final String vAppScopedLocalId;
+ private final Set<Vm> children = Sets.newLinkedHashSet();
+ @Nullable
+ private final VCloudNetworkSection networkSection;
+
+ public VAppTemplateImpl(String name, String type, URI id, Status status, ReferenceType vdc,
+ @Nullable String description, Iterable<Task> tasks, boolean ovfDescriptorUploaded,
+ @Nullable String vAppScopedLocalId, Iterable<Vm> children,
+ @Nullable VCloudNetworkSection networkSection) {
+ super(name, type, id);
+ this.status = checkNotNull(status, "status");
+ this.vdc = vdc;// TODO: once <1.0 is killed check not null
+ this.description = description;
+ Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
+ this.vAppScopedLocalId = vAppScopedLocalId;
+ this.ovfDescriptorUploaded = ovfDescriptorUploaded;
+ Iterables.addAll(this.children, checkNotNull(children, "children"));
+ this.networkSection = networkSection; // can be null when copying
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Status getStatus() {
+ return status;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ReferenceType getVDC() {
+ return vdc;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<Task> getTasks() {
+ return tasks;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getVAppScopedLocalId() {
+ return vAppScopedLocalId;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isOvfDescriptorUploaded() {
+ return ovfDescriptorUploaded;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<Vm> getChildren() {
+ return children;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public VCloudNetworkSection getNetworkSection() {
+ return networkSection;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((children == null) ? 0 : children.hashCode());
+ result = prime * result + ((description == null) ? 0 : description.hashCode());
+ result = prime * result + ((networkSection == null) ? 0 : networkSection.hashCode());
+ result = prime * result + (ovfDescriptorUploaded ? 1231 : 1237);
+ result = prime * result + ((status == null) ? 0 : status.hashCode());
+ result = prime * result + ((tasks == null) ? 0 : tasks.hashCode());
+ result = prime * result + ((vAppScopedLocalId == null) ? 0 : vAppScopedLocalId.hashCode());
+ result = prime * result + ((vdc == null) ? 0 : vdc.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ VAppTemplateImpl other = (VAppTemplateImpl) obj;
+ if (children == null) {
+ if (other.children != null)
+ return false;
+ } else if (!children.equals(other.children))
+ return false;
+ if (description == null) {
+ if (other.description != null)
+ return false;
+ } else if (!description.equals(other.description))
+ return false;
+ if (networkSection == null) {
+ if (other.networkSection != null)
+ return false;
+ } else if (!networkSection.equals(other.networkSection))
+ return false;
+ if (ovfDescriptorUploaded != other.ovfDescriptorUploaded)
+ return false;
+ if (status == null) {
+ if (other.status != null)
+ return false;
+ } else if (!status.equals(other.status))
+ return false;
+ if (tasks == null) {
+ if (other.tasks != null)
+ return false;
+ } else if (!tasks.equals(other.tasks))
+ return false;
+ if (vAppScopedLocalId == null) {
+ if (other.vAppScopedLocalId != null)
+ return false;
+ } else if (!vAppScopedLocalId.equals(other.vAppScopedLocalId))
+ return false;
+ if (vdc == null) {
+ if (other.vdc != null)
+ return false;
+ } else if (!vdc.equals(other.vdc))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "[id=" + getHref() + ", name=" + getName() + ", vdc=" + vdc + ", description=" + description + ", status="
+ + status + "]";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VDCImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VDCImpl.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VDCImpl.java
new file mode 100644
index 0000000..740df72
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VDCImpl.java
@@ -0,0 +1,289 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.AllocationModel;
+import org.jclouds.vcloud.domain.Capacity;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VDC;
+import org.jclouds.vcloud.domain.VDCStatus;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+/**
+ * Locations of resources in vCloud
+ */
+public class VDCImpl extends ReferenceTypeImpl implements VDC {
+
+ private final VDCStatus status;
+ private final ReferenceType org;
+ @Nullable
+ private final String description;
+ private final List<Task> tasks = Lists.newArrayList();
+ private final AllocationModel allocationModel;
+ private final Capacity storageCapacity;
+ private final Capacity cpuCapacity;
+ private final Capacity memoryCapacity;
+ private final Map<String, ReferenceType> resourceEntities = Maps.newLinkedHashMap();
+ private final Map<String, ReferenceType> availableNetworks = Maps.newLinkedHashMap();
+ private final int nicQuota;
+ private final int networkQuota;
+ private final int vmQuota;
+ private final boolean isEnabled;
+
+ public VDCImpl(String name, String type, URI id, VDCStatus status, ReferenceType org, @Nullable String description,
+ Iterable<Task> tasks, AllocationModel allocationModel, @Nullable Capacity storageCapacity,
+ @Nullable Capacity cpuCapacity, @Nullable Capacity memoryCapacity,
+ Map<String, ReferenceType> resourceEntities, Map<String, ReferenceType> availableNetworks, int nicQuota,
+ int networkQuota, int vmQuota, boolean isEnabled) {
+ super(name, type, id);
+ this.status = checkNotNull(status, "status");
+ this.org = org;// TODO: once <1.0 is killed check not null
+ this.description = description;
+ Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
+ this.allocationModel = checkNotNull(allocationModel, "allocationModel");
+ this.storageCapacity = storageCapacity;// TODO: once <1.0 is killed check not null
+ this.cpuCapacity = cpuCapacity;// TODO: once <1.0 is killed check not null
+ this.memoryCapacity = memoryCapacity;// TODO: once <1.0 is killed check not null
+ this.resourceEntities.putAll(checkNotNull(resourceEntities, "resourceEntities"));
+ this.availableNetworks.putAll(checkNotNull(availableNetworks, "availableNetworks"));
+ this.nicQuota = nicQuota;
+ this.networkQuota = networkQuota;
+ this.vmQuota = vmQuota;
+ this.isEnabled = isEnabled;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public VDCStatus getStatus() {
+ return status;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ReferenceType getOrg() {
+ return org;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<Task> getTasks() {
+ return tasks;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AllocationModel getAllocationModel() {
+ return allocationModel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Capacity getStorageCapacity() {
+ return storageCapacity;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Capacity getCpuCapacity() {
+ return cpuCapacity;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Capacity getMemoryCapacity() {
+ return memoryCapacity;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Map<String, ReferenceType> getResourceEntities() {
+ return resourceEntities;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Map<String, ReferenceType> getAvailableNetworks() {
+ return availableNetworks;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getNicQuota() {
+ return nicQuota;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getNetworkQuota() {
+ return networkQuota;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getVmQuota() {
+ return vmQuota;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isEnabled() {
+ return isEnabled;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((allocationModel == null) ? 0 : allocationModel.hashCode());
+ result = prime * result + ((availableNetworks == null) ? 0 : availableNetworks.hashCode());
+ result = prime * result + ((cpuCapacity == null) ? 0 : cpuCapacity.hashCode());
+ result = prime * result + ((description == null) ? 0 : description.hashCode());
+ result = prime * result + (isEnabled ? 1231 : 1237);
+ result = prime * result + ((memoryCapacity == null) ? 0 : memoryCapacity.hashCode());
+ result = prime * result + networkQuota;
+ result = prime * result + nicQuota;
+ result = prime * result + ((org == null) ? 0 : org.hashCode());
+ result = prime * result + ((resourceEntities == null) ? 0 : resourceEntities.hashCode());
+ result = prime * result + ((status == null) ? 0 : status.hashCode());
+ result = prime * result + ((storageCapacity == null) ? 0 : storageCapacity.hashCode());
+ result = prime * result + ((tasks == null) ? 0 : tasks.hashCode());
+ result = prime * result + vmQuota;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ VDCImpl other = (VDCImpl) obj;
+ if (allocationModel == null) {
+ if (other.allocationModel != null)
+ return false;
+ } else if (!allocationModel.equals(other.allocationModel))
+ return false;
+ if (availableNetworks == null) {
+ if (other.availableNetworks != null)
+ return false;
+ } else if (!availableNetworks.equals(other.availableNetworks))
+ return false;
+ if (cpuCapacity == null) {
+ if (other.cpuCapacity != null)
+ return false;
+ } else if (!cpuCapacity.equals(other.cpuCapacity))
+ return false;
+ if (description == null) {
+ if (other.description != null)
+ return false;
+ } else if (!description.equals(other.description))
+ return false;
+ if (isEnabled != other.isEnabled)
+ return false;
+ if (memoryCapacity == null) {
+ if (other.memoryCapacity != null)
+ return false;
+ } else if (!memoryCapacity.equals(other.memoryCapacity))
+ return false;
+ if (networkQuota != other.networkQuota)
+ return false;
+ if (nicQuota != other.nicQuota)
+ return false;
+ if (org == null) {
+ if (other.org != null)
+ return false;
+ } else if (!org.equals(other.org))
+ return false;
+ if (resourceEntities == null) {
+ if (other.resourceEntities != null)
+ return false;
+ } else if (!resourceEntities.equals(other.resourceEntities))
+ return false;
+ if (status == null) {
+ if (other.status != null)
+ return false;
+ } else if (!status.equals(other.status))
+ return false;
+ if (storageCapacity == null) {
+ if (other.storageCapacity != null)
+ return false;
+ } else if (!storageCapacity.equals(other.storageCapacity))
+ return false;
+ if (tasks == null) {
+ if (other.tasks != null)
+ return false;
+ } else if (!tasks.equals(other.tasks))
+ return false;
+ if (vmQuota != other.vmQuota)
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "[id=" + getHref() + ", name=" + getName() + ", org=" + org + ", description=" + description + ", status="
+ + status + ", isEnabled=" + isEnabled + "]";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VmImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VmImpl.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VmImpl.java
new file mode 100644
index 0000000..a6385c6
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/internal/VmImpl.java
@@ -0,0 +1,214 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.internal;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.List;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.GuestCustomizationSection;
+import org.jclouds.vcloud.domain.NetworkConnectionSection;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.ovf.VCloudOperatingSystemSection;
+import org.jclouds.vcloud.domain.ovf.VCloudVirtualHardwareSection;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
+/**
+ * Locations of resources in vCloud
+ */
+public class VmImpl extends ReferenceTypeImpl implements Vm {
+
+ @Nullable
+ private final Status status;
+ private final ReferenceType vApp;
+ @Nullable
+ private final String description;
+ private final List<Task> tasks = Lists.newArrayList();
+ @Nullable
+ private final VCloudVirtualHardwareSection hardware;
+ private final String vAppScopedLocalId;
+ private final VCloudOperatingSystemSection os;
+ @Nullable
+ private final GuestCustomizationSection guestCustomization;
+ @Nullable
+ private final NetworkConnectionSection networkConnectionSection;
+
+ public VmImpl(String name, String type, URI id, @Nullable Status status, ReferenceType vApp,
+ @Nullable String description, Iterable<Task> tasks, @Nullable VCloudVirtualHardwareSection hardware,
+ @Nullable VCloudOperatingSystemSection os, @Nullable NetworkConnectionSection networkConnectionSection,
+ @Nullable GuestCustomizationSection guestCustomization, @Nullable String vAppScopedLocalId) {
+ super(name, type, id);
+ this.status = status;
+ this.vApp = vApp;// TODO: once <1.0 is killed check not null
+ this.description = description;
+ Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
+ this.hardware = hardware;
+ this.os = os;
+ this.networkConnectionSection = networkConnectionSection;
+ this.guestCustomization = guestCustomization;
+ this.vAppScopedLocalId = vAppScopedLocalId;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @Nullable
+ public Status getStatus() {
+ return status;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ReferenceType getParent() {
+ return vApp;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<Task> getTasks() {
+ return tasks;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public VCloudVirtualHardwareSection getVirtualHardwareSection() {
+ return hardware;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public VCloudOperatingSystemSection getOperatingSystemSection() {
+ return os;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public NetworkConnectionSection getNetworkConnectionSection() {
+ return networkConnectionSection;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public GuestCustomizationSection getGuestCustomizationSection() {
+ return guestCustomization;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getVAppScopedLocalId() {
+ return vAppScopedLocalId;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((description == null) ? 0 : description.hashCode());
+ result = prime * result + ((guestCustomization == null) ? 0 : guestCustomization.hashCode());
+ result = prime * result + ((hardware == null) ? 0 : hardware.hashCode());
+ result = prime * result + ((networkConnectionSection == null) ? 0 : networkConnectionSection.hashCode());
+ result = prime * result + ((os == null) ? 0 : os.hashCode());
+ result = prime * result + ((vApp == null) ? 0 : vApp.hashCode());
+ result = prime * result + ((vAppScopedLocalId == null) ? 0 : vAppScopedLocalId.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ VmImpl other = (VmImpl) obj;
+ if (description == null) {
+ if (other.description != null)
+ return false;
+ } else if (!description.equals(other.description))
+ return false;
+ if (guestCustomization == null) {
+ if (other.guestCustomization != null)
+ return false;
+ } else if (!guestCustomization.equals(other.guestCustomization))
+ return false;
+ if (hardware == null) {
+ if (other.hardware != null)
+ return false;
+ } else if (!hardware.equals(other.hardware))
+ return false;
+ if (networkConnectionSection == null) {
+ if (other.networkConnectionSection != null)
+ return false;
+ } else if (!networkConnectionSection.equals(other.networkConnectionSection))
+ return false;
+ if (os == null) {
+ if (other.os != null)
+ return false;
+ } else if (!os.equals(other.os))
+ return false;
+ if (vApp == null) {
+ if (other.vApp != null)
+ return false;
+ } else if (!vApp.equals(other.vApp))
+ return false;
+ if (vAppScopedLocalId == null) {
+ if (other.vAppScopedLocalId != null)
+ return false;
+ } else if (!vAppScopedLocalId.equals(other.vAppScopedLocalId))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "[href=" + getHref() + ", name=" + getName() + ", type=" + getType() + ", description=" + description
+ + ", status=" + status + ", tasks=" + tasks + ", vApp=" + vApp + ", hardware=" + hardware + ", os=" + os
+ + ", network=" + networkConnectionSection + ", vAppScopedLocalId=" + vAppScopedLocalId + "]";
+ }
+
+}
[09/18] stratos git commit: Jclouds vcloud api 1.8.1 clone with
custom changes
Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/OrgNetworkHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/OrgNetworkHandler.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/OrgNetworkHandler.java
new file mode 100644
index 0000000..521f086
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/OrgNetworkHandler.java
@@ -0,0 +1,322 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.jclouds.util.SaxUtils.equalsOrSuffix;
+import static org.jclouds.vcloud.util.Utils.newReferenceType;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.network.DhcpService;
+import org.jclouds.vcloud.domain.network.Features;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.domain.network.FirewallService;
+import org.jclouds.vcloud.domain.network.IpRange;
+import org.jclouds.vcloud.domain.network.IpScope;
+import org.jclouds.vcloud.domain.network.NatService;
+import org.jclouds.vcloud.domain.network.OrgNetwork;
+import org.jclouds.vcloud.domain.network.firewall.FirewallPolicy;
+import org.jclouds.vcloud.domain.network.firewall.FirewallProtocols;
+import org.jclouds.vcloud.domain.network.firewall.FirewallRule;
+import org.jclouds.vcloud.domain.network.internal.OrgNetworkImpl;
+import org.jclouds.vcloud.domain.network.nat.NatPolicy;
+import org.jclouds.vcloud.domain.network.nat.NatProtocol;
+import org.jclouds.vcloud.domain.network.nat.NatRule;
+import org.jclouds.vcloud.domain.network.nat.NatType;
+import org.jclouds.vcloud.domain.network.nat.rules.MappingMode;
+import org.jclouds.vcloud.domain.network.nat.rules.OneToOneVmRule;
+import org.jclouds.vcloud.domain.network.nat.rules.PortForwardingRule;
+import org.jclouds.vcloud.domain.network.nat.rules.VmRule;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+public class OrgNetworkHandler extends ParseSax.HandlerWithResult<OrgNetwork> {
+
+ protected final TaskHandler taskHandler;
+
+ @Inject
+ public OrgNetworkHandler(TaskHandler taskHandler) {
+ this.taskHandler = taskHandler;
+ }
+
+ protected StringBuilder currentText = new StringBuilder();
+
+ protected ReferenceType network;
+ protected ReferenceType org;
+ protected String orgDescription;
+ protected List<Task> tasks = Lists.newArrayList();
+
+ protected String startAddress;
+ protected String endAddress;
+
+ protected boolean inherited;
+ protected String gateway;
+ protected String netmask;
+ protected String dns1;
+ protected String dns2;
+ protected String dnsSuffix;
+ protected Set<IpRange> ipRanges = Sets.newLinkedHashSet();
+ protected Set<String> allocatedIpAddresses = Sets.newLinkedHashSet();
+
+ protected IpScope ipScope;
+ protected ReferenceType parentNetwork;
+ protected FenceMode fenceMode;
+
+ protected boolean serviceEnabled;
+ protected Integer defaultLeaseTime;
+ protected Integer maxLeaseTime;
+
+ protected DhcpService dhcpService;
+
+ protected boolean inFirewallRule;
+ protected boolean firewallRuleEnabled;
+ protected String firewallRuleDescription;
+ protected FirewallPolicy firewallPolicy;
+
+ protected boolean tcp;
+ protected boolean udp;
+ protected FirewallProtocols protocols;
+ protected int port;
+ protected String destinationIp;
+
+ protected List<FirewallRule> firewallRules = Lists.newArrayList();
+ protected FirewallService firewallService;
+
+ protected NatType natType;
+ protected NatPolicy natPolicy;
+
+ protected MappingMode mappingMode;
+ protected String externalIP;
+ protected String vAppScopedVmId;
+ protected int vmNicId;
+
+ protected int externalPort;
+ protected String internalIP;
+ protected int internalPort;
+ protected NatProtocol natProtocol;
+
+ protected String vAppScopedLocalId;
+
+ protected List<NatRule> natRules = Lists.newArrayList();
+ protected NatService natService;
+
+ protected Features features;
+ protected OrgNetwork.Configuration configuration;
+
+ protected ReferenceType networkPool;
+ protected Set<String> allowedExternalIpAddresses = Sets.newLinkedHashSet();
+
+ public OrgNetwork getResult() {
+ return new OrgNetworkImpl(network.getName(), network.getType(), network.getHref(), org, orgDescription, tasks,
+ configuration, networkPool, allowedExternalIpAddresses);
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (SaxUtils.equalsOrSuffix(qName, "OrgNetwork")) {
+ network = newReferenceType(attributes);
+ } else if (SaxUtils.equalsOrSuffix(qName, "FirewallRule")) {
+ this.inFirewallRule = true;
+ } else if (SaxUtils.equalsOrSuffix(qName, "ParentNetwork")) {
+ parentNetwork = newReferenceType(attributes);
+ } else if (SaxUtils.equalsOrSuffix(qName, "Link") && "up".equals(attributes.get("rel"))) {
+ org = newReferenceType(attributes);
+ } else {
+ taskHandler.startElement(uri, localName, qName, attrs);
+ }
+ String type = attributes.get("type");
+ if (type != null) {
+ if (type.indexOf("networkPool+xml") != -1) {
+ networkPool = newReferenceType(attributes);
+ }
+ }
+ }
+
+ public void endElement(String uri, String name, String qName) {
+ taskHandler.endElement(uri, name, qName);
+ if (SaxUtils.equalsOrSuffix(qName, "Task")) {
+ this.tasks.add(taskHandler.getResult());
+ } else if (SaxUtils.equalsOrSuffix(qName, "Description")) {
+ if (inFirewallRule)
+ firewallRuleDescription = currentOrNull();
+ else
+ orgDescription = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "FenceMode")) {
+ fenceMode = FenceMode.fromValue(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "StartAddress")) {
+ startAddress = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "EndAddress")) {
+ endAddress = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "AllocatedIpAddress")) {
+ allocatedIpAddresses.add(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "IpRange")) {
+ ipRanges.add(new IpRange(startAddress, endAddress));
+ this.startAddress = null;
+ this.endAddress = null;
+ } else if (SaxUtils.equalsOrSuffix(qName, "IsInherited")) {
+ inherited = Boolean.parseBoolean(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "Gateway")) {
+ gateway = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "Netmask")) {
+ netmask = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "Dns1")) {
+ dns1 = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "Dns2")) {
+ dns2 = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "DnsSuffix")) {
+ dnsSuffix = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "IpScope")) {
+ ipScope = new IpScope(inherited, gateway, netmask, dns1, dns2, dnsSuffix, ipRanges, allocatedIpAddresses);
+ this.inherited = false;
+ this.gateway = null;
+ this.netmask = null;
+ this.dns1 = null;
+ this.dns2 = null;
+ this.dnsSuffix = null;
+ this.ipRanges = Sets.newLinkedHashSet();
+ this.allocatedIpAddresses = Sets.newLinkedHashSet();
+ } else if (SaxUtils.equalsOrSuffix(qName, "IsEnabled")) {
+ if (inFirewallRule)
+ firewallRuleEnabled = Boolean.parseBoolean(currentOrNull());
+ else
+ serviceEnabled = Boolean.parseBoolean(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "DefaultLeaseTime")) {
+ defaultLeaseTime = Integer.parseInt(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "MaxLeaseTime")) {
+ maxLeaseTime = Integer.parseInt(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "DhcpService")) {
+ this.dhcpService = new DhcpService(serviceEnabled, defaultLeaseTime, maxLeaseTime, Iterables
+ .getOnlyElement(ipRanges));
+ this.serviceEnabled = false;
+ this.defaultLeaseTime = null;
+ this.maxLeaseTime = null;
+ this.ipRanges = Sets.newLinkedHashSet();
+ } else if (SaxUtils.equalsOrSuffix(qName, "Policy")) {
+ if (inFirewallRule)
+ firewallPolicy = FirewallPolicy.fromValue(currentOrNull());
+ else
+ natPolicy = NatPolicy.fromValue(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "Tcp")) {
+ tcp = Boolean.parseBoolean(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "Udp")) {
+ udp = Boolean.parseBoolean(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "Protocols")) {
+ this.protocols = new FirewallProtocols(tcp, udp);
+ this.tcp = false;
+ this.udp = false;
+ } else if (SaxUtils.equalsOrSuffix(qName, "DestinationIp")) {
+ this.destinationIp = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "FirewallRule")) {
+ this.inFirewallRule = false;
+ this.firewallRules.add(new FirewallRule(firewallRuleEnabled, firewallRuleDescription, firewallPolicy,
+ protocols, port, destinationIp));
+ this.firewallRuleEnabled = false;
+ this.firewallRuleDescription = null;
+ this.firewallPolicy = null;
+ this.protocols = null;
+ this.port = -1;
+ this.destinationIp = null;
+ } else if (SaxUtils.equalsOrSuffix(qName, "FirewallService")) {
+ firewallService = new FirewallService(serviceEnabled, firewallRules);
+ this.serviceEnabled = false;
+ this.firewallRules = Lists.newArrayList();
+ } else if (SaxUtils.equalsOrSuffix(qName, "NatType")) {
+ natType = NatType.fromValue(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "MappingMode")) {
+ mappingMode = MappingMode.fromValue(currentOrNull());
+ } else if (qName.equalsIgnoreCase("ExternalIP")) {
+ externalIP = currentOrNull();
+ } else if (qName.equalsIgnoreCase("VAppScopedVmId")) {
+ vAppScopedVmId = currentOrNull();
+ } else if (qName.equalsIgnoreCase("VAppScopedLocalId")) {
+ vAppScopedLocalId = currentOrNull();
+ } else if (qName.equalsIgnoreCase("vmNicId")) {
+ vmNicId = Integer.parseInt(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "OneToOneVmRule")) {
+ natRules.add(new OneToOneVmRule(mappingMode, externalIP, vAppScopedVmId, vmNicId));
+ this.mappingMode = null;
+ this.externalIP = null;
+ this.vAppScopedVmId = null;
+ this.vmNicId = -1;
+ } else if (qName.equalsIgnoreCase("ExternalPort")) {
+ externalPort = Integer.parseInt(currentOrNull());
+ } else if (qName.equalsIgnoreCase("InternalIP")) {
+ internalIP = currentOrNull();
+ } else if (qName.equalsIgnoreCase("InternalPort")) {
+ internalPort = Integer.parseInt(currentOrNull());
+ } else if (equalsOrSuffix(qName, "Protocol")) {
+ natProtocol = NatProtocol.valueOf(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "PortForwardingRule")) {
+ natRules.add(new PortForwardingRule(externalIP, externalPort, internalIP, internalPort, natProtocol));
+ this.externalIP = null;
+ this.externalPort = -1;
+ this.internalIP = null;
+ this.internalPort = -1;
+ this.natProtocol = null;
+ } else if (SaxUtils.equalsOrSuffix(qName, "VmRule")) {
+ natRules.add(new VmRule(externalIP, externalPort, vAppScopedLocalId, vmNicId, internalPort, natProtocol));
+ this.externalIP = null;
+ this.externalPort = -1;
+ this.vAppScopedLocalId = null;
+ this.vmNicId = -1;
+ this.internalPort = -1;
+ this.natProtocol = null;
+ } else if (SaxUtils.equalsOrSuffix(qName, "NatService")) {
+ this.natService = new NatService(serviceEnabled, natType, natPolicy, natRules);
+ this.serviceEnabled = false;
+ this.natType = null;
+ this.natPolicy = null;
+ this.natRules = Lists.newArrayList();
+ } else if (SaxUtils.equalsOrSuffix(qName, "Features")) {
+ this.features = new Features(dhcpService, firewallService, natService);
+ this.dhcpService = null;
+ this.firewallService = null;
+ this.natService = null;
+ } else if (SaxUtils.equalsOrSuffix(qName, "Configuration")) {
+ configuration = new OrgNetworkImpl.ConfigurationImpl(ipScope, parentNetwork, fenceMode, features);
+ this.ipScope = null;
+ this.parentNetwork = null;
+ this.fenceMode = null;
+ this.features = null;
+ } else if (SaxUtils.equalsOrSuffix(qName, "AllowedExternalIpAddress")) {
+ allowedExternalIpAddresses.add(currentOrNull());
+ }
+ currentText = new StringBuilder();
+ }
+
+ public void characters(char ch[], int start, int length) {
+ currentText.append(ch, start, length);
+ }
+
+ protected String currentOrNull() {
+ String returnVal = currentText.toString().trim();
+ return returnVal.equals("") ? null : returnVal;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/SupportedVersionsHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/SupportedVersionsHandler.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/SupportedVersionsHandler.java
new file mode 100644
index 0000000..3e393ac
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/SupportedVersionsHandler.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import java.net.URI;
+import java.util.SortedMap;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+
+import com.google.common.collect.Maps;
+
+public class SupportedVersionsHandler extends ParseSax.HandlerWithResult<SortedMap<String, URI>> {
+ private StringBuilder currentText = new StringBuilder();
+
+ private SortedMap<String, URI> contents = Maps.newTreeMap();
+ private String version;
+ private URI location;
+
+ public SortedMap<String, URI> getResult() {
+ return contents;
+ }
+
+ public void endElement(String uri, String name, String qName) {
+ if (SaxUtils.equalsOrSuffix(qName, "Version")) {
+ version = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "LoginUrl")) {
+ location = URI.create(currentOrNull());
+ } else if (SaxUtils.equalsOrSuffix(qName, "VersionInfo")) {
+ contents.put(version, location);
+ }
+ currentText = new StringBuilder();
+ }
+
+ public void characters(char ch[], int start, int length) {
+ currentText.append(ch, start, length);
+ }
+
+ protected String currentOrNull() {
+ String returnVal = currentText.toString().trim();
+ return returnVal.equals("") ? null : returnVal;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/TaskHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/TaskHandler.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/TaskHandler.java
new file mode 100644
index 0000000..fd421ab
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/TaskHandler.java
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.jclouds.util.SaxUtils.equalsOrSuffix;
+
+import java.text.ParseException;
+import java.util.Date;
+import java.util.Map;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+
+import org.jclouds.date.DateService;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.logging.Logger;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.TaskStatus;
+import org.jclouds.vcloud.domain.VCloudError;
+import org.jclouds.vcloud.domain.internal.TaskImpl;
+import org.jclouds.vcloud.util.Utils;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class TaskHandler extends ParseSax.HandlerWithResult<Task> {
+ protected final DateService dateService;
+ private String operation;
+ private ReferenceType taskLink;
+ private ReferenceType owner;
+ private TaskStatus status;
+ private Date startTime;
+ private Date endTime;
+ private Date expiryTime;
+ private Task task;
+ private VCloudError error;
+ private boolean inOwner;
+
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ @Inject
+ public TaskHandler(DateService dateService) {
+ this.dateService = dateService;
+ }
+
+ public Task getResult() {
+ return task;
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (equalsOrSuffix(qName, "Task")) {
+ if (attributes.get("href") != null && !inOwner)// queued tasks may not have an
+ // href yet
+ taskLink = Utils.newReferenceType(attributes);
+ status = TaskStatus.fromValue(attributes.get("status"));
+ operation = attributes.get("operation");
+ if (attributes.containsKey("startTime"))
+ startTime = parseDate(attributes.get("startTime"));
+ if (attributes.containsKey("endTime"))
+ endTime = parseDate(attributes.get("endTime"));
+ if (attributes.containsKey("expiryTime"))
+ expiryTime = parseDate(attributes.get("expiryTime"));
+ // TODO technically the old Result object should only be owner for copy and delete tasks
+ } else if (equalsOrSuffix(qName, "Owner") || equalsOrSuffix(qName, "Result")) {
+ owner = Utils.newReferenceType(attributes);
+ } else if (equalsOrSuffix(qName, "Link") && "self".equals(attributes.get("rel"))) {
+ taskLink = Utils.newReferenceType(attributes);
+ } else if (equalsOrSuffix(qName, "Error")) {
+ error = Utils.newError(attributes);
+ }
+ }
+
+ private Date parseDate(String toParse) {
+ try {
+ return dateService.iso8601DateParse(toParse);
+ } catch (RuntimeException e) {
+ if (e.getCause() instanceof ParseException) {
+ if (!toParse.endsWith("Z"))
+ toParse += "Z";
+ return dateService.iso8601SecondsDateParse(toParse);
+ } else {
+ logger.error(e, "error parsing date");
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) {
+ if (equalsOrSuffix(qName, "Task")) {
+ this.task = new TaskImpl(taskLink.getHref(), operation, status, startTime, endTime, expiryTime, owner, error);
+ operation = null;
+ taskLink = null;
+ status = null;
+ startTime = null;
+ endTime = null;
+ owner = null;
+ error = null;
+ } else if (equalsOrSuffix(qName, "Owner")) {
+ inOwner = false;
+ }
+ }
+
+ public void characters(char ch[], int start, int length) {
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/TasksListHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/TasksListHandler.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/TasksListHandler.java
new file mode 100644
index 0000000..47ef461
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/TasksListHandler.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import java.util.Map;
+import java.util.SortedSet;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.TasksList;
+import org.jclouds.vcloud.domain.internal.TasksListImpl;
+import org.jclouds.vcloud.util.Utils;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+import com.google.common.collect.Sets;
+
+public class TasksListHandler extends ParseSax.HandlerWithResult<TasksList> {
+
+ private SortedSet<Task> tasks = Sets.newTreeSet();
+ private final TaskHandler taskHandler;
+ private ReferenceType resource;
+
+ @Inject
+ public TasksListHandler(TaskHandler taskHandler) {
+ this.taskHandler = taskHandler;
+ }
+
+ public TasksList getResult() {
+ return new TasksListImpl(resource.getHref(), tasks);
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (SaxUtils.equalsOrSuffix(qName, "TasksList")) {
+ resource = Utils.newReferenceType(attributes);
+ } else if (SaxUtils.equalsOrSuffix(qName, "Link") && "self".equals(attributes.get("rel"))) {
+ resource = Utils.newReferenceType(attributes);
+ } else {
+ taskHandler.startElement(uri, localName, qName, attrs);
+ }
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ taskHandler.endElement(uri, localName, qName);
+ if (SaxUtils.equalsOrSuffix(qName, "Task")) {
+ this.tasks.add(taskHandler.getResult());
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/VAppHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/VAppHandler.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/VAppHandler.java
new file mode 100644
index 0000000..34ac869
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/VAppHandler.java
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.jclouds.util.SaxUtils.equalsOrSuffix;
+import static org.jclouds.vcloud.util.Utils.newReferenceType;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.internal.VAppImpl;
+import org.jclouds.vcloud.domain.ovf.VCloudNetworkSection;
+import org.jclouds.vcloud.xml.ovf.VCloudNetworkSectionHandler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+public class VAppHandler extends ParseSax.HandlerWithResult<VApp> {
+
+ protected final TaskHandler taskHandler;
+ protected final VmHandler vmHandler;
+ protected final VCloudNetworkSectionHandler networkSectionHandler;
+
+ @Inject
+ public VAppHandler(TaskHandler taskHandler, VmHandler vmHandler,
+ VCloudNetworkSectionHandler networkSectionHandler) {
+ this.taskHandler = taskHandler;
+ this.vmHandler = vmHandler;
+ this.networkSectionHandler = networkSectionHandler;
+ }
+
+ protected StringBuilder currentText = new StringBuilder();
+
+ protected ReferenceType template;
+ protected Status status;
+ protected ReferenceType vdc;
+ protected String description;
+ protected List<Task> tasks = Lists.newArrayList();
+ protected boolean ovfDescriptorUploaded = true;
+
+ private boolean inChildren;
+ private boolean inTasks;
+ private boolean inNetworkSection;
+ protected Set<Vm> children = Sets.newLinkedHashSet();
+ private VCloudNetworkSection networkSection;
+
+ public VApp getResult() {
+ return new VAppImpl(template.getName(), template.getType(), template.getHref(), status, vdc, description, tasks,
+ ovfDescriptorUploaded, children, networkSection);
+ }
+
+ protected int depth = 0;
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ depth++;
+ if (depth == 2) {
+ if (equalsOrSuffix(qName, "Children")) {
+ inChildren = true;
+ } else if (equalsOrSuffix(qName, "Tasks")) {
+ inTasks = true;
+ } else if (equalsOrSuffix(qName, "NetworkSection")) {
+ inNetworkSection = true;
+ }
+ }
+ if (inChildren) {
+ vmHandler.startElement(uri, localName, qName, attrs);
+ } else if (inTasks) {
+ taskHandler.startElement(uri, localName, qName, attrs);
+ } else if (inNetworkSection) {
+ networkSectionHandler.startElement(uri, localName, qName, attrs);
+ } else if (equalsOrSuffix(qName, "VApp")) {
+ template = newReferenceType(attributes);
+ if (attributes.containsKey("status"))
+ this.status = Status.fromValue(Integer.parseInt(attributes.get("status")));
+ } else if (equalsOrSuffix(qName, "Link") && "up".equals(attributes.get("rel"))) {
+ vdc = newReferenceType(attributes);
+ }
+
+ }
+
+ public void endElement(String uri, String name, String qName) {
+ depth--;
+ if (depth == 1) {
+ if (equalsOrSuffix(qName, "Children")) {
+ inChildren = false;
+ this.children.add(vmHandler.getResult());
+ } else if (equalsOrSuffix(qName, "Tasks")) {
+ inTasks = false;
+ this.tasks.add(taskHandler.getResult());
+ } else if (equalsOrSuffix(qName, "Description")) {
+ description = SaxUtils.currentOrNull(currentText);
+ } else if (equalsOrSuffix(qName, "NetworkSection")) {
+ inNetworkSection = false;
+ this.networkSection = networkSectionHandler.getResult();
+ }
+ }
+ if (inChildren) {
+ vmHandler.endElement(uri, name, qName);
+ } else if (inTasks) {
+ taskHandler.endElement(uri, name, qName);
+ } else if (inNetworkSection) {
+ networkSectionHandler.endElement(uri, name, qName);
+ } else if (equalsOrSuffix(qName, "ovfDescriptorUploaded")) {
+ ovfDescriptorUploaded = Boolean.parseBoolean(SaxUtils.currentOrNull(currentText));
+ }
+ currentText = new StringBuilder();
+ }
+
+ public void characters(char ch[], int start, int length) {
+ if (inTasks)
+ taskHandler.characters(ch, start, length);
+ else if (inChildren)
+ vmHandler.characters(ch, start, length);
+ else if (inNetworkSection)
+ networkSectionHandler.characters(ch, start, length);
+ else
+ currentText.append(ch, start, length);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/VAppTemplateHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/VAppTemplateHandler.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/VAppTemplateHandler.java
new file mode 100644
index 0000000..2476c16
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/VAppTemplateHandler.java
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.jclouds.util.SaxUtils.equalsOrSuffix;
+import static org.jclouds.vcloud.util.Utils.newReferenceType;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.internal.VAppTemplateImpl;
+import org.jclouds.vcloud.domain.ovf.VCloudNetworkSection;
+import org.jclouds.vcloud.xml.ovf.VCloudNetworkSectionHandler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+public class VAppTemplateHandler extends ParseSax.HandlerWithResult<VAppTemplate> {
+
+ protected final TaskHandler taskHandler;
+ protected final VmHandler vmHandler;
+ protected final VCloudNetworkSectionHandler networkSectionHandler;
+
+ @Inject
+ public VAppTemplateHandler(TaskHandler taskHandler, VmHandler vmHandler,
+ VCloudNetworkSectionHandler networkSectionHandler) {
+ this.taskHandler = taskHandler;
+ this.vmHandler = vmHandler;
+ this.networkSectionHandler = networkSectionHandler;
+ }
+
+ protected StringBuilder currentText = new StringBuilder();
+
+ protected ReferenceType template;
+ protected Status status;
+ protected ReferenceType vdc;
+ protected String description;
+ protected List<Task> tasks = Lists.newArrayList();
+ protected boolean ovfDescriptorUploaded = true;
+ protected String vAppScopedLocalId;
+
+ private boolean inChildren;
+ private boolean inTasks;
+ private boolean inNetworkSection;
+ protected Set<Vm> children = Sets.newLinkedHashSet();
+ private VCloudNetworkSection networkSection;
+
+ public VAppTemplate getResult() {
+ return new VAppTemplateImpl(template.getName(), template.getType(), template.getHref(), status, vdc, description,
+ tasks, ovfDescriptorUploaded, vAppScopedLocalId, children, networkSection);
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (equalsOrSuffix(qName, "Children")) {
+ inChildren = true;
+ } else if (equalsOrSuffix(qName, "Tasks")) {
+ inTasks = true;
+ } else if (equalsOrSuffix(qName, "NetworkSection")) {
+ inNetworkSection = true;
+ }
+ if (inChildren) {
+ vmHandler.startElement(uri, localName, qName, attrs);
+ } else if (inTasks) {
+ taskHandler.startElement(uri, localName, qName, attrs);
+ } else if (inNetworkSection) {
+ networkSectionHandler.startElement(uri, localName, qName, attrs);
+ } else if (equalsOrSuffix(qName, "VAppTemplate")) {
+ template = newReferenceType(attributes);
+ if (attributes.containsKey("status"))
+ this.status = Status.fromValue(Integer.parseInt(attributes.get("status")));
+ } else if (equalsOrSuffix(qName, "Link") && "up".equals(attributes.get("rel"))) {
+ vdc = newReferenceType(attributes);
+ }
+
+ }
+
+ public void endElement(String uri, String name, String qName) {
+ if (equalsOrSuffix(qName, "Children")) {
+ inChildren = false;
+ Vm vm = vmHandler.getResult();
+ if (vm != null)
+ this.children.add(vmHandler.getResult());
+ } else if (equalsOrSuffix(qName, "Tasks")) {
+ inTasks = false;
+ this.tasks.add(taskHandler.getResult());
+ } else if (equalsOrSuffix(qName, "NetworkSection")) {
+ inNetworkSection = false;
+ this.networkSection = networkSectionHandler.getResult();
+ }
+ if (inChildren) {
+ vmHandler.endElement(uri, name, qName);
+ } else if (inTasks) {
+ taskHandler.endElement(uri, name, qName);
+ } else if (inNetworkSection) {
+ networkSectionHandler.endElement(uri, name, qName);
+ } else if (equalsOrSuffix(qName, "Description")) {
+ description = currentOrNull();
+ } else if (equalsOrSuffix(qName, "VAppScopedLocalId")) {
+ vAppScopedLocalId = currentOrNull();
+ } else if (equalsOrSuffix(qName, "ovfDescriptorUploaded")) {
+ ovfDescriptorUploaded = Boolean.parseBoolean(currentOrNull());
+ }
+ currentText = new StringBuilder();
+ }
+
+ public void characters(char ch[], int start, int length) {
+ if (inTasks)
+ taskHandler.characters(ch, start, length);
+ else if (inChildren)
+ vmHandler.characters(ch, start, length);
+ else if (inNetworkSection)
+ networkSectionHandler.characters(ch, start, length);
+ else
+ currentText.append(ch, start, length);
+ }
+
+ protected String currentOrNull() {
+ String returnVal = currentText.toString().trim();
+ return returnVal.equals("") ? null : returnVal;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/VCloudVirtualHardwareHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/VCloudVirtualHardwareHandler.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/VCloudVirtualHardwareHandler.java
new file mode 100644
index 0000000..cf6f6e5
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/VCloudVirtualHardwareHandler.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.jclouds.vcloud.util.Utils.newReferenceType;
+
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.ovf.VirtualHardwareSection;
+import org.jclouds.ovf.xml.VirtualHardwareSectionHandler;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.ovf.VCloudVirtualHardwareSection;
+import org.xml.sax.Attributes;
+
+public class VCloudVirtualHardwareHandler extends ParseSax.HandlerWithResult<VCloudVirtualHardwareSection> {
+
+ private final VirtualHardwareSectionHandler hardwareHandler;
+
+ private ReferenceType hardware;
+
+ @Inject
+ public VCloudVirtualHardwareHandler(VirtualHardwareSectionHandler hardwareHandler) {
+ this.hardwareHandler = hardwareHandler;
+ }
+
+ public VCloudVirtualHardwareSection getResult() {
+ VirtualHardwareSection hardware = hardwareHandler.getResult();
+ return new VCloudVirtualHardwareSection(this.hardware.getType(), this.hardware.getHref(), hardware.getInfo(), hardware
+ .getTransports(), hardware.getSystem(), hardware.getItems());
+ }
+
+ public void startElement(String uri, String localName, String qName, Attributes attrs) {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (qName.endsWith("VirtualHardwareSection")) {
+ hardware = newReferenceType(attributes);
+ }
+ hardwareHandler.startElement(uri, localName, qName, attrs);
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) {
+ hardwareHandler.endElement(uri, localName, qName);
+
+ }
+
+ @Override
+ public void characters(char ch[], int start, int length) {
+ hardwareHandler.characters(ch, start, length);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/VDCHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/VDCHandler.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/VDCHandler.java
new file mode 100644
index 0000000..a7670be
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/VDCHandler.java
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.jclouds.vcloud.util.Utils.newReferenceType;
+import static org.jclouds.vcloud.util.Utils.putReferenceType;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.AllocationModel;
+import org.jclouds.vcloud.domain.Capacity;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VDC;
+import org.jclouds.vcloud.domain.VDCStatus;
+import org.jclouds.vcloud.domain.internal.VDCImpl;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+public class VDCHandler extends ParseSax.HandlerWithResult<VDC> {
+
+ protected final TaskHandler taskHandler;
+
+ @Inject
+ public VDCHandler(TaskHandler taskHandler) {
+ this.taskHandler = taskHandler;
+ }
+
+ protected StringBuilder currentText = new StringBuilder();
+
+ protected ReferenceType vDC;
+ protected VDCStatus status = VDCStatus.READY;
+ protected ReferenceType org;
+ protected String description;
+ protected List<Task> tasks = Lists.newArrayList();
+ protected AllocationModel allocationModel = AllocationModel.UNRECOGNIZED;
+
+ protected Capacity storageCapacity;
+ protected Capacity cpuCapacity;
+ protected Capacity memoryCapacity;
+
+ protected String units;
+ protected long allocated = 0;
+ protected long limit = 0;
+ protected int used = 0;
+ protected long overhead = 0;
+
+ protected Map<String, ReferenceType> resourceEntities = Maps.newLinkedHashMap();
+ protected Map<String, ReferenceType> availableNetworks = Maps.newLinkedHashMap();
+
+ protected int nicQuota;
+ protected int networkQuota;
+ protected int vmQuota;
+ protected boolean isEnabled = true;
+
+ public VDC getResult() {
+ return new VDCImpl(vDC.getName(), vDC.getType(), vDC.getHref(), status, org, description, tasks, allocationModel,
+ storageCapacity, cpuCapacity, memoryCapacity, resourceEntities, availableNetworks, nicQuota,
+ networkQuota, vmQuota, isEnabled);
+ }
+
+ void resetCapacity() {
+ units = null;
+ allocated = 0;
+ limit = 0;
+ used = 0;
+ overhead = 0;
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (qName.endsWith("Vdc")) {
+ vDC = newReferenceType(attributes);
+ String status = attributes.get("status");
+ if (status != null)
+ this.status = VDCStatus.fromValue(Integer.parseInt(status));
+ } else if (qName.endsWith("Network")) {
+ putReferenceType(availableNetworks, attributes);
+ } else if (qName.endsWith("ResourceEntity")) {
+ putReferenceType(resourceEntities, attributes);
+ } else if (qName.endsWith("Link") && "up".equals(attributes.get("rel"))) {
+ org = newReferenceType(attributes);
+ } else {
+ taskHandler.startElement(uri, localName, qName, attrs);
+ }
+
+ }
+
+ public void endElement(String uri, String name, String qName) {
+ taskHandler.endElement(uri, name, qName);
+ if (qName.endsWith("Task")) {
+ this.tasks.add(taskHandler.getResult());
+ } else if (qName.endsWith("Description")) {
+ description = currentOrNull();
+ } else if (qName.endsWith("AllocationModel")) {
+ allocationModel = AllocationModel.fromValue(currentOrNull());
+ } else if (qName.endsWith("Units")) {
+ units = currentOrNull();
+ } else if (qName.endsWith("Allocated")) {
+ allocated = Integer.parseInt(currentOrNull());
+ } else if (qName.endsWith("Used")) {
+ used = Integer.parseInt(currentOrNull());
+ } else if (qName.endsWith("Limit")) {
+ limit = Integer.parseInt(currentOrNull());
+ } else if (qName.endsWith("Overhead")) {
+ overhead = Integer.parseInt(currentOrNull());
+ } else if (qName.endsWith("StorageCapacity")) {
+ storageCapacity = new Capacity(units, allocated, limit, used, overhead);
+ resetCapacity();
+ } else if (qName.endsWith("Cpu")) {
+ cpuCapacity = new Capacity(units, allocated, limit, used, overhead);
+ resetCapacity();
+ } else if (qName.endsWith("Memory")) {
+ memoryCapacity = new Capacity(units, allocated, limit, used, overhead);
+ resetCapacity();
+ } else if (qName.endsWith("DeployedVmsQuota")) {
+ vmQuota = (int) limit;
+ // vcloud express doesn't have the zero is unlimited rule
+ if (vmQuota == -1)
+ vmQuota = 0;
+ } else if (qName.endsWith("VmQuota")) {
+ vmQuota = Integer.parseInt(currentOrNull());
+ } else if (qName.endsWith("NicQuota")) {
+ nicQuota = Integer.parseInt(currentOrNull());
+ } else if (qName.endsWith("NetworkQuota")) {
+ networkQuota = Integer.parseInt(currentOrNull());
+ } else if (qName.endsWith("IsEnabled")) {
+ isEnabled = Boolean.parseBoolean(currentOrNull());
+ }
+ currentText = new StringBuilder();
+ }
+
+ public void characters(char ch[], int start, int length) {
+ currentText.append(ch, start, length);
+ }
+
+ protected String currentOrNull() {
+ String returnVal = currentText.toString().trim();
+ return returnVal.equals("") ? null : returnVal;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/VmHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/VmHandler.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/VmHandler.java
new file mode 100644
index 0000000..dd04477
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/VmHandler.java
@@ -0,0 +1,175 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.jclouds.vcloud.util.Utils.newReferenceType;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.GuestCustomizationSection;
+import org.jclouds.vcloud.domain.NetworkConnectionSection;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.internal.VmImpl;
+import org.jclouds.vcloud.domain.ovf.VCloudOperatingSystemSection;
+import org.jclouds.vcloud.domain.ovf.VCloudVirtualHardwareSection;
+import org.jclouds.vcloud.xml.ovf.VCloudOperatingSystemHandler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+import com.google.common.collect.Lists;
+
+public class VmHandler extends ParseSax.HandlerWithResult<Vm> {
+
+ protected final TaskHandler taskHandler;
+ protected final VCloudVirtualHardwareHandler virtualHardwareHandler;
+ protected final VCloudOperatingSystemHandler operatingSystemHandler;
+ protected final GuestCustomizationSectionHandler guestCustomizationHandler;
+ protected final NetworkConnectionSectionHandler networkConnectionSectionHandler;
+
+ @Inject
+ public VmHandler(TaskHandler taskHandler, VCloudVirtualHardwareHandler virtualHardwareHandler,
+ VCloudOperatingSystemHandler operatingSystemHandler,
+ NetworkConnectionSectionHandler networkConnectionSectionHandler,
+ GuestCustomizationSectionHandler guestCustomizationHandler) {
+ this.taskHandler = taskHandler;
+ this.virtualHardwareHandler = virtualHardwareHandler;
+ this.operatingSystemHandler = operatingSystemHandler;
+ this.networkConnectionSectionHandler = networkConnectionSectionHandler;
+ this.guestCustomizationHandler = guestCustomizationHandler;
+ }
+
+ protected StringBuilder currentText = new StringBuilder();
+
+ protected ReferenceType vm;
+ protected Status status;
+ protected ReferenceType vdc;
+ protected String description;
+ protected List<Task> tasks = Lists.newArrayList();
+ protected VCloudVirtualHardwareSection hardware;
+ protected VCloudOperatingSystemSection os;
+ protected NetworkConnectionSection networkConnectionSection;
+ protected GuestCustomizationSection guestCustomization;
+ protected String vAppScopedLocalId;
+
+ private boolean inTasks;
+ private boolean inHardware;
+ private boolean inOs;
+ private boolean inNetworkConnectionSection;
+ private boolean inGuestCustomization;
+
+ public Vm getResult() {
+ return vm == null ? null : new VmImpl(vm.getName(), vm.getType(), vm.getHref(), status, vdc, description, tasks,
+ hardware, os, networkConnectionSection, guestCustomization, vAppScopedLocalId);
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (qName.endsWith("VirtualHardwareSection")) {
+ inHardware = true;
+ } else if (qName.endsWith("OperatingSystemSection")) {
+ inOs = true;
+ } else if (qName.endsWith("GuestCustomizationSection")) {
+ inGuestCustomization = true;
+ } else if (qName.endsWith("NetworkConnectionSection")) {
+ inNetworkConnectionSection = true;
+ } else if (qName.endsWith("Tasks")) {
+ inTasks = true;
+ }
+ if (inHardware) {
+ virtualHardwareHandler.startElement(uri, localName, qName, attrs);
+ } else if (inOs) {
+ operatingSystemHandler.startElement(uri, localName, qName, attrs);
+ } else if (inNetworkConnectionSection) {
+ networkConnectionSectionHandler.startElement(uri, localName, qName, attrs);
+ } else if (inGuestCustomization) {
+ guestCustomizationHandler.startElement(uri, localName, qName, attrs);
+ } else if (inTasks) {
+ taskHandler.startElement(uri, localName, qName, attrs);
+ } else if (SaxUtils.equalsOrSuffix(qName, "Vm")) {
+ vm = newReferenceType(attributes);
+ String status = attributes.get("status");
+ if (status != null)
+ this.status = Status.fromValue(Integer.parseInt(status));
+ } else if (SaxUtils.equalsOrSuffix(qName, "Link") && "up".equals(attributes.get("rel"))) {
+ vdc = newReferenceType(attributes);
+ }
+ }
+
+ public void endElement(String uri, String name, String qName) {
+ if (qName.endsWith("VirtualHardwareSection")) {
+ inHardware = false;
+ this.hardware = virtualHardwareHandler.getResult();
+ } else if (qName.endsWith("OperatingSystemSection")) {
+ inOs = false;
+ os = operatingSystemHandler.getResult();
+ } else if (qName.endsWith("NetworkConnectionSection")) {
+ inNetworkConnectionSection = false;
+ networkConnectionSection = networkConnectionSectionHandler.getResult();
+ } else if (qName.endsWith("GuestCustomizationSection")) {
+ inGuestCustomization = false;
+ guestCustomization = guestCustomizationHandler.getResult();
+ } else if (qName.endsWith("Tasks")) {
+ inTasks = false;
+ this.tasks.add(taskHandler.getResult());
+ }
+ if (inHardware) {
+ virtualHardwareHandler.endElement(uri, name, qName);
+ } else if (inOs) {
+ operatingSystemHandler.endElement(uri, name, qName);
+ } else if (inGuestCustomization) {
+ guestCustomizationHandler.endElement(uri, name, qName);
+ } else if (inNetworkConnectionSection) {
+ networkConnectionSectionHandler.endElement(uri, name, qName);
+ } else if (inTasks) {
+ taskHandler.endElement(uri, name, qName);
+ } else if (SaxUtils.equalsOrSuffix(qName, "Description")) {
+ description = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "VAppScopedLocalId")) {
+ vAppScopedLocalId = currentOrNull();
+ }
+ currentText = new StringBuilder();
+ }
+
+ public void characters(char ch[], int start, int length) {
+ if (inHardware)
+ virtualHardwareHandler.characters(ch, start, length);
+ else if (inOs)
+ operatingSystemHandler.characters(ch, start, length);
+ else if (inGuestCustomization)
+ guestCustomizationHandler.characters(ch, start, length);
+ else if (inNetworkConnectionSection)
+ networkConnectionSectionHandler.characters(ch, start, length);
+ else if (inTasks)
+ taskHandler.characters(ch, start, length);
+ else
+ currentText.append(ch, start, length);
+ }
+
+ protected String currentOrNull() {
+ String returnVal = currentText.toString().trim();
+ return returnVal.equals("") ? null : returnVal;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudNetworkSectionHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudNetworkSectionHandler.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudNetworkSectionHandler.java
new file mode 100644
index 0000000..39013bf
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudNetworkSectionHandler.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml.ovf;
+
+import static org.jclouds.util.SaxUtils.equalsOrSuffix;
+
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.ovf.NetworkSection;
+import org.jclouds.ovf.xml.NetworkSectionHandler;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.ovf.VCloudNetworkSection;
+import org.jclouds.vcloud.util.Utils;
+import org.xml.sax.Attributes;
+
+public class VCloudNetworkSectionHandler extends ParseSax.HandlerWithResult<VCloudNetworkSection> {
+ private final NetworkSectionHandler networkSectionHandler;
+
+ @Inject
+ VCloudNetworkSectionHandler(NetworkSectionHandler networkSectionHandler) {
+ this.networkSectionHandler = networkSectionHandler;
+ }
+
+ private ReferenceType net;
+
+ public VCloudNetworkSection getResult() {
+ NetworkSection system = networkSectionHandler.getResult();
+ return new VCloudNetworkSection(net.getType(), net.getHref(), system.getInfo(), system.getNetworks());
+ }
+
+ public void startElement(String uri, String localName, String qName, Attributes attrs) {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (equalsOrSuffix(qName, "NetworkSection")) {
+ this.net = Utils.newReferenceType(attributes);
+ }
+ networkSectionHandler.startElement(uri, localName, qName, attrs);
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) {
+ networkSectionHandler.endElement(uri, localName, qName);
+ }
+
+ public void characters(char ch[], int start, int length) {
+ networkSectionHandler.characters(ch, start, length);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudOperatingSystemHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudOperatingSystemHandler.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudOperatingSystemHandler.java
new file mode 100644
index 0000000..058e76a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudOperatingSystemHandler.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml.ovf;
+
+import static org.jclouds.vcloud.util.Utils.newReferenceType;
+
+import java.util.Map;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.ovf.VCloudOperatingSystemSection;
+import org.jclouds.vcloud.util.Utils;
+import org.xml.sax.Attributes;
+
+public class VCloudOperatingSystemHandler extends ParseSax.HandlerWithResult<VCloudOperatingSystemSection> {
+ private StringBuilder currentText = new StringBuilder();
+
+ protected ReferenceType os;
+ protected Integer id;
+ protected String info;
+ protected String vmwOsType;
+ protected String description;
+ protected ReferenceType edit;
+
+ public VCloudOperatingSystemSection getResult() {
+ VCloudOperatingSystemSection system = new VCloudOperatingSystemSection(id, info, description, os.getType(), os.getHref(),
+ vmwOsType, edit);
+ os = null;
+ id = null;
+ info = null;
+ vmwOsType = null;
+ description = null;
+ edit = null;
+ return system;
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (qName.endsWith("Link")) {
+ this.edit = Utils.newReferenceType(attributes);
+ } else if (qName.endsWith("OperatingSystemSection")) {
+ os = newReferenceType(attributes);
+ vmwOsType = attributes.get("osType");
+ if (attributes.containsKey("id"))
+ this.id = Integer.parseInt(attributes.get("id"));
+ }
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) {
+ if (qName.endsWith("Info")) {
+ this.info = currentText.toString().trim();
+ } else if (qName.endsWith("Description")) {
+ this.description = currentText.toString().trim();
+ }
+ currentText = new StringBuilder();
+ }
+
+ public void characters(char ch[], int start, int length) {
+ currentText.append(ch, start, length);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudResourceAllocationSettingDataHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudResourceAllocationSettingDataHandler.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudResourceAllocationSettingDataHandler.java
new file mode 100644
index 0000000..b576c1f
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudResourceAllocationSettingDataHandler.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml.ovf;
+
+import java.util.Map;
+
+import org.jclouds.cim.ResourceAllocationSettingData;
+import org.jclouds.cim.xml.ResourceAllocationSettingDataHandler;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.ovf.EditableResourceAllocationSettingData;
+import org.jclouds.vcloud.domain.ovf.VCloudHardDisk;
+import org.jclouds.vcloud.domain.ovf.VCloudNetworkAdapter;
+import org.jclouds.vcloud.util.Utils;
+import org.xml.sax.Attributes;
+
+public class VCloudResourceAllocationSettingDataHandler extends ResourceAllocationSettingDataHandler {
+
+ private ReferenceType edit;
+
+ private long capacity;
+ private int busType;
+ private String busSubType;
+
+ private String ipAddress;
+ private boolean primaryNetworkConnection;
+ private String ipAddressingMode;
+
+ public ResourceAllocationSettingData getResult() {
+ try {
+ ResourceAllocationSettingData from = super.getResult();
+ if (edit != null) {
+ return EditableResourceAllocationSettingData.builder().fromResourceAllocationSettingData(from).edit(edit)
+ .build();
+ } else if (busSubType != null) {
+ return VCloudHardDisk.builder().fromResourceAllocationSettingData(from).capacity(capacity).busType(busType)
+ .busSubType(busSubType).build();
+ } else if (ipAddress != null) {
+ return VCloudNetworkAdapter.builder().fromResourceAllocationSettingData(from).ipAddress(ipAddress)
+ .primaryNetworkConnection(primaryNetworkConnection).ipAddressingMode(ipAddressingMode).build();
+ } else {
+ return from;
+ }
+ } finally {
+ ipAddress = null;
+ primaryNetworkConnection = false;
+ ipAddressingMode = null;
+ capacity = -1;
+ busType = -1;
+ busSubType = null;
+ edit = null;
+ }
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (qName.endsWith("Link")) {
+ this.edit = Utils.newReferenceType(attributes);
+ } else if (qName.endsWith("HostResource") && attributes.size() > 0) {
+ capacity = Long.parseLong(attributes.get("capacity"));
+ busType = Integer.parseInt(attributes.get("busType"));
+ busSubType = attributes.get("busSubType");
+ } else if (qName.endsWith("Connection") && attributes.size() > 0) {
+ ipAddress = attributes.get("ipAddress");
+ primaryNetworkConnection = Boolean.parseBoolean(attributes.get("primaryNetworkConnection"));
+ ipAddressingMode = attributes.get("ipAddressingMode");
+ }
+ super.startElement(uri, localName, qName, attrs);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
new file mode 100644
index 0000000..d800a94
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
@@ -0,0 +1 @@
+org.jclouds.vcloud.VCloudApiMetadata
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/VCloudApiMetadataTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/VCloudApiMetadataTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/VCloudApiMetadataTest.java
new file mode 100644
index 0000000..8e3f826
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/VCloudApiMetadataTest.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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;
+
+import org.jclouds.compute.internal.BaseComputeServiceApiMetadataTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "VCloudApiMetadataTest")
+public class VCloudApiMetadataTest extends BaseComputeServiceApiMetadataTest {
+
+ public VCloudApiMetadataTest() {
+ super(new VCloudApiMetadata());
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/VCloudApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/VCloudApiTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/VCloudApiTest.java
new file mode 100644
index 0000000..049b3d9
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/VCloudApiTest.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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;
+
+import java.io.IOException;
+import java.util.concurrent.ExecutionException;
+
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.utils.TestUtils;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * Tests behavior of {@code VCloudApi}
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "VCloudApiTest")
+public class VCloudApiTest extends BaseVCloudApiTest<VCloudApi> {
+
+ private VCloudApi syncClient;
+
+ public void testSync() throws SecurityException, NoSuchMethodException, InterruptedException, ExecutionException {
+ assert syncClient.getVAppApi() != null;
+ assert syncClient.getCatalogApi() != null;
+ assert syncClient.getVmApi() != null;
+ assert syncClient.getVAppTemplateApi() != null;
+ assert syncClient.getTaskApi() != null;
+ assert syncClient.getVDCApi() != null;
+ assert syncClient.getNetworkApi() != null;
+ assert syncClient.getOrgApi() != null;
+ }
+
+ @BeforeClass
+ @Override
+ protected void setupFactory() throws IOException {
+ super.setupFactory();
+ syncClient = injector.getInstance(VCloudApi.class);
+ }
+
+ @DataProvider
+ public Object[][] ignoreOnWindows() {
+ return TestUtils.isWindowsOs() ? TestUtils.NO_INVOCATIONS
+ : TestUtils.SINGLE_NO_ARG_INVOCATION;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/VCloudSessionRefreshLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/VCloudSessionRefreshLiveTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/VCloudSessionRefreshLiveTest.java
new file mode 100644
index 0000000..dcd3e8e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/VCloudSessionRefreshLiveTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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;
+
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.testng.annotations.Test;
+
+/**
+ * Tests session refresh works
+ */
+@Test(groups = "live", singleThreaded = true)
+public class VCloudSessionRefreshLiveTest extends BaseVCloudApiLiveTest {
+
+ private static final int timeOut = 40;
+
+ @Test
+ public void testSessionRefresh() throws Exception {
+ VCloudApi connection = view.unwrapApi(VCloudApi.class);
+
+ connection.getOrgApi().findOrgNamed(null);
+ Thread.sleep(timeOut * 1000);
+ connection.getOrgApi().findOrgNamed(null);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/VCloudVersionsApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/VCloudVersionsApiTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/VCloudVersionsApiTest.java
new file mode 100644
index 0000000..37ae52b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/VCloudVersionsApiTest.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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;
+
+import static org.jclouds.reflect.Reflection2.method;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.providers.AnonymousProviderMetadata;
+import org.jclouds.providers.ProviderMetadata;
+import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.xml.SupportedVersionsHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+
+/**
+ * Tests behavior of {@code VCloudVersionsApi}
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "VCloudVersionsApiTest")
+public class VCloudVersionsApiTest extends BaseRestAnnotationProcessingTest<VCloudVersionsApi> {
+
+ public void testVersions() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VCloudVersionsApi.class, "getSupportedVersions");
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
+
+ assertEquals(request.getRequestLine(), "GET http://localhost:8080/versions HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, SupportedVersionsHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ @Override
+ protected void checkFilters(HttpRequest request) {
+ assertEquals(request.getFilters().size(), 1);
+ }
+
+ @Override
+ protected ProviderMetadata createProviderMetadata() {
+ return AnonymousProviderMetadata.forApiOnEndpoint(VCloudVersionsApi.class,
+ "http://localhost:8080");
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCatalogItemToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCatalogItemToXmlPayloadTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCatalogItemToXmlPayloadTest.java
new file mode 100644
index 0000000..599f4a1
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCatalogItemToXmlPayloadTest.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BasePayloadTest;
+import org.jclouds.vcloud.options.CatalogItemOptions;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * Tests behavior of {@code BindCatalogItemToXmlPayload}
+ */
+@Test(groups = "unit")
+public class BindCatalogItemToXmlPayloadTest extends BasePayloadTest {
+
+ public void testDefault() throws IOException {
+ String expected = "<CatalogItem xmlns=\"http://www.vmware.com/vcloud/v1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" name=\"myname\" xsi:schemaLocation=\"http://www.vmware.com/vcloud/v1 http://vcloud.safesecureweb.com/ns/vcloud.xsd\"><Description>mydescription</Description><Entity href=\"http://fooentity\"/><Property key=\"foo\">bar</Property></CatalogItem>";
+
+ CatalogItemOptions options = CatalogItemOptions.Builder.description("mydescription").properties(
+ ImmutableMap.of("foo", "bar"));
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of(options));
+
+ BindCatalogItemToXmlPayload binder = injector.getInstance(BindCatalogItemToXmlPayload.class);
+
+ Map<String, Object> map = ImmutableMap.<String, Object> of("name", "myname", "Entity", "http://fooentity");
+
+ assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppParamsToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppParamsToXmlPayloadTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppParamsToXmlPayloadTest.java
new file mode 100644
index 0000000..8d6042d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppParamsToXmlPayloadTest.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.util.Strings2;
+import org.jclouds.vcloud.internal.BasePayloadTest;
+import org.jclouds.vcloud.options.CloneVAppOptions;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMap.Builder;
+
+/**
+ * Tests behavior of {@code BindCloneVAppParamsToXmlPayload}
+ */
+@Test(groups = "unit")
+public class BindCloneVAppParamsToXmlPayloadTest extends BasePayloadTest {
+
+ public void testWithDescriptionDeployOn() throws Exception {
+ String expected = Strings2.toStringAndClose(getClass().getResourceAsStream("/copyVApp.xml"));
+
+ CloneVAppOptions options = new CloneVAppOptions().deploy().powerOn().description(
+ "The description of the new vApp");
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of(options));
+
+ BindCloneVAppParamsToXmlPayload binder = injector.getInstance(BindCloneVAppParamsToXmlPayload.class);
+
+ Builder<String, Object> map = ImmutableMap.builder();
+ map.put("name", "new-linux-server");
+ map.put("Source", "https://vcenterprise.bluelock.com/api/v1.0/vapp/201");
+ assertEquals(binder.bindToRequest(request, map.build()).getPayload().getRawContent(), expected);
+ }
+
+ public void testWithDescriptionDeployOnSourceDelete() throws Exception {
+ String expected = Strings2.toStringAndClose(getClass().getResourceAsStream("/moveVApp.xml"));
+
+ CloneVAppOptions options = new CloneVAppOptions().deploy().powerOn().description(
+ "The description of the new vApp");
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of(options));
+
+ BindCloneVAppParamsToXmlPayload binder = injector.getInstance(BindCloneVAppParamsToXmlPayload.class);
+
+ Builder<String, Object> map = ImmutableMap.builder();
+ map.put("name", "new-linux-server");
+ map.put("Source", "https://vcenterprise.bluelock.com/api/v1.0/vapp/201");
+ map.put("IsSourceDelete", "true");
+ assertEquals(binder.bindToRequest(request, map.build()).getPayload().getRawContent(), expected);
+ }
+
+ public void testDefault() throws Exception {
+ String expected = Strings2.toStringAndClose(getClass().getResourceAsStream("/copyVApp-default.xml"));
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of());
+
+ BindCloneVAppParamsToXmlPayload binder = injector.getInstance(BindCloneVAppParamsToXmlPayload.class);
+
+ Builder<String, Object> map = ImmutableMap.builder();
+ map.put("name", "my-vapp");
+ map.put("Source", "https://vcenterprise.bluelock.com/api/v1.0/vapp/4181");
+ assertEquals(binder.bindToRequest(request, map.build()).getPayload().getRawContent(), expected);
+ }
+}
[07/18] stratos git commit: Jclouds vcloud api 1.8.1 clone with
custom changes
Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/CatalogApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/CatalogApiTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/CatalogApiTest.java
new file mode 100644
index 0000000..c5094d5
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/CatalogApiTest.java
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.options.CatalogItemOptions;
+import org.jclouds.vcloud.xml.CatalogHandler;
+import org.jclouds.vcloud.xml.CatalogItemHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+/**
+ * Tests behavior of {@code CatalogApi}
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "CatalogApiTest")
+public class CatalogApiTest extends BaseVCloudApiTest<CatalogApi> {
+
+ public void testCatalog() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(CatalogApi.class, "getCatalog", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalog/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalog+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, CatalogHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testCatalogInOrg() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(CatalogApi.class, "findCatalogInOrgNamed", String.class, String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "catalog"));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalog/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalog+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, CatalogHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testCatalogItemURI() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(CatalogApi.class, "getCatalogItem", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalogItem+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, CatalogItemHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testFindCatalogItemInOrgCatalogNamed() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(CatalogApi.class, "findCatalogItemInOrgCatalogNamed", String.class,
+ String.class, String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "catalog", "item"));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalogItem/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalogItem+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, CatalogItemHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testAddVAppTemplateOrMediaImageToCatalogAndNameItem() throws SecurityException, NoSuchMethodException,
+ IOException {
+ Invokable<?, ?> method = method(CatalogApi.class, "addVAppTemplateOrMediaImageToCatalogAndNameItem", URI.class,
+ URI.class, String.class, CatalogItemOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI.create("http://fooentity"), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"), "myname", CatalogItemOptions.Builder
+ .description("mydescription")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/catalog/1/catalogItems HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalogItem+xml\n");
+ assertPayloadEquals(
+ request,
+ "<CatalogItem xmlns=\"http://www.vmware.com/vcloud/v1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" name=\"myname\" xsi:schemaLocation=\"http://www.vmware.com/vcloud/v1 http://vcloud.safesecureweb.com/ns/vcloud.xsd\"><Description>mydescription</Description><Entity href=\"http://fooentity\"/></CatalogItem>",
+ "application/vnd.vmware.vcloud.catalogItem+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, CatalogItemHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/NetworkApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/NetworkApiLiveTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/NetworkApiLiveTest.java
new file mode 100644
index 0000000..b7d7102
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/NetworkApiLiveTest.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "live", enabled = true, singleThreaded = true, testName = "NetworkApiLiveTest")
+public class NetworkApiLiveTest extends BaseVCloudApiLiveTest {
+
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/NetworkApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/NetworkApiTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/NetworkApiTest.java
new file mode 100644
index 0000000..d6ce452
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/NetworkApiTest.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.xml.OrgNetworkHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+/**
+ * Tests behavior of {@code NetworkApi}
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "NetworkApiTest")
+public class NetworkApiTest extends BaseVCloudApiTest<NetworkApi> {
+
+ public void testNetwork() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(NetworkApi.class, "getNetwork", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/network/2")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/network/2 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.network+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, OrgNetworkHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testFindNetworkInOrgVDCNamed() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(NetworkApi.class, "findNetworkInOrgVDCNamed", String.class, String.class,
+ String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "vdc", "network"));
+
+ assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/network/1990 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.network+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, OrgNetworkHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/OrgApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/OrgApiLiveTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/OrgApiLiveTest.java
new file mode 100644
index 0000000..d1c8528
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/OrgApiLiveTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "live", enabled = true, singleThreaded = true, testName = "OrgApiLiveTest")
+public class OrgApiLiveTest extends BaseVCloudApiLiveTest {
+
+ @Test
+ public void testListOrgs() throws Exception {
+ for (ReferenceType response : getVCloudApi().getOrgApi().listOrgs().values()) {
+ assertNotNull(response);
+ assertNotNull(response.getName());
+ assertNotNull(response.getHref());
+ assertEquals(getVCloudApi().getOrgApi().getOrg(response.getHref()).getName(), response.getName());
+ assertEquals(getVCloudApi().getOrgApi().findOrgNamed(response.getName()).getName(), response.getName());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/OrgApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/OrgApiTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/OrgApiTest.java
new file mode 100644
index 0000000..1080dde
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/OrgApiTest.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.xml.OrgHandler;
+import org.jclouds.vcloud.xml.OrgListHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+/**
+ * Tests behavior of {@code OrgApi}
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "OrgApiTest")
+public class OrgApiTest extends BaseVCloudApiTest<OrgApi> {
+
+ public void testlistOrgs() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(OrgApi.class, "listOrgs");
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.orgList+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, OrgListHandler.class);
+ assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
+
+ checkFilters(request);
+ }
+
+ public void testOrg() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(OrgApi.class, "getOrg", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/org/1")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.org+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, OrgHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testFindOrgNamed() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(OrgApi.class, "findOrgNamed", String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org"));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.org+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, OrgHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/TaskApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/TaskApiLiveTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/TaskApiLiveTest.java
new file mode 100644
index 0000000..5be4bf4
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/TaskApiLiveTest.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "live", enabled = true, singleThreaded = true, testName = "TaskApiLiveTest")
+public class TaskApiLiveTest extends BaseVCloudApiLiveTest {
+
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/TaskApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/TaskApiTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/TaskApiTest.java
new file mode 100644
index 0000000..75518f0
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/TaskApiTest.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ReleasePayloadAndReturn;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.xml.TaskHandler;
+import org.jclouds.vcloud.xml.TasksListHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+/**
+ * Tests behavior of {@code TaskApi}
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "TaskApiTest")
+public class TaskApiTest extends BaseVCloudApiTest<TaskApi> {
+
+ public void testGetTasksList() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(TaskApi.class, "getTasksList", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/tasksList/1")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/tasksList/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.tasksList+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TasksListHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testFindTasksListInOrgNamed() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(TaskApi.class, "findTasksListInOrgNamed", String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org"));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/tasksList/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.tasksList+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TasksListHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testGetTask() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(TaskApi.class, "getTask", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/task/1")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/task/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testCancelTask() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(TaskApi.class, "cancelTask", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/task/1")));
+
+ assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/task/1/action/cancel HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppApiLiveTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppApiLiveTest.java
new file mode 100644
index 0000000..cf4aca3
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppApiLiveTest.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.testng.Assert.assertNotNull;
+
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.VDC;
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VAppApiLiveTest")
+public class VAppApiLiveTest extends BaseVCloudApiLiveTest {
+
+ @Test
+ public void testGetVApp() throws Exception {
+ Org org = getVCloudApi().getOrgApi().findOrgNamed(null);
+ for (ReferenceType vdc : org.getVDCs().values()) {
+ VDC response = getVCloudApi().getVDCApi().getVDC(vdc.getHref());
+ for (ReferenceType item : response.getResourceEntities().values()) {
+ if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
+ try {
+ VApp app = getVCloudApi().getVAppApi().getVApp(item.getHref());
+ assertNotNull(app);
+ } catch (RuntimeException e) {
+
+ }
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppApiTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppApiTest.java
new file mode 100644
index 0000000..73ca9a1
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppApiTest.java
@@ -0,0 +1,313 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ReleasePayloadAndReturn;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.util.Strings2;
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.options.CloneVAppOptions;
+import org.jclouds.vcloud.xml.TaskHandler;
+import org.jclouds.vcloud.xml.VAppHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+/**
+ * Tests behavior of {@code VAppApi}
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "VAppApiTest")
+public class VAppApiTest extends BaseVCloudApiTest<VAppApi> {
+
+ public void testopyVAppToVDCAndName() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "copyVAppToVDCAndName", URI.class, URI.class, String.class,
+ CloneVAppOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/4181"), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "my-vapp"));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVApp HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/copyVApp-default.xml")),
+ "application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testCopyVAppToVDCAndNameOptions() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "copyVAppToVDCAndName", URI.class, URI.class, String.class,
+ CloneVAppOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "new-linux-server", new CloneVAppOptions()
+ .deploy().powerOn().description("The description of the new vApp")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVApp HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/copyVApp.xml")),
+ "application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testMoveVAppToVDCAndRenameOptions() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "moveVAppToVDCAndRename", URI.class, URI.class, String.class,
+ CloneVAppOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "new-linux-server", new CloneVAppOptions()
+ .deploy().powerOn().description("The description of the new vApp")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVApp HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/moveVApp.xml")),
+ "application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testDeployVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "deployVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/deploy HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>",
+ "application/vnd.vmware.vcloud.deployVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testDeployAndPowerOnVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "deployAndPowerOnVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/deploy HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" powerOn=\"true\"/>",
+ "application/vnd.vmware.vcloud.deployVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testGetVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "getVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vApp/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, VAppHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testRebootVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "rebootVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/reboot HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testUndeployVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "undeployVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/undeploy HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, "<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>",
+ "application/vnd.vmware.vcloud.undeployVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testUndeployAndSaveStateOfVAppSaveState() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "undeployAndSaveStateOfVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/undeploy HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request,
+ "<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" saveState=\"true\"/>",
+ "application/vnd.vmware.vcloud.undeployVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testDeleteVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "deleteVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request, "DELETE https://vcenterprise.bluelock.com/api/v1.0/vApp/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testPowerOnVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "powerOnVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/powerOn HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testPowerOffVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "powerOffVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/powerOff HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testResetVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "resetVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/reset HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testSuspendVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "suspendVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/suspend HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testShutdownVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "shutdownVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/shutdown HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiLiveTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiLiveTest.java
new file mode 100644
index 0000000..e883235
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiLiveTest.java
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static com.google.common.collect.Iterables.getOnlyElement;
+import static java.util.concurrent.TimeUnit.SECONDS;
+import static org.jclouds.util.Predicates2.retry;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Catalog;
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.jclouds.vcloud.options.CatalogItemOptions;
+import org.jclouds.vcloud.predicates.TaskSuccess;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.ImmutableMap;
+
+@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VAppTemplateApiLiveTest")
+public class VAppTemplateApiLiveTest extends BaseVCloudApiLiveTest {
+ @Test
+ public void testGetVAppTemplate() throws Exception {
+ Org org = getVCloudApi().getOrgApi().findOrgNamed(null);
+ for (ReferenceType cat : org.getCatalogs().values()) {
+ Catalog response = getVCloudApi().getCatalogApi().getCatalog(cat.getHref());
+ for (ReferenceType resource : response.values()) {
+ if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
+ CatalogItem item = getVCloudApi().getCatalogApi().getCatalogItem(resource.getHref());
+ if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
+ VAppTemplate template = getVCloudApi().getVAppTemplateApi().getVAppTemplate(item.getEntity().getHref());
+ if (template != null) {
+ // the UUID in the href is the only way to actually link templates
+ assertEquals(template.getHref(), item.getEntity().getHref());
+ } else {
+ // null can be no longer available or auth exception
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Test
+ public void testGetOvfEnvelopeForVAppTemplate() throws Exception {
+ Org org = getVCloudApi().getOrgApi().findOrgNamed(null);
+ for (ReferenceType cat : org.getCatalogs().values()) {
+ Catalog response = getVCloudApi().getCatalogApi().getCatalog(cat.getHref());
+ for (ReferenceType resource : response.values()) {
+ if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
+ CatalogItem item = getVCloudApi().getCatalogApi().getCatalogItem(resource.getHref());
+ if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
+ getVCloudApi().getVAppTemplateApi().getOvfEnvelopeForVAppTemplate(item.getEntity().getHref());
+ // null can be no longer available or auth exception
+ }
+ }
+ }
+ }
+ }
+
+ @Test
+ public void testFindVAppTemplate() throws Exception {
+ Org org = getVCloudApi().getOrgApi().findOrgNamed(null);
+ for (ReferenceType cat : org.getCatalogs().values()) {
+ Catalog response = getVCloudApi().getCatalogApi().getCatalog(cat.getHref());
+ for (ReferenceType resource : response.values()) {
+ if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
+ CatalogItem item = getVCloudApi().getCatalogApi().getCatalogItem(resource.getHref());
+ if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
+ VAppTemplate template = getVCloudApi().getVAppTemplateApi().findVAppTemplateInOrgCatalogNamed(
+ org.getName(), response.getName(), item.getEntity().getName());
+ if (template != null) {
+ // the UUID in the href is the only way to actually link templates
+ assertEquals(template.getHref(), item.getEntity().getHref());
+ } else {
+ // null can be no longer available or auth exception
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Test
+ public void testCaptureVApp() throws Exception {
+ String group = prefix + "cap";
+ NodeMetadata node = null;
+ VAppTemplate vappTemplate = null;
+ CatalogItem item = null;
+ try {
+
+ node = getOnlyElement(client.createNodesInGroup(group, 1));
+
+ Predicate<URI> taskTester = retry(new TaskSuccess(getVCloudApi()), 600, 5, SECONDS);
+
+ // I have to undeploy first
+ Task task = getVCloudApi().getVAppApi().undeployVApp(URI.create(node.getId()));
+
+ // wait up to ten minutes per above
+ assert taskTester.apply(task.getHref()) : node;
+
+ VApp vApp = getVCloudApi().getVAppApi().getVApp(URI.create(node.getId()));
+
+ // wait up to ten minutes per above
+ assertEquals(vApp.getStatus(), Status.OFF);
+
+ // vdc is equiv to the node's location
+ // vapp uri is the same as the node's id
+ vappTemplate = getVCloudApi().getVAppTemplateApi().captureVAppAsTemplateInVDC(URI.create(node.getId()),
+ group, URI.create(node.getLocation().getId()));
+
+ assertEquals(vappTemplate.getName(), group);
+
+ task = vappTemplate.getTasks().get(0);
+
+ // wait up to ten minutes per above
+ assert taskTester.apply(task.getHref()) : vappTemplate;
+
+ item = getVCloudApi().getCatalogApi().addVAppTemplateOrMediaImageToCatalogAndNameItem(
+ vappTemplate.getHref(),
+ getVCloudApi().getCatalogApi().findCatalogInOrgNamed(null, null).getHref(), "fooname",
+ CatalogItemOptions.Builder.description("description").properties(ImmutableMap.of("foo", "bar")));
+
+ assertEquals(item.getName(), "fooname");
+ assertEquals(item.getDescription(), "description");
+ assertEquals(item.getProperties(), ImmutableMap.of("foo", "bar"));
+ assertEquals(item.getEntity().getName(), "fooname");
+ assertEquals(item.getEntity().getHref(), vappTemplate.getHref());
+ assertEquals(item.getEntity().getType(), vappTemplate.getType());
+
+ } finally {
+ if (item != null)
+ getVCloudApi().getCatalogApi().deleteCatalogItem(item.getHref());
+ if (vappTemplate != null)
+ getVCloudApi().getVAppTemplateApi().deleteVAppTemplate(vappTemplate.getHref());
+ if (node != null)
+ client.destroyNode(node.getId());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiTest.java
new file mode 100644
index 0000000..12bef2e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VAppTemplateApiTest.java
@@ -0,0 +1,236 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.jclouds.reflect.Reflection2.method;
+import static org.jclouds.vcloud.options.InstantiateVAppTemplateOptions.Builder.addNetworkConfig;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.ovf.xml.EnvelopeHandler;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.util.Strings2;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.domain.network.NetworkConfig;
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.options.CaptureVAppOptions;
+import org.jclouds.vcloud.options.CloneVAppTemplateOptions;
+import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
+import org.jclouds.vcloud.xml.TaskHandler;
+import org.jclouds.vcloud.xml.VAppHandler;
+import org.jclouds.vcloud.xml.VAppTemplateHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+/**
+ * Tests behavior of {@code VAppTemplateApi}
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "VAppTemplateApiTest")
+public class VAppTemplateApiTest extends BaseVCloudApiTest<VAppTemplateApi> {
+
+ public void testCreateVAppInVDCByInstantiatingTemplate() throws SecurityException, NoSuchMethodException,
+ IOException {
+ Invokable<?, ?> method = method(VAppTemplateApi.class, "createVAppInVDCByInstantiatingTemplate", String.class,
+ URI.class, URI.class, InstantiateVAppTemplateOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("my-vapp", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3"),
+ addNetworkConfig(new NetworkConfig("aloha", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/network/1991"), FenceMode.NAT_ROUTED))));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/instantiateVAppTemplate HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream(
+ "/instantiationparams-network.xml")), "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml",
+ false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, VAppHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void testCreateVAppInVDCByInstantiatingTemplateOptionsIllegalName() throws SecurityException,
+ NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppTemplateApi.class, "createVAppInVDCByInstantiatingTemplate", String.class,
+ URI.class, URI.class, InstantiateVAppTemplateOptions[].class);
+ processor.createRequest(method, ImmutableList.<Object> of("CentOS 01", URI.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), addNetworkConfig(new NetworkConfig(null,
+ URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/1991"), null))));
+ }
+
+ public void testcopyVAppTemplateToVDCAndName() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppTemplateApi.class, "copyVAppTemplateToVDCAndName", URI.class, URI.class,
+ String.class, CloneVAppTemplateOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/4181"), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "my-vapptemplate"));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVAppTemplate HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream(
+ "/copyVAppTemplate-default.xml")), "application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testcopyVAppTemplateToVDCAndNameOptions() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppTemplateApi.class, "copyVAppTemplateToVDCAndName", URI.class, URI.class,
+ String.class, CloneVAppTemplateOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/201"), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "new-linux-server",
+ new CloneVAppTemplateOptions().description("The description of the new vAppTemplate")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVAppTemplate HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/copyVAppTemplate.xml")),
+ "application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testmoveVAppTemplateToVDCAndRenameOptions() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppTemplateApi.class, "moveVAppTemplateToVDCAndRename", URI.class, URI.class,
+ String.class, CloneVAppTemplateOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/201"), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "new-linux-server",
+ new CloneVAppTemplateOptions().description("The description of the new vAppTemplate")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVAppTemplate HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/moveVAppTemplate.xml")),
+ "application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testcaptureVAppAsTemplateInVDC() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppTemplateApi.class, "captureVAppAsTemplateInVDC", URI.class, String.class,
+ URI.class, CaptureVAppOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/4181"), "my-template", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/captureVApp HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
+ assertPayloadEquals(request, Strings2
+ .toStringAndClose(getClass().getResourceAsStream("/captureVApp-default.xml")),
+ "application/vnd.vmware.vcloud.captureVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, VAppTemplateHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testcaptureVAppAsTemplateInVDCOptions() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppTemplateApi.class, "captureVAppAsTemplateInVDC", URI.class, String.class,
+ URI.class, CaptureVAppOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), "my-template", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), new CaptureVAppOptions()
+ .withDescription("The description of the new vApp Template")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/captureVApp HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/captureVApp.xml")),
+ "application/vnd.vmware.vcloud.captureVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, VAppTemplateHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testFindVAppTemplate() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppTemplateApi.class, "findVAppTemplateInOrgCatalogNamed", String.class,
+ String.class, String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "catalog", "template"));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, VAppTemplateHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testVAppTemplateURI() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppTemplateApi.class, "getVAppTemplate", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, VAppTemplateHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testGetOvfEnvelopeForVAppTemplate() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppTemplateApi.class, "getOvfEnvelopeForVAppTemplate", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2/ovf HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: text/xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, EnvelopeHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VDCApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VDCApiLiveTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VDCApiLiveTest.java
new file mode 100644
index 0000000..be1efdc
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VDCApiLiveTest.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VDCApiLiveTest")
+public class VDCApiLiveTest extends BaseVCloudApiLiveTest {
+
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VDCApiTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VDCApiTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VDCApiTest.java
new file mode 100644
index 0000000..0296453
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VDCApiTest.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.NoSuchElementException;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.xml.VDCHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import com.google.common.reflect.Invokable;
+/**
+ * Tests behavior of {@code VDCApi}
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "VDCApiTest")
+public class VDCApiTest extends BaseVCloudApiTest<VDCApi> {
+
+ @Test(expectedExceptions = NoSuchElementException.class)
+ public void testFindVDCInOrgNamedBadVDC() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VDCApi.class, "findVDCInOrgNamed", String.class, String.class);
+ processor.createRequest(method, ImmutableList.<Object> of("org", "vdc1"));
+ }
+
+ @Test(expectedExceptions = NoSuchElementException.class)
+ public void testFindVDCInOrgNamedBadOrg() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VDCApi.class, "findVDCInOrgNamed", String.class, String.class);
+ processor.createRequest(method, ImmutableList.<Object> of("org1", "vdc"));
+ }
+
+ public void testFindVDCInOrgNamedNullOrg() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VDCApi.class, "findVDCInOrgNamed", String.class, String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "vdc"));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdc/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, VDCHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testFindVDCInOrgNamedNullOrgAndVDC() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VDCApi.class, "findVDCInOrgNamed", String.class, String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, null));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdc/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, VDCHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testGetVDC() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VDCApi.class, "getVDC", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdc/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, VDCHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VmApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VmApiLiveTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VmApiLiveTest.java
new file mode 100644
index 0000000..f6b3d92
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/VmApiLiveTest.java
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static com.google.common.base.Charsets.UTF_8;
+import static com.google.common.collect.Iterables.get;
+import static com.google.common.collect.Iterables.getOnlyElement;
+import static com.google.common.io.BaseEncoding.base64;
+import static org.jclouds.compute.options.RunScriptOptions.Builder.wrapInInitScript;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import org.jclouds.compute.domain.ExecResponse;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.options.TemplateOptions;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.compute.options.VCloudTemplateOptions;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.VDC;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.Iterables;
+import com.google.common.net.HostAndPort;
+
+/**
+ * This tests that we can use guest customization as an alternative to bootstrapping with ssh. There
+ * are a few advantages to this, including the fact that it can work inside google appengine where
+ * network sockets (ssh:22) are prohibited.
+ */
+@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VmApiLiveTest")
+public class VmApiLiveTest extends BaseVCloudApiLiveTest {
+
+ @Test
+ public void testGetThumbnailOfVm() throws Exception {
+ Org org = getVCloudApi().getOrgApi().findOrgNamed(null);
+ for (ReferenceType vdc : org.getVDCs().values()) {
+ VDC response = getVCloudApi().getVDCApi().getVDC(vdc.getHref());
+ for (ReferenceType item : response.getResourceEntities().values()) {
+ if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
+ try {
+ VApp app = getVCloudApi().getVAppApi().getVApp(item.getHref());
+ assertNotNull(app);
+ for (Vm vm : app.getChildren()) {
+ assert getVCloudApi().getVmApi().getScreenThumbnailForVm(vm.getHref()) != null;
+ }
+ } catch (RuntimeException e) {
+
+ }
+ }
+ }
+ }
+ }
+
+ @Test
+ public void testGetVm() throws Exception {
+ Org org = getVCloudApi().getOrgApi().findOrgNamed(null);
+ for (ReferenceType vdc : org.getVDCs().values()) {
+ VDC response = getVCloudApi().getVDCApi().getVDC(vdc.getHref());
+ for (ReferenceType item : response.getResourceEntities().values()) {
+ if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
+ try {
+ VApp app = getVCloudApi().getVAppApi().getVApp(item.getHref());
+ assertNotNull(app);
+ for (Vm vm : app.getChildren()) {
+ assertEquals(getVCloudApi().getVmApi().getVm(vm.getHref()).getHref(), vm.getHref());
+ }
+ } catch (RuntimeException e) {
+
+ }
+ }
+ }
+ }
+ }
+
+ @Test
+ public void testExtendedOptionsWithCustomizationScript() throws Exception {
+ String PARSE_VMTOOLSD = "vmtoolsd --cmd=\"info-get guestinfo.ovfenv\" |grep vCloud_CustomizationInfo|sed 's/.*value=\"\\(.*\\)\".*/\\1/g'";
+
+ String group = prefix + "cus";
+
+ NodeMetadata node = null;
+ try {
+
+ TemplateOptions options = client.templateOptions();
+ options.blockOnPort(22, 180);
+ options.as(VCloudTemplateOptions.class).customizationScript(script);
+ options.as(VCloudTemplateOptions.class).description(group);
+ node = getOnlyElement(client.createNodesInGroup(group, 1, options));
+
+ VApp vapp = client.getContext().unwrapApi(VCloudApi.class).getVAppApi().getVApp(
+ node.getUri());
+ assertEquals(vapp.getDescription(), group);
+
+ Vm vm = Iterables.get(vapp.getChildren(), 0);
+ String apiOutput = vm.getGuestCustomizationSection().getCustomizationScript();
+ checkApiOutput(apiOutput);
+
+ ExecResponse vmTools = client.runScriptOnNode(node.getId(), PARSE_VMTOOLSD,
+ wrapInInitScript(false).runAsRoot(false));
+ checkApiOutput(new String(base64().decode(vmTools.getOutput().trim()), UTF_8));
+
+ ExecResponse foo = client.runScriptOnNode(node.getId(), "cat /root/foo.txt", wrapInInitScript(false)
+ .runAsRoot(false));
+ checkCustomizationOccurred(foo);
+
+ } finally {
+ if (node != null)
+ client.destroyNode(node.getId());
+ }
+ }
+
+ protected void checkCustomizationOccurred(ExecResponse exec) {
+ // note that vmwaretools throws in \r characters when executing scripts
+ assert exec.getOutput().equals(iLoveAscii + "\r\n") : exec;
+ }
+
+ protected void checkApiOutput(String apiOutput) {
+ checkApiOutput1_0_1(apiOutput);
+ }
+
+ // make sure the script has a lot of screwy characters, knowing our parser
+ // throws-out \r
+ protected String iLoveAscii = "I '\"love\"' {asc|!}*&";
+
+ String script = "cat > /root/foo.txt<<EOF\n" + iLoveAscii + "\nEOF\n";
+
+ protected void checkApiOutput1_0_1(String apiOutput) {
+ // in 1.0.1, vcloud director seems to pass through characters via api
+ // flawlessly
+ assertEquals(apiOutput, script);
+ }
+
+ protected void checkApiOutput1_0_0(String apiOutput) {
+ // in 1.0.0, vcloud director seems to remove all newlines
+ assertEquals(apiOutput, script.replace("\n", ""));
+ }
+
+ protected HostAndPort getSocket(NodeMetadata node) {
+ return HostAndPort.fromParts(get(node.getPublicAddresses(), 0), 22);
+ }
+
+}
[10/18] stratos git commit: Jclouds vcloud api 1.8.1 clone with
custom changes
Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/location/OrgAndVDCToLocationSupplier.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/location/OrgAndVDCToLocationSupplier.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/location/OrgAndVDCToLocationSupplier.java
new file mode 100644
index 0000000..92b3c2e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/location/OrgAndVDCToLocationSupplier.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.location;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.Set;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.location.Iso3166;
+import org.jclouds.location.Provider;
+import org.jclouds.location.suppliers.LocationsSupplier;
+import org.jclouds.location.suppliers.all.JustProvider;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+
+import com.google.common.base.Supplier;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.ImmutableSet.Builder;
+import com.google.common.collect.Iterables;
+
+@Singleton
+public class OrgAndVDCToLocationSupplier extends JustProvider implements LocationsSupplier {
+
+ private final Supplier<Map<String, ReferenceType>> orgNameToResource;
+ private final Supplier<Map<String, Org>> orgNameToVDCResource;
+ private final Supplier<Map<String, Supplier<Set<String>>>> isoCodesByIdSupplier;
+
+ @Inject
+ OrgAndVDCToLocationSupplier(@Iso3166 Set<String> isoCodes, @Provider String providerName,
+ @Provider Supplier<URI> endpoint,
+ @org.jclouds.vcloud.endpoints.Org Supplier<Map<String, ReferenceType>> orgNameToResource,
+ Supplier<Map<String, Org>> orgNameToVDCResource,
+ @Iso3166 Supplier<Map<String, Supplier<Set<String>>>> isoCodesByIdSupplier) {
+ super(providerName, endpoint, isoCodes);
+ this.orgNameToResource = checkNotNull(orgNameToResource, "orgNameToResource");
+ this.orgNameToVDCResource = checkNotNull(orgNameToVDCResource, "orgNameToVDCResource");
+ this.isoCodesByIdSupplier = checkNotNull(isoCodesByIdSupplier, "isoCodesByIdSupplier");
+ }
+
+ @Override
+ public Set<Location> get() {
+ return buildJustProviderOrVDCs().build();
+ }
+
+ protected Builder<Location> buildJustProviderOrVDCs() {
+ Builder<Location> locations = ImmutableSet.builder();
+ Location provider = Iterables.getOnlyElement(super.get());
+ if (orgNameToResource.get().size() == 0)
+ return locations.add(provider);
+ Map<String, Supplier<Set<String>>> isoCodesById = isoCodesByIdSupplier.get();
+ for (ReferenceType org : orgNameToResource.get().values()) {
+ LocationBuilder builder = new LocationBuilder().scope(LocationScope.REGION).id(org.getHref().toASCIIString())
+ .description(org.getName()).parent(provider);
+ if (isoCodesById.containsKey(org.getHref().toASCIIString()))
+ builder.iso3166Codes(isoCodesById.get(org.getHref().toASCIIString()).get());
+ Location orgL = builder.build();
+ for (ReferenceType vdc : orgNameToVDCResource.get().get(org.getName()).getVDCs().values()) {
+ builder = new LocationBuilder().scope(LocationScope.ZONE).id(vdc.getHref().toASCIIString()).description(
+ vdc.getName()).parent(orgL);
+ if (isoCodesById.containsKey(vdc.getHref().toASCIIString()))
+ builder.iso3166Codes(isoCodesById.get(vdc.getHref().toASCIIString()).get());
+ locations.add(builder.build());
+ }
+ }
+ return locations;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/options/CaptureVAppOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/options/CaptureVAppOptions.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/options/CaptureVAppOptions.java
new file mode 100644
index 0000000..89580fd
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/options/CaptureVAppOptions.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.options;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+public class CaptureVAppOptions {
+
+ private String description;
+
+ public CaptureVAppOptions withDescription(String description) {
+ checkNotNull(description, "description");
+ this.description = description;
+ return this;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public static class Builder {
+
+ /**
+ * @see CaptureVAppOptions#withDescription(String)
+ */
+ public static CaptureVAppOptions withDescription(String description) {
+ CaptureVAppOptions options = new CaptureVAppOptions();
+ return options.withDescription(description);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/options/CatalogItemOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/options/CatalogItemOptions.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/options/CatalogItemOptions.java
new file mode 100644
index 0000000..6512031
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/options/CatalogItemOptions.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.options;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Map;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+
+public class CatalogItemOptions {
+
+ private String description;
+ private Map<String, String> properties = Maps.newLinkedHashMap();
+
+ /**
+ * optional description for the CatalogItem
+ */
+ public CatalogItemOptions description(String description) {
+ this.description = checkNotNull(description, "description");
+ return this;
+ }
+
+ /**
+ * optional properties for the CatalogItem
+ */
+ public CatalogItemOptions properties(Map<String, String> properties) {
+ this.properties = ImmutableMap.copyOf(checkNotNull(properties, "properties"));
+ return this;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
+ public static class Builder {
+
+ /**
+ * @see CatalogItemOptions#description
+ */
+ public static CatalogItemOptions description(String description) {
+ return new CatalogItemOptions().description(description);
+ }
+
+ /**
+ * @see CatalogItemOptions#properties
+ */
+ public static CatalogItemOptions properties(Map<String, String> properties) {
+ return new CatalogItemOptions().properties(properties);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/options/CloneOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/options/CloneOptions.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/options/CloneOptions.java
new file mode 100644
index 0000000..e3f5eea
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/options/CloneOptions.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.options;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+public class CloneOptions {
+
+ private String description;
+
+ /**
+ * the clone should be powered on after it is deployed
+ */
+ public CloneOptions description(String description) {
+ checkNotNull(description, "description");
+ this.description = description;
+ return this;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public static class Builder {
+
+ /**
+ * @see CloneOptions#description(String)
+ */
+ public static CloneOptions description(String description) {
+ return new CloneOptions().description(description);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/options/CloneVAppOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/options/CloneVAppOptions.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/options/CloneVAppOptions.java
new file mode 100644
index 0000000..8aed313
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/options/CloneVAppOptions.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.options;
+
+import static com.google.common.base.Preconditions.checkState;
+
+public class CloneVAppOptions extends CloneOptions {
+
+ private boolean deploy;
+ private boolean powerOn;
+
+ /**
+ * the clone should be deployed after it is created
+ */
+ public CloneVAppOptions deploy() {
+ this.deploy = true;
+ return this;
+ }
+
+ /**
+ * the clone should be powered on after it is deployed
+ */
+ public CloneVAppOptions powerOn() {
+ checkState(deploy, "must set deploy before setting powerOn");
+ powerOn = true;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public CloneVAppOptions description(String description) {
+ return CloneVAppOptions.class.cast(super.description(description));
+ }
+
+ public boolean isDeploy() {
+ return deploy;
+ }
+
+ public boolean isPowerOn() {
+ return powerOn;
+ }
+
+ public static class Builder {
+
+ /**
+ * @see CloneVAppOptions#deploy()
+ */
+ public static CloneVAppOptions deploy() {
+ return new CloneVAppOptions().deploy();
+ }
+
+ /**
+ * @see CloneVAppOptions#powerOn()
+ */
+ public static CloneVAppOptions powerOn() {
+ return new CloneVAppOptions().powerOn();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public static CloneVAppOptions description(String description) {
+ return new CloneVAppOptions().description(description);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/options/CloneVAppTemplateOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/options/CloneVAppTemplateOptions.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/options/CloneVAppTemplateOptions.java
new file mode 100644
index 0000000..e10d45d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/options/CloneVAppTemplateOptions.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.options;
+
+public class CloneVAppTemplateOptions extends CloneOptions {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public CloneVAppTemplateOptions description(String description) {
+ return CloneVAppTemplateOptions.class.cast(super.description(description));
+ }
+
+ public static class Builder {
+ /**
+ * {@inheritDoc}
+ */
+ public static CloneVAppTemplateOptions description(String description) {
+ return new CloneVAppTemplateOptions().description(description);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/options/InstantiateVAppTemplateOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/options/InstantiateVAppTemplateOptions.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/options/InstantiateVAppTemplateOptions.java
new file mode 100644
index 0000000..8d35d1d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/options/InstantiateVAppTemplateOptions.java
@@ -0,0 +1,173 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.options;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Set;
+
+import org.jclouds.vcloud.domain.network.NetworkConfig;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.Sets;
+
+public class InstantiateVAppTemplateOptions {
+ private Set<NetworkConfig> networkConfig = Sets.newLinkedHashSet();
+
+ private Boolean customizeOnInstantiate;
+ private String description = null;
+ private boolean deploy = true;
+ private boolean powerOn = true;
+
+ public String getDescription() {
+ return description;
+ }
+
+ public boolean shouldDeploy() {
+ return deploy;
+ }
+
+ public boolean shouldPowerOn() {
+ return powerOn;
+ }
+
+ /**
+ * Optional description. Used for the Description of the vApp created by this
+ * instantiation.
+ */
+ public InstantiateVAppTemplateOptions description(String description) {
+ this.description = description;
+ return this;
+ }
+
+ /**
+ * deploy the vapp after it is instantiated?
+ */
+ public InstantiateVAppTemplateOptions deploy(boolean deploy) {
+ this.deploy = deploy;
+ return this;
+ }
+
+ /**
+ * powerOn the vapp after it is instantiated?
+ */
+ public InstantiateVAppTemplateOptions powerOn(boolean powerOn) {
+ this.powerOn = powerOn;
+ return this;
+ }
+
+ /**
+ * {@networkConfig VAppTemplate}s have internal networks that can be
+ * connected in order to access the internet or other external networks.
+ *
+ * <h4>default behaviour if you don't use this option</h4> By default, we
+ * connect the first internal {@networkConfig
+ * org.jclouds.vcloud.domain.VAppTemplate#getNetworkSection network in the
+ * vapp template}to a default chosen from the org or specified via
+ * {@networkConfig
+ * org.jclouds.vcloud.reference.VCloudConstants#
+ * PROPERTY_VCLOUD_DEFAULT_NETWORK} using the {@networkConfig
+ * org.jclouds.vcloud.domain.FenceMode#BRIDGED} or an
+ * override set by the property {@networkConfig
+ * org.jclouds.vcloud.reference.VCloudConstants#
+ * PROPERTY_VCLOUD_DEFAULT_FENCEMODE}.
+ */
+ public InstantiateVAppTemplateOptions addNetworkConfig(NetworkConfig networkConfig) {
+ this.networkConfig.add(checkNotNull(networkConfig, "networkConfig"));
+ return this;
+ }
+
+ public Set<NetworkConfig> getNetworkConfig() {
+ return networkConfig;
+ }
+
+ public static class Builder {
+
+ /**
+ * @see InstantiateVAppTemplateOptions#description
+ */
+ public static InstantiateVAppTemplateOptions description(String description) {
+ InstantiateVAppTemplateOptions options = new InstantiateVAppTemplateOptions();
+ return options.description(description);
+ }
+
+ /**
+ * @see InstantiateVAppTemplateOptions#deploy
+ */
+ public static InstantiateVAppTemplateOptions deploy(boolean deploy) {
+ InstantiateVAppTemplateOptions options = new InstantiateVAppTemplateOptions();
+ return options.deploy(deploy);
+ }
+
+ /**
+ * @see InstantiateVAppTemplateOptions#powerOn
+ */
+ public static InstantiateVAppTemplateOptions powerOn(boolean powerOn) {
+ InstantiateVAppTemplateOptions options = new InstantiateVAppTemplateOptions();
+ return options.powerOn(powerOn);
+ }
+
+ /**
+ * @see InstantiateVAppTemplateOptions#addNetworkConfig
+ */
+ public static InstantiateVAppTemplateOptions addNetworkConfig(NetworkConfig networkConfig) {
+ InstantiateVAppTemplateOptions options = new InstantiateVAppTemplateOptions();
+ return options.addNetworkConfig(networkConfig);
+ }
+
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof InstantiateVAppTemplateOptions) {
+ final InstantiateVAppTemplateOptions other = InstantiateVAppTemplateOptions.class.cast(object);
+ return equal(networkConfig, other.networkConfig)
+ && equal(customizeOnInstantiate, other.customizeOnInstantiate) && equal(description, other.description)
+ && equal(deploy, other.deploy) && equal(powerOn, other.powerOn);
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(networkConfig, customizeOnInstantiate, description, deploy, powerOn);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+ protected ToStringHelper string() {
+ ToStringHelper toString = Objects.toStringHelper("").omitNullValues();
+ toString.add("customizeOnInstantiate", customizeOnInstantiate).add("description", description);
+ if (networkConfig.size() > 0)
+ toString.add("networkConfig", networkConfig);
+ if (!deploy)
+ toString.add("deploy", deploy);
+ if (!powerOn)
+ toString.add("powerOn", powerOn);
+ return toString;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/predicates/TaskSuccess.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/predicates/TaskSuccess.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/predicates/TaskSuccess.java
new file mode 100644
index 0000000..2b249ce
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/predicates/TaskSuccess.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.predicates;
+
+import java.net.URI;
+
+import javax.annotation.Resource;
+import javax.inject.Singleton;
+
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.TaskInErrorStateException;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.TaskStatus;
+
+import com.google.common.base.Predicate;
+import com.google.inject.Inject;
+
+/**
+ *
+ * Tests to see if a task succeeds.
+ */
+@Singleton
+public class TaskSuccess implements Predicate<URI> {
+
+ private final VCloudApi client;
+
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ @Inject
+ public TaskSuccess(VCloudApi client) {
+ this.client = client;
+ }
+
+ public boolean apply(URI taskId) {
+ logger.trace("looking for status on task %s", taskId);
+
+ Task task = client.getTaskApi().getTask(taskId);
+ // perhaps task isn't available, yet
+ if (task == null)
+ return false;
+ logger.trace("%s: looking for status %s: currently: %s", task, TaskStatus.SUCCESS, task.getStatus());
+ if (task.getStatus() == TaskStatus.ERROR)
+ throw new TaskInErrorStateException(task);
+ return task.getStatus() == TaskStatus.SUCCESS;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/reference/VCloudConstants.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/reference/VCloudConstants.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/reference/VCloudConstants.java
new file mode 100644
index 0000000..2429c6a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/reference/VCloudConstants.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.reference;
+
+/**
+ * Configuration properties and constants used in VCloud connections.
+ */
+public final class VCloudConstants {
+ public static final String PROPERTY_VCLOUD_VERSION_SCHEMA = "jclouds.vcloud.version.schema";
+ /**
+ * name of the default org that your vApp will join, if an org isn't
+ * explicitly specified.
+ */
+ public static final String PROPERTY_VCLOUD_DEFAULT_ORG = "jclouds.vcloud.defaults.org";
+ /**
+ * name of the default catalog to query, if it isn't explicitly specified.
+ */
+ public static final String PROPERTY_VCLOUD_DEFAULT_CATALOG = "jclouds.vcloud.defaults.catalog";
+ /**
+ * name of the VDC that your vApp will join, if a vDC isn't explicitly
+ * specified.
+ */
+ public static final String PROPERTY_VCLOUD_DEFAULT_VDC = "jclouds.vcloud.defaults.vdc";
+ /**
+ * name of the default network, in the default VDC that your vApp will join.
+ */
+ public static final String PROPERTY_VCLOUD_DEFAULT_NETWORK = "jclouds.vcloud.defaults.network";
+ public static final String PROPERTY_VCLOUD_DEFAULT_FENCEMODE = "jclouds.vcloud.defaults.fencemode";
+
+ public static final String PROPERTY_VCLOUD_XML_NAMESPACE = "jclouds.vcloud.xml.ns";
+ public static final String PROPERTY_VCLOUD_XML_SCHEMA = "jclouds.vcloud.xml.schema";
+
+ public static final String PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED = "jclouds.vcloud.timeout.task-complete";
+
+ private VCloudConstants() {
+ throw new AssertionError("intentionally unimplemented");
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/reference/package-info.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/reference/package-info.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/reference/package-info.java
new file mode 100644
index 0000000..158debe
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/reference/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.
+ */
+/**
+ * This package contains properties and reference data used in vCloud.
+ */
+package org.jclouds.vcloud.reference;
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/suppliers/OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/suppliers/OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/suppliers/OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault.java
new file mode 100644
index 0000000..938b6fd
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/suppliers/OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.suppliers;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.NoSuchElementException;
+
+import org.jclouds.config.ValueOfConfigurationKeyOrNull;
+import org.jclouds.vcloud.domain.ReferenceType;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+
+public class OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault implements
+ Function<Iterable<ReferenceType>, ReferenceType> {
+
+ protected final ValueOfConfigurationKeyOrNull valueOfConfigurationKeyOrNull;
+ protected final String configurationKey;
+ protected final Predicate<ReferenceType> defaultSelector;
+
+ public OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(
+ ValueOfConfigurationKeyOrNull valueOfConfigurationKeyOrNull, String configurationKey,
+ Predicate<ReferenceType> defaultSelector) {
+ this.configurationKey = checkNotNull(configurationKey, "configurationKey");
+ this.valueOfConfigurationKeyOrNull = checkNotNull(valueOfConfigurationKeyOrNull, "valueOfConfigurationKeyOrNull");
+ this.defaultSelector = checkNotNull(defaultSelector, "defaultSelector");
+ }
+
+ @Override
+ public ReferenceType apply(Iterable<ReferenceType> referenceTypes) {
+ checkNotNull(referenceTypes, "referenceTypes");
+ checkArgument(Iterables.size(referenceTypes) > 0,
+ "No referenceTypes corresponding to configuration key %s present", configurationKey);
+ if (Iterables.size(referenceTypes) == 1)
+ return Iterables.getLast(referenceTypes);
+ String namingPattern = valueOfConfigurationKeyOrNull.apply(configurationKey);
+ if (namingPattern != null) {
+ return findReferenceTypeWithNameMatchingPattern(referenceTypes, namingPattern);
+ } else {
+ return defaultReferenceType(referenceTypes);
+ }
+ }
+
+ public ReferenceType defaultReferenceType(Iterable<ReferenceType> referenceTypes) {
+ return Iterables.find(referenceTypes, defaultSelector);
+ }
+
+ public ReferenceType findReferenceTypeWithNameMatchingPattern(Iterable<ReferenceType> referenceTypes,
+ String namingPattern) {
+ try {
+ return Iterables.find(referenceTypes, new ReferenceTypeNameMatchesPattern(namingPattern));
+ } catch (NoSuchElementException e) {
+ throw new NoSuchElementException(String.format(
+ "referenceType matching pattern [%s], corresponding to configuration key %s, not in %s", namingPattern,
+ configurationKey, referenceTypes));
+ }
+ }
+
+ static class ReferenceTypeNameMatchesPattern implements Predicate<ReferenceType> {
+
+ private final String namingPattern;
+
+ public ReferenceTypeNameMatchesPattern(String namingPattern) {
+ this.namingPattern = checkNotNull(namingPattern, "namingPattern");
+ }
+
+ @Override
+ public boolean apply(ReferenceType arg0) {
+ return arg0.getName().matches(namingPattern);
+ }
+
+ @Override
+ public String toString() {
+ return "nameMatchesPattern(" + namingPattern + ")";
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/suppliers/VAppTemplatesSupplier.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/suppliers/VAppTemplatesSupplier.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/suppliers/VAppTemplatesSupplier.java
new file mode 100644
index 0000000..08e1017
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/suppliers/VAppTemplatesSupplier.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.suppliers;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.collect.Iterables.concat;
+import static com.google.common.collect.Sets.newLinkedHashSet;
+import static org.jclouds.concurrent.FutureIterables.transformParallel;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Callable;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.Constants;
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.VAppTemplate;
+
+import com.google.common.base.Function;
+import com.google.common.base.Supplier;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.ListeningExecutorService;
+
+@Singleton
+public class VAppTemplatesSupplier implements Supplier<Set<VAppTemplate>> {
+
+ @Resource
+ @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+ public Logger logger = Logger.NULL;
+
+ private final Supplier<Map<String, Org>> orgMap;
+ private final Function<Org, Iterable<VAppTemplate>> imagesInOrg;
+ private final ListeningExecutorService userExecutor;
+
+ @Inject
+ VAppTemplatesSupplier(Supplier<Map<String, Org>> orgMap,
+ Function<Org, Iterable<VAppTemplate>> imagesInOrg,
+ @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
+ this.orgMap = checkNotNull(orgMap, "orgMap");
+ this.imagesInOrg = checkNotNull(imagesInOrg, "imagesInOrg");
+ this.userExecutor = checkNotNull(userExecutor, "userExecutor");
+ }
+
+ @Override
+ public Set<VAppTemplate> get() {
+ Iterable<Org> orgs = checkNotNull(orgMap.get().values(), "orgs");
+ Iterable<? extends Iterable<VAppTemplate>> images = transformParallel(orgs,
+ new Function<Org, ListenableFuture<? extends Iterable<VAppTemplate>>>() {
+ public ListenableFuture<Iterable<VAppTemplate>> apply(final Org from) {
+ checkNotNull(from, "org");
+ return userExecutor.submit(new Callable<Iterable<VAppTemplate>>() {
+ public Iterable<VAppTemplate> call() throws Exception {
+ return imagesInOrg.apply(from);
+ }
+ public String toString() {
+ return "imagesInOrg(" + from.getHref() + ")";
+ }
+ });
+ }
+ }, userExecutor, null, logger, "images in " + orgs);
+ return newLinkedHashSet(concat(images));
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/util/Utils.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/util/Utils.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/util/Utils.java
new file mode 100644
index 0000000..623ee08
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/util/Utils.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.util;
+
+import java.net.URI;
+import java.util.Map;
+
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VCloudError;
+import org.jclouds.vcloud.domain.VCloudError.MinorCode;
+import org.jclouds.vcloud.domain.internal.ErrorImpl;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+
+public class Utils {
+
+ public static ReferenceType newReferenceType(Map<String, String> attributes, String defaultType) {
+ String uri = attributes.get("href");
+ String type = attributes.get("type");
+ String relationship = attributes.get("rel");
+ // savvis org has null href
+ URI href = (uri != null) ? URI.create(uri) : null;
+ return new ReferenceTypeImpl(attributes.get("name"), type != null ? type : defaultType, href, relationship);
+ }
+
+ public static ReferenceType newReferenceType(Map<String, String> attributes) {
+ return newReferenceType(attributes, null);
+ }
+
+ public static VCloudError newError(Map<String, String> attributes) {
+
+ String vendorSpecificErrorCode = attributes.get("vendorSpecificErrorCode");
+ int errorCode;
+ // remove this logic when vcloud 0.8 is gone
+ try {
+ errorCode = Integer.parseInt(attributes.get("majorErrorCode"));
+ } catch (NumberFormatException e) {
+ errorCode = 500;
+ vendorSpecificErrorCode = attributes.get("majorErrorCode");
+ }
+ MinorCode minorErrorCode = attributes.containsKey("minorErrorCode") ? MinorCode.fromValue(attributes
+ .get("minorErrorCode")) : null;
+ if (minorErrorCode == null || minorErrorCode == MinorCode.UNRECOGNIZED) {
+ vendorSpecificErrorCode = attributes.get("minorErrorCode");
+ }
+
+ return new ErrorImpl(attributes.get("message"), errorCode, minorErrorCode, vendorSpecificErrorCode, attributes
+ .get("stackTrace"));
+ }
+
+ public static void putReferenceType(Map<String, ReferenceType> map, Map<String, String> attributes) {
+ map.put(attributes.get("name"), newReferenceType(attributes));
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/util/VCloudUtils.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/util/VCloudUtils.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/util/VCloudUtils.java
new file mode 100644
index 0000000..67e2445
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/util/VCloudUtils.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.util;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Provider;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.VCloudError;
+import org.jclouds.vcloud.xml.ErrorHandler;
+
+/**
+ * Needed to sign and verify requests and responses.
+ */
+@Singleton
+public class VCloudUtils {
+ private final ParseSax.Factory factory;
+ private final Provider<ErrorHandler> errorHandlerProvider;
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ @Inject
+ VCloudUtils(Factory factory, Provider<ErrorHandler> errorHandlerProvider) {
+ this.factory = factory;
+ this.errorHandlerProvider = errorHandlerProvider;
+ }
+
+ public VCloudError parseErrorFromContent(HttpRequest request, HttpResponse response) {
+ // HEAD has no content
+ if (response.getPayload() == null)
+ return null;
+ // NOTE in vCloud Datacenter 1.5, if you make vCloud 1.0 requests, the content type
+ // header is suffixed with ;1.0
+ String contentType = response.getPayload().getContentMetadata().getContentType();
+ if (contentType != null && contentType.startsWith(VCloudMediaType.ERROR_XML)) {
+ try {
+ return factory.create(errorHandlerProvider.get()).setContext(request).apply(response);
+ } catch (RuntimeException e) {
+ logger.warn(e, "error parsing error");
+ }
+ }
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/CatalogHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/CatalogHandler.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/CatalogHandler.java
new file mode 100644
index 0000000..60bd01f
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/CatalogHandler.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.jclouds.vcloud.util.Utils.newReferenceType;
+import static org.jclouds.vcloud.util.Utils.putReferenceType;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Catalog;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.internal.CatalogImpl;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+public class CatalogHandler extends ParseSax.HandlerWithResult<Catalog> {
+
+ protected final TaskHandler taskHandler;
+
+ @Inject
+ public CatalogHandler(TaskHandler taskHandler) {
+ this.taskHandler = taskHandler;
+ }
+
+ private StringBuilder currentText = new StringBuilder();
+
+ private ReferenceType catalog;
+ private Map<String, ReferenceType> contents = Maps.newLinkedHashMap();
+ protected List<Task> tasks = Lists.newArrayList();
+ private String description;
+ private ReferenceType org;
+
+ private boolean published = true;
+ private boolean readOnly = true;
+
+ public Catalog getResult() {
+ return new CatalogImpl(catalog.getName(), catalog.getType(), catalog.getHref(), org, description, contents,
+ tasks, published, readOnly);
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (SaxUtils.equalsOrSuffix(qName, "Catalog")) {
+ catalog = newReferenceType(attributes, VCloudMediaType.CATALOG_XML);
+ } else if (SaxUtils.equalsOrSuffix(qName, "CatalogItem")) {
+ putReferenceType(contents, attributes);
+ } else if (SaxUtils.equalsOrSuffix(qName, "Link") && "up".equals(attributes.get("rel"))) {
+ org = newReferenceType(attributes);
+ } else if (SaxUtils.equalsOrSuffix(qName, "Link") && "add".equals(attributes.get("rel"))) {
+ readOnly = false;
+ } else {
+ taskHandler.startElement(uri, localName, qName, attrs);
+ }
+ }
+
+ public void endElement(String uri, String name, String qName) {
+ taskHandler.endElement(uri, name, qName);
+ if (SaxUtils.equalsOrSuffix(qName, "Task")) {
+ this.tasks.add(taskHandler.getResult());
+ } else if (SaxUtils.equalsOrSuffix(qName, "Description")) {
+ description = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "IsPublished")) {
+ published = Boolean.parseBoolean(currentOrNull());
+ }
+ currentText = new StringBuilder();
+ }
+
+ public void characters(char ch[], int start, int length) {
+ currentText.append(ch, start, length);
+ }
+
+ protected String currentOrNull() {
+ String returnVal = currentText.toString().trim();
+ return returnVal.equals("") ? null : returnVal;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/CatalogItemHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/CatalogItemHandler.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/CatalogItemHandler.java
new file mode 100644
index 0000000..926e8a8
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/CatalogItemHandler.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.jclouds.vcloud.util.Utils.newReferenceType;
+
+import java.util.Map;
+import java.util.SortedMap;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.internal.CatalogItemImpl;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+import com.google.common.collect.Maps;
+
+public class CatalogItemHandler extends ParseSax.HandlerWithResult<CatalogItem> {
+ private StringBuilder currentText = new StringBuilder();
+
+ protected ReferenceType catalogItem;
+ protected ReferenceType entity;
+
+ protected String description;
+ protected String key;
+ protected SortedMap<String, String> properties = Maps.newTreeMap();
+
+ public CatalogItem getResult() {
+ return new CatalogItemImpl(catalogItem.getName(), catalogItem.getHref(), description, entity, properties);
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (SaxUtils.equalsOrSuffix(qName, "CatalogItem")) {
+ catalogItem = newReferenceType(attributes);
+ } else if (SaxUtils.equalsOrSuffix(qName, "Entity")) {
+ entity = newReferenceType(attributes);
+ } else if (SaxUtils.equalsOrSuffix(qName, "Property")) {
+ key = attributes.get("key");
+ }
+ }
+
+ public void endElement(String uri, String name, String qName) {
+ if (SaxUtils.equalsOrSuffix(qName, "Description")) {
+ description = currentOrNull();
+ } else if (SaxUtils.equalsOrSuffix(qName, "Property")) {
+ properties.put(key, currentOrNull());
+ key = null;
+ }
+ currentText = new StringBuilder();
+ }
+
+ public void characters(char ch[], int start, int length) {
+ currentText.append(ch, start, length);
+ }
+
+ protected String currentOrNull() {
+ String returnVal = currentText.toString().trim();
+ return returnVal.equals("") ? null : returnVal;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/ErrorHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/ErrorHandler.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/ErrorHandler.java
new file mode 100644
index 0000000..3c4704a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/ErrorHandler.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import java.util.Map;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.VCloudError;
+import org.jclouds.vcloud.util.Utils;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class ErrorHandler extends ParseSax.HandlerWithResult<VCloudError> {
+ private VCloudError error;
+
+ public VCloudError getResult() {
+ return error;
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (SaxUtils.equalsOrSuffix(qName, "Error")) {
+ error = Utils.newError(attributes);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/GuestCustomizationSectionHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/GuestCustomizationSectionHandler.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/GuestCustomizationSectionHandler.java
new file mode 100644
index 0000000..3fb2227
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/GuestCustomizationSectionHandler.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.jclouds.vcloud.util.Utils.newReferenceType;
+
+import java.util.Map;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.GuestCustomizationSection;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.xml.sax.Attributes;
+
+public class GuestCustomizationSectionHandler extends ParseSax.HandlerWithResult<GuestCustomizationSection> {
+ protected StringBuilder currentText = new StringBuilder();
+ private ReferenceType guest;
+ private ReferenceType edit;
+
+ protected String info;
+ protected String name;
+ protected Boolean enabled;
+ protected Boolean changeSid;
+ protected String virtualMachineId;
+ protected Boolean joinDomainEnabled;
+ protected Boolean useOrgSettings;
+ protected String domainName;
+ protected String domainUserName;
+ protected String domainUserPassword;
+ protected Boolean adminPasswordEnabled;
+ protected Boolean adminPasswordAuto;
+ protected String adminPassword;
+ protected Boolean resetPasswordRequired;
+ protected String customizationScript;
+ protected String computerName;
+
+ public GuestCustomizationSection getResult() {
+ GuestCustomizationSection system = new GuestCustomizationSection(guest.getType(), guest.getHref(), info, enabled,
+ changeSid, virtualMachineId, joinDomainEnabled, useOrgSettings, domainName, domainUserName,
+ domainUserPassword, adminPasswordEnabled, adminPasswordAuto, adminPassword, resetPasswordRequired,
+ customizationScript, computerName, edit);
+ this.guest = null;
+ this.info = null;
+ this.edit = null;
+ this.enabled = null;
+ this.changeSid = null;
+ this.virtualMachineId = null;
+ this.joinDomainEnabled = null;
+ this.useOrgSettings = null;
+ this.domainName = null;
+ this.domainUserName = null;
+ this.domainUserPassword = null;
+ this.adminPasswordEnabled = null;
+ this.adminPasswordAuto = null;
+ this.adminPassword = null;
+ this.resetPasswordRequired = null;
+ this.customizationScript = null;
+ this.computerName = null;
+ return system;
+ }
+
+ public void startElement(String uri, String localName, String qName, Attributes attrs) {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ this.currentText = new StringBuilder();
+ if (qName.endsWith("GuestCustomizationSection")) {
+ guest = newReferenceType(attributes);
+ } else if (qName.endsWith("Link") && "edit".equals(attributes.get("rel"))) {
+ edit = newReferenceType(attributes);
+ }
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) {
+ if (qName.endsWith("Info")) {
+ this.info = currentOrNull();
+ } else if (qName.endsWith("AdminPasswordEnabled")) {
+ this.adminPasswordEnabled = Boolean.parseBoolean(currentOrNull());
+ } else if (qName.endsWith("JoinDomainEnabled")) {
+ this.joinDomainEnabled = Boolean.parseBoolean(currentOrNull());
+ } else if (qName.endsWith("Enabled")) {
+ this.enabled = Boolean.parseBoolean(currentOrNull());
+ } else if (qName.endsWith("ChangeSid")) {
+ this.changeSid = Boolean.parseBoolean(currentOrNull());
+ } else if (qName.endsWith("VirtualMachineId")) {
+ this.virtualMachineId = currentOrNull();
+ } else if (qName.endsWith("UseOrgSettings")) {
+ this.useOrgSettings = Boolean.parseBoolean(currentOrNull());
+ } else if (qName.endsWith("DomainName")) {
+ this.domainName = currentOrNull();
+ } else if (qName.endsWith("DomainUserName")) {
+ this.domainUserName = currentOrNull();
+ } else if (qName.endsWith("DomainUserPassword")) {
+ this.domainUserPassword = currentOrNull();
+ } else if (qName.endsWith("AdminPasswordAuto")) {
+ this.adminPasswordAuto = Boolean.parseBoolean(currentOrNull());
+ } else if (qName.endsWith("AdminPassword")) {
+ this.adminPassword = currentOrNull();
+ } else if (qName.endsWith("ResetPasswordRequired")) {
+ this.resetPasswordRequired = Boolean.parseBoolean(currentOrNull());
+ } else if (qName.endsWith("CustomizationScript")) {
+ this.customizationScript = currentOrNull();
+ if (this.customizationScript != null)
+ customizationScript = customizationScript.replace(">", ">");
+ } else if (qName.endsWith("ComputerName")) {
+ this.computerName = currentOrNull();
+ } else if (qName.endsWith("Name")) {
+ this.name = currentOrNull();
+ }
+ currentText = new StringBuilder();
+ }
+
+ public void characters(char ch[], int start, int length) {
+ currentText.append(ch, start, length);
+ }
+
+ protected String currentOrNull() {
+ String returnVal = currentText.toString();
+ return returnVal.equals("") ? null : returnVal;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/NetworkConnectionHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/NetworkConnectionHandler.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/NetworkConnectionHandler.java
new file mode 100644
index 0000000..aefb753
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/NetworkConnectionHandler.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import java.util.Map;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.NetworkConnection;
+import org.jclouds.vcloud.domain.network.IpAddressAllocationMode;
+import org.xml.sax.Attributes;
+
+public class NetworkConnectionHandler extends ParseSax.HandlerWithResult<NetworkConnection> {
+ protected StringBuilder currentText = new StringBuilder();
+
+ protected String network;
+ protected int networkConnectionIndex;
+ protected String ipAddress;
+ protected String externalIpAddress;
+ protected boolean connected;
+ protected String MACAddress;
+ protected IpAddressAllocationMode ipAddressAllocationMode;
+
+ public NetworkConnection getResult() {
+ NetworkConnection connection = new NetworkConnection(network, networkConnectionIndex, ipAddress,
+ externalIpAddress, connected, MACAddress, ipAddressAllocationMode);
+ this.network = null;
+ this.networkConnectionIndex = -1;
+ this.ipAddress = null;
+ this.externalIpAddress = null;
+ this.connected = false;
+ this.MACAddress = null;
+ this.ipAddressAllocationMode = null;
+ return connection;
+ }
+
+ public void startElement(String uri, String localName, String qName, Attributes attrs) {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (qName.endsWith("NetworkConnection")) {
+ network = attributes.get("network");
+ }
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) {
+ if (qName.endsWith("NetworkConnectionIndex")) {
+ this.networkConnectionIndex = Integer.parseInt(currentOrNull());
+ } else if (qName.endsWith("IpAddress")) {
+ this.ipAddress = currentOrNull();
+ } else if (qName.endsWith("ExternalIpAddress")) {
+ this.externalIpAddress = currentOrNull();
+ } else if (qName.endsWith("IsConnected")) {
+ this.connected = Boolean.parseBoolean(currentOrNull());
+ } else if (qName.endsWith("MACAddress")) {
+ this.MACAddress = currentOrNull();
+ } else if (qName.endsWith("IpAddressAllocationMode")) {
+ this.ipAddressAllocationMode = IpAddressAllocationMode.valueOf(currentOrNull());
+ }
+ currentText = new StringBuilder();
+ }
+
+ public void characters(char ch[], int start, int length) {
+ currentText.append(ch, start, length);
+ }
+
+ protected String currentOrNull() {
+ String returnVal = currentText.toString().trim();
+ return returnVal.equals("") ? null : returnVal;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/NetworkConnectionSectionHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/NetworkConnectionSectionHandler.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/NetworkConnectionSectionHandler.java
new file mode 100644
index 0000000..e8d4c74
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/NetworkConnectionSectionHandler.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.jclouds.vcloud.util.Utils.newReferenceType;
+
+import java.util.Map;
+import java.util.Set;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.NetworkConnection;
+import org.jclouds.vcloud.domain.NetworkConnectionSection;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.xml.sax.Attributes;
+
+import com.google.common.collect.Sets;
+
+public class NetworkConnectionSectionHandler extends ParseSax.HandlerWithResult<NetworkConnectionSection> {
+ protected StringBuilder currentText = new StringBuilder();
+
+ private final NetworkConnectionHandler networkConnectionHandler;
+
+ @Inject
+ public NetworkConnectionSectionHandler(NetworkConnectionHandler networkConnectionHandler) {
+ this.networkConnectionHandler = networkConnectionHandler;
+ }
+
+ protected String info;
+ protected Set<NetworkConnection> connections = Sets.newLinkedHashSet();
+ protected ReferenceType section;
+ protected ReferenceType edit;
+ protected Integer primaryNetworkConnectionIndex;
+ protected boolean inConnections;
+
+ public NetworkConnectionSection getResult() {
+ return new NetworkConnectionSection(section.getType(), section.getHref(), info, primaryNetworkConnectionIndex,
+ connections, edit);
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (qName.endsWith("NetworkConnection")) {
+ inConnections = true;
+ }
+ if (inConnections) {
+ networkConnectionHandler.startElement(uri, localName, qName, attrs);
+ } else if (qName.endsWith("NetworkConnectionSection")) {
+ section = newReferenceType(attributes);
+ } else if (qName.endsWith("Link") && "edit".equals(attributes.get("rel"))) {
+ edit = newReferenceType(attributes);
+ }
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String qName) {
+ if (qName.endsWith("NetworkConnection")) {
+ inConnections = false;
+ connections.add(networkConnectionHandler.getResult());
+ }
+ if (inConnections) {
+ networkConnectionHandler.endElement(uri, localName, qName);
+ } else if (qName.endsWith("Info")) {
+ this.info = currentOrNull();
+ } else if (qName.endsWith("PrimaryNetworkConnectionIndex")) {
+ this.primaryNetworkConnectionIndex = Integer.valueOf(currentOrNull());
+ }
+ currentText = new StringBuilder();
+ }
+
+ @Override
+ public void characters(char ch[], int start, int length) {
+ if (inConnections)
+ networkConnectionHandler.characters(ch, start, length);
+ else
+ currentText.append(ch, start, length);
+ }
+
+ protected String currentOrNull() {
+ String returnVal = currentText.toString().trim();
+ return returnVal.equals("") ? null : returnVal;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/OrgHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/OrgHandler.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/OrgHandler.java
new file mode 100644
index 0000000..1892e30
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/OrgHandler.java
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.jclouds.vcloud.util.Utils.newReferenceType;
+import static org.jclouds.vcloud.util.Utils.putReferenceType;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.internal.OrgImpl;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+public class OrgHandler extends ParseSax.HandlerWithResult<Org> {
+
+ protected final TaskHandler taskHandler;
+
+ @Inject
+ public OrgHandler(TaskHandler taskHandler) {
+ this.taskHandler = taskHandler;
+ }
+
+ private StringBuilder currentText = new StringBuilder();
+
+ protected ReferenceType org;
+ protected Map<String, ReferenceType> vdcs = Maps.newLinkedHashMap();
+ protected ReferenceType tasksList;
+ protected Map<String, ReferenceType> catalogs = Maps.newLinkedHashMap();
+ protected Map<String, ReferenceType> networks = Maps.newLinkedHashMap();
+ protected List<Task> tasks = Lists.newArrayList();
+
+ protected String description;
+ protected String fullName;
+
+ public Org getResult() {
+ return new OrgImpl(org.getName(), org.getType(), org.getHref(), fullName != null ? fullName : org.getName(),
+ description, catalogs, vdcs, networks, tasksList, tasks);
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (qName.endsWith("Org")) {
+ org = newReferenceType(attributes);
+ } else if (qName.endsWith("Link")) {
+ String type = attributes.get("type");
+ if (type != null) {
+ if (type.indexOf("vdc+xml") != -1) {
+ putReferenceType(vdcs, attributes);
+ } else if (type.indexOf("catalog+xml") != -1) {
+ putReferenceType(catalogs, attributes);
+ } else if (type.indexOf("tasksList+xml") != -1) {
+ tasksList = newReferenceType(attributes);
+ } else if (type.indexOf("network+xml") != -1) {
+ putReferenceType(networks, attributes);
+ }
+ }
+ } else {
+ taskHandler.startElement(uri, localName, qName, attrs);
+ }
+
+ }
+
+ public void endElement(String uri, String name, String qName) {
+ taskHandler.endElement(uri, name, qName);
+ if (qName.endsWith("Task")) {
+ this.tasks.add(taskHandler.getResult());
+ } else if (qName.endsWith("Description")) {
+ description = currentOrNull();
+ } else if (qName.endsWith("FullName")) {
+ fullName = currentOrNull();
+ }
+ currentText = new StringBuilder();
+ }
+
+ public void characters(char ch[], int start, int length) {
+ currentText.append(ch, start, length);
+ }
+
+ protected String currentOrNull() {
+ String returnVal = currentText.toString().trim();
+ return returnVal.equals("") ? null : returnVal;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/OrgListHandler.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/OrgListHandler.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/OrgListHandler.java
new file mode 100644
index 0000000..5176165
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/xml/OrgListHandler.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.jclouds.vcloud.util.Utils.putReferenceType;
+
+import java.util.Map;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.util.SaxUtils;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+import com.google.common.collect.Maps;
+
+public class OrgListHandler extends ParseSax.HandlerWithResult<Map<String, ReferenceType>> {
+
+ private Map<String, ReferenceType> org = Maps.newHashMap();
+
+ public Map<String, ReferenceType> getResult() {
+ return org;
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+ Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
+ if (qName.endsWith("Link") || qName.endsWith("Org")) {
+ String type = attributes.get("type");
+ if (type != null) {
+ if (type.indexOf("org+xml") != -1) {
+ putReferenceType(org, attributes);
+ }
+ }
+ }
+ }
+}
[13/18] stratos git commit: Jclouds vcloud api 1.8.1 clone with
custom changes
Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/DhcpService.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/DhcpService.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/DhcpService.java
new file mode 100644
index 0000000..628a7d1
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/DhcpService.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.network;
+
+import static com.google.common.base.Objects.equal;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+
+/**
+ * specifies the properties of the network’s DHCP service
+ */
+public class DhcpService {
+ private final boolean enabled;
+ @Nullable
+ private final Integer defaultLeaseTime;
+ @Nullable
+ private final Integer maxLeaseTime;
+ @Nullable
+ private final IpRange ipRange;
+
+ public DhcpService(boolean enabled, @Nullable Integer defaultLeaseTime, @Nullable Integer maxLeaseTime,
+ @Nullable IpRange ipRange) {
+ this.enabled = enabled;
+ this.defaultLeaseTime = defaultLeaseTime;
+ this.maxLeaseTime = maxLeaseTime;
+ this.ipRange = ipRange;
+ }
+
+ /**
+ * @return true if the service is enabled
+ *
+ * @since vcloud api 0.8
+ */
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ /**
+ * default duration of a DHCP address lease
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public Integer getDefaultLeaseTime() {
+ return defaultLeaseTime;
+ }
+
+ /**
+ * maximum duration of a DHCP address lease.
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public Integer getMaxLeaseTime() {
+ return maxLeaseTime;
+ }
+
+ /**
+ * @return range of IP addresses available to DHCP clients
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public IpRange getIpRange() {
+ return ipRange;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ DhcpService that = DhcpService.class.cast(o);
+ return equal(this.enabled, that.enabled) && equal(this.defaultLeaseTime, that.defaultLeaseTime)
+ && equal(this.maxLeaseTime, that.maxLeaseTime) && equal(this.ipRange, that.ipRange);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(enabled, defaultLeaseTime, maxLeaseTime, ipRange);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("enabled", enabled)
+ .add("defaultLeaseTime", defaultLeaseTime).add("maxLeaseTime", maxLeaseTime).add("ipRange", ipRange)
+ .toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/Features.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/Features.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/Features.java
new file mode 100644
index 0000000..24eb38e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/Features.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.network;
+
+import static com.google.common.base.Objects.equal;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+
+/**
+ * The Features element defines the DHCP and firewall features of a network.
+ */
+public class Features {
+ @Nullable
+ private final DhcpService dhcpService;
+ @Nullable
+ private final FirewallService firewallService;
+ @Nullable
+ private final NatService natService;
+
+ public Features(@Nullable DhcpService dhcpService, @Nullable FirewallService firewallService,
+ @Nullable NatService natService) {
+ this.dhcpService = dhcpService;
+ this.firewallService = firewallService;
+ this.natService = natService;
+ }
+
+ /**
+ * specifies the properties of the network’s DHCP service
+ *
+ * @since vcloud api 0.9, but emulated for 0.8
+ */
+ @Nullable
+ public DhcpService getDhcpService() {
+ return dhcpService;
+ }
+
+ /**
+ * defines the firewall service capabilities of the network
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ public FirewallService getFirewallService() {
+ return firewallService;
+ }
+
+ /**
+ * defines the NAT service capabilities of the network
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ public NatService getNatService() {
+ return natService;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ Features that = Features.class.cast(o);
+ return equal(this.dhcpService, that.dhcpService) && equal(this.firewallService, that.firewallService)
+ && equal(this.natService, that.natService);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(dhcpService, firewallService, natService);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("dhcpService", dhcpService)
+ .add("firewallService", firewallService).add("natService", natService).toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/FenceMode.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/FenceMode.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/FenceMode.java
new file mode 100644
index 0000000..a531b0d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/FenceMode.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.network;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.CaseFormat;
+
+/**
+ *
+ * The FenceMode element contains one of the following strings that specify how a network is
+ * connected to its parent network.
+ */
+public enum FenceMode {
+ /**
+ * The two networks are bridged.
+ * <p/>
+ * Note that in vcloud 0.8 this was called ALLOW_IN_OUT, and so our implementation automatically
+ * converts this for you. Use bridged instead of allowInOut.
+ *
+ * @since vcloud api 0.9
+ */
+ BRIDGED,
+ /**
+ * The two networks are not connected.
+ *
+ * @since vcloud api 0.8
+ */
+ ISOLATED,
+ /**
+ * The two networks are connected as specified in their NatService elements.
+ *
+ * @since vcloud api 0.8
+ */
+ NAT_ROUTED, UNRECOGNIZED;
+
+ public String value() {
+ return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name());
+ }
+
+ @Override
+ public String toString() {
+ return value();
+ }
+
+ public static FenceMode fromValue(String fenceMode) {
+ try {
+ return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(fenceMode, "fenceMode")));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/FirewallService.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/FirewallService.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/FirewallService.java
new file mode 100644
index 0000000..63212b2
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/FirewallService.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.network;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.List;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.network.firewall.FirewallRule;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
+/**
+ * The FirewallService element defines the firewall service capabilities of a network.
+ */
+public class FirewallService {
+ private final boolean enabled;
+
+ List<FirewallRule> firewallRules = Lists.newArrayList();
+
+ public FirewallService(boolean enabled, Iterable<FirewallRule> firewallRules) {
+ this.enabled = enabled;
+ Iterables.addAll(this.firewallRules, checkNotNull(firewallRules, "firewallRules"));
+ }
+
+ /**
+ * @return Firewall rules for the network
+ *
+ * @since vcloud api 0.8
+ */
+ public List<FirewallRule> getFirewallRules() {
+ return firewallRules;
+ }
+
+ /**
+ * @return true if the service is enabled
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ FirewallService that = FirewallService.class.cast(o);
+ return equal(this.enabled, that.enabled) && equal(this.firewallRules, that.firewallRules);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(enabled, firewallRules);
+ }
+
+ @Override
+ public String toString() {
+ ToStringHelper helper = Objects.toStringHelper("").omitNullValues().add("enabled", enabled);
+ if (firewallRules.size() > 0)
+ helper.add("firewallRules", firewallRules);
+ return helper.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpAddressAllocationMode.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpAddressAllocationMode.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpAddressAllocationMode.java
new file mode 100644
index 0000000..2b32691
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpAddressAllocationMode.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.network;
+
+
+/**
+ *
+ * The IpAddressAllocationMode element specifies how an IP address is allocated to this connection.
+ */
+public enum IpAddressAllocationMode {
+ /**
+ * no IP addressing mode specified
+ *
+ * @since vcloud api 1.0
+ */
+ NONE,
+ /**
+ * static IP address assigned manually
+ *
+ * @since vcloud api 1.0
+ */
+ MANUAL,
+ /**
+ * static IP address allocated from a pool
+ *
+ * @since vcloud api 1.0
+ */
+ POOL,
+ /**
+ * IP address assigned by DHCP
+ *
+ * @since vcloud api 1.0
+ */
+ DHCP;
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpRange.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpRange.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpRange.java
new file mode 100644
index 0000000..180d13d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpRange.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.network;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.Objects;
+
+/**
+ * The IpRange element defines a range of IP addresses available on a network.
+ */
+public class IpRange {
+ private final String startAddress;
+ private final String endAddress;
+
+ public IpRange(String startAddress, String endAddress) {
+ this.startAddress = checkNotNull(startAddress, "startAddress");
+ this.endAddress = checkNotNull(endAddress, "endAddress");
+ }
+
+ /**
+ * @return lowest IP address in the range
+ *
+ * @since vcloud api 0.9
+ */
+ public String getStartAddress() {
+ return startAddress;
+ }
+
+ /**
+ * @return highest IP address in the range
+ *
+ * @since vcloud api 0.9
+ */
+ public String getEndAddress() {
+ return endAddress;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ IpRange that = IpRange.class.cast(o);
+ return equal(this.startAddress, that.startAddress) && equal(this.endAddress, that.endAddress);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(startAddress, endAddress);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("startAddress", startAddress)
+ .add("endAddress", endAddress).toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpScope.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpScope.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpScope.java
new file mode 100644
index 0000000..e5af063
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/IpScope.java
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.network;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Set;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Sets;
+
+/**
+ * The IpScope element defines the address range, gateway, netmask, and other properties of the
+ * network.
+ */
+public class IpScope {
+ private final boolean inherited;
+ @Nullable
+ private final String gateway;
+ @Nullable
+ private final String netmask;
+ @Nullable
+ private final String dns1;
+ @Nullable
+ private final String dns2;
+ @Nullable
+ private final String dnsSuffix;
+ private final Set<IpRange> ipRanges = Sets.newLinkedHashSet();
+ private final Set<String> allocatedIpAddresses = Sets.newLinkedHashSet();
+
+ public IpScope(boolean inherited, @Nullable String gateway, @Nullable String netmask, @Nullable String dns1,
+ @Nullable String dns2, @Nullable String dnsSuffix, Iterable<IpRange> ipRanges,
+ Iterable<String> allocatedIpAddresses) {
+ this.inherited = inherited;
+ this.gateway = gateway;
+ this.netmask = netmask;
+ this.dns1 = dns1;
+ this.dns2 = dns2;
+ this.dnsSuffix = dnsSuffix;
+ Iterables.addAll(this.ipRanges, checkNotNull(ipRanges, "ipRanges"));
+ Iterables.addAll(this.allocatedIpAddresses, checkNotNull(allocatedIpAddresses, "allocatedIpAddresses"));
+ }
+
+ /**
+ * @return true of the values in this IpScope element are inherited from the ParentNetwork of the
+ * containing Configuration
+ * @since vcloud api 0.9
+ */
+ public boolean isInherited() {
+ return inherited;
+ }
+
+ /**
+ * @return IP address of the network gateway
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ public String getGateway() {
+ return gateway;
+ }
+
+ /**
+ * @return netmask to apply to addresses on the network
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ public String getNetmask() {
+ return netmask;
+ }
+
+ /**
+ * @return IP address of the primary DNS server for this network
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public String getDns1() {
+ return dns1;
+ }
+
+ /**
+ * @return IP address of the secondary DNS server for this network
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public String getDns2() {
+ return dns2;
+ }
+
+ /**
+ * @return suffix to be applied when resolving hostnames that are not fully‐qualified.
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public String getDnsSuffix() {
+ return dnsSuffix;
+ }
+
+ /**
+ * @return A container for IpRange elements.
+ *
+ * @since vcloud api 0.9
+ */
+ public Set<IpRange> getIpRanges() {
+ return ipRanges;
+ }
+
+ /**
+ * @return A list of addresses allocated from any of the specified IpRanges
+ *
+ * @since vcloud api 0.9
+ */
+ public Set<String> getAllocatedIpAddresses() {
+ return allocatedIpAddresses;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ IpScope that = IpScope.class.cast(o);
+ return equal(this.inherited, that.inherited) && equal(this.gateway, that.gateway)
+ && equal(this.netmask, that.netmask) && equal(this.dns1, that.dns1) && equal(this.dns2, that.dns2)
+ && equal(this.dnsSuffix, that.dnsSuffix)
+ && equal(this.ipRanges, that.ipRanges)
+ && equal(this.allocatedIpAddresses, that.allocatedIpAddresses);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(inherited, gateway, netmask, dns1, dns2, dnsSuffix, ipRanges, allocatedIpAddresses);
+ }
+
+ @Override
+ public String toString() {
+ ToStringHelper helper = Objects.toStringHelper("").omitNullValues().add("inherited", inherited).add("gateway", gateway)
+ .add("netmask", netmask).add("dns1", dns1).add("dns2", dns2).add("dnsSuffix", dnsSuffix);
+ if (ipRanges.size() > 0)
+ helper.add("ipRanges", ipRanges);
+ if (allocatedIpAddresses.size() > 0)
+ helper.add("allocatedIpAddresses", allocatedIpAddresses);
+ return helper.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/NatService.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/NatService.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/NatService.java
new file mode 100644
index 0000000..ea4c388
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/NatService.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.network;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.List;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.network.nat.NatPolicy;
+import org.jclouds.vcloud.domain.network.nat.NatRule;
+import org.jclouds.vcloud.domain.network.nat.NatType;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
+/**
+ * The NatService element defines the network address translation capabilities of a network.
+ */
+public class NatService {
+ private final boolean enabled;
+ @Nullable
+ private final NatType type;
+ @Nullable
+ private final NatPolicy policy;
+ private final List<NatRule> natRules = Lists.newArrayList();
+
+ public NatService(boolean enabled, @Nullable NatType type, @Nullable NatPolicy policy,
+ Iterable<NatRule> natRules) {
+ this.enabled = enabled;
+ this.type = type;
+ this.policy = policy;
+ Iterables.addAll(this.natRules, checkNotNull(natRules, "natRules"));
+ }
+
+ /**
+ * @return Nat rules for the network
+ *
+ * @since vcloud api 0.8
+ */
+ public List<NatRule> getNatRules() {
+ return natRules;
+ }
+
+ /**
+ * @return true if the service is enabled
+ *
+ * @since vcloud api 0.9
+ */
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ /**
+ * @return specifies how Network Address Translation is implemented by the NAT service
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public NatType getType() {
+ return type;
+ }
+
+ /**
+ * @return specifies how packets are handled by the NAT service.
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ public NatPolicy getPolicy() {
+ return policy;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ NatService that = NatService.class.cast(o);
+ return equal(this.enabled, that.enabled) && equal(this.type, that.type)
+ && equal(this.policy, that.policy) && equal(this.natRules, that.natRules);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(enabled, type, policy, natRules);
+ }
+
+ @Override
+ public String toString() {
+ ToStringHelper helper = Objects.toStringHelper("").omitNullValues().add("enabled", enabled)
+ .add("type", type).add("policy", policy);
+ if (natRules.size() > 0)
+ helper.add("natRules", natRules);
+ return helper.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/NetworkConfig.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/NetworkConfig.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/NetworkConfig.java
new file mode 100644
index 0000000..79e6461
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/NetworkConfig.java
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.network;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+
+import org.jclouds.javax.annotation.Nullable;
+
+public class NetworkConfig {
+
+ public Builder toBuilder() {
+ return builder().fromNetworkConfig(this);
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static class Builder {
+ private String networkName;
+ private URI parentNetwork;
+ private FenceMode fenceMode;
+
+ public Builder networkName(String networkName) {
+ this.networkName = networkName;
+ return this;
+ }
+
+ public Builder parentNetwork(URI parentNetwork) {
+ this.parentNetwork = parentNetwork;
+ return this;
+ }
+
+ public Builder fenceMode(FenceMode fenceMode) {
+ this.fenceMode = fenceMode;
+ return this;
+ }
+
+ public Builder fromNetworkConfig(NetworkConfig in) {
+ return networkName(in.getNetworkName()).parentNetwork(in.getParentNetwork()).fenceMode(in.getFenceMode());
+ }
+
+ public NetworkConfig build() {
+ return new NetworkConfig(networkName, parentNetwork, fenceMode);
+ }
+ }
+
+ @Nullable
+ private final String networkName;
+ private final URI parentNetwork;
+ @Nullable
+ private final FenceMode fenceMode;
+
+ /**
+ *
+ * Create a new NetworkConfig.
+ *
+ * @param networkName
+ * a valid {@networkConfig
+ * org.jclouds.vcloud.domain.VAppTemplate#getNetworkSection network in the vapp
+ * template}, or null to have us choose default
+ * @param parentNetwork
+ * a valid {@networkConfig org.jclouds.vcloud.domain.Org#getNetworks in
+ * the Org}
+ * @param fenceMode
+ * how to manage the relationship between the two networks
+ */
+ public NetworkConfig(String networkName, URI parentNetwork, FenceMode fenceMode) {
+ this.networkName = networkName;
+ this.parentNetwork = checkNotNull(parentNetwork, "parentNetwork");
+ this.fenceMode = fenceMode;
+ }
+
+ public NetworkConfig(URI parentNetwork) {
+ this(null, parentNetwork, null);
+ }
+
+ /**
+ * A name for the network. If the
+ * {@link org.jclouds.vcloud.domain.VAppTemplate#getNetworkSection} includes a
+ * {@link NetworkSection.Network} network element, the name you specify for the vApp network must
+ * match the name specified in that element’s name attribute.
+ *
+ * @return
+ */
+ public String getNetworkName() {
+ return networkName;
+ }
+
+ /**
+ *
+ * @return A reference to the organization network to which this network connects.
+ */
+ public URI getParentNetwork() {
+ return parentNetwork;
+ }
+
+ /**
+ * A value of bridged indicates that this vApp network is connected directly to the organization
+ * network.
+ */
+ public FenceMode getFenceMode() {
+ return fenceMode;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((fenceMode == null) ? 0 : fenceMode.hashCode());
+ result = prime * result + ((parentNetwork == null) ? 0 : parentNetwork.hashCode());
+ result = prime * result + ((networkName == null) ? 0 : networkName.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ NetworkConfig other = (NetworkConfig) obj;
+ if (fenceMode == null) {
+ if (other.fenceMode != null)
+ return false;
+ } else if (!fenceMode.equals(other.fenceMode))
+ return false;
+ if (parentNetwork == null) {
+ if (other.parentNetwork != null)
+ return false;
+ } else if (!parentNetwork.equals(other.parentNetwork))
+ return false;
+ if (networkName == null) {
+ if (other.networkName != null)
+ return false;
+ } else if (!networkName.equals(other.networkName))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "[networkName=" + networkName + ", parentNetwork=" + parentNetwork + ", fenceMode=" + fenceMode + "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/OrgNetwork.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/OrgNetwork.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/OrgNetwork.java
new file mode 100644
index 0000000..f50d18c
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/OrgNetwork.java
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.network;
+
+import java.util.List;
+import java.util.Set;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.network.internal.OrgNetworkImpl;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * A vDC is a deployment environment for vApps. A Vdc element provides a user view of a vDC.
+ */
+@org.jclouds.vcloud.endpoints.Network
+@ImplementedBy(OrgNetworkImpl.class)
+public interface OrgNetwork extends ReferenceType {
+ /**
+ * The org this network belongs to.
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ ReferenceType getOrg();
+
+ /**
+ * optional description
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ String getDescription();
+
+ /**
+ * read‐only container for Task elements. Each element in the container represents a queued,
+ * running, or failed task owned by this object.
+ *
+ * @since vcloud api 0.9
+ */
+ List<Task> getTasks();
+
+ /**
+ *
+ * @return properties of the network
+ *
+ * @since vcloud api 0.9, but emulated for 0.8
+ */
+ Configuration getConfiguration();
+
+ /**
+ * A reference the network pool from which this network is provisioned. This element, which is
+ * required when creating a NatRouted or Isolated network, is returned in response to a creation
+ * request but not shown in subsequent GET requests.
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ ReferenceType getNetworkPool();
+
+ /**
+ * list of external IP addresses that this network can use for NAT.
+ *
+ * @since vcloud api 0.9
+ */
+ Set<String> getAllowedExternalIpAddresses();
+
+ /**
+ * The Configuration element specifies properties of a network.
+ */
+ interface Configuration {
+ /**
+ * defines the address range, gateway, netmask, and other properties of the network.
+ *
+ * @since vcloud api 0.9, but emulated for 0.8
+ */
+ @Nullable
+ IpScope getIpScope();
+
+ /**
+ * reference to a network to which this network connects
+ *
+ * @since vcloud api 0.9
+ */
+ @Nullable
+ ReferenceType getParentNetwork();
+
+ /**
+ * defines how this network is connected to its ParentNetwork
+ *
+ * @since vcloud api 0.8
+ */
+ FenceMode getFenceMode();
+
+ /**
+ * defines a set of network features.
+ *
+ * @since vcloud api 0.9, but emulated for 0.8
+ */
+ @Nullable Features getFeatures();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallPolicy.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallPolicy.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallPolicy.java
new file mode 100644
index 0000000..44a5e81
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallPolicy.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.network.firewall;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.CaseFormat;
+
+/**
+ * specifies how packets are handled by the firewall
+ */
+public enum FirewallPolicy {
+ /**
+ * drop packets of this type
+ */
+ DROP,
+ /**
+ * allow packets of this type to pass through the firewall
+ */
+ ALLOW, UNRECOGNIZED;
+
+ public String value() {
+ return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name());
+ }
+
+ @Override
+ public String toString() {
+ return value();
+ }
+
+ public static FirewallPolicy fromValue(String policy) {
+ try {
+ return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(policy, "policy")));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallProtocols.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallProtocols.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallProtocols.java
new file mode 100644
index 0000000..8b09dc2
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallProtocols.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.network.firewall;
+
+import static com.google.common.base.Objects.equal;
+
+import com.google.common.base.Objects;
+
+/**
+ * The Protocols element specifies the protocols to which firewall rules apply.
+ *
+ * @since vcloud api 0.9 emulated for 0.8
+ */
+public class FirewallProtocols {
+ private final boolean tcp;
+ private final boolean udp;
+
+ public FirewallProtocols(boolean tcp, boolean udp) {
+ this.tcp = tcp;
+ this.udp = udp;
+ }
+
+ /**
+ * @return true if the firewall rules apply to the TCP protocol
+ */
+ public boolean isTcp() {
+ return tcp;
+ }
+
+ /**
+ * @return true if the firewall rules apply to the UDP protocol
+ */
+ public boolean isUdp() {
+ return udp;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ FirewallProtocols that = FirewallProtocols.class.cast(o);
+ return equal(this.tcp, that.tcp) && equal(this.udp, that.udp);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(tcp, udp);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("tcp", tcp).add("udp", udp).toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallRule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallRule.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallRule.java
new file mode 100644
index 0000000..dfb578b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/firewall/FirewallRule.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.network.firewall;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+
+/**
+ * The FirewallRule element defines a single firewall rule.
+ *
+ * @since vcloud api 0.8
+ */
+public class FirewallRule {
+
+ private final boolean enabled;
+ @Nullable
+ private final String description;
+ @Nullable
+ private final FirewallPolicy policy;
+ @Nullable
+ private final FirewallProtocols protocols;
+ private final int port;
+ private final String destinationIp;
+
+ public FirewallRule(boolean enabled, @Nullable String description, @Nullable FirewallPolicy policy,
+ @Nullable FirewallProtocols protocols, int port, String destinationIp) {
+ this.enabled = enabled;
+ this.description = description;
+ this.policy = policy;
+ this.protocols = protocols;
+ this.port = port;
+ this.destinationIp = checkNotNull(destinationIp, "destinationIp");
+ }
+
+ /**
+ * @return true if the rule is enabled
+ */
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ /**
+ * @return description of the rule
+ */
+ @Nullable
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @return specifies how packets are handled by the firewall
+ */
+ @Nullable
+ public FirewallPolicy getPolicy() {
+ return policy;
+ }
+
+ /**
+ * @return specifies the protocols to which this firewall rule applies
+ */
+ @Nullable
+ public FirewallProtocols getProtocols() {
+ return protocols;
+ }
+
+ /**
+ * @return specifies the network port to which this firewall rule applies. A value of ‐1 matches
+ * any port.
+ */
+ public int getPort() {
+ return port;
+ }
+
+ /**
+ * @return specifies the destination IP address, inside the firewall, to which this firewall rule
+ * applies
+ */
+ public String getDestinationIp() {
+ return destinationIp;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ FirewallRule that = FirewallRule.class.cast(o);
+ return equal(this.enabled, that.enabled) && equal(this.description, that.description)
+ && equal(this.policy, that.policy) && equal(this.protocols, that.protocols) && equal(this.port, that.port)
+ && equal(this.destinationIp, that.destinationIp);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(enabled, description, policy, protocols, port, destinationIp);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("enabled", enabled).add("description", description)
+ .add("policy", policy).add("protocols", protocols).add("port", port).add("destinationIp", destinationIp)
+ .toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/internal/OrgNetworkImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/internal/OrgNetworkImpl.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/internal/OrgNetworkImpl.java
new file mode 100644
index 0000000..76a394f
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/internal/OrgNetworkImpl.java
@@ -0,0 +1,198 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.network.internal;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Set;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.domain.network.Features;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.domain.network.IpScope;
+import org.jclouds.vcloud.domain.network.OrgNetwork;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+public class OrgNetworkImpl extends ReferenceTypeImpl implements OrgNetwork {
+ @Nullable
+ private final ReferenceType org;
+ @Nullable
+ private final String description;
+ private final List<Task> tasks = Lists.newArrayList();
+ private final Configuration configuration;
+ @Nullable
+ private final ReferenceType networkPool;
+ private final Set<String> allowedExternalIpAddresses = Sets.newLinkedHashSet();
+
+ public OrgNetworkImpl(String name, String type, URI id, @Nullable ReferenceType org, @Nullable String description,
+ Iterable<Task> tasks, Configuration configuration, @Nullable ReferenceType networkPool,
+ Iterable<String> allowedExternalIpAddresses) {
+ super(name, type, id);
+ this.org = org;
+ this.description = description;
+ Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
+ this.configuration = checkNotNull(configuration, "configuration");
+ this.networkPool = networkPool;
+ Iterables.addAll(this.allowedExternalIpAddresses, checkNotNull(allowedExternalIpAddresses,
+ "allowedExternalIpAddresses"));
+ }
+
+ public static class ConfigurationImpl implements Configuration {
+
+ @Nullable
+ private final IpScope ipScope;
+ @Nullable
+ private final ReferenceType parentNetwork;
+ private final FenceMode fenceMode;
+ private final Features features;
+
+ public ConfigurationImpl(@Nullable IpScope ipScope, @Nullable ReferenceType parentNetwork, FenceMode fenceMode,
+ @Nullable Features features) {
+ this.ipScope = ipScope;
+ this.parentNetwork = parentNetwork;
+ this.fenceMode = checkNotNull(fenceMode, "fenceMode");
+ this.features = features;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IpScope getIpScope() {
+ return ipScope;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ReferenceType getParentNetwork() {
+ return parentNetwork;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public FenceMode getFenceMode() {
+ return fenceMode;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @Nullable
+ public Features getFeatures() {
+ return features;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ ConfigurationImpl that = ConfigurationImpl.class.cast(o);
+ return equal(this.ipScope, that.ipScope) && equal(this.parentNetwork, that.parentNetwork)
+ && equal(this.fenceMode, that.fenceMode) && equal(this.features, that.features);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(ipScope, parentNetwork, fenceMode, features);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("ipScope", ipScope).add("parentNetwork", parentNetwork)
+ .add("fenceMode", fenceMode).add("features", features).toString();
+ }
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ReferenceType getOrg() {
+ return org;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<Task> getTasks() {
+ return tasks;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Configuration getConfiguration() {
+ return configuration;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ReferenceType getNetworkPool() {
+ return networkPool;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<String> getAllowedExternalIpAddresses() {
+ return allowedExternalIpAddresses;
+ }
+
+ @Override
+ public ToStringHelper string() {
+ ToStringHelper helper = super.string().add("org", org).add("description", description)
+ .add("configuration", configuration).add("networkPool", networkPool);
+ if (allowedExternalIpAddresses.size() > 0)
+ helper.add("allowedExternalIpAddresses", allowedExternalIpAddresses);
+ if (tasks.size() > 0)
+ helper.add("tasks", tasks);
+ return helper;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatPolicy.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatPolicy.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatPolicy.java
new file mode 100644
index 0000000..8a49b33
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatPolicy.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.network.nat;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.CaseFormat;
+
+/**
+ * The Policy element of a NatService element specifies how packets are handled by the NAT service.
+ */
+public enum NatPolicy {
+ /**
+ * packets of this type pass through the firewall in both directions
+ */
+ ALLOW_TRAFFIC,
+ /**
+ * only inbound packets of this type pass through the firewall
+ */
+ ALLOW_TRAFFIC_IN, UNRECOGNIZED;
+
+ public String value() {
+ return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name());
+ }
+
+ @Override
+ public String toString() {
+ return value();
+ }
+
+ public static NatPolicy fromValue(String policy) {
+ try {
+ return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(policy, "policy")));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatProtocol.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatProtocol.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatProtocol.java
new file mode 100644
index 0000000..7204bae
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatProtocol.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.network.nat;
+
+
+/**
+ *
+ * The Protocol specifies the network protocol to which this rule applies
+ *
+ * @since vcloud api 0.9
+ */
+public enum NatProtocol {
+ /**
+ * the rule applies to the TCP protocol
+ *
+ * @since vcloud api 0.9
+ */
+ TCP,
+ /**
+ * the rule applies to the UDP protocol
+ *
+ * @since vcloud api 0.9
+ */
+ UDP,
+ /**
+ * the rule applies to the TCP and UDP protocols.
+ *
+ * @since vcloud api 0.9
+ */
+ TCP_UDP;
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatRule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatRule.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatRule.java
new file mode 100644
index 0000000..b9ca510
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatRule.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.network.nat;
+
+import org.jclouds.javax.annotation.Nullable;
+
+/**
+ *
+ * Defines a rule associated with Nat
+ *
+ * @since vcloud api 0.9
+ */
+public interface NatRule {
+ /**
+ * IP address to which this NAT rule maps the IP address specified in the InternalIp element.
+ */
+ @Nullable
+ String getExternalIP();
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatType.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatType.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatType.java
new file mode 100644
index 0000000..98b95e2
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/NatType.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.network.nat;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.CaseFormat;
+
+/**
+ *
+ * The NatType element specifies how network address translation is implemented by the NAT service.
+ *
+ * @since vcloud api 0.9
+ */
+public enum NatType {
+ /**
+ * NAT service implemented by IP address translation
+ *
+ * @since vcloud api 0.9
+ */
+ IP_TRANSLATION,
+ /**
+ * NAT service implemented by network port forwarding
+ *
+ * @since vcloud api 0.9
+ */
+ PORT_FORWARDING, UNRECOGNIZED;
+
+ public String value() {
+ return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name());
+ }
+
+ @Override
+ public String toString() {
+ return value();
+ }
+
+ public static NatType fromValue(String natType) {
+ try {
+ return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(natType, "natType")));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/MappingMode.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/MappingMode.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/MappingMode.java
new file mode 100644
index 0000000..6d71116
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/MappingMode.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.network.nat.rules;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.CaseFormat;
+
+/**
+ * The MappingMode element specifies how IP address mapping is implemented by the NAT service.
+ */
+public enum MappingMode {
+ /**
+ * the external IP address is specified in the ExternalIP element
+ */
+ MANUAL,
+ /**
+ * the external IP address is assigned automatically
+ */
+ AUTOMATIC, UNRECOGNIZED;
+
+ public String value() {
+ return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name());
+ }
+
+ @Override
+ public String toString() {
+ return value();
+ }
+
+ public static MappingMode fromValue(String mode) {
+ try {
+ return valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(mode, "mode")));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/OneToOneVmRule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/OneToOneVmRule.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/OneToOneVmRule.java
new file mode 100644
index 0000000..c2b1b4b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/OneToOneVmRule.java
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.network.nat.rules;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.network.nat.NatRule;
+
+import com.google.common.base.Objects;
+
+/**
+ * The OneToOneVmRule element describes a NAT rule that specifies network address translation
+ * details for a single virtual machine. The external IP address can be specified manually or
+ * assigned automatically at deployment time. The internal IP address is discovered by looking up
+ * the specified VmReference and NIC ID.
+ *
+ * @since vcloud 0.9
+ */
+public class OneToOneVmRule implements NatRule {
+ private final MappingMode mappingMode;
+ @Nullable
+ private final String externalIP;
+ @Nullable
+ private final String vAppScopedVmId;
+ private final int vmNicId;
+
+ public OneToOneVmRule(MappingMode mappingMode, @Nullable String externalIp, @Nullable String vAppScopedVmId,
+ int vmNicId) {
+ this.mappingMode = checkNotNull(mappingMode, "mappingMode");
+ this.externalIP = externalIp;
+ this.vAppScopedVmId = vAppScopedVmId;
+ this.vmNicId = vmNicId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ OneToOneVmRule that = OneToOneVmRule.class.cast(o);
+ return equal(this.mappingMode, that.mappingMode) && equal(this.externalIP, that.externalIP)
+ && equal(this.vAppScopedVmId, that.vAppScopedVmId) && equal(this.vmNicId, that.vmNicId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(mappingMode, externalIP, vAppScopedVmId, vmNicId);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("mappingMode", mappingMode).add("externalIP", externalIP)
+ .add("vAppScopedVmId", vAppScopedVmId).add("vmNicId", vmNicId).toString();
+ }
+
+ /**
+ * @return how IP address mapping is implemented by the NAT service
+ * @since vcloud 0.9
+ */
+ public MappingMode getMappingMode() {
+ return mappingMode;
+ }
+
+ /**
+ * @return if MappingMode is manual, specifies the external IP address of this Vm, otherwise
+ * null.
+ * @since vcloud 0.9
+ */
+ @Nullable
+ @Override
+ public String getExternalIP() {
+ return externalIP;
+ }
+
+ /**
+ * @return read‐only identifier created on import
+ * @since vcloud 0.9
+ */
+ @Nullable
+ public String getVAppScopedVmId() {
+ return vAppScopedVmId;
+ }
+
+ /**
+ * @return device number of the NIC on the referenced virtual machine
+ * @since vcloud 0.9
+ */
+ public int getVmNicId() {
+ return vmNicId;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/PortForwardingRule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/PortForwardingRule.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/PortForwardingRule.java
new file mode 100644
index 0000000..3170a73
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/PortForwardingRule.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.network.nat.rules;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.vcloud.domain.network.nat.NatProtocol;
+import org.jclouds.vcloud.domain.network.nat.NatRule;
+
+import com.google.common.base.Objects;
+
+/**
+ * The PortForwardingRule element describes a NAT rule that maps an IP address and port in an
+ * organization network to an external IP address and port.
+ *
+ * @since vcloud 0.8
+ */
+public class PortForwardingRule implements NatRule {
+ private final String externalIP;
+ private final int externalPort;
+ private final String internalIP;
+ private final int internalPort;
+ private final NatProtocol protocol;
+
+ public PortForwardingRule(String externalIP, int externalPort, String internalIP, int internalPort,
+ NatProtocol protocol) {
+ this.externalIP = checkNotNull(externalIP, "externalIP");
+ this.externalPort = externalPort;
+ this.internalIP = checkNotNull(internalIP, "internalIP");
+ this.internalPort = internalPort;
+ this.protocol = checkNotNull(protocol, "protocol");
+ }
+
+ /**
+ * IP address to which this NAT rule maps the IP address specified in the InternalIp element.
+ */
+ @Override
+ public String getExternalIP() {
+ return externalIP;
+ }
+
+ /**
+ * network port to which this NAT rule maps the port number specified in the InternalPort element
+ */
+ public int getExternalPort() {
+ return externalPort;
+ }
+
+ /**
+ * IP address to which this NAT rule maps the IP address specified in the ExternalIp element.
+ */
+ public String getInternalIP() {
+ return internalIP;
+ }
+
+ /**
+ * network port to which this NAT rule maps the port number specified in the ExternalPort
+ * element.
+ */
+ public int getInternalPort() {
+ return internalPort;
+ }
+
+ /**
+ * specifies the network protocol to which this rule applies
+ */
+ public NatProtocol getProtocol() {
+ return protocol;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ PortForwardingRule that = PortForwardingRule.class.cast(o);
+ return equal(this.externalIP, that.externalIP) && equal(this.externalPort, that.externalPort)
+ && equal(this.internalIP, that.internalIP) && equal(this.internalPort, that.internalPort)
+ && equal(this.protocol, that.protocol);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(externalIP, externalPort, internalIP, internalPort, protocol);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("externalIP", externalIP)
+ .add("externalPort", externalPort).add("internalIP", internalIP).add("internalPort", internalPort)
+ .add("protocol", protocol).toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/VmRule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/VmRule.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/VmRule.java
new file mode 100644
index 0000000..8793a58
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/network/nat/rules/VmRule.java
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain.network.nat.rules;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.network.nat.NatProtocol;
+import org.jclouds.vcloud.domain.network.nat.NatRule;
+
+import com.google.common.base.Objects;
+
+/**
+ * The VmRule element describes a NAT rule that maps an IP address and port in a vApp network to an
+ * external IP address and port. The external IP address, external port, and internal port are
+ * specified in the element. The internal IP address is discovered by looking up the specified
+ * VmReference and VmNicId.
+ *
+ * @since vcloud 0.9
+ */
+public class VmRule implements NatRule {
+ @Nullable
+ private final String externalIP;
+ private final int externalPort;
+ @Nullable
+ private final String vAppScopedLocalId;
+ private final int vmNicId;
+ private final int internalPort;
+ private final NatProtocol protocol;
+
+ public VmRule(@Nullable String externalIP, int externalPort, @Nullable String vAppScopedLocalId, int vmNicId,
+ int internalPort, NatProtocol protocol) {
+ this.externalIP = externalIP;
+ this.externalPort = externalPort;
+ this.vAppScopedLocalId = vAppScopedLocalId;
+ this.vmNicId = vmNicId;
+ this.internalPort = internalPort;
+ this.protocol = checkNotNull(protocol, "protocol");
+ }
+
+ /**
+ * IP address to which this NAT rule maps the IP address specified in the vAppScopedLocalId element.
+ */
+ @Nullable
+ public String getExternalIP() {
+ return externalIP;
+ }
+
+ /**
+ * network port to which this NAT rule maps the port number specified in the InternalPort element
+ */
+ public Integer getExternalPort() {
+ return externalPort;
+ }
+
+ /**
+ * @return read‐only identifier created on import
+ * @since vcloud 0.9
+ */
+ @Nullable
+ public String getVAppScopedLocalId() {
+ return vAppScopedLocalId;
+ }
+
+ /**
+ * @return device number of the NIC on the referenced virtual machine
+ * @since vcloud 0.9
+ */
+ public int getVmNicId() {
+ return vmNicId;
+ }
+
+ /**
+ * network port to which this NAT rule maps the port number specified in the ExternalPort
+ * element.
+ */
+ public Integer getInternalPort() {
+ return internalPort;
+ }
+
+ /**
+ * specifies the network protocol to which this rule applies
+ */
+ public NatProtocol getProtocol() {
+ return protocol;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ VmRule that = VmRule.class.cast(o);
+ return equal(this.externalIP, that.externalIP) && equal(this.externalPort, that.externalPort)
+ && equal(this.vAppScopedLocalId, that.vAppScopedLocalId) && equal(this.vmNicId, that.vmNicId)
+ && equal(this.internalPort, that.internalPort) && equal(this.protocol, that.protocol);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(externalIP, externalPort, vAppScopedLocalId, vmNicId, internalPort, protocol);
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper("").omitNullValues().add("externalIP", externalIP)
+ .add("externalPort", externalPort).add("vAppScopedLocalId", vAppScopedLocalId).add("vmNicId", vmNicId)
+ .add("internalPort", internalPort).add("protocol", protocol).toString();
+ }
+
+}
[16/18] stratos git commit: Jclouds vcloud api 1.8.1 clone with
custom changes
Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/VCloudHardwareBuilderFromResourceAllocations.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/VCloudHardwareBuilderFromResourceAllocations.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/VCloudHardwareBuilderFromResourceAllocations.java
new file mode 100644
index 0000000..2f3bd42
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/VCloudHardwareBuilderFromResourceAllocations.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.compute.functions;
+
+import javax.inject.Singleton;
+
+import org.jclouds.cim.ResourceAllocationSettingData;
+import org.jclouds.cim.functions.HardwareBuilderFromResourceAllocations;
+import org.jclouds.compute.domain.Volume;
+import org.jclouds.compute.domain.internal.VolumeImpl;
+import org.jclouds.vcloud.domain.ovf.VCloudHardDisk;
+
+@Singleton
+public class VCloudHardwareBuilderFromResourceAllocations extends HardwareBuilderFromResourceAllocations {
+ @Override
+ public Volume apply(ResourceAllocationSettingData from) {
+ if (from instanceof VCloudHardDisk) {
+ VCloudHardDisk vDisk = VCloudHardDisk.class.cast(from);
+ return new VolumeImpl(from.getAddressOnParent() + "", Volume.Type.LOCAL, vDisk.getCapacity() / 1024f, null,
+ "0".equals(from.getAddressOnParent()), true);
+ } else {
+ return super.apply(from);
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/ValidateVAppTemplateAndReturnEnvelopeOrThrowIllegalArgumentException.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/ValidateVAppTemplateAndReturnEnvelopeOrThrowIllegalArgumentException.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/ValidateVAppTemplateAndReturnEnvelopeOrThrowIllegalArgumentException.java
new file mode 100644
index 0000000..dce8306
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/ValidateVAppTemplateAndReturnEnvelopeOrThrowIllegalArgumentException.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.compute.functions;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.concurrent.ExecutionException;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.logging.Logger;
+import org.jclouds.ovf.Envelope;
+import org.jclouds.vcloud.domain.VAppTemplate;
+
+import com.google.common.base.Function;
+import com.google.common.cache.LoadingCache;
+
+@Singleton
+public class ValidateVAppTemplateAndReturnEnvelopeOrThrowIllegalArgumentException implements
+ Function<VAppTemplate, Envelope> {
+
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ private final LoadingCache<URI, Envelope> envelopes;
+
+ @Inject
+ protected ValidateVAppTemplateAndReturnEnvelopeOrThrowIllegalArgumentException(LoadingCache<URI, Envelope> envelopes) {
+ this.envelopes = checkNotNull(envelopes, "envelopes");
+ }
+
+ @Override
+ public Envelope apply(VAppTemplate from) {
+ checkArgument(from.getChildren().size() == 1, "multiple vms are not supported: %s", from);
+
+ checkArgument(from.getNetworkSection().getNetworks().size() == 1,
+ "multiple network connections are not supported: %s", from);
+
+ checkArgument(from.isOvfDescriptorUploaded(), "ovf descriptor is not uploaded: %s", from);
+ Envelope ovf = getOVFForVAppTemplateAndValidate(from);
+ return ovf;
+ }
+
+ private Envelope getOVFForVAppTemplateAndValidate(VAppTemplate from) throws IllegalArgumentException {
+ Envelope ovf;
+ try {
+ ovf = envelopes.get(from.getHref());
+ checkArgument(ovf.getVirtualSystem().getVirtualHardwareSections().size() > 0,
+ "no hardware sections exist in ovf %s", ovf);
+ } catch (ExecutionException e) {
+ throw new IllegalArgumentException("no ovf envelope found for: " + from, e);
+ }
+ return ovf;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/internal/VCloudTemplateBuilderImpl.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/internal/VCloudTemplateBuilderImpl.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/internal/VCloudTemplateBuilderImpl.java
new file mode 100644
index 0000000..8304466
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/internal/VCloudTemplateBuilderImpl.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.compute.internal;
+
+import java.util.Set;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Provider;
+
+import org.jclouds.collect.Memoized;
+import org.jclouds.compute.domain.Hardware;
+import org.jclouds.compute.domain.TemplateBuilder;
+import org.jclouds.compute.domain.internal.TemplateBuilderImpl;
+import org.jclouds.compute.options.TemplateOptions;
+import org.jclouds.compute.strategy.GetImageStrategy;
+import org.jclouds.compute.suppliers.ImageCacheSupplier;
+import org.jclouds.domain.Location;
+
+import com.google.common.base.Supplier;
+
+public class VCloudTemplateBuilderImpl extends TemplateBuilderImpl {
+
+ @Inject
+ protected VCloudTemplateBuilderImpl(@Memoized Supplier<Set<? extends Location>> locations,
+ ImageCacheSupplier images, @Memoized Supplier<Set<? extends Hardware>> sizes,
+ Supplier<Location> defaultLocation, @Named("DEFAULT") Provider<TemplateOptions> optionsProvider,
+ @Named("DEFAULT") Provider<TemplateBuilder> defaultTemplateProvider, GetImageStrategy getImageStrategy) {
+ super(locations, images, sizes, defaultLocation, optionsProvider, defaultTemplateProvider, getImageStrategy);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/options/VCloudTemplateOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/options/VCloudTemplateOptions.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/options/VCloudTemplateOptions.java
new file mode 100644
index 0000000..03b12fe
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/options/VCloudTemplateOptions.java
@@ -0,0 +1,348 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.compute.options;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Strings.emptyToNull;
+
+import java.net.URI;
+import java.util.Map;
+
+import org.jclouds.compute.options.TemplateOptions;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.domain.network.IpAddressAllocationMode;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * Contains options supported in the {@code ComputeService#runNode} operation on
+ * the "vcloud" provider. <h2>
+ * Usage</h2> The recommended way to instantiate a VCloudTemplateOptions object
+ * is to statically import VCloudTemplateOptions.* and invoke a static creation
+ * method followed by an instance mutator (if needed):
+ * <p/>
+ * <code>
+ * import static org.jclouds.compute.options.VCloudTemplateOptions.Builder.*;
+ * <p/>
+ * ComputeService client = // get connection
+ * templateBuilder.options(inboundPorts(22, 80, 8080, 443));
+ * Set<NodeMetadata> set = client.createNodesInGroup(tag, 2, templateBuilder.build());
+ * <code>
+ */
+public class VCloudTemplateOptions extends TemplateOptions implements Cloneable {
+ @Override
+ public VCloudTemplateOptions clone() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ copyTo(options);
+ return options;
+ }
+
+ @Override
+ public void copyTo(TemplateOptions to) {
+ super.copyTo(to);
+ if (to instanceof VCloudTemplateOptions) {
+ VCloudTemplateOptions eTo = VCloudTemplateOptions.class.cast(to);
+ if (getCustomizationScript() != null)
+ eTo.customizationScript(getCustomizationScript());
+ if (getDescription() != null)
+ eTo.description(getDescription());
+ if (getIpAddressAllocationMode() != null)
+ eTo.ipAddressAllocationMode(getIpAddressAllocationMode());
+ if (getIpAddressAllocationMode() != null)
+ eTo.ipAddressAllocationMode(getIpAddressAllocationMode());
+ if (getParentNetwork() != null)
+ eTo.parentNetwork(getParentNetwork());
+ if (getFenceMode() != null)
+ eTo.fenceMode(getFenceMode());
+ }
+ }
+
+ private String description = null;
+ private String customizationScript = null;
+ private IpAddressAllocationMode ipAddressAllocationMode = null;
+ private URI parentNetwork = null;
+ private FenceMode fenceMode = null;
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ VCloudTemplateOptions that = VCloudTemplateOptions.class.cast(o);
+ return super.equals(that) && equal(this.description, that.description)
+ && equal(this.customizationScript, that.customizationScript)
+ && equal(this.ipAddressAllocationMode, that.ipAddressAllocationMode)
+ && equal(this.parentNetwork, that.parentNetwork);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(super.hashCode(), description, customizationScript, ipAddressAllocationMode,
+ parentNetwork);
+ }
+
+ @Override
+ public ToStringHelper string() {
+ return super.string().add("description", description).add("customizationScript", customizationScript)
+ .add("ipAddressAllocationMode", ipAddressAllocationMode).add("parentNetwork", parentNetwork);
+ }
+
+ /**
+ * Optional description. Used for the Description of the vApp created by this
+ * instantiation.
+ */
+ public VCloudTemplateOptions description(String description) {
+ this.description = description;
+ return this;
+ }
+
+ /**
+ * Specifies the customizationScript used to run instances with
+ */
+ public VCloudTemplateOptions customizationScript(String customizationScript) {
+ this.customizationScript = checkNotNull(emptyToNull(customizationScript), "customizationScript must be defined");
+ return this;
+ }
+
+ /**
+ * Specifies the ipAddressAllocationMode used to for network interfaces on
+ * the VMs
+ */
+ public VCloudTemplateOptions ipAddressAllocationMode(IpAddressAllocationMode ipAddressAllocationMode) {
+ this.ipAddressAllocationMode = ipAddressAllocationMode;
+ return this;
+ }
+
+ /**
+ * Specifies the parentNetwork to connect the the network interfaces on the
+ * VMs to.
+ *
+ * @see InstantiateVAppTemplateOptions#addNetworkConfig
+ */
+ public VCloudTemplateOptions parentNetwork(URI parentNetwork) {
+ this.parentNetwork = parentNetwork;
+ return this;
+ }
+
+ /**
+ * How to connect to the parent network
+ *
+ * @see InstantiateVAppTemplateOptions#addNetworkConfig
+ */
+ public VCloudTemplateOptions fenceMode(FenceMode fenceMode) {
+ this.fenceMode = fenceMode;
+ return this;
+ }
+
+ public static class Builder {
+ /**
+ * @see VCloudTemplateOptions#description
+ */
+ public static VCloudTemplateOptions description(String description) {
+ return new VCloudTemplateOptions().description(description);
+ }
+
+ /**
+ * @see VCloudTemplateOptions#customizationScript
+ */
+ public static VCloudTemplateOptions customizationScript(String customizationScript) {
+ return new VCloudTemplateOptions().customizationScript(customizationScript);
+ }
+
+ /**
+ * @see VCloudTemplateOptions#ipAddressAllocationMode
+ */
+ public static VCloudTemplateOptions ipAddressAllocationMode(IpAddressAllocationMode ipAddressAllocationMode) {
+ return new VCloudTemplateOptions().ipAddressAllocationMode(ipAddressAllocationMode);
+ }
+
+ /**
+ * @see VCloudTemplateOptions#parentNetwork(URI parentNetwork)
+ */
+ public static VCloudTemplateOptions parentNetwork(URI parentNetwork) {
+ return new VCloudTemplateOptions().parentNetwork(parentNetwork);
+ }
+
+ /**
+ * @see VCloudTemplateOptions#fenceMode(FenceMode)
+ */
+ public static VCloudTemplateOptions fenceMode(FenceMode fenceMode) {
+ return new VCloudTemplateOptions().fenceMode(fenceMode);
+ }
+
+ // methods that only facilitate returning the correct object type
+ /**
+ * @see TemplateOptions#inboundPorts
+ */
+ public static VCloudTemplateOptions inboundPorts(int... ports) {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ return VCloudTemplateOptions.class.cast(options.inboundPorts(ports));
+ }
+
+ /**
+ * @see TemplateOptions#port
+ */
+ public static VCloudTemplateOptions blockOnPort(int port, int seconds) {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ return VCloudTemplateOptions.class.cast(options.blockOnPort(port, seconds));
+ }
+
+ /**
+ * @see TemplateOptions#userMetadata(Map)
+ */
+ public static VCloudTemplateOptions userMetadata(Map<String, String> userMetadata) {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ return VCloudTemplateOptions.class.cast(options.userMetadata(userMetadata));
+ }
+
+ /**
+ * @see TemplateOptions#userMetadata(String, String)
+ */
+ public static VCloudTemplateOptions userMetadata(String key, String value) {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ return VCloudTemplateOptions.class.cast(options.userMetadata(key, value));
+ }
+
+ /**
+ * @see TemplateOptions#nodeNames(Iterable)
+ */
+ public static VCloudTemplateOptions nodeNames(Iterable<String> nodeNames) {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ return VCloudTemplateOptions.class.cast(options.nodeNames(nodeNames));
+ }
+
+ /**
+ * @see TemplateOptions#networks(Iterable)
+ */
+ public static VCloudTemplateOptions networks(Iterable<String> networks) {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ return VCloudTemplateOptions.class.cast(options.networks(networks));
+ }
+
+ }
+
+ /**
+ * @return description of the vApp
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @return customizationScript on the vms
+ */
+ public String getCustomizationScript() {
+ return customizationScript;
+ }
+
+ /**
+ * @return ipAddressAllocationMode on the vms
+ */
+ public IpAddressAllocationMode getIpAddressAllocationMode() {
+ return ipAddressAllocationMode;
+ }
+
+ /**
+ * @return parentNetwork to connect to the vms
+ */
+ public URI getParentNetwork() {
+ return parentNetwork;
+ }
+
+ /**
+ * @return FenceMode to connect the parent network with
+ */
+ public FenceMode getFenceMode() {
+ return fenceMode;
+ }
+
+ // methods that only facilitate returning the correct object type
+
+ /**
+ * @see TemplateOptions#blockOnPort
+ */
+ @Override
+ public VCloudTemplateOptions blockOnPort(int port, int seconds) {
+ return VCloudTemplateOptions.class.cast(super.blockOnPort(port, seconds));
+ }
+
+ /**
+ *
+ * special thing is that we do assume if you are passing groups that you have
+ * everything you need already defined. for example, our option inboundPorts
+ * normally creates ingress rules accordingly but if we notice you've
+ * specified securityGroups, we do not mess with rules at all
+ *
+ * @see TemplateOptions#inboundPorts
+ */
+ @Override
+ public VCloudTemplateOptions inboundPorts(int... ports) {
+ return VCloudTemplateOptions.class.cast(super.inboundPorts(ports));
+ }
+
+ /**
+ * @see TemplateOptions#authorizePublicKey(String)
+ */
+ @Override
+ public VCloudTemplateOptions authorizePublicKey(String publicKey) {
+ return VCloudTemplateOptions.class.cast(super.authorizePublicKey(publicKey));
+ }
+
+ /**
+ * @see TemplateOptions#installPrivateKey(String)
+ */
+ @Override
+ public VCloudTemplateOptions installPrivateKey(String privateKey) {
+ return VCloudTemplateOptions.class.cast(super.installPrivateKey(privateKey));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public VCloudTemplateOptions userMetadata(Map<String, String> userMetadata) {
+ return VCloudTemplateOptions.class.cast(super.userMetadata(userMetadata));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public VCloudTemplateOptions userMetadata(String key, String value) {
+ return VCloudTemplateOptions.class.cast(super.userMetadata(key, value));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public VCloudTemplateOptions nodeNames(Iterable<String> nodeNames) {
+ return VCloudTemplateOptions.class.cast(super.nodeNames(nodeNames));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public VCloudTemplateOptions networks(Iterable<String> networks) {
+ return VCloudTemplateOptions.class.cast(super.networks(networks));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.java
new file mode 100644
index 0000000..e8b9fcd
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.java
@@ -0,0 +1,299 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.compute.strategy;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Predicates.not;
+import static com.google.common.collect.Iterables.find;
+import static com.google.common.collect.Iterables.get;
+import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
+import static org.jclouds.compute.util.ComputeServiceUtils.metadataAndTagsAsCommaDelimitedValue;
+import static org.jclouds.vcloud.compute.util.VCloudComputeUtils.getCredentialsFrom;
+import static org.jclouds.vcloud.options.InstantiateVAppTemplateOptions.Builder.addNetworkConfig;
+
+import java.net.URI;
+import java.util.Map;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.compute.ComputeServiceAdapter.NodeAndInitialCredentials;
+import org.jclouds.compute.domain.Template;
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.logging.Logger;
+import org.jclouds.ovf.Network;
+import org.jclouds.predicates.validators.DnsNameValidator;
+import org.jclouds.rest.annotations.BuildVersion;
+import org.jclouds.vcloud.TaskStillRunningException;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.compute.options.VCloudTemplateOptions;
+import org.jclouds.vcloud.domain.GuestCustomizationSection;
+import org.jclouds.vcloud.domain.NetworkConnection;
+import org.jclouds.vcloud.domain.NetworkConnectionSection;
+import org.jclouds.vcloud.domain.NetworkConnectionSection.Builder;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.network.IpAddressAllocationMode;
+import org.jclouds.vcloud.domain.network.NetworkConfig;
+import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Joiner;
+import com.google.common.base.Predicate;
+import com.google.common.cache.LoadingCache;
+import com.google.common.collect.ImmutableSet;
+
+@Singleton
+public class InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn {
+ @Resource
+ @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+ protected Logger logger = Logger.NULL;
+
+ protected final VCloudApi client;
+ protected final Predicate<URI> successTester;
+ protected final LoadingCache<URI, VAppTemplate> vAppTemplates;
+ protected final NetworkConfigurationForNetworkAndOptions networkConfigurationForNetworkAndOptions;
+ protected final String buildVersion;
+
+
+ @Inject
+ protected InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn(VCloudApi client,
+ Predicate<URI> successTester, LoadingCache<URI, VAppTemplate> vAppTemplates, NetworkConfigurationForNetworkAndOptions networkConfigurationForNetworkAndOptions,
+ @BuildVersion String buildVersion) {
+ this.client = client;
+ this.successTester = successTester;
+ this.vAppTemplates = vAppTemplates;
+ this.networkConfigurationForNetworkAndOptions = networkConfigurationForNetworkAndOptions;
+ this.buildVersion = buildVersion;
+ }
+
+ /**
+ * per john ellis at bluelock, vCloud Director 1.5 is more strict than earlier versions.
+ * <p/>
+ * It appears to be 15 characters to match Windows' hostname limitation. Must be alphanumeric, at
+ * least one non-number character and hyphens and underscores are the only non-alpha character
+ * allowed.
+ */
+ public static enum ComputerNameValidator {
+ INSTANCE;
+
+ private DnsNameValidator validator;
+
+ ComputerNameValidator() {
+ this.validator = new DnsNameValidator(3, 15);
+ }
+
+ public void validate(@Nullable String t) throws IllegalArgumentException {
+ this.validator.validate(t);
+ }
+
+ }
+
+ public NodeAndInitialCredentials<VApp> createNodeWithGroupEncodedIntoName(String group, String name, Template template) {
+ // no sense waiting until failures occur later
+ ComputerNameValidator.INSTANCE.validate(name);
+ VApp vAppResponse = instantiateVAppFromTemplate(name, template);
+ waitForTask(vAppResponse.getTasks().get(0));
+ logger.debug("<< instantiated VApp(%s)", vAppResponse.getName());
+
+ // vm data is available after instantiate completes
+ vAppResponse = client.getVAppApi().getVApp(vAppResponse.getHref());
+
+ // per above check, we know there is only a single VM
+ Vm vm = get(vAppResponse.getChildren(), 0);
+
+ template.getOptions().userMetadata(ComputeServiceConstants.NODE_GROUP_KEY, group);
+ VCloudTemplateOptions vOptions = VCloudTemplateOptions.class.cast(template.getOptions());
+
+ // note we cannot do tasks in parallel or VCD will throw "is busy" errors
+
+ // note we must do this before any other customizations as there is a dependency on
+ // valid naming conventions before you can perform commands such as updateCPUCount
+ logger.trace(">> updating customization vm(%s) name->(%s)", vm.getName(), name);
+ waitForTask(updateVmWithNameAndCustomizationScript(vm, name, vOptions.getCustomizationScript()));
+ logger.trace("<< updated customization vm(%s)", name);
+
+ ensureVmHasAllocationModeOrPooled(vAppResponse, vOptions.getIpAddressAllocationMode());
+
+ int cpuCount = (int) getCores(template.getHardware());
+ logger.trace(">> updating cpuCount(%d) vm(%s)", cpuCount, vm.getName());
+ waitForTask(updateCPUCountOfVm(vm, cpuCount));
+ logger.trace("<< updated cpuCount vm(%s)", vm.getName());
+ int memoryMB = template.getHardware().getRam();
+ logger.trace(">> updating memoryMB(%d) vm(%s)", memoryMB, vm.getName());
+ waitForTask(updateMemoryMBOfVm(vm, memoryMB));
+ logger.trace("<< updated memoryMB vm(%s)", vm.getName());
+ logger.trace(">> deploying vApp(%s)", vAppResponse.getName());
+ waitForTask(client.getVAppApi().deployVApp(vAppResponse.getHref()));
+ logger.trace("<< deployed vApp(%s)", vAppResponse.getName());
+
+ // only after deploy is the password valid
+ vAppResponse = client.getVAppApi().getVApp(vAppResponse.getHref());
+
+ logger.trace(">> powering on vApp(%s)", vAppResponse.getName());
+ client.getVAppApi().powerOnVApp(vAppResponse.getHref());
+
+ return new NodeAndInitialCredentials<VApp>(vAppResponse, vAppResponse.getHref().toASCIIString(),
+ getCredentialsFrom(vAppResponse));
+
+ }
+
+ @VisibleForTesting
+ protected VApp instantiateVAppFromTemplate(String name, Template template) {
+ VCloudTemplateOptions vOptions = VCloudTemplateOptions.class.cast(template.getOptions());
+
+ URI templateId = URI.create(template.getImage().getId());
+
+ VAppTemplate vAppTemplate = vAppTemplates.getUnchecked(templateId);
+
+ if (vAppTemplate.getChildren().size() > 1)
+ throw new UnsupportedOperationException("we currently do not support multiple vms in a vAppTemplate "
+ + vAppTemplate);
+
+ if (vAppTemplate.getNetworkSection().getNetworks().size() > 1)
+ throw new UnsupportedOperationException(
+ "we currently do not support multiple network connections in a vAppTemplate " + vAppTemplate);
+
+ Network networkToConnect = get(vAppTemplate.getNetworkSection().getNetworks(), 0);
+
+
+ NetworkConfig config = networkConfigurationForNetworkAndOptions.apply(networkToConnect, vOptions);
+
+ // note that in VCD 1.5, the network name after instantiation will be the same as the parent
+ InstantiateVAppTemplateOptions options = addNetworkConfig(config);
+
+ // TODO make disk size specifiable
+ // disk((long) ((template.getHardware().getVolumes().get(0).getSize()) *
+ // 1024 * 1024l));
+
+
+
+ String description = VCloudTemplateOptions.class.cast(template.getOptions()).getDescription();
+ if (description == null) {
+ Map<String, String> md = metadataAndTagsAsCommaDelimitedValue(template.getOptions());
+ description = Joiner.on('\n').withKeyValueSeparator("=").join(md);
+ }
+
+ options.description(description);
+ options.deploy(false);
+ options.powerOn(false);
+
+ URI VDC = URI.create(template.getLocation().getId());
+
+ logger.debug(">> instantiating vApp vDC(%s) template(%s) name(%s) options(%s) ", VDC, templateId, name, options);
+
+ VApp vAppResponse = client.getVAppTemplateApi().createVAppInVDCByInstantiatingTemplate(name, VDC, templateId,
+ options);
+ return vAppResponse;
+ }
+
+ // TODO: filtering on "none" is a hack until we can filter on
+ // vAppTemplate.getNetworkConfigSection().getNetworkConfigs() where
+ // name = getChildren().NetworkConnectionSection.connection where ipallocationmode == none
+ static Predicate<Network> networkWithNoIpAllocation = new Predicate<Network>() {
+
+ @Override
+ public boolean apply(Network input) {
+ return "none".equals(input.getName());
+ }
+
+ };
+
+ public void waitForTask(Task task) {
+ if (!successTester.apply(task.getHref())) {
+ throw new TaskStillRunningException(task);
+ }
+ }
+ /**
+ * Naming constraints modifying a VM on a VApp in vCloud Director (at least v1.5) can be more
+ * strict than those in a vAppTemplate. For example, while it is possible to instantiate a
+ * vAppTemplate with a VM named (incorrectly) {@code Ubuntu_10.04}, you must change the name to a
+ * valid (alphanumeric underscore) name before you can update it.
+ */
+ public Task updateVmWithNameAndCustomizationScript(Vm vm, String name, @Nullable String customizationScript) {
+ GuestCustomizationSection guestConfiguration = vm.getGuestCustomizationSection();
+ guestConfiguration.setComputerName(name);
+ if (customizationScript != null) {
+ // In version 1.0.0, the api returns a script that loses newlines, so we cannot append to a
+ // customization script.
+ // TODO: parameterize whether to overwrite or append existing customization
+ if (!buildVersion.startsWith("1.0.0") && !"".endsWith(buildVersion)
+ && guestConfiguration.getCustomizationScript() != null)
+ customizationScript = guestConfiguration.getCustomizationScript() + "\n" + customizationScript;
+
+ guestConfiguration.setCustomizationScript(customizationScript);
+ }
+ return client.getVmApi().updateGuestCustomizationOfVm(guestConfiguration, vm.getHref());
+ }
+
+ public void ensureVmHasAllocationModeOrPooled(VApp vApp, @Nullable IpAddressAllocationMode ipAllocationMode) {
+ Network networkToConnect = find(vApp.getNetworkSection().getNetworks(), not(networkWithNoIpAllocation));
+
+ Vm vm = get(vApp.getChildren(), 0);
+
+ NetworkConnectionSection net = vm.getNetworkConnectionSection();
+ checkArgument(net.getConnections().size() > 0, "no connections on vm %s", vm);
+
+ NetworkConnection toConnect = findWithPoolAllocationOrFirst(net);
+
+ if (ipAllocationMode == null)
+ ipAllocationMode = toConnect.getIpAddressAllocationMode();
+
+ // make sure that we are in fact allocating ips
+ if (ipAllocationMode == IpAddressAllocationMode.NONE)
+ ipAllocationMode = IpAddressAllocationMode.POOL;
+
+ if (toConnect.isConnected() && toConnect.getIpAddressAllocationMode() == ipAllocationMode
+ && toConnect.getNetwork().equals(networkToConnect.getName())) {
+ // then we don't need to change the network settings, and can save a call
+ } else {
+ Builder builder = net.toBuilder();
+ builder.connections(ImmutableSet.of(toConnect.toBuilder().network(networkToConnect.getName()).connected(true)
+ .ipAddressAllocationMode(ipAllocationMode).build()));
+ logger.trace(">> updating networkConnection vm(%s)", vm.getName());
+
+ waitForTask(client.getVmApi().updateNetworkConnectionOfVm(builder.build(), vm.getHref()));
+ logger.trace("<< updated networkConnection vm(%s)", vm.getName());
+
+ }
+
+ }
+
+ private NetworkConnection findWithPoolAllocationOrFirst(NetworkConnectionSection net) {
+ return find(net.getConnections(), new Predicate<NetworkConnection>() {
+
+ @Override
+ public boolean apply(NetworkConnection input) {
+ return input.getIpAddressAllocationMode() == IpAddressAllocationMode.POOL;
+ }
+
+ }, get(net.getConnections(), 0));
+ }
+
+ public Task updateCPUCountOfVm(Vm vm, int cpuCount) {
+ return client.getVmApi().updateCPUCountOfVm(cpuCount, vm.getHref());
+ }
+
+ public Task updateMemoryMBOfVm(Vm vm, int memoryInMB) {
+ return client.getVmApi().updateMemoryMBOfVm(memoryInMB, vm.getHref());
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/strategy/NetworkConfigurationForNetworkAndOptions.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/strategy/NetworkConfigurationForNetworkAndOptions.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/strategy/NetworkConfigurationForNetworkAndOptions.java
new file mode 100644
index 0000000..28c8a9b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/strategy/NetworkConfigurationForNetworkAndOptions.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.compute.strategy;
+
+import java.net.URI;
+
+import javax.inject.Inject;
+
+import org.jclouds.ovf.Network;
+import org.jclouds.vcloud.compute.options.VCloudTemplateOptions;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.domain.network.NetworkConfig;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Supplier;
+
+@Beta
+public class NetworkConfigurationForNetworkAndOptions {
+ protected final Supplier<NetworkConfig> defaultNetworkConfig;
+ protected final FenceMode defaultFenceMode;
+
+ @Inject
+ protected NetworkConfigurationForNetworkAndOptions(Supplier<NetworkConfig> defaultNetworkConfig,
+ FenceMode defaultFenceMode) {
+ this.defaultNetworkConfig = defaultNetworkConfig;
+ this.defaultFenceMode = defaultFenceMode;
+ }
+
+ /**
+ *
+ * returns a {@link NetworkConfig} used to instantiate a vAppTemplate to
+ * either the default parent (org) network, or one specified by options.
+ *
+ * @param networkToConnect
+ * network defined in the VAppTemplate you wish to connect to
+ * @param vOptions
+ * options to override defaults with
+ * @return
+ */
+ public NetworkConfig apply(Network networkToConnect, VCloudTemplateOptions vOptions) {
+ NetworkConfig config;
+ URI userDefinedParentNetwork = vOptions.getParentNetwork();
+ FenceMode fenceMode = vOptions.getFenceMode() != null ? vOptions.getFenceMode() : defaultFenceMode;
+ if (userDefinedParentNetwork != null) {
+ config = NetworkConfig.builder().networkName("jclouds").fenceMode(fenceMode)
+ .parentNetwork(userDefinedParentNetwork).build();
+ } else {
+ config = defaultNetworkConfig.get().toBuilder().fenceMode(fenceMode).build();
+ }
+
+ // if we only have a disconnected network, we are adding a new section
+ // for the upstream
+ if (InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.networkWithNoIpAllocation
+ .apply(networkToConnect)) {
+ // TODO: remove the disconnected entry
+ } else {
+ config = config.toBuilder().networkName(networkToConnect.getName()).build();
+ }
+ return config;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudComputeServiceAdapter.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudComputeServiceAdapter.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudComputeServiceAdapter.java
new file mode 100644
index 0000000..cd636df
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/strategy/VCloudComputeServiceAdapter.java
@@ -0,0 +1,262 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.compute.strategy;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.collect.Iterables.contains;
+import static com.google.common.collect.Iterables.filter;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.Set;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.compute.ComputeServiceAdapter;
+import org.jclouds.compute.domain.Template;
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.domain.Location;
+import org.jclouds.logging.Logger;
+import org.jclouds.ovf.Envelope;
+import org.jclouds.util.Throwables2;
+import org.jclouds.vcloud.TaskInErrorStateException;
+import org.jclouds.vcloud.TaskStillRunningException;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.suppliers.VAppTemplatesSupplier;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.ImmutableSet.Builder;
+
+/**
+ * defines the connection between the {@link org.jclouds.vcloud.VCloudApi} implementation and the jclouds
+ * {@link ComputeService}
+ */
+@Singleton
+public class VCloudComputeServiceAdapter implements ComputeServiceAdapter<VApp, VAppTemplate, VAppTemplate, Location> {
+
+ @Resource
+ @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+ protected Logger logger = Logger.NULL;
+
+ protected final VCloudApi client;
+ protected final Predicate<URI> successTester;
+ protected final InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn booter;
+ protected final Supplier<Map<String, Org>> nameToOrg;
+ protected final Supplier<Set<VAppTemplate>> templates;
+ protected final Function<VAppTemplate, Envelope> templateToEnvelope;
+
+ @Inject
+ protected VCloudComputeServiceAdapter(VCloudApi client, Predicate<URI> successTester,
+ InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn booter,
+ Supplier<Map<String, Org>> nameToOrg, VAppTemplatesSupplier templates,
+ Function<VAppTemplate, Envelope> templateToEnvelope) {
+ this.client = checkNotNull(client, "client");
+ this.successTester = checkNotNull(successTester, "successTester");
+ this.booter = checkNotNull(booter, "booter");
+ this.nameToOrg = checkNotNull(nameToOrg, "nameToOrg");
+ this.templates = checkNotNull(templates, "templates");
+ this.templateToEnvelope = checkNotNull(templateToEnvelope, "templateToEnvelope");
+ }
+
+ @Override
+ public NodeAndInitialCredentials<VApp> createNodeWithGroupEncodedIntoName(String group, String name,
+ Template template) {
+ return booter.createNodeWithGroupEncodedIntoName(group, name, template);
+ }
+
+ @Override
+ public Iterable<VAppTemplate> listHardwareProfiles() {
+ return supportedTemplates();
+ }
+
+ private Iterable<VAppTemplate> supportedTemplates() {
+ return filter(templates.get(), new Predicate<VAppTemplate>() {
+
+ @Override
+ public boolean apply(VAppTemplate from) {
+ try {
+ templateToEnvelope.apply(from);
+ } catch (IllegalArgumentException e) {
+ logger.warn("Unsupported: " + e.getMessage());
+ return false;
+ } catch (RuntimeException e) {
+ IllegalArgumentException e2 = Throwables2.getFirstThrowableOfType(e, IllegalArgumentException.class);
+ if (e2 != null) {
+ logger.warn("Unsupported: " + e2.getMessage());
+ return false;
+ } else {
+ throw e;
+ }
+ }
+ return true;
+ }
+
+ });
+ }
+
+ @Override
+ public Iterable<VAppTemplate> listImages() {
+ return supportedTemplates();
+ }
+
+ @Override
+ public Iterable<VApp> listNodes() {
+ // TODO: parallel or cache
+ Builder<VApp> nodes = ImmutableSet.builder();
+ for (Org org : nameToOrg.get().values()) {
+ for (ReferenceType vdc : org.getVDCs().values()) {
+ for (ReferenceType resource : client.getVDCApi().getVDC(vdc.getHref()).getResourceEntities().values()) {
+ if (resource.getType().equals(VCloudMediaType.VAPP_XML)) {
+ addVAppToSetRetryingIfNotYetPresent(nodes, vdc, resource);
+ }
+ }
+ }
+ }
+ return nodes.build();
+ }
+
+ @Override
+ public Iterable<VApp> listNodesByIds(final Iterable<String> ids) {
+ return filter(listNodes(), new Predicate<VApp>() {
+
+ @Override
+ public boolean apply(VApp vm) {
+ return contains(ids, vm.getHref().toASCIIString());
+ }
+ });
+ }
+
+ @VisibleForTesting
+ void addVAppToSetRetryingIfNotYetPresent(Builder<VApp> nodes, ReferenceType vdc, ReferenceType resource) {
+ VApp node = null;
+ int i = 0;
+ while (node == null && i++ < 3) {
+ try {
+ node = client.getVAppApi().getVApp(resource.getHref());
+ nodes.add(node);
+ } catch (NullPointerException e) {
+ logger.warn("vApp %s not yet present in vdc %s", resource.getName(), vdc.getName());
+ }
+ }
+ }
+
+ @Override
+ public Iterable<Location> listLocations() {
+ // Not using the adapter to determine locations
+ return ImmutableSet.<Location>of();
+ }
+
+ @Override
+ public VApp getNode(String in) {
+ URI id = URI.create(in);
+ return client.getVAppApi().getVApp(id);
+ }
+
+ @Override
+ public VAppTemplate getImage(String in) {
+ URI id = URI.create(in);
+ return client.getVAppTemplateApi().getVAppTemplate(id);
+ }
+
+ @Override
+ public void destroyNode(String id) {
+ URI vappId = URI.create(checkNotNull(id, "node.id"));
+ VApp vApp = cancelAnyRunningTasks(vappId);
+ if (vApp.getStatus() != Status.OFF) {
+ logger.debug(">> powering off VApp vApp(%s), current status: %s", vApp.getName(), vApp.getStatus());
+ try {
+ waitForTask(client.getVAppApi().powerOffVApp(vApp.getHref()));
+ vApp = client.getVAppApi().getVApp(vApp.getHref());
+ logger.debug("<< %s vApp(%s)", vApp.getStatus(), vApp.getName());
+ } catch (IllegalStateException e) {
+ logger.warn(e, "<< %s vApp(%s)", vApp.getStatus(), vApp.getName());
+ }
+ logger.debug(">> undeploying vApp(%s), current status: %s", vApp.getName(), vApp.getStatus());
+ try {
+ waitForTask(client.getVAppApi().undeployVApp(vApp.getHref()));
+ vApp = client.getVAppApi().getVApp(vApp.getHref());
+ logger.debug("<< %s vApp(%s)", vApp.getStatus(), vApp.getName());
+ } catch (IllegalStateException e) {
+ logger.warn(e, "<< %s vApp(%s)", vApp.getStatus(), vApp.getName());
+ }
+ }
+ logger.debug(">> deleting vApp(%s)", vApp.getHref());
+ waitForTask(client.getVAppApi().deleteVApp(vApp.getHref()));
+ logger.debug("<< deleted vApp(%s)", vApp.getHref());
+ }
+
+ VApp waitForPendingTasksToComplete(URI vappId) {
+ VApp vApp = client.getVAppApi().getVApp(vappId);
+ if (vApp.getTasks().size() == 0)
+ return vApp;
+ for (Task task : vApp.getTasks())
+ waitForTask(task);
+ return client.getVAppApi().getVApp(vappId);
+ }
+
+ VApp cancelAnyRunningTasks(URI vappId) {
+ VApp vApp = client.getVAppApi().getVApp(vappId);
+ if (vApp.getTasks().size() == 0)
+ return vApp;
+ for (Task task : vApp.getTasks()) {
+ try {
+ client.getTaskApi().cancelTask(task.getHref());
+ waitForTask(task);
+ } catch (TaskInErrorStateException e) {
+ }
+ }
+ return client.getVAppApi().getVApp(vappId);
+
+ }
+
+ public void waitForTask(Task task) {
+ if (!successTester.apply(task.getHref()))
+ throw new TaskStillRunningException(task);
+ }
+
+ @Override
+ public void rebootNode(String in) {
+ URI id = URI.create(checkNotNull(in, "node.id"));
+ waitForTask(client.getVAppApi().resetVApp(id));
+ }
+
+ @Override
+ public void resumeNode(String in) {
+ URI id = URI.create(checkNotNull(in, "node.id"));
+ waitForTask(client.getVAppApi().powerOnVApp(id));
+ }
+
+ @Override
+ public void suspendNode(String in) {
+ URI id = URI.create(checkNotNull(in, "node.id"));
+ waitForTask(client.getVAppApi().powerOffVApp(id));
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/util/VCloudComputeUtils.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/util/VCloudComputeUtils.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/util/VCloudComputeUtils.java
new file mode 100644
index 0000000..905565e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/util/VCloudComputeUtils.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.compute.util;
+
+import static com.google.common.collect.Iterables.filter;
+
+import java.util.Set;
+
+import org.jclouds.cim.CIMPredicates;
+import org.jclouds.cim.ResourceAllocationSettingData;
+import org.jclouds.cim.ResourceAllocationSettingData.ResourceType;
+import org.jclouds.compute.domain.CIMOperatingSystem;
+import org.jclouds.compute.domain.OperatingSystem;
+import org.jclouds.domain.LoginCredentials;
+import org.jclouds.vcloud.domain.NetworkConnection;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.ovf.VCloudNetworkAdapter;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.ImmutableSet.Builder;
+import com.google.common.collect.Iterables;
+
+public class VCloudComputeUtils {
+ public static OperatingSystem toComputeOs(VApp vApp, OperatingSystem defaultOs) {
+ CIMOperatingSystem cimOs = toComputeOs(vApp);
+ return cimOs != null ? cimOs : defaultOs;
+ }
+
+ public static CIMOperatingSystem toComputeOs(VApp vApp) {
+ // TODO we need to change the design so that it doesn't assume single-vms
+ return vApp.getChildren().size() > 0 ? toComputeOs(Iterables.get(vApp.getChildren(), 0)) : null;
+ }
+
+ public static CIMOperatingSystem toComputeOs(Vm vm) {
+ return CIMOperatingSystem.toComputeOs(vm.getOperatingSystemSection());
+ }
+
+ public static String getVirtualSystemIdentifierOfFirstVMIn(VApp vApp) {
+ return vApp.getChildren().size() > 0 ? getVirtualSystemIdentifierOf(Iterables.get(vApp.getChildren(), 0)) : null;
+ }
+
+ public static String getVirtualSystemIdentifierOf(Vm vm) {
+ if (vm.getVirtualHardwareSection() != null && vm.getVirtualHardwareSection().getSystem() != null)
+ return vm.getVirtualHardwareSection().getSystem().getVirtualSystemIdentifier();
+ return null;
+ }
+
+ public static LoginCredentials getCredentialsFrom(VApp vApp) {
+ return vApp.getChildren().size() > 0 ? getCredentialsFrom(Iterables.get(vApp.getChildren(), 0)) : null;
+ }
+
+ public static LoginCredentials getCredentialsFrom(VAppTemplate vApp) {
+ return vApp.getChildren().size() > 0 ? getCredentialsFrom(Iterables.get(vApp.getChildren(), 0)) : null;
+ }
+
+ public static LoginCredentials getCredentialsFrom(Vm vm) {
+ LoginCredentials.Builder builder = LoginCredentials.builder();
+ if (vm.getGuestCustomizationSection() != null)
+ builder.password(vm.getGuestCustomizationSection().getAdminPassword());
+ return builder.build();
+ }
+
+ public static Set<String> getIpsFromVApp(VApp vApp) {
+ // TODO make this work with composite vApps
+ if (vApp.getChildren().size() == 0)
+ return ImmutableSet.of();
+ Builder<String> ips = ImmutableSet.builder();
+ Vm vm = Iterables.get(vApp.getChildren(), 0);
+ // TODO: figure out how to differentiate public from private ip addresses
+ // assumption is that we'll do this from the network object, which may
+ // have
+ // enough data to tell whether or not it is a public network without
+ // string
+ // parsing. At worst, we could have properties set per cloud provider to
+ // declare the networks which are public, then check against these in
+ // networkconnection.getNetwork
+ if (vm.getNetworkConnectionSection() != null) {
+ for (NetworkConnection connection : vm.getNetworkConnectionSection().getConnections()) {
+ if (connection.getIpAddress() != null)
+ ips.add(connection.getIpAddress());
+ if (connection.getExternalIpAddress() != null)
+ ips.add(connection.getExternalIpAddress());
+ }
+ } else {
+ for (ResourceAllocationSettingData net : filter(vm.getVirtualHardwareSection().getItems(),
+ CIMPredicates.resourceTypeIn(ResourceType.ETHERNET_ADAPTER))) {
+ if (net instanceof VCloudNetworkAdapter) {
+ VCloudNetworkAdapter vNet = VCloudNetworkAdapter.class.cast(net);
+ if (vNet.getIpAddress() != null)
+ ips.add(vNet.getIpAddress());
+ }
+ }
+ }
+ return ips.build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultCatalogForOrg.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultCatalogForOrg.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultCatalogForOrg.java
new file mode 100644
index 0000000..eb700f3
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultCatalogForOrg.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.config;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_CATALOG;
+
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.config.ValueOfConfigurationKeyOrNull;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.Catalog;
+import org.jclouds.vcloud.suppliers.OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+
+@Singleton
+public class DefaultCatalogForOrg implements Function<ReferenceType, ReferenceType> {
+ private final OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault selector;
+ private final Supplier<Map<String, Org>> nameToOrg;
+
+ @Inject
+ public DefaultCatalogForOrg(ValueOfConfigurationKeyOrNull valueOfConfigurationKeyOrNull,
+ @Catalog Predicate<ReferenceType> defaultSelector, Supplier<Map<String, Org>> nameToOrg) {
+ this.selector = new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(checkNotNull(
+ valueOfConfigurationKeyOrNull, "valueOfConfigurationKeyOrNull"), PROPERTY_VCLOUD_DEFAULT_CATALOG,
+ checkNotNull(defaultSelector, "defaultSelector"));
+ this.nameToOrg = checkNotNull(nameToOrg, "nameToOrg");
+ }
+
+ @Override
+ public ReferenceType apply(ReferenceType defaultOrg) {
+ Org org = nameToOrg.get().get(defaultOrg.getName());
+ checkState(org != null, "could not retrieve Org at %s", defaultOrg);
+ return selector.apply(org.getCatalogs().values());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultNetworkForVDC.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultNetworkForVDC.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultNetworkForVDC.java
new file mode 100644
index 0000000..e336b95
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultNetworkForVDC.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.config;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_NETWORK;
+
+import java.net.URI;
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.config.ValueOfConfigurationKeyOrNull;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VDC;
+import org.jclouds.vcloud.endpoints.Network;
+import org.jclouds.vcloud.suppliers.OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+
+@Singleton
+public class DefaultNetworkForVDC implements Function<ReferenceType, ReferenceType> {
+
+ private final OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault selector;
+ private final Supplier<Map<URI, VDC>> uriToVDC;
+
+ @Inject
+ public DefaultNetworkForVDC(ValueOfConfigurationKeyOrNull valueOfConfigurationKeyOrNull,
+ @Network Predicate<ReferenceType> defaultSelector, Supplier<Map<URI, VDC>> uriToVDC) {
+ this.selector = new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(checkNotNull(
+ valueOfConfigurationKeyOrNull, "valueOfConfigurationKeyOrNull"), PROPERTY_VCLOUD_DEFAULT_NETWORK,
+ checkNotNull(defaultSelector, "defaultSelector"));
+ this.uriToVDC = checkNotNull(uriToVDC, "uriToVDC");
+ }
+
+ @Override
+ public ReferenceType apply(ReferenceType defaultVDC) {
+ org.jclouds.vcloud.domain.VDC vDC = uriToVDC.get().get(defaultVDC.getHref());
+ checkState(vDC != null, "could not retrieve VDC at %s", defaultVDC);
+ return selector.apply(vDC.getAvailableNetworks().values());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultOrgForUser.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultOrgForUser.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultOrgForUser.java
new file mode 100644
index 0000000..8ed2eba
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultOrgForUser.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.config;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_ORG;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.config.ValueOfConfigurationKeyOrNull;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VCloudSession;
+import org.jclouds.vcloud.endpoints.Org;
+import org.jclouds.vcloud.suppliers.OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault;
+
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+
+@Singleton
+public class DefaultOrgForUser implements Supplier<ReferenceType> {
+
+ private final OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault selector;
+ private final Supplier<VCloudSession> session;
+
+ @Inject
+ public DefaultOrgForUser(ValueOfConfigurationKeyOrNull valueOfConfigurationKeyOrNull,
+ @Org Predicate<ReferenceType> defaultSelector, Supplier<VCloudSession> session) {
+ this.selector = new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(checkNotNull(
+ valueOfConfigurationKeyOrNull, "valueOfConfigurationKeyOrNull"), PROPERTY_VCLOUD_DEFAULT_ORG, checkNotNull(
+ defaultSelector, "defaultSelector"));
+ this.session = checkNotNull(session, "session");
+ }
+
+ @Override
+ public ReferenceType get() {
+ return selector.apply(session.get().getOrgs().values());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultTasksListForOrg.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultTasksListForOrg.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultTasksListForOrg.java
new file mode 100644
index 0000000..c670161
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultTasksListForOrg.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.config;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+
+import com.google.common.base.Function;
+import com.google.common.base.Supplier;
+
+@Singleton
+public class DefaultTasksListForOrg implements Function<ReferenceType, ReferenceType> {
+ private final Supplier<Map<String, Org>> nameToOrg;
+
+ @Inject
+ public DefaultTasksListForOrg(Supplier<Map<String, Org>> nameToOrg) {
+ this.nameToOrg = checkNotNull(nameToOrg, "nameToOrg");
+ }
+
+ @Override
+ public ReferenceType apply(ReferenceType defaultOrg) {
+ org.jclouds.vcloud.domain.Org org = nameToOrg.get().get(defaultOrg.getName());
+ checkState(org != null, "could not retrieve Org at %s", defaultOrg);
+ return org.getTasksList();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultVCloudReferencesModule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultVCloudReferencesModule.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultVCloudReferencesModule.java
new file mode 100644
index 0000000..5a0ba9d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultVCloudReferencesModule.java
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.config;
+
+import java.net.URI;
+import java.util.Map;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.domain.Catalog;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.Org;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMap.Builder;
+import com.google.inject.AbstractModule;
+import com.google.inject.Injector;
+import com.google.inject.Provides;
+import com.google.inject.TypeLiteral;
+
+public class DefaultVCloudReferencesModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ bind(new TypeLiteral<Supplier<ReferenceType>>() {
+ }).annotatedWith(Org.class).to(DefaultOrgForUser.class);
+ }
+
+ @Provides
+ @Singleton
+ @org.jclouds.vcloud.endpoints.Org
+ protected Predicate<ReferenceType> provideDefaultOrgSelector(Injector i) {
+ return Predicates.alwaysTrue();
+ }
+
+ @Provides
+ @org.jclouds.vcloud.endpoints.TasksList
+ @Singleton
+ protected Supplier<ReferenceType> provideDefaultTasksList(DefaultTasksListForOrg defaultTasksListURIForOrg,
+ @org.jclouds.vcloud.endpoints.Org Supplier<ReferenceType> defaultOrg) {
+ return Suppliers.compose(defaultTasksListURIForOrg, defaultOrg);
+ }
+
+ @Provides
+ @org.jclouds.vcloud.endpoints.Catalog
+ @Singleton
+ protected Supplier<ReferenceType> provideDefaultCatalog(DefaultCatalogForOrg defaultCatalogURIForOrg,
+ @org.jclouds.vcloud.endpoints.Org Supplier<ReferenceType> defaultOrg) {
+ return Suppliers.compose(defaultCatalogURIForOrg, defaultOrg);
+ }
+
+ @Provides
+ @Singleton
+ @org.jclouds.vcloud.endpoints.Catalog
+ protected Predicate<ReferenceType> provideDefaultCatalogSelector(Injector i) {
+ return i.getInstance(WriteableCatalog.class);
+ }
+
+ @Provides
+ @Singleton
+ protected Supplier<Map<URI, org.jclouds.vcloud.domain.Catalog>> provideCatalogsById(
+ Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.Catalog>>> supplier) {
+ return Suppliers
+ .compose(
+ new Function<Map<String, Map<String, org.jclouds.vcloud.domain.Catalog>>, Map<URI, org.jclouds.vcloud.domain.Catalog>>() {
+
+ @Override
+ public Map<URI, Catalog> apply(Map<String, Map<String, Catalog>> arg0) {
+ Builder<URI, Catalog> builder = ImmutableMap.builder();
+ for (Map<String, Catalog> v1 : arg0.values()) {
+ for (Catalog v2 : v1.values()) {
+ builder.put(v2.getHref(), v2);
+ }
+ }
+ return builder.build();
+ }
+
+ }, supplier);
+ }
+
+ @Singleton
+ public static class WriteableCatalog implements Predicate<ReferenceType> {
+
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ private final Supplier<Map<URI, org.jclouds.vcloud.domain.Catalog>> catalogsByIdSupplier;
+
+ @Inject
+ public WriteableCatalog(Supplier<Map<URI, org.jclouds.vcloud.domain.Catalog>> catalogsByIdSupplier) {
+ this.catalogsByIdSupplier = catalogsByIdSupplier;
+ }
+
+ @Override
+ public boolean apply(ReferenceType arg0) {
+ // TODO: this is inefficient, calculating the index each time, but
+ // shouldn't be added to constructor as the supplier is an expensive
+ // call
+ Map<URI, Catalog> index = catalogsByIdSupplier.get();
+ Catalog catalog = index.get(arg0.getHref());
+ if (catalog == null) {
+ if (logger.isTraceEnabled())
+ logger.trace("didn't find catalog %s", arg0);
+ return false;
+ } else
+ return !catalog.isReadOnly();
+ }
+ }
+
+ @Provides
+ @org.jclouds.vcloud.endpoints.VDC
+ @Singleton
+ protected Supplier<ReferenceType> provideDefaultVDC(DefaultVDCForOrg defaultVDCURIForOrg,
+ @org.jclouds.vcloud.endpoints.Org Supplier<ReferenceType> defaultOrg) {
+ return Suppliers.compose(defaultVDCURIForOrg, defaultOrg);
+ }
+
+ @Provides
+ @Singleton
+ @org.jclouds.vcloud.endpoints.VDC
+ protected Predicate<ReferenceType> provideDefaultVDCSelector(Injector i) {
+ return Predicates.alwaysTrue();
+ }
+
+ @Provides
+ @org.jclouds.vcloud.endpoints.Network
+ @Singleton
+ protected Supplier<ReferenceType> provideDefaultNetwork(DefaultNetworkForVDC defaultNetworkURIForVDC,
+ @org.jclouds.vcloud.endpoints.VDC Supplier<ReferenceType> defaultVDC) {
+ return Suppliers.compose(defaultNetworkURIForVDC, defaultVDC);
+ }
+
+ @Provides
+ @Singleton
+ @org.jclouds.vcloud.endpoints.Network
+ protected Predicate<ReferenceType> provideDefaultNetworkSelector(Injector i) {
+ return Predicates.alwaysTrue();
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultVDCForOrg.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultVDCForOrg.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultVDCForOrg.java
new file mode 100644
index 0000000..4eefd30
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/DefaultVDCForOrg.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.config;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_VDC;
+
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.config.ValueOfConfigurationKeyOrNull;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.VDC;
+import org.jclouds.vcloud.suppliers.OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+
+@Singleton
+public class DefaultVDCForOrg implements Function<ReferenceType, ReferenceType> {
+ private final OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault selector;
+ private final Supplier<Map<String, Org>> nameToOrg;
+
+ @Inject
+ public DefaultVDCForOrg(ValueOfConfigurationKeyOrNull valueOfConfigurationKeyOrNull,
+ @VDC Predicate<ReferenceType> defaultSelector, Supplier<Map<String, Org>> nameToOrg) {
+ this.selector = new OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(checkNotNull(
+ valueOfConfigurationKeyOrNull, "valueOfConfigurationKeyOrNull"), PROPERTY_VCLOUD_DEFAULT_VDC,
+ checkNotNull(defaultSelector, "defaultSelector"));
+ this.nameToOrg = checkNotNull(nameToOrg, "nameToOrg");
+ }
+
+ @Override
+ public ReferenceType apply(ReferenceType defaultOrg) {
+ Org org = nameToOrg.get().get(defaultOrg.getName());
+ checkState(org != null, "could not retrieve Org at %s", defaultOrg);
+ return selector.apply(org.getVDCs().values());
+ }
+
+}
[18/18] stratos git commit: Jclouds vcloud api 1.8.1 clone with
custom changes
Posted by ra...@apache.org.
Jclouds vcloud api 1.8.1 clone with custom changes
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/6573fbed
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/6573fbed
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/6573fbed
Branch: refs/heads/master
Commit: 6573fbed3cb2acab9595ab66a4004546076abc81
Parents: ae5425e
Author: R-Rajkumar <rr...@gmail.com>
Authored: Tue Nov 25 21:08:52 2014 +0530
Committer: R-Rajkumar <rr...@gmail.com>
Committed: Tue Nov 25 21:08:52 2014 +0530
----------------------------------------------------------------------
.../apis/vcloud/1.8.1-stratos/README.txt | 6 +
.../jclouds/apis/vcloud/1.8.1-stratos/pom.xml | 131 +++
.../vcloud/TaskInErrorStateException.java | 34 +
.../vcloud/TaskStillRunningException.java | 34 +
.../main/java/org/jclouds/vcloud/VCloudApi.java | 90 ++
.../org/jclouds/vcloud/VCloudApiMetadata.java | 101 +++
.../org/jclouds/vcloud/VCloudMediaType.java | 222 +++++
.../jclouds/vcloud/VCloudResponseException.java | 66 ++
.../java/org/jclouds/vcloud/VCloudToken.java | 34 +
.../org/jclouds/vcloud/VCloudVersionsApi.java | 38 +
.../binders/BindCPUCountToXmlPayload.java | 74 ++
.../BindCaptureVAppParamsToXmlPayload.java | 119 +++
.../binders/BindCatalogItemToXmlPayload.java | 121 +++
.../binders/BindCloneParamsToXmlPayload.java | 128 +++
.../BindCloneVAppParamsToXmlPayload.java | 60 ++
...BindCloneVAppTemplateParamsToXmlPayload.java | 55 ++
.../BindDeployVAppParamsToXmlPayload.java | 37 +
...ndGuestCustomizationSectionToXmlPayload.java | 107 +++
...stantiateVAppTemplateParamsToXmlPayload.java | 216 +++++
.../vcloud/binders/BindMemoryToXmlPayload.java | 75 ++
...indNetworkConnectionSectionToXmlPayload.java | 101 +++
.../vcloud/binders/BindParamsToXmlPayload.java | 76 ++
.../BindUndeployVAppParamsToXmlPayload.java | 37 +
.../OrgNameAndCatalogNameToEndpoint.java | 75 ++
.../binders/OrgNameAndVDCNameToEndpoint.java | 74 ++
.../OrgNameCatalogNameItemNameToEndpoint.java | 73 ++
...meCatalogNameVAppTemplateNameToEndpoint.java | 86 ++
.../OrgNameVDCNameNetworkNameToEndpoint.java | 50 +
...NameVDCNameResourceEntityNameToEndpoint.java | 50 +
.../OrgNameVDCNameResourceNameToEndpoint.java | 77 ++
.../VCloudComputeServiceContextModule.java | 37 +
.../VCloudComputeServiceDependenciesModule.java | 150 +++
.../functions/FindLocationForResource.java | 66 ++
.../compute/functions/HardwareForVApp.java | 68 ++
.../functions/HardwareForVAppTemplate.java | 81 ++
.../compute/functions/ImageForVAppTemplate.java | 79 ++
.../compute/functions/VAppToNodeMetadata.java | 111 +++
...dHardwareBuilderFromResourceAllocations.java | 40 +
...EnvelopeOrThrowIllegalArgumentException.java | 74 ++
.../internal/VCloudTemplateBuilderImpl.java | 45 +
.../compute/options/VCloudTemplateOptions.java | 348 +++++++
...edIntoNameThenCustomizeDeployAndPowerOn.java | 299 ++++++
...etworkConfigurationForNetworkAndOptions.java | 76 ++
.../strategy/VCloudComputeServiceAdapter.java | 262 ++++++
.../vcloud/compute/util/VCloudComputeUtils.java | 112 +++
.../vcloud/config/DefaultCatalogForOrg.java | 59 ++
.../vcloud/config/DefaultNetworkForVDC.java | 61 ++
.../vcloud/config/DefaultOrgForUser.java | 54 ++
.../vcloud/config/DefaultTasksListForOrg.java | 49 +
.../config/DefaultVCloudReferencesModule.java | 161 ++++
.../jclouds/vcloud/config/DefaultVDCForOrg.java | 59 ++
.../vcloud/config/VCloudHttpApiModule.java | 536 +++++++++++
.../jclouds/vcloud/domain/AllocationModel.java | 70 ++
.../org/jclouds/vcloud/domain/Capacity.java | 106 +++
.../java/org/jclouds/vcloud/domain/Catalog.java | 66 ++
.../org/jclouds/vcloud/domain/CatalogItem.java | 34 +
.../domain/GuestCustomizationSection.java | 440 +++++++++
.../domain/InstantiateVAppTemplateParams.java | 96 ++
.../vcloud/domain/NetworkConnection.java | 231 +++++
.../vcloud/domain/NetworkConnectionSection.java | 218 +++++
.../java/org/jclouds/vcloud/domain/Org.java | 84 ++
.../jclouds/vcloud/domain/ReferenceType.java | 52 ++
.../java/org/jclouds/vcloud/domain/Status.java | 244 +++++
.../java/org/jclouds/vcloud/domain/Task.java | 72 ++
.../org/jclouds/vcloud/domain/TaskStatus.java | 68 ++
.../org/jclouds/vcloud/domain/TasksList.java | 34 +
.../java/org/jclouds/vcloud/domain/VApp.java | 85 ++
.../org/jclouds/vcloud/domain/VAppTemplate.java | 95 ++
.../org/jclouds/vcloud/domain/VCloudError.java | 118 +++
.../jclouds/vcloud/domain/VCloudSession.java | 25 +
.../java/org/jclouds/vcloud/domain/VDC.java | 144 +++
.../org/jclouds/vcloud/domain/VDCStatus.java | 57 ++
.../main/java/org/jclouds/vcloud/domain/Vm.java | 106 +++
.../vcloud/domain/internal/CatalogImpl.java | 189 ++++
.../vcloud/domain/internal/CatalogItemImpl.java | 106 +++
.../vcloud/domain/internal/ErrorImpl.java | 114 +++
.../jclouds/vcloud/domain/internal/OrgImpl.java | 168 ++++
.../domain/internal/ReferenceTypeImpl.java | 99 ++
.../vcloud/domain/internal/TaskImpl.java | 160 ++++
.../vcloud/domain/internal/TasksListImpl.java | 78 ++
.../vcloud/domain/internal/VAppImpl.java | 163 ++++
.../domain/internal/VAppTemplateImpl.java | 202 +++++
.../jclouds/vcloud/domain/internal/VDCImpl.java | 289 ++++++
.../jclouds/vcloud/domain/internal/VmImpl.java | 214 +++++
.../vcloud/domain/network/DhcpService.java | 106 +++
.../jclouds/vcloud/domain/network/Features.java | 95 ++
.../vcloud/domain/network/FenceMode.java | 68 ++
.../vcloud/domain/network/FirewallService.java | 86 ++
.../domain/network/IpAddressAllocationMode.java | 50 +
.../jclouds/vcloud/domain/network/IpRange.java | 75 ++
.../jclouds/vcloud/domain/network/IpScope.java | 169 ++++
.../vcloud/domain/network/NatService.java | 115 +++
.../vcloud/domain/network/NetworkConfig.java | 163 ++++
.../vcloud/domain/network/OrgNetwork.java | 119 +++
.../domain/network/firewall/FirewallPolicy.java | 53 ++
.../network/firewall/FirewallProtocols.java | 71 ++
.../domain/network/firewall/FirewallRule.java | 124 +++
.../domain/network/internal/OrgNetworkImpl.java | 198 ++++
.../vcloud/domain/network/nat/NatPolicy.java | 53 ++
.../vcloud/domain/network/nat/NatProtocol.java | 46 +
.../vcloud/domain/network/nat/NatRule.java | 33 +
.../vcloud/domain/network/nat/NatType.java | 59 ++
.../domain/network/nat/rules/MappingMode.java | 53 ++
.../network/nat/rules/OneToOneVmRule.java | 109 +++
.../network/nat/rules/PortForwardingRule.java | 110 +++
.../vcloud/domain/network/nat/rules/VmRule.java | 127 +++
.../EditableResourceAllocationSettingData.java | 298 ++++++
.../vcloud/domain/ovf/VCloudHardDisk.java | 326 +++++++
.../vcloud/domain/ovf/VCloudNetworkAdapter.java | 328 +++++++
.../vcloud/domain/ovf/VCloudNetworkSection.java | 80 ++
.../ovf/VCloudOperatingSystemSection.java | 118 +++
.../ovf/VCloudVirtualHardwareSection.java | 179 ++++
.../org/jclouds/vcloud/endpoints/Catalog.java | 34 +
.../org/jclouds/vcloud/endpoints/Network.java | 34 +
.../java/org/jclouds/vcloud/endpoints/Org.java | 34 +
.../org/jclouds/vcloud/endpoints/OrgList.java | 34 +
.../org/jclouds/vcloud/endpoints/TasksList.java | 34 +
.../jclouds/vcloud/endpoints/VCloudLogin.java | 36 +
.../java/org/jclouds/vcloud/endpoints/VDC.java | 34 +
.../org/jclouds/vcloud/features/CatalogApi.java | 143 +++
.../org/jclouds/vcloud/features/NetworkApi.java | 60 ++
.../org/jclouds/vcloud/features/OrgApi.java | 84 ++
.../org/jclouds/vcloud/features/TaskApi.java | 80 ++
.../org/jclouds/vcloud/features/VAppApi.java | 260 ++++++
.../vcloud/features/VAppTemplateApi.java | 179 ++++
.../org/jclouds/vcloud/features/VDCApi.java | 71 ++
.../java/org/jclouds/vcloud/features/VmApi.java | 293 ++++++
...ddVCloudAuthorizationAndCookieToRequest.java | 60 ++
.../vcloud/functions/CatalogItemsInCatalog.java | 61 ++
.../vcloud/functions/CatalogItemsInOrg.java | 54 ++
.../jclouds/vcloud/functions/CatalogsInOrg.java | 69 ++
.../functions/DefaultNetworkNameInTemplate.java | 47 +
.../jclouds/vcloud/functions/NetworksInOrg.java | 54 ++
.../vcloud/functions/OrgNameToEndpoint.java | 53 ++
.../functions/OrgNameToTasksListEndpoint.java | 58 ++
.../vcloud/functions/OrgsForLocations.java | 70 ++
.../jclouds/vcloud/functions/OrgsForNames.java | 53 ++
.../ParseLoginResponseFromHeaders.java | 103 +++
.../functions/VAppTemplatesForCatalogItems.java | 63 ++
.../vcloud/functions/VAppTemplatesInOrg.java | 62 ++
.../org/jclouds/vcloud/functions/VDCsInOrg.java | 54 ++
.../ParseVCloudErrorFromHttpResponse.java | 118 +++
.../http/filters/VCloudBasicAuthentication.java | 58 ++
.../http/filters/VCloudSupportedVersions.java | 35 +
.../jclouds/vcloud/internal/VCloudLoginApi.java | 45 +
.../org/jclouds/vcloud/loaders/OVFLoader.java | 47 +
.../vcloud/loaders/VAppTemplateLoader.java | 47 +
.../org/jclouds/vcloud/location/DefaultVDC.java | 74 ++
.../location/OrgAndVDCToLocationSupplier.java | 90 ++
.../vcloud/options/CaptureVAppOptions.java | 46 +
.../vcloud/options/CatalogItemOptions.java | 72 ++
.../jclouds/vcloud/options/CloneOptions.java | 48 +
.../vcloud/options/CloneVAppOptions.java | 83 ++
.../options/CloneVAppTemplateOptions.java | 37 +
.../options/InstantiateVAppTemplateOptions.java | 173 ++++
.../jclouds/vcloud/predicates/TaskSuccess.java | 63 ++
.../vcloud/reference/VCloudConstants.java | 52 ++
.../jclouds/vcloud/reference/package-info.java | 20 +
...thNameMatchingConfigurationKeyOrDefault.java | 95 ++
.../vcloud/suppliers/VAppTemplatesSupplier.java | 83 ++
.../java/org/jclouds/vcloud/util/Utils.java | 67 ++
.../org/jclouds/vcloud/util/VCloudUtils.java | 65 ++
.../org/jclouds/vcloud/xml/CatalogHandler.java | 101 +++
.../jclouds/vcloud/xml/CatalogItemHandler.java | 78 ++
.../org/jclouds/vcloud/xml/ErrorHandler.java | 42 +
.../xml/GuestCustomizationSectionHandler.java | 134 +++
.../vcloud/xml/NetworkConnectionHandler.java | 84 ++
.../xml/NetworkConnectionSectionHandler.java | 100 ++
.../java/org/jclouds/vcloud/xml/OrgHandler.java | 109 +++
.../org/jclouds/vcloud/xml/OrgListHandler.java | 51 ++
.../jclouds/vcloud/xml/OrgNetworkHandler.java | 322 +++++++
.../vcloud/xml/SupportedVersionsHandler.java | 57 ++
.../org/jclouds/vcloud/xml/TaskHandler.java | 125 +++
.../jclouds/vcloud/xml/TasksListHandler.java | 71 ++
.../org/jclouds/vcloud/xml/VAppHandler.java | 148 +++
.../jclouds/vcloud/xml/VAppTemplateHandler.java | 149 +++
.../xml/VCloudVirtualHardwareHandler.java | 69 ++
.../java/org/jclouds/vcloud/xml/VDCHandler.java | 164 ++++
.../java/org/jclouds/vcloud/xml/VmHandler.java | 175 ++++
.../xml/ovf/VCloudNetworkSectionHandler.java | 66 ++
.../xml/ovf/VCloudOperatingSystemHandler.java | 78 ++
...oudResourceAllocationSettingDataHandler.java | 86 ++
.../services/org.jclouds.apis.ApiMetadata | 1 +
.../jclouds/vcloud/VCloudApiMetadataTest.java | 28 +
.../java/org/jclouds/vcloud/VCloudApiTest.java | 62 ++
.../vcloud/VCloudSessionRefreshLiveTest.java | 39 +
.../jclouds/vcloud/VCloudVersionsApiTest.java | 68 ++
.../BindCatalogItemToXmlPayloadTest.java | 51 ++
.../BindCloneVAppParamsToXmlPayloadTest.java | 79 ++
...CloneVAppTemplateParamsToXmlPayloadTest.java | 87 ++
.../BindDeployVAppParamsToXmlPayloadTest.java | 59 ++
...tiateVAppTemplateParamsToXmlPayloadTest.java | 177 ++++
...etworkConnectionSectionToXmlPayloadTest.java | 66 ++
.../BindUndeployVAppParamsToXmlPayloadTest.java | 59 ++
.../BaseVCloudComputeServiceExpectTest.java | 158 ++++
.../compute/VCloudComputeServiceLiveTest.java | 49 +
.../functions/FindLocationForResourceTest.java | 62 ++
.../functions/ListImagesInVCloudExpectTest.java | 85 ++
.../functions/VAppToNodeMetadataTest.java | 226 +++++
.../options/VCloudTemplateOptionsTest.java | 195 ++++
...ThenCustomizeDeployAndPowerOnExpectTest.java | 167 ++++
.../VCloudComputeServiceAdapterTest.java | 89 ++
.../vcloud/features/CatalogApiLiveTest.java | 50 +
.../jclouds/vcloud/features/CatalogApiTest.java | 129 +++
.../vcloud/features/NetworkApiLiveTest.java | 26 +
.../jclouds/vcloud/features/NetworkApiTest.java | 73 ++
.../jclouds/vcloud/features/OrgApiLiveTest.java | 39 +
.../org/jclouds/vcloud/features/OrgApiTest.java | 89 ++
.../vcloud/features/TaskApiLiveTest.java | 26 +
.../jclouds/vcloud/features/TaskApiTest.java | 106 +++
.../vcloud/features/VAppApiLiveTest.java | 49 +
.../jclouds/vcloud/features/VAppApiTest.java | 313 +++++++
.../features/VAppTemplateApiLiveTest.java | 164 ++++
.../vcloud/features/VAppTemplateApiTest.java | 236 +++++
.../jclouds/vcloud/features/VDCApiLiveTest.java | 26 +
.../org/jclouds/vcloud/features/VDCApiTest.java | 100 ++
.../jclouds/vcloud/features/VmApiLiveTest.java | 161 ++++
.../org/jclouds/vcloud/features/VmApiTest.java | 318 +++++++
...loudAuthorizationAndCookieToRequestTest.java | 51 ++
.../ParseLoginResponseFromHeadersTest.java | 145 +++
.../ParseVCloudErrorFromHttpResponseTest.java | 92 ++
.../vcloud/internal/BasePayloadTest.java | 51 ++
.../vcloud/internal/BaseVCloudApiLiveTest.java | 55 ++
.../vcloud/internal/BaseVCloudApiTest.java | 270 ++++++
.../vcloud/internal/VCloudLoginApiTest.java | 95 ++
.../InstantiateVAppTemplateOptionsTest.java | 72 ++
...meMatchingConfigurationKeyOrDefaultTest.java | 113 +++
.../org/jclouds/vcloud/utils/TestUtils.java | 30 +
.../jclouds/vcloud/xml/CatalogHandlerTest.java | 133 +++
.../vcloud/xml/CatalogItemHandlerTest.java | 84 ++
.../GuestCustomizationSectionHandlerTest.java | 73 ++
.../xml/NetworkConnectionHandlerTest.java | 55 ++
.../NetworkConnectionSectionHandlerTest.java | 61 ++
.../org/jclouds/vcloud/xml/OrgHandlerTest.java | 122 +++
.../jclouds/vcloud/xml/OrgListHandlerTest.java | 55 ++
.../vcloud/xml/OrgNetworkHandlerTest.java | 102 +++
.../xml/SupportedVersionsHandlerTest.java | 51 ++
.../org/jclouds/vcloud/xml/TaskHandlerTest.java | 133 +++
.../vcloud/xml/TasksListHandlerTest.java | 80 ++
.../org/jclouds/vcloud/xml/VAppHandlerTest.java | 75 ++
.../vcloud/xml/VAppTemplateHandlerTest.java | 162 ++++
.../org/jclouds/vcloud/xml/VDCHandlerTest.java | 134 +++
.../org/jclouds/vcloud/xml/VmHandlerTest.java | 77 ++
...VCloudOperatingSystemSectionHandlerTest.java | 59 ++
...VCloudVirtualHardwareSectionHandlerTest.java | 151 ++++
.../src/test/resources/captureVApp-default.xml | 1 +
.../src/test/resources/captureVApp.xml | 1 +
.../src/test/resources/catalog-blank.xml | 7 +
.../src/test/resources/catalog-hosting.xml | 25 +
.../src/test/resources/catalog.xml | 27 +
.../src/test/resources/catalog1.0-vcd15.xml | 9 +
...alogItem-carrenza-with-default-namespace.xml | 8 +
...talogItem-carrenza-with-vcloud-namespace.xml | 8 +
.../src/test/resources/catalogItem-hosting.xml | 14 +
.../test/resources/catalogItem-terremark.xml | 16 +
.../src/test/resources/catalogItem1.0-vcd15.xml | 8 +
.../src/test/resources/copyVApp-default.xml | 1 +
.../src/test/resources/copyVApp.xml | 1 +
.../test/resources/copyVAppTemplate-default.xml | 1 +
.../src/test/resources/copyVAppTemplate.xml | 1 +
.../src/test/resources/cpuItem.xml | 1 +
.../src/test/resources/guestCustomization.xml | 23 +
.../resources/guestCustomizationSection.xml | 3 +
.../src/test/resources/instantiatedvapp.xml | 13 +
.../instantiationparams-description.xml | 1 +
.../resources/instantiationparams-network.xml | 1 +
.../src/test/resources/instantiationparams.xml | 1 +
.../1.8.1-stratos/src/test/resources/log4j.xml | 151 ++++
.../src/test/resources/memoryItem.xml | 1 +
.../src/test/resources/moveVApp.xml | 1 +
.../src/test/resources/moveVAppTemplate.xml | 1 +
.../src/test/resources/networkconnection.xml | 7 +
.../test/resources/networkconnectionsection.xml | 18 +
.../src/test/resources/org-1.0.xml | 24 +
.../src/test/resources/org-hosting.xml | 12 +
.../src/test/resources/org-savvis.xml | 13 +
.../1.8.1-stratos/src/test/resources/org.xml | 5 +
.../src/test/resources/org1.0-vcd15.xml | 11 +
.../src/test/resources/orgList1.0-vcd15.xml | 4 +
.../src/test/resources/orglist-savvis.xml | 3 +
.../src/test/resources/orglist.xml | 3 +
.../src/test/resources/orgnetwork-bridged.xml | 20 +
.../src/test/resources/orgnetwork-isolated.xml | 31 +
.../1.8.1-stratos/src/test/resources/os.xml | 11 +
.../src/test/resources/ovf-multi-vm.xml | 285 ++++++
.../src/test/resources/ovf-ubuntu64.xml | 148 +++
.../src/test/resources/task-1.0.xml | 9 +
.../src/test/resources/task-error.xml | 9 +
.../src/test/resources/task-hosting.xml | 12 +
.../src/test/resources/task-self.xml | 11 +
.../src/test/resources/task-vcd15.xml | 5 +
.../1.8.1-stratos/src/test/resources/task.xml | 8 +
.../src/test/resources/taskslist-hosting.xml | 14 +
.../src/test/resources/taskslist.xml | 27 +
.../resources/template1.0-vcd15-multi-vm.xml | 68 ++
.../src/test/resources/template1.0-vcd15.xml | 72 ++
.../src/test/resources/vAppTemplate-copying.xml | 41 +
.../src/test/resources/vAppTemplate.xml | 143 +++
.../vAppTemplate1.0-vcd15_withNewlines.xml | 109 +++
.../src/test/resources/vapp-hosting.xml | 235 +++++
.../src/test/resources/vapp-none.xml | 237 +++++
.../src/test/resources/vapp-pool.xml | 227 +++++
.../src/test/resources/vapp-rhel-off-static.xml | 325 +++++++
.../src/test/resources/vapp-ubuntu-off-dhcp.xml | 213 +++++
.../src/test/resources/vapp-unresolved.xml | 21 +
.../src/test/resources/vapp-win-off-static.xml | 219 +++++
.../src/test/resources/vdc-1.0.xml | 49 +
.../src/test/resources/vdc-hosting.xml | 60 ++
.../src/test/resources/vdc-nonet.xml | 22 +
.../1.8.1-stratos/src/test/resources/vdc.xml | 36 +
.../src/test/resources/vdc1.0-vcd15.xml | 47 +
.../src/test/resources/versions-vcd15.xml | 906 +++++++++++++++++++
.../src/test/resources/versions.xml | 7 +
.../test/resources/virtualhardwaresection.xml | 118 +++
.../src/test/resources/vm-rhel-off-static.xml | 197 ++++
315 files changed, 29470 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/README.txt
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/README.txt b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/README.txt
new file mode 100644
index 0000000..b00a7af
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/README.txt
@@ -0,0 +1,6 @@
+#
+# The jclouds API for VMware vCloud (http://www.vmware.com/products/vcloud/).
+#
+# TODO: Implementation status.
+# TODO: Supported features.
+# TODO: Usage example.
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/pom.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/pom.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/pom.xml
new file mode 100644
index 0000000..8357aec
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/pom.xml
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-project</artifactId>
+ <version>1.8.1</version>
+ </parent>
+ <groupId>org.apache.stratos</groupId>
+ <artifactId>vcloud</artifactId>
+ <version>1.8.1-stratos</version>
+ <name>jclouds vcloud api</name>
+ <description>jclouds components to access an implementation of VMWare vCloud</description>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <jclouds.version>1.8.1</jclouds.version>
+ <test.vcloud.endpoint>FIXME_ENDPOINT</test.vcloud.endpoint>
+ <test.vcloud.api-version>1.0</test.vcloud.api-version>
+ <test.vcloud.build-version />
+ <test.vcloud.identity>FIXME_IDENTITY</test.vcloud.identity>
+ <test.vcloud.credential>FIXME_CREDENTIAL</test.vcloud.credential>
+ <test.vcloud.template />
+ <jclouds.osgi.export>org.jclouds.vcloud*;version="${project.version}"</jclouds.osgi.export>
+ <jclouds.osgi.import>
+ org.jclouds.compute.internal;version="${jclouds.version}",
+ org.jclouds.rest.internal;version="${jclouds.version}",
+ org.jclouds*;version="${jclouds.version}",
+ *
+ </jclouds.osgi.import>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.jamesmurty.utils</groupId>
+ <artifactId>java-xmlbuilder</artifactId>
+ <version>0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-core</artifactId>
+ <version>${jclouds.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-core</artifactId>
+ <version>${jclouds.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-compute</artifactId>
+ <version>${jclouds.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-compute</artifactId>
+ <version>${jclouds.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-sshj</artifactId>
+ <version>${jclouds.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-log4j</artifactId>
+ <version>${jclouds.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>live</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>integration</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <systemPropertyVariables>
+ <test.vcloud.endpoint>${test.vcloud.endpoint}</test.vcloud.endpoint>
+ <test.vcloud.api-version>${test.vcloud.api-version}</test.vcloud.api-version>
+ <test.vcloud.build-version>${test.vcloud.build-version}</test.vcloud.build-version>
+ <test.vcloud.identity>${test.vcloud.identity}</test.vcloud.identity>
+ <test.vcloud.credential>${test.vcloud.credential}</test.vcloud.credential>
+ <test.vcloud.template>${test.vcloud.template}</test.vcloud.template>
+ </systemPropertyVariables>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <scm>
+ <tag>4.0.0-rc4</tag>
+ </scm>
+</project>
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/TaskInErrorStateException.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/TaskInErrorStateException.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/TaskInErrorStateException.java
new file mode 100644
index 0000000..fb54599
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/TaskInErrorStateException.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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;
+
+import org.jclouds.vcloud.domain.Task;
+
+public class TaskInErrorStateException extends RuntimeException {
+
+ private final Task task;
+
+ public TaskInErrorStateException(Task task) {
+ super("error on task: " + task + " error: " + task.getError());
+ this.task = task;
+ }
+
+ public Task getTask() {
+ return task;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/TaskStillRunningException.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/TaskStillRunningException.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/TaskStillRunningException.java
new file mode 100644
index 0000000..64eafbe
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/TaskStillRunningException.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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;
+
+import org.jclouds.vcloud.domain.Task;
+
+public class TaskStillRunningException extends RuntimeException {
+
+ private final Task task;
+
+ public TaskStillRunningException(Task task) {
+ super("task still running: " + task);
+ this.task = task;
+ }
+
+ public Task getTask() {
+ return task;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/VCloudApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/VCloudApi.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/VCloudApi.java
new file mode 100644
index 0000000..1c3b46c
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/VCloudApi.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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;
+
+import java.io.Closeable;
+
+import org.jclouds.rest.annotations.Delegate;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.vcloud.features.CatalogApi;
+import org.jclouds.vcloud.features.NetworkApi;
+import org.jclouds.vcloud.features.OrgApi;
+import org.jclouds.vcloud.features.TaskApi;
+import org.jclouds.vcloud.features.VAppApi;
+import org.jclouds.vcloud.features.VAppTemplateApi;
+import org.jclouds.vcloud.features.VDCApi;
+import org.jclouds.vcloud.features.VmApi;
+import org.jclouds.vcloud.filters.AddVCloudAuthorizationAndCookieToRequest;
+
+/**
+ * Provides access to VCloud resources via their REST API.
+ * <p/>
+ *
+ * @see <a href="http://communities.vmware.com/community/developer/forums/vcloudapi" />
+ */
+@RequestFilters(AddVCloudAuthorizationAndCookieToRequest.class)
+public interface VCloudApi extends Closeable {
+ /**
+ * Provides asynchronous access to VApp Template features.
+ *
+ */
+ @Delegate
+ VAppTemplateApi getVAppTemplateApi();
+
+ /**
+ * Provides synchronous access to VApp features.
+ */
+ @Delegate
+ VAppApi getVAppApi();
+
+ /**
+ * Provides synchronous access to Vm features.
+ */
+ @Delegate
+ VmApi getVmApi();
+
+ /**
+ * Provides synchronous access to Catalog features.
+ */
+ @Delegate
+ CatalogApi getCatalogApi();
+
+ /**
+ * Provides synchronous access to Task features.
+ */
+ @Delegate
+ TaskApi getTaskApi();
+
+ /**
+ * Provides synchronous access to VDC features.
+ */
+ @Delegate
+ VDCApi getVDCApi();
+
+ /**
+ * Provides synchronous access to Network features.
+ */
+ @Delegate
+ NetworkApi getNetworkApi();
+
+ /**
+ * Provides synchronous access to Org features.
+ */
+ @Delegate
+ OrgApi getOrgApi();
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/VCloudApiMetadata.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/VCloudApiMetadata.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/VCloudApiMetadata.java
new file mode 100644
index 0000000..4c88d8a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/VCloudApiMetadata.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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;
+import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
+import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
+import static org.jclouds.reflect.Reflection2.typeToken;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_FENCEMODE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_VERSION_SCHEMA;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
+
+import java.net.URI;
+import java.util.Properties;
+
+import org.jclouds.compute.ComputeServiceContext;
+import org.jclouds.rest.internal.BaseHttpApiMetadata;
+import org.jclouds.vcloud.compute.config.VCloudComputeServiceContextModule;
+import org.jclouds.vcloud.config.VCloudHttpApiModule;
+import org.jclouds.vcloud.domain.network.FenceMode;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Module;
+
+/**
+ * Implementation of {@link ApiMetadata} for VCloud 1.0 API
+ */
+public class VCloudApiMetadata extends BaseHttpApiMetadata<VCloudApi> {
+
+
+ @Override
+ public Builder toBuilder() {
+ return new Builder().fromApiMetadata(this);
+ }
+
+ public VCloudApiMetadata() {
+ this(new Builder());
+ }
+
+ protected VCloudApiMetadata(Builder builder) {
+ super(builder);
+ }
+
+ public static Properties defaultProperties() {
+ Properties properties = BaseHttpApiMetadata.defaultProperties();
+ properties.setProperty(PROPERTY_VCLOUD_VERSION_SCHEMA, "1");
+ properties.setProperty(PROPERTY_VCLOUD_XML_NAMESPACE,
+ String.format("http://www.vmware.com/vcloud/v${%s}", PROPERTY_VCLOUD_VERSION_SCHEMA));
+ properties.setProperty(PROPERTY_SESSION_INTERVAL, 8 * 60 + "");
+ properties.setProperty(PROPERTY_VCLOUD_XML_SCHEMA, "http://vcloud.safesecureweb.com/ns/vcloud.xsd");
+ properties.setProperty("jclouds.dns_name_length_min", "1");
+ properties.setProperty("jclouds.dns_name_length_max", "80");
+ properties.setProperty(PROPERTY_VCLOUD_DEFAULT_FENCEMODE, FenceMode.BRIDGED.toString());
+ // TODO integrate this with the {@link ComputeTimeouts} instead of having
+ // a single timeout for
+ // everything.
+ properties.setProperty(PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED, 1200l * 1000l + "");
+ properties.setProperty(PROPERTY_SESSION_INTERVAL, 300 + "");
+ // CIM ostype does not include version info
+ properties.setProperty(TEMPLATE, "osFamily=UBUNTU,os64Bit=true");
+ return properties;
+ }
+
+ public static class Builder extends BaseHttpApiMetadata.Builder<VCloudApi, Builder> {
+ protected Builder() {
+ id("vcloud")
+ .name("VCloud 1.0 API")
+ .identityName("User at Organization (user@org)")
+ .credentialName("Password")
+ .documentation(URI.create("http://www.vmware.com/support/pubs/vcd_pubs.html"))
+ .version("1.0")
+ .defaultProperties(VCloudApiMetadata.defaultProperties())
+ .view(typeToken(ComputeServiceContext.class))
+ .defaultModules(ImmutableSet.<Class<? extends Module>>of(VCloudHttpApiModule.class, VCloudComputeServiceContextModule.class));
+ }
+
+ @Override
+ public VCloudApiMetadata build() {
+ return new VCloudApiMetadata(this);
+ }
+
+ @Override
+ protected Builder self() {
+ return this;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/VCloudMediaType.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/VCloudMediaType.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/VCloudMediaType.java
new file mode 100644
index 0000000..67701fb
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/VCloudMediaType.java
@@ -0,0 +1,222 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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;
+
+import javax.ws.rs.core.MediaType;
+
+/**
+ * Resource Types used in VCloud
+ *
+ * @see MediaType
+ */
+public interface VCloudMediaType {
+ /**
+ * "application/vnd.vmware.vcloud.error+xml"
+ */
+ public static final String ERROR_XML = "application/vnd.vmware.vcloud.error+xml";
+
+ /**
+ * "application/vnd.vmware.vcloud.error+xml"
+ */
+ public static final MediaType ERROR_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.error+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.vcloud+xml"
+ */
+ public static final String VCLOUD_XML = "application/vnd.vmware.vcloud.vcloud+xml";
+
+ /**
+ * "application/vnd.vmware.vcloud.vcloud+xml"
+ */
+ public static final MediaType VCLOUD_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.vcloud+xml");
+ /**
+ * "application/vnd.vmware.vcloud.orgList+xml"
+ */
+ public static final String ORGLIST_XML = "application/vnd.vmware.vcloud.orgList+xml";
+
+ /**
+ * "application/vnd.vmware.vcloud.orgList+xml"
+ */
+ public static final MediaType ORGLIST_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.orgList+xml");
+ /**
+ * "application/vnd.vmware.vcloud.org+xml"
+ */
+ public static final String ORG_XML = "application/vnd.vmware.vcloud.org+xml";
+ /**
+ * "application/vnd.vmware.vcloud.org+xml"
+ */
+ public static final MediaType ORG_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.org+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.vdc+xml"
+ */
+ public static final String VDC_XML = "application/vnd.vmware.vcloud.vdc+xml";
+ /**
+ * "application/vnd.vmware.vcloud.vdc+xml"
+ */
+ public static final MediaType VDC_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.vdc+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.catalog+xml"
+ */
+ public static final String CATALOG_XML = "application/vnd.vmware.vcloud.catalog+xml";
+ /**
+ * "application/vnd.vmware.vcloud.catalog+xml"
+ */
+ public static final MediaType CATALOG_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.catalog+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.tasksList+xml"
+ */
+ public static final String TASKSLIST_XML = "application/vnd.vmware.vcloud.tasksList+xml";
+ /**
+ * "application/vnd.vmware.vcloud.tasksList+xml"
+ */
+ public static final MediaType TASKSLIST_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.tasksList+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.catalogItem+xml"
+ */
+ public static final String CATALOGITEM_XML = "application/vnd.vmware.vcloud.catalogItem+xml";
+ /**
+ * "application/vnd.vmware.vcloud.catalogItem+xml"
+ */
+ public static final MediaType CATALOGITEM_XML_TYPE = new MediaType("application",
+ "vnd.vmware.vcloud.catalogItem+xml");
+ /**
+ * "application/vnd.vmware.vcloud.networkConnectionSection+xml"
+ */
+ public static final String NETWORKCONNECTIONSECTION_XML = "application/vnd.vmware.vcloud.networkConnectionSection+xml";
+ /**
+ * "application/vnd.vmware.vcloud.networkConnectionSection+xml"
+ */
+ public static final MediaType NETWORKCONNECTIONSECTION_XML_TYPE = new MediaType("application",
+ "vnd.vmware.vcloud.networkConnectionSection+xml");
+ /**
+ * "application/vnd.vmware.vcloud.virtualHardwareSection+xml"
+ */
+ public static final String VIRTUALHARDWARESECTION_XML = "application/vnd.vmware.vcloud.virtualHardwareSection+xml";
+ /**
+ * "application/vnd.vmware.vcloud.virtualHardwareSection+xml"
+ */
+ public static final MediaType VIRTUALHARDWARESECTION_XML_TYPE = new MediaType("application",
+ "vnd.vmware.vcloud.virtualHardwareSection+xml");
+ /**
+ * "application/vnd.vmware.vcloud.guestCustomizationSection+xml"
+ */
+ public static final String GUESTCUSTOMIZATIONSECTION_XML = "application/vnd.vmware.vcloud.guestCustomizationSection+xml";
+ /**
+ * "application/vnd.vmware.vcloud.guestCustomizationSection+xml"
+ */
+ public static final MediaType GUESTCUSTOMIZATIONSECTION_XML_TYPE = new MediaType("application",
+ "vnd.vmware.vcloud.guestCustomizationSection+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.networkSection+xml"
+ */
+ public static final String NETWORKSECTION_XML = "application/vnd.vmware.vcloud.networkSection+xml";
+ /**
+ * "application/vnd.vmware.vcloud.networkSection+xml"
+ */
+ public static final MediaType NETWORKSECTION_XML_TYPE = new MediaType("application",
+ "vnd.vmware.vcloud.networkSection+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.task+xml"
+ */
+ public static final String TASK_XML = "application/vnd.vmware.vcloud.task+xml";
+ /**
+ * "application/vnd.vmware.vcloud.task+xml"
+ */
+ public static final MediaType TASK_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.task+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.undeployVAppParams+xml"
+ */
+ public static final String UNDEPLOYVAPPPARAMS_XML = "application/vnd.vmware.vcloud.undeployVAppParams+xml";
+ /**
+ * "application/vnd.vmware.vcloud.undeployVAppParams+xml"
+ */
+ public static final MediaType UNDEPLOYVAPPPARAMS_XML_TYPE = new MediaType("application",
+ "vnd.vmware.vcloud.undeployVAppParams+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.deployVAppParams+xml"
+ */
+ public static final String DEPLOYVAPPPARAMS_XML = "application/vnd.vmware.vcloud.deployVAppParams+xml";
+ /**
+ * "application/vnd.vmware.vcloud.deployVAppParams+xml"
+ */
+ public static final MediaType DEPLOYVAPPPARAMS_XML_TYPE = new MediaType("application",
+ "vnd.vmware.vcloud.deployVAppParams+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.vApp+xml"
+ */
+ public static final String VAPP_XML = "application/vnd.vmware.vcloud.vApp+xml";
+ /**
+ * "application/vnd.vmware.vcloud.vApp+xml"
+ */
+ public static final MediaType VAPP_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.vApp+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.vm+xml"
+ */
+ public static final String VM_XML = "application/vnd.vmware.vcloud.vm+xml";
+ /**
+ * "application/vnd.vmware.vcloud.vm+xml"
+ */
+ public static final MediaType VM_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.vm+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.vAppTemplate+xml"
+ */
+ public static final String VAPPTEMPLATE_XML = "application/vnd.vmware.vcloud.vAppTemplate+xml";
+ /**
+ * "application/vnd.vmware.vcloud.vAppTemplate+xml"
+ */
+ public static final MediaType VAPPTEMPLATE_XML_TYPE = new MediaType("application",
+ "vnd.vmware.vcloud.vAppTemplate+xml");
+ /**
+ * "application/vnd.vmware.vcloud.network+xml"
+ */
+ public static final String NETWORK_XML = "application/vnd.vmware.vcloud.network+xml";
+ /**
+ * "application/vnd.vmware.vcloud.network+xml"
+ */
+ public static final MediaType NETWORK_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.network+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.rasdItem+xml"
+ */
+ public static final String RASDITEM_XML = "application/vnd.vmware.vcloud.rasdItem+xml";
+ /**
+ * "application/vnd.vmware.vcloud.rasdItem+xml"
+ */
+ public static final MediaType RASDITEM_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.rasdItem+xml");
+
+ /**
+ * "application/vnd.vmware.vcloud.session+xml"
+ */
+ public static final String SESSION_XML = "application/vnd.vmware.vcloud.session+xml";
+
+ /**
+ * "application/vnd.vmware.vcloud.session+xml"
+ */
+ public static final MediaType SESSION_XML_TYPE = new MediaType("application", "vnd.vmware.vcloud.session+xml");
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/VCloudResponseException.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/VCloudResponseException.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/VCloudResponseException.java
new file mode 100644
index 0000000..ea8d7f8
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/VCloudResponseException.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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;
+
+import org.jclouds.http.HttpCommand;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.http.HttpResponseException;
+import org.jclouds.vcloud.domain.VCloudError;
+
+/**
+ * Encapsulates an VCloud Error.
+ */
+public class VCloudResponseException extends HttpResponseException {
+
+ private org.jclouds.vcloud.domain.VCloudError error;
+
+ public VCloudResponseException(HttpCommand command, HttpResponse response, VCloudError error) {
+ super(String.format("request %s failed with code %s, error: %s", command.getCurrentRequest().getRequestLine(), response
+ .getStatusCode(), error.toString()), command, response);
+ this.setError(error);
+
+ }
+
+ public VCloudResponseException(HttpCommand command, HttpResponse response, VCloudError error, Throwable cause) {
+ super(String.format("request %1$s failed with error: %2$s", command.getCurrentRequest().getRequestLine(), error
+ .toString()), command, response, cause);
+ this.setError(error);
+
+ }
+
+ public VCloudResponseException(String message, HttpCommand command, HttpResponse response, VCloudError error) {
+ super(message, command, response);
+ this.setError(error);
+
+ }
+
+ public VCloudResponseException(String message, HttpCommand command, HttpResponse response, VCloudError error,
+ Throwable cause) {
+ super(message, command, response, cause);
+ this.setError(error);
+
+ }
+
+ public void setError(VCloudError error) {
+ this.error = error;
+ }
+
+ public VCloudError getError() {
+ return error;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/VCloudToken.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/VCloudToken.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/VCloudToken.java
new file mode 100644
index 0000000..2aca7bd
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/VCloudToken.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * A VCloud Session Token
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
+@Qualifier
+public @interface VCloudToken {
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/VCloudVersionsApi.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/VCloudVersionsApi.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/VCloudVersionsApi.java
new file mode 100644
index 0000000..b6c46f9
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/VCloudVersionsApi.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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;
+
+import java.io.Closeable;
+import java.net.URI;
+import java.util.SortedMap;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.XMLResponseParser;
+import org.jclouds.vcloud.http.filters.VCloudSupportedVersions;
+import org.jclouds.vcloud.xml.SupportedVersionsHandler;
+
+@RequestFilters(VCloudSupportedVersions.class)
+public interface VCloudVersionsApi extends Closeable {
+
+ @GET
+ @XMLResponseParser(SupportedVersionsHandler.class)
+ @Path("/versions")
+ SortedMap<String, URI> getSupportedVersions();
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCPUCountToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCPUCountToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCPUCountToXmlPayload.java
new file mode 100644
index 0000000..fc757a1
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCPUCountToXmlPayload.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
+
+import java.util.Properties;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.cim.ResourceAllocationSettingData.ResourceType;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.binders.BindToStringPayload;
+
+import com.google.common.base.Throwables;
+import com.google.inject.Inject;
+import com.jamesmurty.utils.XMLBuilder;
+
+@Singleton
+public class BindCPUCountToXmlPayload extends BindToStringPayload {
+ protected final String ns;
+ protected final String schema;
+
+ @Inject
+ public BindCPUCountToXmlPayload(BindToStringPayload stringBinder, @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns,
+ @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
+ this.ns = ns;
+ this.schema = schema;
+ }
+
+ private static final String RESOURCE_ALLOCATION_NS = "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData";
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
+ checkArgument(checkNotNull(payload, "cpuCount") instanceof Integer, "this binder is only valid for Integers!");
+ Integer cpuCount = Integer.class.cast(payload);
+ XMLBuilder cpuItem;
+ try {
+ cpuItem = XMLBuilder.create("Item").a("xmlns", ns).a("xmlns:rasd", RESOURCE_ALLOCATION_NS);
+ cpuItem.e("rasd:AllocationUnits").t("hertz * 10^6");
+ cpuItem.e("rasd:Description").t("Number of Virtual CPUs");
+ cpuItem.e("rasd:ElementName").t(cpuCount.toString() + " virtual CPU(s)");
+ cpuItem.e("rasd:InstanceID").t("4");
+ cpuItem.e("rasd:ResourceType").t(ResourceType.PROCESSOR.value());
+ cpuItem.e("rasd:VirtualQuantity").t(cpuCount.toString());
+ cpuItem.e("rasd:Weight").t("0");
+ Properties outputProperties = new Properties();
+ outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
+ request = super.bindToRequest(request, cpuItem.asString(outputProperties));
+ } catch (Exception e) {
+ Throwables.propagate(e);
+ }
+ return request;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCaptureVAppParamsToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCaptureVAppParamsToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCaptureVAppParamsToXmlPayload.java
new file mode 100644
index 0000000..8a556be
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCaptureVAppParamsToXmlPayload.java
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
+
+import java.util.Map;
+import java.util.Properties;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToStringPayload;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.options.CaptureVAppOptions;
+
+import com.google.inject.Inject;
+import com.jamesmurty.utils.XMLBuilder;
+
+@Singleton
+public class BindCaptureVAppParamsToXmlPayload implements MapBinder {
+
+ protected final String ns;
+ protected final String schema;
+ private final BindToStringPayload stringBinder;
+
+ @Inject
+ public BindCaptureVAppParamsToXmlPayload(BindToStringPayload stringBinder,
+ @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
+ this.ns = ns;
+ this.schema = schema;
+ this.stringBinder = stringBinder;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest,
+ "this binder is only valid for GeneratedHttpRequests!");
+ GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request;
+ String templateName = checkNotNull(postParams.remove("templateName"), "templateName").toString();
+ String vApp = checkNotNull(postParams.remove("vApp"), "vApp").toString();
+
+ CaptureVAppOptions options = findOptionsInArgsOrNull(gRequest);
+ if (options == null) {
+ options = new CaptureVAppOptions();
+ }
+ try {
+ return stringBinder.bindToRequest(request, generateXml(templateName, vApp, options));
+ } catch (ParserConfigurationException e) {
+ throw new RuntimeException(e);
+ } catch (FactoryConfigurationError e) {
+ throw new RuntimeException(e);
+ } catch (TransformerException e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ protected String generateXml(String templateName, String vApp, CaptureVAppOptions options)
+ throws ParserConfigurationException, FactoryConfigurationError, TransformerException {
+ XMLBuilder rootBuilder = buildRoot(templateName);
+ if (options.getDescription() != null)
+ rootBuilder.e("Description").text(options.getDescription());
+ rootBuilder.e("Source").a("href", vApp).a("type", VCloudMediaType.VAPP_XML);
+ Properties outputProperties = new Properties();
+ outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
+ return rootBuilder.asString(outputProperties);
+ }
+
+ protected XMLBuilder buildRoot(String name) throws ParserConfigurationException, FactoryConfigurationError {
+ XMLBuilder rootBuilder = XMLBuilder.create("CaptureVAppParams").a("name", name).a("xmlns", ns)
+ .a("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance").a("xsi:schemaLocation", ns + " " + schema);
+ return rootBuilder;
+ }
+
+ protected CaptureVAppOptions findOptionsInArgsOrNull(GeneratedHttpRequest gRequest) {
+ for (Object arg : gRequest.getInvocation().getArgs()) {
+ if (arg instanceof CaptureVAppOptions) {
+ return (CaptureVAppOptions) arg;
+ } else if (arg instanceof CaptureVAppOptions[]) {
+ CaptureVAppOptions[] options = (CaptureVAppOptions[]) arg;
+ return (options.length > 0) ? options[0] : null;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ throw new IllegalStateException("CaptureVAppParams is needs parameters");
+ }
+
+ protected String ifNullDefaultTo(String value, String defaultValue) {
+ return value != null ? value : checkNotNull(defaultValue, "defaultValue");
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCatalogItemToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCatalogItemToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCatalogItemToXmlPayload.java
new file mode 100644
index 0000000..98c4e3a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCatalogItemToXmlPayload.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToStringPayload;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.options.CatalogItemOptions;
+
+import com.google.inject.Inject;
+import com.jamesmurty.utils.XMLBuilder;
+
+@Singleton
+public class BindCatalogItemToXmlPayload implements MapBinder {
+
+ protected final String ns;
+ protected final String schema;
+ private final BindToStringPayload stringBinder;
+
+ @Inject
+ public BindCatalogItemToXmlPayload(BindToStringPayload stringBinder,
+ @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
+ this.ns = ns;
+ this.schema = schema;
+ this.stringBinder = stringBinder;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest,
+ "this binder is only valid for GeneratedHttpRequests!");
+ GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request;
+ String name = checkNotNull(postParams.get("name"), "name").toString();
+ URI entity = URI.create(checkNotNull(postParams.get("Entity"), "Entity").toString());
+
+ CatalogItemOptions options = findOptionsInArgsOrNew(gRequest);
+ try {
+ return stringBinder.bindToRequest(request, generateXml(name, entity, options));
+ } catch (ParserConfigurationException e) {
+ throw new RuntimeException(e);
+ } catch (FactoryConfigurationError e) {
+ throw new RuntimeException(e);
+ } catch (TransformerException e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ protected String generateXml(String templateName, URI entity, CatalogItemOptions options)
+ throws ParserConfigurationException, FactoryConfigurationError, TransformerException {
+ XMLBuilder rootBuilder = buildRoot(templateName);
+ if (options.getDescription() != null)
+ rootBuilder.e("Description").t(options.getDescription());
+ rootBuilder.e("Entity").a("href", entity.toASCIIString());
+ for (Entry<String, String> entry : options.getProperties().entrySet()) {
+ rootBuilder.e("Property").a("key", entry.getKey()).t(entry.getValue());
+ }
+ Properties outputProperties = new Properties();
+ outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
+ return rootBuilder.asString(outputProperties);
+ }
+
+ protected XMLBuilder buildRoot(String name) throws ParserConfigurationException, FactoryConfigurationError {
+ XMLBuilder rootBuilder = XMLBuilder.create("CatalogItem").a("name", name).a("xmlns", ns).a("xmlns:xsi",
+ "http://www.w3.org/2001/XMLSchema-instance").a("xsi:schemaLocation", ns + " " + schema);
+ return rootBuilder;
+ }
+
+ protected CatalogItemOptions findOptionsInArgsOrNew(GeneratedHttpRequest gRequest) {
+ for (Object arg : gRequest.getInvocation().getArgs()) {
+ if (arg instanceof CatalogItemOptions) {
+ return CatalogItemOptions.class.cast(arg);
+ } else if (arg.getClass().isArray()) {
+ Object[] array = (Object[]) arg;
+ if (array.length > 0 && array[0] instanceof CatalogItemOptions)
+ return CatalogItemOptions.class.cast(array[0]);
+ }
+ }
+ return new CatalogItemOptions();
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ throw new IllegalStateException("CatalogItem is needs parameters");
+ }
+
+ protected String ifNullDefaultTo(String value, String defaultValue) {
+ return value != null ? value : checkNotNull(defaultValue, "defaultValue");
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCloneParamsToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCloneParamsToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCloneParamsToXmlPayload.java
new file mode 100644
index 0000000..71617bc
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCloneParamsToXmlPayload.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
+
+import java.util.Map;
+import java.util.Properties;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToStringPayload;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.options.CloneOptions;
+
+import com.google.common.base.Throwables;
+import com.google.inject.Inject;
+import com.jamesmurty.utils.XMLBuilder;
+
+@Singleton
+public abstract class BindCloneParamsToXmlPayload<O extends CloneOptions> implements MapBinder {
+
+ protected final String ns;
+ protected final String schema;
+ private final BindToStringPayload stringBinder;
+
+ protected abstract String getRootElement();
+ protected abstract String getSourceMediaType();
+ protected abstract Class<O> getOptionClass();
+
+ @Inject
+ public BindCloneParamsToXmlPayload(BindToStringPayload stringBinder,
+ @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
+ this.ns = ns;
+ this.schema = schema;
+ this.stringBinder = stringBinder;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest,
+ "this binder is only valid for GeneratedHttpRequests!");
+ GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request;
+ String name = checkNotNull(postParams.get("name"), "name").toString();
+ String source = checkNotNull(postParams.get("Source"), "Source").toString();
+ boolean isSourceDelete = Boolean.parseBoolean((String) postParams.get("IsSourceDelete"));
+
+ O options = findOptionsInArgsOrNew(gRequest);
+ return stringBinder.bindToRequest(request, generateXml(name, source, isSourceDelete, options));
+ }
+
+ protected String generateXml(String name, String source, boolean isSourceDelete, O options) {
+ XMLBuilder rootBuilder = buildRoot(name, options);
+ addElementsUnderRoot(rootBuilder, source, options, isSourceDelete);
+ Properties outputProperties = new Properties();
+ outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
+ try {
+ return rootBuilder.asString(outputProperties);
+ } catch (Exception e) {
+ throw Throwables.propagate(e);
+ }
+ }
+
+ protected void addElementsUnderRoot(XMLBuilder rootBuilder, String source, O options, boolean isSourceDelete) {
+ if (options.getDescription() != null)
+ rootBuilder.e("Description").text(options.getDescription());
+ rootBuilder.e("Source").a("href", source).a("type", getSourceMediaType());
+ if (isSourceDelete)
+ rootBuilder.e("IsSourceDelete").t("true");
+ }
+
+ protected XMLBuilder buildRoot(String name, O options) {
+ try {
+ return XMLBuilder.create(getRootElement()).a("xmlns", ns).a("xmlns:xsi",
+ "http://www.w3.org/2001/XMLSchema-instance").a("xsi:schemaLocation", ns + " " + schema).a("name",
+ name);
+ } catch (Exception e) {
+ throw Throwables.propagate(e);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ protected O findOptionsInArgsOrNew(GeneratedHttpRequest gRequest) {
+ for (Object arg : gRequest.getInvocation().getArgs()) {
+ if (getOptionClass().isInstance(arg)) {
+ return (O) arg;
+ } else if (arg.getClass().isArray()) {
+ Object[] array = (Object[]) arg;
+ if (array.length > 0 && getOptionClass().isInstance(array[0]))
+ return (O) array[0];
+ }
+ }
+ try {
+ return getOptionClass().newInstance();
+ } catch (Exception e) {
+ throw Throwables.propagate(e);
+ }
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ throw new IllegalStateException("CloneParams is needs parameters");
+ }
+
+ protected String ifNullDefaultTo(String value, String defaultValue) {
+ return value != null ? value : checkNotNull(defaultValue, "defaultValue");
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCloneVAppParamsToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCloneVAppParamsToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCloneVAppParamsToXmlPayload.java
new file mode 100644
index 0000000..50c3b83
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCloneVAppParamsToXmlPayload.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.rest.binders.BindToStringPayload;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.options.CloneVAppOptions;
+
+import com.google.inject.Inject;
+import com.jamesmurty.utils.XMLBuilder;
+
+@Singleton
+public class BindCloneVAppParamsToXmlPayload extends BindCloneParamsToXmlPayload<CloneVAppOptions> {
+
+ @Inject
+ public BindCloneVAppParamsToXmlPayload(BindToStringPayload stringBinder,
+ @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
+ super(stringBinder, ns, schema);
+ }
+
+ @Override
+ protected Class<CloneVAppOptions> getOptionClass() {
+ return CloneVAppOptions.class;
+ }
+
+ @Override
+ protected String getRootElement() {
+ return "CloneVAppParams";
+ }
+
+ @Override
+ protected String getSourceMediaType() {
+ return VCloudMediaType.VAPP_XML;
+ }
+
+ protected XMLBuilder buildRoot(String name, CloneVAppOptions options) {
+ return super.buildRoot(name, options).a("deploy", options.isDeploy() + "").a("powerOn", options.isPowerOn() + "");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayload.java
new file mode 100644
index 0000000..2323c94
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayload.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.rest.binders.BindToStringPayload;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.options.CloneVAppTemplateOptions;
+
+import com.google.inject.Inject;
+
+@Singleton
+public class BindCloneVAppTemplateParamsToXmlPayload extends BindCloneParamsToXmlPayload<CloneVAppTemplateOptions> {
+
+ @Inject
+ public BindCloneVAppTemplateParamsToXmlPayload(BindToStringPayload stringBinder,
+ @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
+ super(stringBinder, schema, schema);
+ }
+
+ @Override
+ protected Class<CloneVAppTemplateOptions> getOptionClass() {
+ return CloneVAppTemplateOptions.class;
+ }
+
+ @Override
+ protected String getRootElement() {
+ return "CloneVAppTemplateParams";
+ }
+
+ @Override
+ protected String getSourceMediaType() {
+ return VCloudMediaType.VAPPTEMPLATE_XML;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayload.java
new file mode 100644
index 0000000..d376222
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayload.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.rest.binders.BindToStringPayload;
+
+import com.google.inject.Inject;
+
+@Singleton
+public class BindDeployVAppParamsToXmlPayload extends BindParamsToXmlPayload {
+
+ @Inject
+ public BindDeployVAppParamsToXmlPayload(BindToStringPayload stringBinder,
+ @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns) {
+ super("DeployVAppParams", stringBinder, ns);
+ }
+
+}
[08/18] stratos git commit: Jclouds vcloud api 1.8.1 clone with
custom changes
Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayloadTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayloadTest.java
new file mode 100644
index 0000000..73d6342
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayloadTest.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static org.jclouds.util.Strings2.toStringAndClose;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BasePayloadTest;
+import org.jclouds.vcloud.options.CloneVAppTemplateOptions;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMap.Builder;
+
+/**
+ * Tests behavior of {@code BindCloneVAppTemplateParamsToXmlPayload}
+ */
+@Test(groups = "unit")
+public class BindCloneVAppTemplateParamsToXmlPayloadTest extends BasePayloadTest {
+ public void testWithDescription() throws IOException {
+ String expected = toStringAndClose(getClass().getResourceAsStream("/copyVAppTemplate.xml"));
+
+ CloneVAppTemplateOptions options = new CloneVAppTemplateOptions()
+ .description("The description of the new vAppTemplate");
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of(options));
+
+ BindCloneVAppTemplateParamsToXmlPayload binder = injector
+ .getInstance(BindCloneVAppTemplateParamsToXmlPayload.class);
+
+ Builder<String, Object> map = ImmutableMap.builder();
+ map.put("name", "new-linux-server");
+ map.put("Source", "https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/201");
+
+ assertEquals(binder.bindToRequest(request, map.build()).getPayload().getRawContent(), expected);
+ }
+
+ public void testWithDescriptionSourceDelete() throws IOException {
+ String expected = toStringAndClose(getClass().getResourceAsStream("/moveVAppTemplate.xml"));
+
+ CloneVAppTemplateOptions options = new CloneVAppTemplateOptions()
+ .description("The description of the new vAppTemplate");
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of(options));
+
+ BindCloneVAppTemplateParamsToXmlPayload binder = injector
+ .getInstance(BindCloneVAppTemplateParamsToXmlPayload.class);
+
+ Builder<String, Object> map = ImmutableMap.builder();
+ map.put("name", "new-linux-server");
+ map.put("Source", "https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/201");
+ map.put("IsSourceDelete", "true");
+
+ assertEquals(binder.bindToRequest(request, map.build()).getPayload().getRawContent(), expected);
+ }
+
+ public void testDefault() throws IOException {
+ String expected = toStringAndClose(getClass().getResourceAsStream("/copyVAppTemplate-default.xml"));
+
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of());
+
+ BindCloneVAppTemplateParamsToXmlPayload binder = injector
+ .getInstance(BindCloneVAppTemplateParamsToXmlPayload.class);
+
+ Builder<String, Object> map = ImmutableMap.builder();
+ map.put("name", "my-vapptemplate");
+ map.put("Source", "https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/4181");
+
+ assertEquals(binder.bindToRequest(request, map.build()).getPayload().getRawContent(), expected);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayloadTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayloadTest.java
new file mode 100644
index 0000000..f145e97
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayloadTest.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BasePayloadTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Maps;
+
+/**
+ * Tests behavior of {@code BindDeployVAppParamsToXmlPayload}
+ */
+@Test(groups = "unit")
+public class BindDeployVAppParamsToXmlPayloadTest extends BasePayloadTest {
+
+ public void testPowerOnTrue() throws IOException {
+ String expected = "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" powerOn=\"true\"/>";
+
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of());
+
+ BindDeployVAppParamsToXmlPayload binder = injector.getInstance(BindDeployVAppParamsToXmlPayload.class);
+
+ Map<String, Object> map = Maps.newHashMap();
+ map.put("powerOn", "true");
+ assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+ }
+
+ public void testDefault() throws IOException {
+ String expected = "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>";
+
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of());
+
+ BindDeployVAppParamsToXmlPayload binder = injector.getInstance(BindDeployVAppParamsToXmlPayload.class);
+
+ Map<String, Object> map = Maps.newHashMap();
+ assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayloadTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayloadTest.java
new file mode 100644
index 0000000..ead0bad
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayloadTest.java
@@ -0,0 +1,177 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.replay;
+import static org.jclouds.vcloud.options.InstantiateVAppTemplateOptions.Builder.addNetworkConfig;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_FENCEMODE;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Map;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.util.Strings2;
+import org.jclouds.vcloud.VCloudApiMetadata;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.domain.network.NetworkConfig;
+import org.jclouds.vcloud.endpoints.Network;
+import org.jclouds.vcloud.internal.BasePayloadTest;
+import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
+import org.nnsoft.guice.rocoto.Rocoto;
+import org.nnsoft.guice.rocoto.configuration.ConfigurationModule;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Function;
+import com.google.common.base.Functions;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Provides;
+
+/**
+ * Tests behavior of {@code BindInstantiateVAppTemplateParamsToXmlPayload}
+ */
+@Test(groups = "unit")
+public class BindInstantiateVAppTemplateParamsToXmlPayloadTest extends BasePayloadTest {
+ Injector createInjector(final URI vAppTemplate, final VAppTemplate value) {
+
+ return Guice.createInjector(Rocoto.expandVariables(new ConfigurationModule() {
+
+ @Provides
+ @Singleton
+ @Network
+ protected Function<VAppTemplate, String> templateToDefaultNetworkName() {
+ return Functions.forMap(ImmutableMap.of(value, "vAppNet-vApp Internal"));
+ }
+
+ @Provides
+ @Singleton
+ protected LoadingCache<URI, VAppTemplate> templateIdToVAppTemplate() {
+ return CacheBuilder.newBuilder().build(
+ CacheLoader.from(Functions.forMap(ImmutableMap.of(vAppTemplate, value))));
+ }
+
+ @Override
+ protected void bindConfigurations() {
+ bindProperties(new VCloudApiMetadata().getDefaultProperties());
+ }
+
+ @Provides
+ @Singleton
+ public FenceMode defaultFenceMode(@Named(PROPERTY_VCLOUD_DEFAULT_FENCEMODE) String fenceMode) {
+ return FenceMode.fromValue(fenceMode);
+ }
+
+ @Network
+ @Provides
+ @Singleton
+ Supplier<ReferenceType> provideNetwork() {
+ return Suppliers.<ReferenceType>ofInstance(new ReferenceTypeImpl(null, null, URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/network/1990")));
+ }
+ }));
+ }
+
+ public void testDefault() throws IOException {
+ URI templateUri = URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3");
+ VAppTemplate template = createMock(VAppTemplate.class);
+ replay(template);
+
+ String expected = Strings2.toStringAndClose(getClass().getResourceAsStream("/instantiationparams.xml"));
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of(new InstantiateVAppTemplateOptions()));
+
+ BindInstantiateVAppTemplateParamsToXmlPayload binder = createInjector(templateUri, template).getInstance(
+ BindInstantiateVAppTemplateParamsToXmlPayload.class);
+
+ Map<String, Object> map = Maps.newHashMap();
+ map.put("name", "my-vapp");
+ map.put("template", templateUri.toASCIIString());
+ assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+ }
+
+ public void testDescription() throws IOException {
+ URI templateUri = URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3");
+ VAppTemplate template = createMock(VAppTemplate.class);
+ replay(template);
+
+ String expected = Strings2.toStringAndClose(getClass()
+ .getResourceAsStream("/instantiationparams-description.xml"));
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of(new InstantiateVAppTemplateOptions().description("my foo")));
+
+ BindInstantiateVAppTemplateParamsToXmlPayload binder = createInjector(templateUri, template).getInstance(
+ BindInstantiateVAppTemplateParamsToXmlPayload.class);
+
+ Map<String, Object> map = Maps.newHashMap();
+ map.put("name", "my-vapp");
+ map.put("template", templateUri.toASCIIString());
+ assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+ }
+
+ public void testWhenTemplateDoesntExist() throws IOException {
+ URI templateUri = URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3");
+ VAppTemplate template = createMock(VAppTemplate.class);
+ replay(template);
+
+ String expected = Strings2.toStringAndClose(getClass().getResourceAsStream("/instantiationparams.xml"));
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of());
+
+ BindInstantiateVAppTemplateParamsToXmlPayload binder = createInjector(templateUri, template).getInstance(
+ BindInstantiateVAppTemplateParamsToXmlPayload.class);
+
+ Map<String, Object> map = Maps.newHashMap();
+ map.put("name", "my-vapp");
+ map.put("template", templateUri.toASCIIString());
+ assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+ }
+
+ public void testWithNetworkNameFenceMode() throws IOException {
+ URI templateUri = URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3");
+ VAppTemplate template = createMock(VAppTemplate.class);
+ replay(template);
+
+ InstantiateVAppTemplateOptions options = addNetworkConfig(new NetworkConfig("aloha", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/network/1991"), FenceMode.NAT_ROUTED));
+
+ String expected = Strings2.toStringAndClose(getClass().getResourceAsStream("/instantiationparams-network.xml"));
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of(options));
+
+ BindInstantiateVAppTemplateParamsToXmlPayload binder = createInjector(templateUri, template).getInstance(
+ BindInstantiateVAppTemplateParamsToXmlPayload.class);
+
+ Map<String, Object> map = Maps.newHashMap();
+ map.put("name", "my-vapp");
+ map.put("template", "https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3");
+
+ assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayloadTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayloadTest.java
new file mode 100644
index 0000000..77059b0
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayloadTest.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.vcloud.domain.NetworkConnection;
+import org.jclouds.vcloud.domain.NetworkConnectionSection;
+import org.jclouds.vcloud.domain.network.IpAddressAllocationMode;
+import org.jclouds.vcloud.internal.BasePayloadTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests behavior of {@code BindNetworkConnectionSectionToXmlPayload}
+ */
+@Test(groups = "unit", testName = "BindNetworkConnectionSectionToXmlPayloadTest")
+public class BindNetworkConnectionSectionToXmlPayloadTest extends BasePayloadTest {
+
+ public void testWithIpAllocationModeNONE() throws IOException {
+
+ HttpRequest request = HttpRequest.builder().endpoint("http://localhost/key").method("GET")
+ .build();
+
+ BindNetworkConnectionSectionToXmlPayload binder = injector
+ .getInstance(BindNetworkConnectionSectionToXmlPayload.class);
+
+ binder.bindToRequest(
+ request,
+ NetworkConnectionSection
+ .builder()
+ .type("application/vnd.vmware.vcloud.networkConnectionSection+xml")
+ .info("Specifies the available VM network connections")
+ .href(URI.create("https://1.1.1.1/api/v1.0/vApp/vm-1/networkConnectionSection/"))
+ .connections(
+ ImmutableSet.<NetworkConnection> of(NetworkConnection.builder().network("none")
+ .ipAddressAllocationMode(IpAddressAllocationMode.NONE).build())).build());
+ assertEquals(request.getPayload().getContentMetadata().getContentType(),
+ "application/vnd.vmware.vcloud.networkConnectionSection+xml");
+
+ assertEquals(
+ request.getPayload().getRawContent(),
+ "<NetworkConnectionSection xmlns=\"http://www.vmware.com/vcloud/v1\" xmlns:ovf=\"http://schemas.dmtf.org/ovf/envelope/1\" href=\"https://1.1.1.1/api/v1.0/vApp/vm-1/networkConnectionSection/\" ovf:required=\"false\" type=\"application/vnd.vmware.vcloud.networkConnectionSection+xml\"><ovf:Info>Specifies the available VM network connections</ovf:Info><NetworkConnection network=\"none\"><NetworkConnectionIndex>0</NetworkConnectionIndex><IsConnected>false</IsConnected><IpAddressAllocationMode>NONE</IpAddressAllocationMode></NetworkConnection></NetworkConnectionSection>");
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayloadTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayloadTest.java
new file mode 100644
index 0000000..59a4141
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayloadTest.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BasePayloadTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Maps;
+
+/**
+ * Tests behavior of {@code BindUndeployVAppParamsToXmlPayload}
+ */
+@Test(groups = "unit")
+public class BindUndeployVAppParamsToXmlPayloadTest extends BasePayloadTest {
+
+ public void testSaveStateTrue() throws IOException {
+ String expected = "<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" saveState=\"true\"/>";
+
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of());
+
+ BindUndeployVAppParamsToXmlPayload binder = injector.getInstance(BindUndeployVAppParamsToXmlPayload.class);
+
+ Map<String, Object> map = Maps.newHashMap();
+ map.put("saveState", "true");
+ assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+ }
+
+ public void testDefault() throws IOException {
+ String expected = "<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>";
+
+ GeneratedHttpRequest request = requestForArgs(ImmutableList.<Object> of());
+
+ BindUndeployVAppParamsToXmlPayload binder = injector.getInstance(BindUndeployVAppParamsToXmlPayload.class);
+
+ Map<String, Object> map = Maps.newHashMap();
+ assertEquals(binder.bindToRequest(request, map).getPayload().getRawContent(), expected);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/BaseVCloudComputeServiceExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/BaseVCloudComputeServiceExpectTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/BaseVCloudComputeServiceExpectTest.java
new file mode 100644
index 0000000..e938600
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/BaseVCloudComputeServiceExpectTest.java
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.compute;
+
+import java.net.URI;
+import java.util.Properties;
+
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.apis.ApiMetadata;
+import org.jclouds.compute.ComputeService;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.rest.internal.BaseRestApiExpectTest;
+import org.jclouds.vcloud.VCloudApiMetadata;
+import org.jclouds.vcloud.VCloudMediaType;
+
+import com.google.common.base.Function;
+import com.google.common.net.HttpHeaders;
+import com.google.inject.Module;
+
+/**
+ * Base class for writing VCloud Expect tests for ComputeService operations
+ */
+public abstract class BaseVCloudComputeServiceExpectTest extends BaseRestApiExpectTest<ComputeService> {
+ protected static final String ENDPOINT = "https://zone.myvcloud.com/api";
+
+ protected HttpRequest versionsRequest = HttpRequest.builder().method("GET").endpoint(
+ URI.create(ENDPOINT + "/versions")).addHeader(HttpHeaders.ACCEPT, "*/*").build();
+
+ protected HttpResponse versionsResponseFromVCD1_5 = HttpResponse.builder().statusCode(200)
+ .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/versions-vcd15.xml", "text/xml"))
+ .build();
+
+ // initial auth is using basic
+ protected HttpRequest version1_0LoginRequest = HttpRequest.builder().method("POST").endpoint(ENDPOINT + "/v1.0/login")
+ .addHeader(HttpHeaders.ACCEPT, "application/vnd.vmware.vcloud.session+xml;version=1.0")
+ .addHeader(HttpHeaders.AUTHORIZATION, "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==").build();
+
+ protected String sessionToken = "AtatAgvJMrwOc9pDQq4RRCRLazThpnTKJDxSVH9oB2I=";
+
+ // login response includes a cookie and also a vcloud extended header with the session token in it
+ // NOTE: vCloud Director 1.5 returns ;version=1.0 on responses to requests made in 1.0 format.
+ protected HttpResponse successfulVersion1_0LoginResponseFromVCD1_5WithSingleOrg = HttpResponse.builder().statusCode(200)
+ .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/orgList1.0-vcd15.xml", VCloudMediaType.ORGLIST_XML + ";version=1.0"))
+ .addHeader("x-vcloud-authorization", sessionToken)
+ .addHeader(HttpHeaders.SET_COOKIE, String.format("vcloud-token=%s; Secure; Path=/", sessionToken)).build();
+
+ // objects are looked up by id and the format of the id is hex-hyphen
+ protected String orgId = "c076f90a-397a-49fa-89b8-b294c1599cd0";
+
+ protected HttpRequest version1_0GetOrgRequest = HttpRequest.builder().method("GET").endpoint(ENDPOINT + "/v1.0/org/" + orgId)
+ .addHeader(HttpHeaders.ACCEPT, VCloudMediaType.ORG_XML+";version=1.0")
+ .addHeader("x-vcloud-authorization", sessionToken)
+ .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken).build();
+
+ protected HttpResponse successfulVersion1_0GetOrgResponseFromVCD1_5WithSingleTasksListVDCAndNetwork = HttpResponse.builder().statusCode(200)
+ .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/org1.0-vcd15.xml", VCloudMediaType.ORG_XML + ";version=1.0"))
+ .build();
+
+ protected String catalogId = "3155f393-1e1d-4572-8c9c-d76f72ddb658";
+ protected String vdcId = "e9cd3387-ac57-4d27-a481-9bee75e0690f";
+
+ protected HttpRequest version1_0GetCatalogRequest = HttpRequest.builder().method("GET").endpoint(ENDPOINT + "/v1.0/catalog/" + catalogId)
+ .addHeader(HttpHeaders.ACCEPT, VCloudMediaType.CATALOG_XML +";version=1.0")
+ .addHeader("x-vcloud-authorization", sessionToken)
+ .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken).build();
+
+ protected HttpResponse successfulVersion1_0GetCatalogResponseFromVCD1_5WithSingleTemplate = HttpResponse.builder().statusCode(200)
+ .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/catalog1.0-vcd15.xml", VCloudMediaType.CATALOG_XML + ";version=1.0"))
+ .build();
+
+ protected String catalogItemId = "ceb369f7-1d07-4e32-9dbd-ebb5aa6ca55c";
+
+ protected HttpRequest version1_0GetCatalogItemRequest = HttpRequest.builder().method("GET").endpoint(ENDPOINT + "/v1.0/catalogItem/" + catalogItemId)
+ .addHeader(HttpHeaders.ACCEPT, VCloudMediaType.CATALOGITEM_XML +";version=1.0")
+ .addHeader("x-vcloud-authorization", sessionToken)
+ .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken).build();
+
+ protected HttpResponse successfulVersion1_0GetCatalogItemResponseFromVCD1_5ForTemplate = HttpResponse.builder().statusCode(200)
+ .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/catalogItem1.0-vcd15.xml", VCloudMediaType.CATALOGITEM_XML + ";version=1.0"))
+ .build();
+
+ // note vAppTemplate has a prefix in its id
+ protected String templateId = "vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728";
+
+ protected HttpRequest version1_0GetVDCRequest = HttpRequest.builder().method("GET").endpoint(ENDPOINT + "/v1.0/vdc/" + vdcId)
+ .addHeader(HttpHeaders.ACCEPT, VCloudMediaType.VDC_XML +";version=1.0")
+ .addHeader("x-vcloud-authorization", sessionToken)
+ .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken).build();
+
+ protected HttpResponse successfulVersion1_0GetVDCResponseFromVCD1_5WithSingleTemplateAndNetwork = HttpResponse.builder().statusCode(200)
+ .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/vdc1.0-vcd15.xml", VCloudMediaType.VDC_XML + ";version=1.0"))
+ .build();
+
+ protected String networkId = "b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1";
+
+ protected HttpRequest version1_0GetVAppTemplateRequest = HttpRequest.builder().method("GET").endpoint(ENDPOINT + "/v1.0/vAppTemplate/" + templateId)
+ .addHeader(HttpHeaders.ACCEPT, VCloudMediaType.VAPPTEMPLATE_XML +";version=1.0")
+ .addHeader("x-vcloud-authorization", sessionToken)
+ .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken).build();
+
+ protected HttpResponse successfulVersion1_0GetVAppTemplateResponseFromVCD1_5WithSingleVMAndVDCParent = HttpResponse.builder().statusCode(200)
+ .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/template1.0-vcd15.xml", VCloudMediaType.VAPPTEMPLATE_XML + ";version=1.0"))
+ .build();
+
+ protected HttpResponse successfulVersion1_0GetVAppTemplateResponseFromVCD1_5WithMultipleVMsAndVDCParent = HttpResponse.builder().statusCode(200)
+ .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/template1.0-vcd15-multi-vm.xml", VCloudMediaType.VAPPTEMPLATE_XML + ";version=1.0"))
+ .build();
+
+ protected HttpRequest version1_0GetOVFForVAppTemplateRequest = HttpRequest.builder().method("GET").endpoint(ENDPOINT + "/v1.0/vAppTemplate/" + templateId + "/ovf")
+ .addHeader(HttpHeaders.ACCEPT, MediaType.TEXT_XML +";version=1.0")
+ .addHeader("x-vcloud-authorization", sessionToken)
+ .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken).build();
+
+ protected HttpResponse successfulVersion1_0GetOVFForVAppTemplateResponseFromVCD1_5WithSingleVM = HttpResponse.builder().statusCode(200)
+ .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/ovf-ubuntu64.xml", MediaType.TEXT_XML + ";version=1.0"))
+ .build();
+
+ protected HttpResponse successfulVersion1_0GetOVFForVAppTemplateResponseFromVCD1_5WithMultipleVMs = HttpResponse.builder().statusCode(200)
+ .message("HTTP/1.1 200 OK").payload(payloadFromResourceWithContentType("/ovf-multi-vm.xml", MediaType.TEXT_XML + ";version=1.0"))
+ .build();
+
+ public BaseVCloudComputeServiceExpectTest() {
+ provider = "vcloud";
+ }
+
+ @Override
+ public ComputeService createClient(Function<HttpRequest, HttpResponse> fn, Module module, Properties props) {
+ return createInjector(fn, module, props).getInstance(ComputeService.class);
+ }
+
+ @Override
+ protected ApiMetadata createApiMetadata() {
+ return new VCloudApiMetadata();
+ }
+
+ @Override
+ protected Properties setupProperties() {
+ Properties props = super.setupProperties();
+ props.setProperty(provider + ".endpoint", ENDPOINT);
+ return props;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/VCloudComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/VCloudComputeServiceLiveTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/VCloudComputeServiceLiveTest.java
new file mode 100644
index 0000000..f5d3ec6
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/VCloudComputeServiceLiveTest.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.compute;
+
+import org.jclouds.compute.internal.BaseComputeServiceLiveTest;
+import org.jclouds.sshj.config.SshjSshClientModule;
+import org.testng.annotations.Test;
+
+import com.google.inject.Module;
+
+@Test(groups = "live", enabled = true, singleThreaded = true)
+public class VCloudComputeServiceLiveTest extends BaseComputeServiceLiveTest {
+
+ public VCloudComputeServiceLiveTest() {
+ provider = "vcloud";
+ }
+
+ @Override
+ public void setServiceDefaults() {
+ // extremely short names needed so that we don't get errors relating to
+ // guestCustomization.computerName being too long
+ group = "vcd";
+ }
+
+ @Override
+ public void testOptionToNotBlock() {
+ // start call has to block until deploy
+ }
+
+ @Override
+ protected Module getSshModule() {
+ return new SshjSshClientModule();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/FindLocationForResourceTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/FindLocationForResourceTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/FindLocationForResourceTest.java
new file mode 100644
index 0000000..65534aa
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/FindLocationForResourceTest.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.compute.functions;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Suppliers;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests behavior of {@code FindLocationForResource}
+ */
+@Test(groups = "unit")
+public class FindLocationForResourceTest {
+ public void testMatchWhenIdIsHref() {
+ Location location = new LocationBuilder().id("http://foo").description("description")
+ .scope(LocationScope.PROVIDER).build();
+ FindLocationForResource converter = new FindLocationForResource(
+ Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet.<Location> of(location)));
+ assertEquals(converter.apply(new ReferenceTypeImpl("name", "type", URI.create("http://foo"))), location);
+ }
+
+ @Test(expectedExceptions = NoSuchElementException.class)
+ public void testGracefulWhenHrefIsntLocationId() {
+ FindLocationForResource converter = new FindLocationForResource(
+ Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet.<Location> of(new LocationBuilder()
+ .id("http://bar").description("description").scope(LocationScope.PROVIDER).build())));
+ converter.apply(new ReferenceTypeImpl("name", "type", URI.create("http://foo")));
+ }
+
+ @Test(expectedExceptions = NoSuchElementException.class)
+ public void testGracefulWhenLocationIdIsntURI() {
+ FindLocationForResource converter = new FindLocationForResource(
+ Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet.<Location> of(new LocationBuilder().id("1")
+ .description("description").scope(LocationScope.PROVIDER).build())));
+ converter.apply(new ReferenceTypeImpl("name", "type", URI.create("http://foo")));
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/ListImagesInVCloudExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/ListImagesInVCloudExpectTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/ListImagesInVCloudExpectTest.java
new file mode 100644
index 0000000..426de42
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/ListImagesInVCloudExpectTest.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.compute.functions;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+import java.util.Set;
+
+import org.jclouds.cim.OSType;
+import org.jclouds.compute.ComputeService;
+import org.jclouds.compute.domain.CIMOperatingSystem;
+import org.jclouds.compute.domain.Image;
+import org.jclouds.compute.domain.ImageBuilder;
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.domain.LoginCredentials;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.location.suppliers.all.JustProvider;
+import org.jclouds.vcloud.compute.BaseVCloudComputeServiceExpectTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterables;
+
+@Test(singleThreaded = true, testName = "ListImagesInVCloudExpectTest")
+public class ListImagesInVCloudExpectTest extends BaseVCloudComputeServiceExpectTest {
+
+ public void testListImagesUsingVCloud1_0ApiOnServerRunningVCloudDirector1_5ReturnsImageWithLocationForVAppTemplateInVDC() throws Exception {
+ ComputeService compute = requestsSendResponses(ImmutableMap.<HttpRequest, HttpResponse>builder()
+ .put(versionsRequest, versionsResponseFromVCD1_5)
+ .put(version1_0LoginRequest, successfulVersion1_0LoginResponseFromVCD1_5WithSingleOrg)
+ .put(version1_0GetOrgRequest, successfulVersion1_0GetOrgResponseFromVCD1_5WithSingleTasksListVDCAndNetwork)
+ .put(version1_0GetCatalogRequest, successfulVersion1_0GetCatalogResponseFromVCD1_5WithSingleTemplate)
+ .put(version1_0GetCatalogItemRequest, successfulVersion1_0GetCatalogItemResponseFromVCD1_5ForTemplate)
+ .put(version1_0GetVDCRequest, successfulVersion1_0GetVDCResponseFromVCD1_5WithSingleTemplateAndNetwork)
+ .put(version1_0GetVAppTemplateRequest, successfulVersion1_0GetVAppTemplateResponseFromVCD1_5WithSingleVMAndVDCParent)
+ .put(version1_0GetOVFForVAppTemplateRequest, successfulVersion1_0GetOVFForVAppTemplateResponseFromVCD1_5WithSingleVM)
+ .build());
+
+ Location provider = Iterables.getOnlyElement(compute.getContext().utils().injector().getInstance(JustProvider.class).get());
+
+ Location orgLocation = new LocationBuilder().id(ENDPOINT + "/v1.0/org/" + orgId).scope(LocationScope.REGION)
+ .description("jclouds").parent(provider).build();
+
+ Location vdcLocation = new LocationBuilder().id(ENDPOINT + "/v1.0/vdc/" + vdcId).scope(LocationScope.ZONE)
+ .description("orgVDC-jclouds-Tier1-PAYG").parent(orgLocation).build();
+
+ Set<? extends Image> currentImages = compute.listImages();
+ assertEquals(compute.listImages().size(), 1);
+ Image onlyImage = Iterables.get(currentImages, 0);
+
+
+ Image expectedImage = new ImageBuilder()
+ .ids(ENDPOINT + "/v1.0/vAppTemplate/" + templateId)
+ .uri(URI.create(ENDPOINT + "/v1.0/vAppTemplate/" + templateId))
+ .name("UbuntuServer-x64-2GB")
+ .operatingSystem(new CIMOperatingSystem(OSType.UBUNTU_64, "", null, "Ubuntu Linux (64-bit)"))
+ // TODO: this looks like a bug, as it says network interfaces
+ .description("This is a special place-holder used for disconnected network interfaces.")
+ .defaultCredentials(LoginCredentials.builder().identity("root").build())
+ .status(Image.Status.AVAILABLE)
+ .location(vdcLocation).build();
+
+ assertEquals(onlyImage, expectedImage);
+ assertEquals(onlyImage.getStatus(), Image.Status.AVAILABLE);
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/VAppToNodeMetadataTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/VAppToNodeMetadataTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/VAppToNodeMetadataTest.java
new file mode 100644
index 0000000..3e36be2
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/functions/VAppToNodeMetadataTest.java
@@ -0,0 +1,226 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.compute.functions;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import java.io.InputStream;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import javax.inject.Singleton;
+
+import org.jclouds.cim.xml.ResourceAllocationSettingDataHandler;
+import org.jclouds.collect.Memoized;
+import org.jclouds.compute.domain.Hardware;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.domain.Credentials;
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.vcloud.VCloudApiMetadata;
+import org.jclouds.vcloud.compute.config.VCloudComputeServiceDependenciesModule;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.internal.VAppImpl;
+import org.jclouds.vcloud.xml.VAppHandler;
+import org.jclouds.vcloud.xml.ovf.VCloudResourceAllocationSettingDataHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Function;
+import com.google.common.base.Joiner;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Maps;
+import com.google.inject.AbstractModule;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Provides;
+import com.google.inject.TypeLiteral;
+import com.google.inject.name.Names;
+
+/**
+ * Tests behavior of {@code VAppToNodeMetadata}
+ */
+@Test(groups = "unit")
+public class VAppToNodeMetadataTest {
+
+ public Injector createInjectorWithLocation(final Location location) {
+ return Guice.createInjector(new SaxParserModule(), new AbstractModule() {
+
+ @Override
+ protected void configure() {
+ Names.bindProperties(binder(), new VCloudApiMetadata().getDefaultProperties());
+ bind(new TypeLiteral<Function<ReferenceType, Location>>() {
+ }).to(new TypeLiteral<FindLocationForResource>() {
+ });
+ bind(new TypeLiteral<Function<VApp, Hardware>>() {
+ }).to(new TypeLiteral<HardwareForVApp>() {
+ });
+ bind(ResourceAllocationSettingDataHandler.class).to(VCloudResourceAllocationSettingDataHandler.class);
+ }
+
+ @Memoized
+ @Singleton
+ @Provides
+ Supplier<Set<? extends Location>> supplyLocations() {
+ return Suppliers.<Set<? extends Location>> ofInstance(ImmutableSet.<Location> of(location));
+ }
+
+ @Singleton
+ @Provides
+ Map<String, Credentials> supplyCreds() {
+ return Maps.newConcurrentMap();
+ }
+
+ @Singleton
+ @Provides
+ protected Map<Status, NodeMetadata.Status> provideVAppStatusToNodeStatus() {
+ return VCloudComputeServiceDependenciesModule.toPortableNodeStatus;
+ }
+
+ });
+ }
+
+ public void testWhenVDCIsLocation() {
+ Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
+ .scope(LocationScope.PROVIDER).build();
+ Injector injector = createInjectorWithLocation(location);
+ InputStream is = getClass().getResourceAsStream("/vapp-pool.xml");
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
+ VAppToNodeMetadata converter = injector.getInstance(VAppToNodeMetadata.class);
+ NodeMetadata node = converter.apply(result);
+ assertNotNull(node);
+ assertEquals(node.getUserMetadata(), ImmutableMap.<String, String>of());
+ assertEquals(node.getTags(), ImmutableSet.<String>of());
+ assertEquals(node.getLocation(), location);
+ assertEquals(node.getPrivateAddresses(), ImmutableSet.of("172.16.7.230"));
+ assertEquals(node.getPublicAddresses(), ImmutableSet.of());
+ }
+
+ public void testWithMetadataParseException() {
+ Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
+ .scope(LocationScope.PROVIDER).build();
+ Injector injector = createInjectorWithLocation(location);
+ InputStream is = getClass().getResourceAsStream("/vapp-pool.xml");
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
+ VAppToNodeMetadata converter = injector.getInstance(VAppToNodeMetadata.class);
+ ImmutableMap<String, String> metadata = ImmutableMap.<String, String>of();
+ ImmutableSet<String> tags = ImmutableSet.<String>of();
+
+ String description = " user=user_ssoid_1\nuid=3b7bb605-bb30-4e62-a3de-9076b052dee7 label='foo-DEVELOPMENT' date=2013-01-22 17:39:28.252";
+
+ result = new VAppImpl(result.getName(), result.getType(), result.getHref(), result.getStatus(), result.getVDC(),
+ description, result.getTasks(), result.isOvfDescriptorUploaded(), result.getChildren(),
+ result.getNetworkSection());
+
+ NodeMetadata node = converter.apply(result);
+ assertNotNull(node);
+ assertEquals(node.getUserMetadata(), metadata);
+ assertEquals(node.getTags(), tags);
+ }
+
+ public void testWithMetadataNoNewLines() {
+ Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
+ .scope(LocationScope.PROVIDER).build();
+ Injector injector = createInjectorWithLocation(location);
+ InputStream is = getClass().getResourceAsStream("/vapp-pool.xml");
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
+ VAppToNodeMetadata converter = injector.getInstance(VAppToNodeMetadata.class);
+ ImmutableMap<String, String> metadata = ImmutableMap.<String, String>of();
+ ImmutableSet<String> tags = ImmutableSet.<String>of();
+
+ String description = " user=user_ssoid_1 uid=3b7bb605-bb30-4e62-a3de-9076b052dee7 label='foo-DEVELOPMENT' date=2013-01-22 17:39:28.252";
+
+ result = new VAppImpl(result.getName(), result.getType(), result.getHref(), result.getStatus(), result.getVDC(),
+ description, result.getTasks(), result.isOvfDescriptorUploaded(), result.getChildren(),
+ result.getNetworkSection());
+
+ NodeMetadata node = converter.apply(result);
+ assertNotNull(node);
+ assertEquals(node.getUserMetadata(), metadata);
+ assertEquals(node.getTags(), tags);
+ }
+
+ public void testWithEncodedMetadata() {
+ Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
+ .scope(LocationScope.PROVIDER).build();
+ Injector injector = createInjectorWithLocation(location);
+ InputStream is = getClass().getResourceAsStream("/vapp-pool.xml");
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
+ VAppToNodeMetadata converter = injector.getInstance(VAppToNodeMetadata.class);
+ ImmutableMap<String, String> metadata = ImmutableMap.<String, String>of("foo", "bar");
+ ImmutableSet<String> tags = ImmutableSet.<String>of("tag1", "tag2");
+
+ String description = Joiner
+ .on('\n')
+ .withKeyValueSeparator("=")
+ .join(ImmutableMap.<String, String> builder().putAll(metadata)
+ .put("jclouds_tags", Joiner.on(',').join(tags)).build());
+
+ result = new VAppImpl(result.getName(), result.getType(), result.getHref(), result.getStatus(), result.getVDC(),
+ description, result.getTasks(), result.isOvfDescriptorUploaded(), result.getChildren(),
+ result.getNetworkSection());
+
+ NodeMetadata node = converter.apply(result);
+ assertNotNull(node);
+ assertEquals(node.getUserMetadata(), metadata);
+ assertEquals(node.getTags(), tags);
+
+ }
+
+ public void testGracefulWhenNoIPs() {
+ Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/1").description("description")
+ .scope(LocationScope.PROVIDER).build();
+ Injector injector = createInjectorWithLocation(location);
+ InputStream is = getClass().getResourceAsStream("/vapp-none.xml");
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
+ VAppToNodeMetadata converter = injector.getInstance(VAppToNodeMetadata.class);
+ NodeMetadata node = converter.apply(result);
+ assertNotNull(node);
+ assertEquals(node.getLocation(), location);
+ assertEquals(node.getPrivateAddresses(), ImmutableSet.of());
+ assertEquals(node.getPublicAddresses(), ImmutableSet.of());
+ }
+
+ @Test(expectedExceptions = NoSuchElementException.class)
+ public void testGracefulWhenVDCIsNotLocation() {
+ Location location = new LocationBuilder().id("https://1.1.1.1/api/v1.0/vdc/11111").description("description")
+ .scope(LocationScope.PROVIDER).build();
+ Injector injector = createInjectorWithLocation(location);
+ InputStream is = getClass().getResourceAsStream("/vapp-pool.xml");
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
+ VAppToNodeMetadata converter = injector.getInstance(VAppToNodeMetadata.class);
+ NodeMetadata node = converter.apply(result);
+ assertNotNull(node);
+ assertEquals(node.getLocation(), location);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/options/VCloudTemplateOptionsTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/options/VCloudTemplateOptionsTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/options/VCloudTemplateOptionsTest.java
new file mode 100644
index 0000000..4677835
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/options/VCloudTemplateOptionsTest.java
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.compute.options;
+
+import static org.jclouds.vcloud.compute.options.VCloudTemplateOptions.Builder.blockOnPort;
+import static org.jclouds.vcloud.compute.options.VCloudTemplateOptions.Builder.customizationScript;
+import static org.jclouds.vcloud.compute.options.VCloudTemplateOptions.Builder.description;
+import static org.jclouds.vcloud.compute.options.VCloudTemplateOptions.Builder.inboundPorts;
+import static org.jclouds.vcloud.compute.options.VCloudTemplateOptions.Builder.ipAddressAllocationMode;
+import static org.jclouds.vcloud.compute.options.VCloudTemplateOptions.Builder.parentNetwork;
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.compute.options.TemplateOptions;
+import org.jclouds.vcloud.domain.network.IpAddressAllocationMode;
+import org.testng.annotations.Test;
+
+/**
+ * Tests possible uses of VCloudTemplateOptions and
+ * VCloudTemplateOptions.Builder.*
+ */
+public class VCloudTemplateOptionsTest {
+ @Test
+ public void testipAddressAllocationMode() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ options.ipAddressAllocationMode(IpAddressAllocationMode.NONE);
+ assertEquals(options.getIpAddressAllocationMode(), IpAddressAllocationMode.NONE);
+ }
+
+ @Test
+ public void testipAddressAllocationModeStatic() {
+ VCloudTemplateOptions options = ipAddressAllocationMode(IpAddressAllocationMode.NONE);
+ assertEquals(options.getIpAddressAllocationMode(), IpAddressAllocationMode.NONE);
+ }
+
+ public void testAs() {
+ TemplateOptions options = new VCloudTemplateOptions();
+ assertEquals(options.as(VCloudTemplateOptions.class), options);
+ }
+
+ @Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = "customizationScript must be defined")
+ public void testcustomizationScriptBadFormat() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ options.customizationScript("");
+ }
+
+ @Test
+ public void testcustomizationScript() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ options.customizationScript("mykeypair");
+ assertEquals(options.getCustomizationScript(), "mykeypair");
+ }
+
+ @Test
+ public void testcustomizationScriptStatic() {
+ VCloudTemplateOptions options = customizationScript("mykeypair");
+ assertEquals(options.getCustomizationScript(), "mykeypair");
+ }
+
+ @Test
+ public void testNullparentNetwork() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ assertEquals(options.getParentNetwork(), null);
+ }
+
+ @Test
+ public void testparentNetwork() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ options.parentNetwork(URI.create("https://network"));
+ assertEquals(options.getParentNetwork(), URI.create("https://network"));
+ }
+
+ @Test
+ public void testparentNetworkStatic() {
+ VCloudTemplateOptions options = parentNetwork(URI.create("https://network"));
+ assertEquals(options.getParentNetwork(), URI.create("https://network"));
+ }
+
+ @Test
+ public void testdescription() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ options.description("mykeypair");
+ assertEquals(options.getDescription(), "mykeypair");
+ }
+
+ @Test
+ public void testdescriptionStatic() {
+ VCloudTemplateOptions options = description("mykeypair");
+ assertEquals(options.getDescription(), "mykeypair");
+ }
+
+ @Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = "customizationScript must be defined")
+ public void testcustomizationScriptNPE() {
+ customizationScript(null);
+ }
+
+ @Test
+ public void testinstallPrivateKey() throws IOException {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ options.installPrivateKey("-----BEGIN RSA PRIVATE KEY-----");
+ assertEquals(options.getPrivateKey(), "-----BEGIN RSA PRIVATE KEY-----");
+ }
+
+ @Test
+ public void testNullinstallPrivateKey() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ assertEquals(options.getPrivateKey(), null);
+ }
+
+ @Test
+ public void testauthorizePublicKey() throws IOException {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ options.authorizePublicKey("ssh-rsa");
+ assertEquals(options.getPublicKey(), "ssh-rsa");
+ }
+
+ @Test
+ public void testNullauthorizePublicKey() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ assertEquals(options.getPublicKey(), null);
+ }
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void testblockOnPortBadFormat() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ options.blockOnPort(-1, -1);
+ }
+
+ @Test
+ public void testblockOnPort() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ options.blockOnPort(22, 30);
+ assertEquals(options.getPort(), 22);
+ assertEquals(options.getSeconds(), 30);
+
+ }
+
+ @Test
+ public void testNullblockOnPort() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ assertEquals(options.getPort(), -1);
+ assertEquals(options.getSeconds(), -1);
+ }
+
+ @Test
+ public void testblockOnPortStatic() {
+ VCloudTemplateOptions options = blockOnPort(22, 30);
+ assertEquals(options.getPort(), 22);
+ assertEquals(options.getSeconds(), 30);
+ }
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void testinboundPortsBadFormat() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ options.inboundPorts(-1, -1);
+ }
+
+ @Test
+ public void testinboundPorts() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ options.inboundPorts(22, 30);
+ assertEquals(options.getInboundPorts()[0], 22);
+ assertEquals(options.getInboundPorts()[1], 30);
+
+ }
+
+ @Test
+ public void testDefaultOpen22() {
+ VCloudTemplateOptions options = new VCloudTemplateOptions();
+ assertEquals(options.getInboundPorts()[0], 22);
+ }
+
+ @Test
+ public void testinboundPortsStatic() {
+ VCloudTemplateOptions options = inboundPorts(22, 30);
+ assertEquals(options.getInboundPorts()[0], 22);
+ assertEquals(options.getInboundPorts()[1], 30);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOnExpectTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOnExpectTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOnExpectTest.java
new file mode 100644
index 0000000..2608021
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/strategy/InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOnExpectTest.java
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.compute.strategy;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+import java.util.Properties;
+
+import org.jclouds.compute.ComputeService;
+import org.jclouds.compute.ComputeServiceAdapter.NodeAndInitialCredentials;
+import org.jclouds.compute.domain.Template;
+import org.jclouds.domain.LoginCredentials;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.vcloud.compute.BaseVCloudComputeServiceExpectTest;
+import org.jclouds.vcloud.compute.options.VCloudTemplateOptions;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.net.HttpHeaders;
+import com.jamesmurty.utils.XMLBuilder;
+
+@Test(singleThreaded = true, testName = "InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOnExpectTest")
+public class InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOnExpectTest extends
+ BaseVCloudComputeServiceExpectTest {
+
+ String ns = "http://www.vmware.com/vcloud/v1";
+ Properties outputProperties;
+ public InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOnExpectTest() {
+ outputProperties = new Properties();
+ outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
+ }
+
+ HttpResponse successfulVersion1_0InstantiatedVApp = HttpResponse.builder()
+ .statusCode(200)
+ .message("HTTP/1.1 200 OK")
+ .payload(payloadFromResourceWithContentType("/instantiatedvapp.xml", "application/vnd.vmware.vcloud.vApp+xml")).build();
+
+ // TODO: finish me!
+ @Test(enabled = false)
+ public void testCreateNodeUsingVCloud1_0ApiAgainstVCloudDirector1_5WhenVAppTemplateHasNetworkNamedNone()
+ throws Exception {
+
+ String group = "group";
+ String name = "group-abcd";
+
+ String instantiateXML = XMLBuilder.create("InstantiateVAppTemplateParams")
+ .a("xmlns", ns).a("xmlns:ovf", "http://schemas.dmtf.org/ovf/envelope/1")
+ .a("deploy", "false").a("name", name).a("powerOn", "false")
+ .e("Description").up()
+ .e("InstantiationParams")
+ .e("NetworkConfigSection")
+ .e("ovf:Info").t("Configuration parameters for logical networks").up()
+ .e("NetworkConfig").a("networkName", "orgNet-jclouds-External") // NOTE not "None"
+ .e("Configuration")
+ .e("ParentNetwork").a("href", ENDPOINT + "/v1.0/network/" + networkId).up()
+ .e("FenceMode").t("bridged").up()
+ .up()
+ .up()
+ .up()
+ .up()
+ .e("Source").a("href", ENDPOINT + "/v1.0/vAppTemplate/" + templateId).up()
+ .e("AllEULAsAccepted").t("true").up()
+ .asString(outputProperties);
+
+ HttpRequest version1_0InstantiateWithNetworkNamedSameAsOrgNetwork = HttpRequest.builder().method("POST")
+ .endpoint(ENDPOINT + "/v1.0/vdc/" + vdcId + "/action/instantiateVAppTemplate")
+ .addHeader(HttpHeaders.ACCEPT, "application/vnd.vmware.vcloud.vApp+xml;version=1.0")
+ .addHeader("x-vcloud-authorization", sessionToken)
+ .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken)
+ .payload(payloadFromStringWithContentType(instantiateXML, "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")).build();
+
+ ComputeService compute = requestsSendResponses(ImmutableMap.<HttpRequest, HttpResponse> builder()
+ .put(versionsRequest, versionsResponseFromVCD1_5)
+ .put(version1_0LoginRequest, successfulVersion1_0LoginResponseFromVCD1_5WithSingleOrg)
+ .put(version1_0GetOrgRequest, successfulVersion1_0GetOrgResponseFromVCD1_5WithSingleTasksListVDCAndNetwork)
+ .put(version1_0GetCatalogRequest, successfulVersion1_0GetCatalogResponseFromVCD1_5WithSingleTemplate)
+ .put(version1_0GetCatalogItemRequest, successfulVersion1_0GetCatalogItemResponseFromVCD1_5ForTemplate)
+ .put(version1_0GetVDCRequest, successfulVersion1_0GetVDCResponseFromVCD1_5WithSingleTemplateAndNetwork)
+ .put(version1_0GetVAppTemplateRequest, successfulVersion1_0GetVAppTemplateResponseFromVCD1_5WithSingleVMAndVDCParent)
+ .put(version1_0GetOVFForVAppTemplateRequest, successfulVersion1_0GetOVFForVAppTemplateResponseFromVCD1_5WithSingleVM)
+ .put(version1_0InstantiateWithNetworkNamedSameAsOrgNetwork, successfulVersion1_0InstantiatedVApp).build());
+
+ InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn starter = compute.getContext()
+ .utils().injector().getInstance(
+ InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.class);
+
+
+ NodeAndInitialCredentials<VApp> appAndCreds = starter.createNodeWithGroupEncodedIntoName(group, name, compute
+ .templateBuilder().build());
+
+ assertEquals(appAndCreds.getNode().getName(), name);
+ assertEquals(appAndCreds.getCredentials(), LoginCredentials.builder().user("root").password("fromVApp").build());
+
+ }
+
+ public void testInstantiateVAppFromTemplateWhenUsingOverriddenNetworkAndFenceMode()
+ throws Exception {
+
+ String name = "group-abcd";
+ FenceMode fenceMode = FenceMode.NAT_ROUTED;
+ URI parentNetwork = URI.create(ENDPOINT + "/v1.0/network/" + "foooooooo");
+
+ String instantiateXML = XMLBuilder.create("InstantiateVAppTemplateParams")
+ .a("xmlns", ns).a("xmlns:ovf", "http://schemas.dmtf.org/ovf/envelope/1")
+ .a("deploy", "false").a("name", name).a("powerOn", "false")
+ .e("Description").up()
+ .e("InstantiationParams")
+ .e("NetworkConfigSection")
+ .e("ovf:Info").t("Configuration parameters for logical networks").up()
+ .e("NetworkConfig").a("networkName", "jclouds") // NOTE not "None"
+ .e("Configuration")
+ .e("ParentNetwork").a("href", parentNetwork.toASCIIString()).up()
+ .e("FenceMode").t(fenceMode.toString()).up()
+ .up()
+ .up()
+ .up()
+ .up()
+ .e("Source").a("href", ENDPOINT + "/v1.0/vAppTemplate/" + templateId).up()
+ .e("AllEULAsAccepted").t("true").up()
+ .asString(outputProperties);
+
+ HttpRequest version1_0InstantiateWithCustomizedNetwork = HttpRequest.builder().method("POST")
+ .endpoint(ENDPOINT + "/v1.0/vdc/" + vdcId + "/action/instantiateVAppTemplate")
+ .addHeader(HttpHeaders.ACCEPT, "application/vnd.vmware.vcloud.vApp+xml;version=1.0")
+ .addHeader("x-vcloud-authorization", sessionToken)
+ .addHeader(HttpHeaders.COOKIE, "vcloud-token=" + sessionToken)
+ .payload(payloadFromStringWithContentType(instantiateXML, "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")).build();
+
+ ComputeService compute = requestsSendResponses(ImmutableMap.<HttpRequest, HttpResponse> builder()
+ .put(versionsRequest, versionsResponseFromVCD1_5)
+ .put(version1_0LoginRequest, successfulVersion1_0LoginResponseFromVCD1_5WithSingleOrg)
+ .put(version1_0GetOrgRequest, successfulVersion1_0GetOrgResponseFromVCD1_5WithSingleTasksListVDCAndNetwork)
+ .put(version1_0GetCatalogRequest, successfulVersion1_0GetCatalogResponseFromVCD1_5WithSingleTemplate)
+ .put(version1_0GetCatalogItemRequest, successfulVersion1_0GetCatalogItemResponseFromVCD1_5ForTemplate)
+ .put(version1_0GetVDCRequest, successfulVersion1_0GetVDCResponseFromVCD1_5WithSingleTemplateAndNetwork)
+ .put(version1_0GetVAppTemplateRequest, successfulVersion1_0GetVAppTemplateResponseFromVCD1_5WithSingleVMAndVDCParent)
+ .put(version1_0GetOVFForVAppTemplateRequest, successfulVersion1_0GetOVFForVAppTemplateResponseFromVCD1_5WithSingleVM)
+ .put(version1_0InstantiateWithCustomizedNetwork, successfulVersion1_0InstantiatedVApp).build());
+
+ InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn starter = compute.getContext()
+ .utils().injector().getInstance(
+ InstantiateVAppTemplateWithGroupEncodedIntoNameThenCustomizeDeployAndPowerOn.class);
+
+ Template template = compute.templateBuilder().build();
+ template.getOptions().as(VCloudTemplateOptions.class).parentNetwork(parentNetwork).fenceMode(fenceMode);
+ starter.instantiateVAppFromTemplate(name, template);
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/strategy/VCloudComputeServiceAdapterTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/strategy/VCloudComputeServiceAdapterTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/strategy/VCloudComputeServiceAdapterTest.java
new file mode 100644
index 0000000..232b151
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/compute/strategy/VCloudComputeServiceAdapterTest.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.compute.strategy;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+
+import org.jclouds.compute.ComputeService;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.vcloud.compute.BaseVCloudComputeServiceExpectTest;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Function;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+
+public class VCloudComputeServiceAdapterTest extends BaseVCloudComputeServiceExpectTest {
+
+ @Test
+ public void testListHardwareProfiles() throws Exception {
+ ComputeService compute = requestsSendResponses(ImmutableMap.<HttpRequest, HttpResponse> builder()
+ .put(versionsRequest, versionsResponseFromVCD1_5)
+ .put(version1_0LoginRequest, successfulVersion1_0LoginResponseFromVCD1_5WithSingleOrg)
+ .put(version1_0GetOrgRequest, successfulVersion1_0GetOrgResponseFromVCD1_5WithSingleTasksListVDCAndNetwork)
+ .put(version1_0GetCatalogRequest, successfulVersion1_0GetCatalogResponseFromVCD1_5WithSingleTemplate)
+ .put(version1_0GetCatalogItemRequest, successfulVersion1_0GetCatalogItemResponseFromVCD1_5ForTemplate)
+ .put(version1_0GetVDCRequest, successfulVersion1_0GetVDCResponseFromVCD1_5WithSingleTemplateAndNetwork)
+ .put(version1_0GetVAppTemplateRequest, successfulVersion1_0GetVAppTemplateResponseFromVCD1_5WithSingleVMAndVDCParent)
+ .put(version1_0GetOVFForVAppTemplateRequest, successfulVersion1_0GetOVFForVAppTemplateResponseFromVCD1_5WithSingleVM)
+ .build());
+
+ VCloudComputeServiceAdapter adapter = compute.getContext()
+ .utils().injector().getInstance(VCloudComputeServiceAdapter.class);
+
+ Iterable<VAppTemplate> hardwareProfiles = adapter.listHardwareProfiles();
+
+ Iterable<URI> hardwareProfileRefs = Iterables.transform(ImmutableList.copyOf(hardwareProfiles), new Function<VAppTemplate, URI>() {
+ @Override public URI apply(VAppTemplate input) {
+ return input.getHref();
+ }
+ });
+ assertEquals(ImmutableSet.copyOf(hardwareProfileRefs), ImmutableSet.of(URI.create("https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728")));
+ }
+
+ /**
+ * For issue 994. In BaseEnvelopeHandler when it encounters VirtualSystemCollection, it throws IllegalArgumentException
+ * (cannot currently create envelopes with multiple virtual systems).
+ * Thus we do not include the VM in the supported set, but we do return without propagating the exception.
+ */
+ @Test
+ public void testListHardwareProfilesWithUnsupportedTemplate() throws Exception {
+ ComputeService compute = requestsSendResponses(ImmutableMap.<HttpRequest, HttpResponse> builder()
+ .put(versionsRequest, versionsResponseFromVCD1_5)
+ .put(version1_0LoginRequest, successfulVersion1_0LoginResponseFromVCD1_5WithSingleOrg)
+ .put(version1_0GetOrgRequest, successfulVersion1_0GetOrgResponseFromVCD1_5WithSingleTasksListVDCAndNetwork)
+ .put(version1_0GetCatalogRequest, successfulVersion1_0GetCatalogResponseFromVCD1_5WithSingleTemplate)
+ .put(version1_0GetCatalogItemRequest, successfulVersion1_0GetCatalogItemResponseFromVCD1_5ForTemplate)
+ .put(version1_0GetVDCRequest, successfulVersion1_0GetVDCResponseFromVCD1_5WithSingleTemplateAndNetwork)
+ .put(version1_0GetVAppTemplateRequest, successfulVersion1_0GetVAppTemplateResponseFromVCD1_5WithMultipleVMsAndVDCParent)
+ .put(version1_0GetOVFForVAppTemplateRequest, successfulVersion1_0GetOVFForVAppTemplateResponseFromVCD1_5WithMultipleVMs)
+ .build());
+
+ VCloudComputeServiceAdapter adapter = compute.getContext()
+ .utils().injector().getInstance(VCloudComputeServiceAdapter.class);
+
+ Iterable<VAppTemplate> hardwareProfiles = adapter.listHardwareProfiles();
+
+ assertEquals(ImmutableSet.copyOf(hardwareProfiles), ImmutableSet.of());
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/CatalogApiLiveTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/CatalogApiLiveTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/CatalogApiLiveTest.java
new file mode 100644
index 0000000..a787afb
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/features/CatalogApiLiveTest.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import org.jclouds.rest.annotations.ApiVersion;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.testng.annotations.Test;
+
+import com.google.inject.Key;
+
+@Test(groups = "live", enabled = true, singleThreaded = true, testName = "CatalogApiLiveTest")
+public class CatalogApiLiveTest extends BaseVCloudApiLiveTest {
+ @Test
+ public void testGetCatalog() throws Exception {
+ Org org = getVCloudApi().getOrgApi().findOrgNamed(null);
+ for (ReferenceType catalog : org.getCatalogs().values()) {
+ assertEquals(catalog.getType(), VCloudMediaType.CATALOG_XML);
+ assertNotNull(getVCloudApi().getCatalogApi().getCatalog(catalog.getHref()));
+ }
+ }
+
+ @Test
+ public void testFindCatalogIsWriteableIfNotVersion1_5() throws Exception {
+ // when we are in vCloud 1.0.0 public catalogs don't work, so our default
+ // catalog is private
+ if (!view.utils().injector().getInstance(Key.get(String.class, ApiVersion.class)).startsWith("1.5"))
+ assertTrue(getVCloudApi().getCatalogApi().findCatalogInOrgNamed(null, null).isReadOnly());
+ }
+}
[17/18] stratos git commit: Jclouds vcloud api 1.8.1 clone with
custom changes
Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindGuestCustomizationSectionToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindGuestCustomizationSectionToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindGuestCustomizationSectionToXmlPayload.java
new file mode 100644
index 0000000..3ba51d1
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindGuestCustomizationSectionToXmlPayload.java
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
+
+import java.util.Properties;
+
+import javax.annotation.Resource;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.logging.Logger;
+import org.jclouds.rest.binders.BindToStringPayload;
+import org.jclouds.vcloud.domain.GuestCustomizationSection;
+
+import com.google.common.base.Throwables;
+import com.google.inject.Inject;
+import com.jamesmurty.utils.XMLBuilder;
+
+@Singleton
+public class BindGuestCustomizationSectionToXmlPayload extends BindToStringPayload {
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ protected final String ns;
+ protected final String schema;
+
+ @Inject
+ public BindGuestCustomizationSectionToXmlPayload(BindToStringPayload stringBinder,
+ @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
+ this.ns = ns;
+ this.schema = schema;
+ }
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
+ checkArgument(checkNotNull(payload, "GuestCustomizationSection") instanceof GuestCustomizationSection,
+ "this binder is only valid for GuestCustomizationSection!");
+ GuestCustomizationSection guest = GuestCustomizationSection.class.cast(payload);
+ XMLBuilder guestCustomizationSection;
+ try {
+ guestCustomizationSection = XMLBuilder.create("GuestCustomizationSection").a("xmlns", ns).a("xmlns:ovf",
+ "http://schemas.dmtf.org/ovf/envelope/1").a("type", guest.getType()).a("href",
+ guest.getHref().toASCIIString()).a("ovf:required", "false");
+ guestCustomizationSection.e("ovf:Info").t(guest.getInfo());
+
+ if (guest.isEnabled() != null)
+ guestCustomizationSection.e("Enabled").t(guest.isEnabled().toString());
+ if (guest.shouldChangeSid() != null)
+ guestCustomizationSection.e("ChangeSid").t(guest.shouldChangeSid().toString());
+ if (guest.getVirtualMachineId() != null)
+ guestCustomizationSection.e("VirtualMachineId").t(guest.getVirtualMachineId().toString());
+ if (guest.isJoinDomainEnabled() != null)
+ guestCustomizationSection.e("JoinDomainEnabled").t(guest.isJoinDomainEnabled().toString());
+ if (guest.shouldUseOrgSettings() != null)
+ guestCustomizationSection.e("UseOrgSettings").t(guest.shouldUseOrgSettings().toString());
+ if (guest.getDomainName() != null)
+ guestCustomizationSection.e("DomainName").t(guest.getDomainName().toString());
+ if (guest.getDomainUserName() != null)
+ guestCustomizationSection.e("DomainUserName").t(guest.getDomainUserName().toString());
+ if (guest.getDomainUserPassword() != null)
+ guestCustomizationSection.e("DomainUserPassword").t(guest.getDomainUserPassword().toString());
+ if (guest.isAdminPasswordEnabled() != null)
+ guestCustomizationSection.e("AdminPasswordEnabled").t(guest.isAdminPasswordEnabled().toString());
+ if (guest.isAdminPasswordAuto() != null)
+ guestCustomizationSection.e("AdminPasswordAuto").t(guest.isAdminPasswordAuto().toString());
+ // if (guest.getAdminPassword() != null)
+ // guestCustomizationSection.e("AdminPassword").t(guest.getAdminPassword().toString());
+ if (guest.isResetPasswordRequired() != null)
+ guestCustomizationSection.e("ResetPasswordRequired").t(guest.isResetPasswordRequired().toString());
+ if (guest.getCustomizationScript() != null)
+ guestCustomizationSection.e("CustomizationScript").t(guest.getCustomizationScript());
+ if (guest.getComputerName() != null)
+ guestCustomizationSection.e("ComputerName").t(guest.getComputerName().toString());
+ if (guest.getEdit() != null)
+ guestCustomizationSection.e("Link").a("rel", "edit").a("type", guest.getType()).a("href",
+ guest.getHref().toASCIIString());
+
+ Properties outputProperties = new Properties();
+ outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
+ request = super.bindToRequest(request, guestCustomizationSection.asString(outputProperties));
+ request.getPayload().getContentMetadata().setContentType(guest.getType());
+ } catch (Exception e) {
+ Throwables.propagate(e);
+ }
+ return request;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayload.java
new file mode 100644
index 0000000..08e5443
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayload.java
@@ -0,0 +1,216 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.collect.Iterables.transform;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToStringPayload;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.domain.network.NetworkConfig;
+import org.jclouds.vcloud.endpoints.Network;
+import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Function;
+import com.google.common.base.Supplier;
+import com.google.common.cache.LoadingCache;
+import com.google.common.collect.ImmutableSet;
+import com.jamesmurty.utils.XMLBuilder;
+
+@Singleton
+public class BindInstantiateVAppTemplateParamsToXmlPayload implements MapBinder {
+
+ protected final String ns;
+ protected final String schema;
+ protected final BindToStringPayload stringBinder;
+ protected final Supplier<ReferenceType> defaultNetwork;
+ protected final FenceMode defaultFenceMode;
+ protected final LoadingCache<URI, VAppTemplate> templateCache;
+ protected final Function<VAppTemplate, String> defaultNetworkNameInTemplate;
+
+ @Inject
+ public BindInstantiateVAppTemplateParamsToXmlPayload(LoadingCache<URI, VAppTemplate> templateCache,
+ @Network Function<VAppTemplate, String> defaultNetworkNameInTemplate, BindToStringPayload stringBinder,
+ @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema,
+ @Network Supplier<ReferenceType> network, FenceMode fenceMode) {
+ this.templateCache = templateCache;
+ this.defaultNetworkNameInTemplate = defaultNetworkNameInTemplate;
+ this.ns = ns;
+ this.schema = schema;
+ this.stringBinder = stringBinder;
+ this.defaultNetwork = network;
+ this.defaultFenceMode = fenceMode;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ checkArgument(checkNotNull(request, "request") instanceof GeneratedHttpRequest,
+ "this binder is only valid for GeneratedHttpRequests!");
+ GeneratedHttpRequest gRequest = (GeneratedHttpRequest) request;
+ String name = checkNotNull(postParams.remove("name"), "name").toString();
+ URI template = URI.create(checkNotNull(postParams.remove("template"), "template").toString());
+
+ Set<NetworkConfig> networkConfig = null;
+
+ NetworkConfigDecorator networkConfigDecorator = new NetworkConfigDecorator(templateCache.getUnchecked(template),
+ defaultNetwork.get().getHref(), defaultFenceMode, defaultNetworkNameInTemplate);
+
+ InstantiateVAppTemplateOptions options = findOptionsInArgsOrNull(gRequest);
+
+ if (options != null) {
+ if (options.getNetworkConfig().size() > 0)
+ networkConfig = ImmutableSet
+ .copyOf(transform(options.getNetworkConfig(), networkConfigDecorator));
+ } else {
+ options = new InstantiateVAppTemplateOptions();
+ }
+
+ if (networkConfig == null)
+ networkConfig = ImmutableSet.of(networkConfigDecorator.apply(null));
+
+ try {
+ return stringBinder.bindToRequest(request, generateXml(name, options.getDescription(), options.shouldDeploy(),
+ options.shouldPowerOn(), template, networkConfig));
+ } catch (ParserConfigurationException e) {
+ throw new RuntimeException(e);
+ } catch (FactoryConfigurationError e) {
+ throw new RuntimeException(e);
+ } catch (TransformerException e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ @VisibleForTesting
+ Set<Vm> ifCustomizationScriptIsSetGetVmsInTemplate(String customizationScript, final URI template) {
+ Set<Vm> vms = ImmutableSet.of();
+ if (customizationScript != null) {
+ VAppTemplate vAppTemplate = templateCache.getUnchecked(template);
+ checkArgument(vAppTemplate != null, "vAppTemplate %s not found!", template);
+ vms = vAppTemplate.getChildren();
+ checkArgument(vms.size() > 0, "no vms found in vAppTemplate %s", vAppTemplate);
+ }
+ return vms;
+ }
+
+ protected static final class NetworkConfigDecorator implements Function<NetworkConfig, NetworkConfig> {
+ private final VAppTemplate template;
+ private final URI defaultNetwork;
+ private final FenceMode defaultFenceMode;
+ private final Function<VAppTemplate, String> defaultNetworkNameInTemplate;
+
+ protected NetworkConfigDecorator(VAppTemplate template, URI defaultNetwork, FenceMode defaultFenceMode,
+ Function<VAppTemplate, String> defaultNetworkNameInTemplate) {
+ this.template = checkNotNull(template, "template");
+ this.defaultNetwork = checkNotNull(defaultNetwork, "defaultNetwork");
+ this.defaultFenceMode = checkNotNull(defaultFenceMode, "defaultFenceMode");
+ this.defaultNetworkNameInTemplate = checkNotNull(defaultNetworkNameInTemplate, "defaultNetworkNameInTemplate");
+ }
+
+ @Override
+ public NetworkConfig apply(NetworkConfig from) {
+ if (from == null)
+ return new NetworkConfig(defaultNetworkNameInTemplate.apply(template), defaultNetwork, defaultFenceMode);
+ URI network = ifNullDefaultTo(from.getParentNetwork(), defaultNetwork);
+ FenceMode fenceMode = ifNullDefaultTo(from.getFenceMode(), defaultFenceMode);
+ // using conditional statement instead of ifNullDefaultTo so that we lazy invoke the
+ // function, as it is an expensive one.
+ String networkName = from.getNetworkName() != null ? from.getNetworkName() : defaultNetworkNameInTemplate
+ .apply(template);
+ return new NetworkConfig(networkName, network, fenceMode);
+ }
+ }
+
+ protected String generateXml(String name, @Nullable String description, boolean deploy, boolean powerOn,
+ URI template, Iterable<NetworkConfig> networkConfig)
+ throws ParserConfigurationException, FactoryConfigurationError, TransformerException {
+ XMLBuilder rootBuilder = buildRoot(name).a("deploy", deploy + "").a("powerOn", powerOn + "");
+ if (description != null)
+ rootBuilder.e("Description").t(description);
+ XMLBuilder instantiationParamsBuilder = rootBuilder.e("InstantiationParams");
+ addNetworkConfig(instantiationParamsBuilder, networkConfig);
+ rootBuilder.e("Source").a("href", template.toASCIIString());
+ rootBuilder.e("AllEULAsAccepted").t("true");
+
+ Properties outputProperties = new Properties();
+ outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
+ return rootBuilder.asString(outputProperties);
+ }
+
+ protected void addNetworkConfig(XMLBuilder instantiationParamsBuilder,
+ Iterable<NetworkConfig> networkConfig) {
+ XMLBuilder networkConfigBuilder = instantiationParamsBuilder.e("NetworkConfigSection");
+ networkConfigBuilder.e("ovf:Info").t("Configuration parameters for logical networks");
+ for (NetworkConfig n : networkConfig) {
+ XMLBuilder configurationBuilder = networkConfigBuilder.e("NetworkConfig").a("networkName", n.getNetworkName())
+ .e("Configuration");
+ configurationBuilder.e("ParentNetwork").a("href", n.getParentNetwork().toASCIIString());
+ if (n.getFenceMode() != null) {
+ configurationBuilder.e("FenceMode").t(n.getFenceMode().toString());
+ }
+ }
+ }
+
+ protected XMLBuilder buildRoot(String name) throws ParserConfigurationException, FactoryConfigurationError {
+ return XMLBuilder.create("InstantiateVAppTemplateParams").a("name", name).a("xmlns", ns)
+ .a("xmlns:ovf", "http://schemas.dmtf.org/ovf/envelope/1");
+ }
+
+ protected InstantiateVAppTemplateOptions findOptionsInArgsOrNull(GeneratedHttpRequest gRequest) {
+ for (Object arg : gRequest.getInvocation().getArgs()) {
+ if (arg instanceof InstantiateVAppTemplateOptions) {
+ return (InstantiateVAppTemplateOptions) arg;
+ } else if (arg instanceof InstantiateVAppTemplateOptions[]) {
+ InstantiateVAppTemplateOptions[] options = (InstantiateVAppTemplateOptions[]) arg;
+ return (options.length > 0) ? options[0] : null;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ throw new IllegalStateException("InstantiateVAppTemplateParams is needs parameters");
+ }
+
+ public static <T> T ifNullDefaultTo(T value, T defaultValue) {
+ return value != null ? value : checkNotNull(defaultValue, "defaultValue");
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindMemoryToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindMemoryToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindMemoryToXmlPayload.java
new file mode 100644
index 0000000..e6a1cd4
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindMemoryToXmlPayload.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
+
+import java.util.Properties;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.cim.ResourceAllocationSettingData.ResourceType;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.binders.BindToStringPayload;
+
+import com.google.common.base.Throwables;
+import com.google.inject.Inject;
+import com.jamesmurty.utils.XMLBuilder;
+
+@Singleton
+public class BindMemoryToXmlPayload extends BindToStringPayload {
+ protected final String ns;
+ protected final String schema;
+
+ @Inject
+ public BindMemoryToXmlPayload(BindToStringPayload stringBinder, @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns,
+ @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
+ this.ns = ns;
+ this.schema = schema;
+ }
+
+ private static final String RESOURCE_ALLOCATION_NS = "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData";
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
+ checkArgument(checkNotNull(payload, "memoryInMB") instanceof Integer, "this binder is only valid for Integers!");
+ Integer memoryInMB = Integer.class.cast(payload);
+ XMLBuilder cpuItem;
+ try {
+ cpuItem = XMLBuilder.create("Item").a("xmlns", ns).a("xmlns:rasd", RESOURCE_ALLOCATION_NS);
+ cpuItem.e("rasd:AllocationUnits").t("byte * 2^20");
+ cpuItem.e("rasd:Description").t("Memory Size");
+ cpuItem.e("rasd:ElementName").t(memoryInMB.toString() + " MB of memory");
+ cpuItem.e("rasd:InstanceID").t("5");
+ cpuItem.e("rasd:Reservation").t("0");
+ cpuItem.e("rasd:ResourceType").t(ResourceType.MEMORY.value());
+ cpuItem.e("rasd:VirtualQuantity").t(memoryInMB.toString());
+ cpuItem.e("rasd:Weight").t("0");
+ Properties outputProperties = new Properties();
+ outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
+ request = super.bindToRequest(request, cpuItem.asString(outputProperties));
+ } catch (Exception e) {
+ Throwables.propagate(e);
+ }
+ return request;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayload.java
new file mode 100644
index 0000000..6a27725
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayload.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_SCHEMA;
+
+import java.util.Properties;
+
+import javax.annotation.Resource;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.logging.Logger;
+import org.jclouds.rest.binders.BindToStringPayload;
+import org.jclouds.vcloud.domain.NetworkConnection;
+import org.jclouds.vcloud.domain.NetworkConnectionSection;
+
+import com.google.common.base.Throwables;
+import com.google.inject.Inject;
+import com.jamesmurty.utils.XMLBuilder;
+
+@Singleton
+public class BindNetworkConnectionSectionToXmlPayload extends BindToStringPayload {
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ protected final String ns;
+ protected final String schema;
+
+ @Inject
+ public BindNetworkConnectionSectionToXmlPayload(BindToStringPayload stringBinder,
+ @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns, @Named(PROPERTY_VCLOUD_XML_SCHEMA) String schema) {
+ this.ns = ns;
+ this.schema = schema;
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
+ checkArgument(checkNotNull(payload, "NetworkConnectionSection") instanceof NetworkConnectionSection,
+ "this binder is only valid for NetworkConnectionSection!");
+ NetworkConnectionSection net = NetworkConnectionSection.class.cast(payload);
+ XMLBuilder networkConnectionSection;
+ try {
+ networkConnectionSection = XMLBuilder.create("NetworkConnectionSection").a("xmlns", ns)
+ .a("xmlns:ovf", "http://schemas.dmtf.org/ovf/envelope/1").a("type", net.getType())
+ .a("href", net.getHref().toASCIIString()).a("ovf:required", "false");
+ networkConnectionSection.e("ovf:Info").t(net.getInfo());
+
+ if (net.getPrimaryNetworkConnectionIndex() != null)
+ networkConnectionSection.e("PrimaryNetworkConnectionIndex").t(
+ net.getPrimaryNetworkConnectionIndex().toString());
+ for (NetworkConnection networkConnection : net.getConnections()) {
+ XMLBuilder networkConnectionSectionChild = networkConnectionSection.e("NetworkConnection").a("network",
+ networkConnection.getNetwork());
+ networkConnectionSectionChild.e("NetworkConnectionIndex").t(
+ networkConnection.getNetworkConnectionIndex() + "");
+ if (networkConnection.getExternalIpAddress() != null)
+ networkConnectionSectionChild.e("ExternalIpAddress").t(networkConnection.getExternalIpAddress());
+ if (networkConnection.getIpAddress() != null)
+ networkConnectionSectionChild.e("IpAddress").t(networkConnection.getIpAddress());
+ networkConnectionSectionChild.e("IsConnected").t(networkConnection.isConnected() + "");
+ if (networkConnection.getMACAddress() != null)
+ networkConnectionSectionChild.e("MACAddress").t(networkConnection.getMACAddress());
+ if (networkConnection.getIpAddressAllocationMode() != null)
+ networkConnectionSectionChild.e("IpAddressAllocationMode").t(
+ networkConnection.getIpAddressAllocationMode().toString());
+ }
+
+ if (net.getEdit() != null)
+ networkConnectionSection.e("Link").a("rel", "edit").a("type", net.getType())
+ .a("href", net.getHref().toASCIIString());
+
+ Properties outputProperties = new Properties();
+ outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
+ request = super.bindToRequest(request, networkConnectionSection.asString(outputProperties));
+ request.getPayload().getContentMetadata().setContentType(net.getType());
+ } catch (Exception e) {
+ Throwables.propagate(e);
+ }
+ return request;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindParamsToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindParamsToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindParamsToXmlPayload.java
new file mode 100644
index 0000000..f613c1b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindParamsToXmlPayload.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.rest.binders.BindToStringPayload;
+
+import com.google.inject.Inject;
+import com.jamesmurty.utils.XMLBuilder;
+
+@Singleton
+public class BindParamsToXmlPayload implements MapBinder {
+
+ protected final String ns;
+ protected final BindToStringPayload stringBinder;
+ protected final String element;
+
+ @Inject
+ public BindParamsToXmlPayload(String element, BindToStringPayload stringBinder,
+ @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns) {
+ this.element = element;
+ this.ns = ns;
+ this.stringBinder = stringBinder;
+ }
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ try {
+ return stringBinder.bindToRequest(request, generateXml(postParams));
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private String generateXml(Map<String, Object> postParams) throws ParserConfigurationException,
+ FactoryConfigurationError, TransformerException {
+ XMLBuilder rootBuilder = XMLBuilder.create(element);
+ for (Entry<String, Object> entry : postParams.entrySet())
+ rootBuilder.a(entry.getKey(), (String) entry.getValue());
+ rootBuilder.a("xmlns", ns);
+ Properties outputProperties = new Properties();
+ outputProperties.put(javax.xml.transform.OutputKeys.OMIT_XML_DECLARATION, "yes");
+ return rootBuilder.asString(outputProperties);
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ throw new IllegalArgumentException("incorrect usage");
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayload.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayload.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayload.java
new file mode 100644
index 0000000..d95846e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayload.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_XML_NAMESPACE;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.rest.binders.BindToStringPayload;
+
+import com.google.inject.Inject;
+
+@Singleton
+public class BindUndeployVAppParamsToXmlPayload extends BindParamsToXmlPayload {
+
+ @Inject
+ public BindUndeployVAppParamsToXmlPayload(BindToStringPayload stringBinder,
+ @Named(PROPERTY_VCLOUD_XML_NAMESPACE) String ns) {
+ super("UndeployVAppParams", stringBinder, ns);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameAndCatalogNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameAndCatalogNameToEndpoint.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameAndCatalogNameToEndpoint.java
new file mode 100644
index 0000000..09c81e5
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameAndCatalogNameToEndpoint.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.Catalog;
+
+import com.google.common.base.Supplier;
+import com.google.common.collect.Iterables;
+
+@Singleton
+public class OrgNameAndCatalogNameToEndpoint implements MapBinder {
+ private final Supplier<Map<String, Org>> orgMap;
+ private final Supplier<ReferenceType> defaultOrg;
+ private final Supplier<ReferenceType> defaultCatalog;
+
+ @Inject
+ public OrgNameAndCatalogNameToEndpoint(Supplier<Map<String, Org>> orgMap,
+ @org.jclouds.vcloud.endpoints.Org Supplier<ReferenceType> defaultOrg,
+ @Catalog Supplier<ReferenceType> defaultCatalog) {
+ this.orgMap = orgMap;
+ this.defaultOrg = defaultOrg;
+ this.defaultCatalog = defaultCatalog;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ Object org = postParams.get("orgName");
+ Object catalog = postParams.get("catalogName");
+ if (org == null && catalog == null)
+ return (R) request.toBuilder().endpoint(defaultCatalog.get().getHref()).build();
+ else if (org == null)
+ org = defaultOrg.get().getName();
+
+ try {
+ Map<String, ReferenceType> catalogs = checkNotNull(orgMap.get().get(org)).getCatalogs();
+ URI endpoint = catalog == null ? Iterables.getLast(catalogs.values()).getHref() : catalogs.get(catalog).getHref();
+ return (R) request.toBuilder().endpoint(endpoint).build();
+ } catch (NullPointerException e) {
+ throw new NoSuchElementException(org + "/" + catalog + " not found in " + orgMap.get());
+ }
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ throw new IllegalStateException(getClass() + " needs parameters");
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameAndVDCNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameAndVDCNameToEndpoint.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameAndVDCNameToEndpoint.java
new file mode 100644
index 0000000..b4bc580
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameAndVDCNameToEndpoint.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.VDC;
+
+import com.google.common.base.Supplier;
+import com.google.common.collect.Iterables;
+
+@Singleton
+public class OrgNameAndVDCNameToEndpoint implements MapBinder {
+ private final Supplier<Map<String, Org>> orgNameToVDCEndpoint;
+ private final Supplier<ReferenceType> defaultOrg;
+ private final Supplier<ReferenceType> defaultVDC;
+
+ @Inject
+ public OrgNameAndVDCNameToEndpoint(Supplier<Map<String, Org>> orgNameToVDCEndpoint,
+ @org.jclouds.vcloud.endpoints.Org Supplier<ReferenceType> defaultOrg, @VDC Supplier<ReferenceType> defaultVDC) {
+ this.orgNameToVDCEndpoint = orgNameToVDCEndpoint;
+ this.defaultOrg = defaultOrg;
+ this.defaultVDC = defaultVDC;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ Object org = postParams.get("orgName");
+ Object vdc = postParams.get("vdcName");
+ if (org == null && vdc == null)
+ return (R) request.toBuilder().endpoint(defaultVDC.get().getHref()).build();
+ else if (org == null)
+ org = defaultOrg.get().getName();
+
+ try {
+ Map<String, ReferenceType> vdcs = checkNotNull(orgNameToVDCEndpoint.get().get(org)).getVDCs();
+ URI endpoint = vdc == null ? Iterables.getLast(vdcs.values()).getHref() : vdcs.get(vdc).getHref();
+ return (R) request.toBuilder().endpoint(endpoint).build();
+ } catch (NullPointerException e) {
+ throw new NoSuchElementException(org + "/" + vdc + " not found in " + orgNameToVDCEndpoint.get());
+ }
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ throw new IllegalStateException(getClass() + " needs parameters");
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameCatalogNameItemNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameCatalogNameItemNameToEndpoint.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameCatalogNameItemNameToEndpoint.java
new file mode 100644
index 0000000..2d9f762
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameCatalogNameItemNameToEndpoint.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.Catalog;
+import org.jclouds.vcloud.endpoints.Org;
+
+import com.google.common.base.Supplier;
+
+@Singleton
+public class OrgNameCatalogNameItemNameToEndpoint implements MapBinder {
+ private final Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.Catalog>>> orgCatalogMap;
+ private final Supplier<ReferenceType> defaultOrg;
+ private final Supplier<ReferenceType> defaultCatalog;
+
+ @Inject
+ public OrgNameCatalogNameItemNameToEndpoint(
+ Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.Catalog>>> orgCatalogMap,
+ @Org Supplier<ReferenceType> defaultOrg, @Catalog Supplier<ReferenceType> defaultCatalog) {
+ this.orgCatalogMap = orgCatalogMap;
+ this.defaultOrg = defaultOrg;
+ this.defaultCatalog = defaultCatalog;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ Object org = postParams.get("orgName");
+ Object catalog = postParams.get("catalogName");
+ Object catalogItem = postParams.get("itemName");
+ if (org == null)
+ org = defaultOrg.get().getName();
+ if (catalog == null)
+ catalog = defaultCatalog.get().getName();
+ try {
+ Map<String, org.jclouds.vcloud.domain.Catalog> catalogs = checkNotNull(orgCatalogMap.get().get(org));
+ return (R) request.toBuilder().endpoint(catalogs.get(catalog).get(catalogItem).getHref()).build();
+ } catch (NullPointerException e) {
+ throw new NoSuchElementException(org + "/" + catalog + "/" + catalogItem + " not found in "
+ + orgCatalogMap.get());
+ }
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ throw new IllegalStateException(getClass() + " needs parameters");
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameCatalogNameVAppTemplateNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameCatalogNameVAppTemplateNameToEndpoint.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameCatalogNameVAppTemplateNameToEndpoint.java
new file mode 100644
index 0000000..a8b798d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameCatalogNameVAppTemplateNameToEndpoint.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.Catalog;
+import org.jclouds.vcloud.endpoints.Org;
+
+import com.google.common.base.Supplier;
+
+@Singleton
+public class OrgNameCatalogNameVAppTemplateNameToEndpoint implements MapBinder {
+ private final Supplier<Map<String, Map<String, Map<String, CatalogItem>>>> orgCatalogItemMap;
+ private final Supplier<ReferenceType> defaultOrg;
+ private final Supplier<ReferenceType> defaultCatalog;
+
+ @Inject
+ public OrgNameCatalogNameVAppTemplateNameToEndpoint(
+ Supplier<Map<String, Map<String, Map<String, CatalogItem>>>> orgCatalogItemMap,
+ @Org Supplier<ReferenceType> defaultOrg, @Catalog Supplier<ReferenceType> defaultCatalog) {
+ this.orgCatalogItemMap = orgCatalogItemMap;
+ this.defaultOrg = defaultOrg;
+ this.defaultCatalog = defaultCatalog;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ Object org = postParams.get("orgName");
+ Object catalog = postParams.get("catalogName");
+ Object catalogItem = postParams.get("itemName");
+ if (org == null)
+ org = defaultOrg.get().getName();
+ if (catalog == null)
+ catalog = defaultCatalog.get().getName();
+ Map<String, Map<String, Map<String, CatalogItem>>> orgCatalogItemMap = this.orgCatalogItemMap.get();
+
+ if (!orgCatalogItemMap.containsKey(org))
+ throw new NoSuchElementException("org: " + org + " not found in " + orgCatalogItemMap.keySet());
+ Map<String, Map<String, CatalogItem>> catalogs = orgCatalogItemMap.get(org);
+
+ if (!catalogs.containsKey(catalog))
+ throw new NoSuchElementException("catalog: " + org + "/" + catalog + " not found in " + catalogs.keySet());
+ Map<String, CatalogItem> catalogMap = catalogs.get(catalog);
+
+ if (!catalogMap.containsKey(catalogItem))
+ throw new NoSuchElementException("item: " + org + "/" + catalog + "/" + catalogItem + " not found in "
+ + catalogMap.keySet());
+ CatalogItem item = catalogMap.get(catalogItem);
+
+ URI endpoint = checkNotNull(item.getEntity(),
+ "item: " + org + "/" + catalog + "/" + catalogItem + " has no entity").getHref();
+ return (R) request.toBuilder().endpoint(endpoint).build();
+ }
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ throw new IllegalStateException(getClass() + " needs parameters");
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameVDCNameNetworkNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameVDCNameNetworkNameToEndpoint.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameVDCNameNetworkNameToEndpoint.java
new file mode 100644
index 0000000..11bfeac
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameVDCNameNetworkNameToEndpoint.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.Org;
+import org.jclouds.vcloud.endpoints.VDC;
+
+import com.google.common.base.Supplier;
+
+@Singleton
+public class OrgNameVDCNameNetworkNameToEndpoint extends OrgNameVDCNameResourceNameToEndpoint {
+ @Inject
+ public OrgNameVDCNameNetworkNameToEndpoint(
+ Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.VDC>>> orgVDCMap,
+ @Org Supplier<ReferenceType> defaultOrg, @VDC Supplier<ReferenceType> defaultVDC) {
+ super(orgVDCMap, defaultOrg, defaultVDC);
+ }
+
+ protected URI getEndpointOfResourceInVDC(Object org, Object vDC, Object resource,
+ org.jclouds.vcloud.domain.VDC vDCObject) {
+ ReferenceType resourceEntity = vDCObject.getAvailableNetworks().get(resource);
+ if (resourceEntity == null)
+ throw new NoSuchElementException("network " + resource + " in vdc " + vDC + ", org " + org + " not found in "
+ + vDCObject.getAvailableNetworks().keySet());
+ return resourceEntity.getHref();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameVDCNameResourceEntityNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameVDCNameResourceEntityNameToEndpoint.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameVDCNameResourceEntityNameToEndpoint.java
new file mode 100644
index 0000000..effcc49
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameVDCNameResourceEntityNameToEndpoint.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.endpoints.Org;
+import org.jclouds.vcloud.endpoints.VDC;
+
+import com.google.common.base.Supplier;
+
+@Singleton
+public class OrgNameVDCNameResourceEntityNameToEndpoint extends OrgNameVDCNameResourceNameToEndpoint {
+ @Inject
+ public OrgNameVDCNameResourceEntityNameToEndpoint(
+ Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.VDC>>> orgVDCMap,
+ @Org Supplier<ReferenceType> defaultOrg, @VDC Supplier<ReferenceType> defaultVDC) {
+ super(orgVDCMap, defaultOrg, defaultVDC);
+ }
+
+ protected URI getEndpointOfResourceInVDC(Object org, Object vDC, Object resource,
+ org.jclouds.vcloud.domain.VDC vDCObject) {
+ ReferenceType resourceEntity = vDCObject.getResourceEntities().get(resource);
+ if (resourceEntity == null)
+ throw new NoSuchElementException("entity " + resource + " in vdc " + vDC + ", org " + org + " not found in "
+ + vDCObject.getResourceEntities().keySet());
+ return resourceEntity.getHref();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameVDCNameResourceNameToEndpoint.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameVDCNameResourceNameToEndpoint.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameVDCNameResourceNameToEndpoint.java
new file mode 100644
index 0000000..99ac848
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/binders/OrgNameVDCNameResourceNameToEndpoint.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.binders;
+
+import static com.google.common.base.Preconditions.checkState;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import javax.inject.Inject;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.MapBinder;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VDC;
+import org.jclouds.vcloud.endpoints.Org;
+
+import com.google.common.base.Supplier;
+public abstract class OrgNameVDCNameResourceNameToEndpoint implements MapBinder {
+
+ protected final Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.VDC>>> orgVDCMap;
+ protected final Supplier<ReferenceType> defaultOrg;
+ protected final Supplier<ReferenceType> defaultVDC;
+
+ @Inject
+ public OrgNameVDCNameResourceNameToEndpoint(
+ Supplier<Map<String, Map<String, org.jclouds.vcloud.domain.VDC>>> orgVDCMap,
+ @Org Supplier<ReferenceType> defaultOrg, @org.jclouds.vcloud.endpoints.VDC Supplier<ReferenceType> defaultVDC) {
+ this.orgVDCMap = orgVDCMap;
+ this.defaultOrg = defaultOrg;
+ this.defaultVDC = defaultVDC;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
+ Object org = postParams.get("orgName");
+ Object vDC = postParams.get("vdcName");
+ Object resource = postParams.get("resourceName");
+ if (org == null)
+ org = defaultOrg.get().getName();
+ if (vDC == null)
+ vDC = defaultVDC.get().getName();
+ Map<String, Map<String, org.jclouds.vcloud.domain.VDC>> orgToVDCs = orgVDCMap.get();
+ checkState(orgToVDCs != null, "could not get map of org name to vdcs!");
+ Map<String, org.jclouds.vcloud.domain.VDC> vDCs = orgToVDCs.get(org);
+ if (vDCs == null)
+ throw new NoSuchElementException("org " + org + " not found in " + orgToVDCs.keySet());
+ org.jclouds.vcloud.domain.VDC vDCObject = vDCs.get(vDC);
+ if (vDCObject == null)
+ throw new NoSuchElementException("vdc " + vDC + " in org " + org + " not found in " + vDCs.keySet());
+ URI endpoint = getEndpointOfResourceInVDC(org, vDC, resource, vDCObject);
+ return (R) request.toBuilder().endpoint(endpoint).build();
+ }
+
+ protected abstract URI getEndpointOfResourceInVDC(Object org, Object vDC, Object resource, VDC vDCObject);
+
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ throw new IllegalStateException(getClass() + " needs parameters");
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/config/VCloudComputeServiceContextModule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/config/VCloudComputeServiceContextModule.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/config/VCloudComputeServiceContextModule.java
new file mode 100644
index 0000000..d3538c0
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/config/VCloudComputeServiceContextModule.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.compute.config;
+
+import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
+import org.jclouds.domain.Location;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.VAppTemplate;
+
+/**
+ * Configures the {@link VCloudComputeServiceContext}; requires {@link VCloudComputeClientImpl}
+ * bound.
+ */
+public class VCloudComputeServiceContextModule extends
+ ComputeServiceAdapterContextModule<VApp, VAppTemplate, VAppTemplate, Location> {
+
+ @Override
+ protected void configure() {
+ super.configure();
+ install(new VCloudComputeServiceDependenciesModule());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/config/VCloudComputeServiceDependenciesModule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/config/VCloudComputeServiceDependenciesModule.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/config/VCloudComputeServiceDependenciesModule.java
new file mode 100644
index 0000000..8b53c90
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/config/VCloudComputeServiceDependenciesModule.java
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.compute.config;
+
+
+import java.util.Map;
+
+import javax.inject.Singleton;
+
+import org.jclouds.compute.ComputeServiceAdapter;
+import org.jclouds.compute.domain.Hardware;
+import org.jclouds.compute.domain.Image;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.domain.TemplateBuilder;
+import org.jclouds.compute.options.TemplateOptions;
+import org.jclouds.domain.Location;
+import org.jclouds.functions.IdentityFunction;
+import org.jclouds.vcloud.compute.functions.HardwareForVApp;
+import org.jclouds.vcloud.compute.functions.HardwareForVAppTemplate;
+import org.jclouds.vcloud.compute.functions.ImageForVAppTemplate;
+import org.jclouds.vcloud.compute.functions.VAppToNodeMetadata;
+import org.jclouds.vcloud.compute.internal.VCloudTemplateBuilderImpl;
+import org.jclouds.vcloud.compute.options.VCloudTemplateOptions;
+import org.jclouds.vcloud.compute.strategy.VCloudComputeServiceAdapter;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.domain.network.NetworkConfig;
+import org.jclouds.vcloud.endpoints.Network;
+import org.jclouds.vcloud.functions.VAppTemplatesInOrg;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Function;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.collect.ImmutableMap;
+import com.google.inject.AbstractModule;
+import com.google.inject.Provides;
+import com.google.inject.TypeLiteral;
+
+public class VCloudComputeServiceDependenciesModule extends AbstractModule {
+
+ @VisibleForTesting
+ public static final Map<Status, NodeMetadata.Status> toPortableNodeStatus = ImmutableMap
+ .<Status, NodeMetadata.Status> builder()
+ .put(Status.OFF, NodeMetadata.Status.SUSPENDED)
+ .put(Status.ON, NodeMetadata.Status.RUNNING)
+ .put(Status.RESOLVED, NodeMetadata.Status.PENDING)
+ .put(Status.MIXED, NodeMetadata.Status.PENDING)
+ .put(Status.UNKNOWN, NodeMetadata.Status.UNRECOGNIZED)
+ .put(Status.UNRECOGNIZED, NodeMetadata.Status.UNRECOGNIZED)
+ .put(Status.DEPLOYED, NodeMetadata.Status.PENDING)
+ .put(Status.SUSPENDED, NodeMetadata.Status.SUSPENDED)
+ .put(Status.WAITING_FOR_INPUT, NodeMetadata.Status.PENDING)
+ .put(Status.INCONSISTENT, NodeMetadata.Status.PENDING)
+ .put(Status.ERROR, NodeMetadata.Status.ERROR)
+ .put(Status.UNRESOLVED, NodeMetadata.Status.PENDING).build();
+
+ @Singleton
+ @Provides
+ protected Map<Status, NodeMetadata.Status> toPortableNodeStatus() {
+ return toPortableNodeStatus;
+ }
+
+ @VisibleForTesting
+ public static final Map<Status, Image.Status> toPortableImageStatus = ImmutableMap
+ .<Status, Image.Status> builder()
+ .put(Status.RESOLVED, Image.Status.AVAILABLE)
+ .put(Status.OFF, Image.Status.AVAILABLE)
+ .put(Status.MIXED, Image.Status.PENDING)
+ .put(Status.UNKNOWN, Image.Status.UNRECOGNIZED)
+ .put(Status.UNRECOGNIZED, Image.Status.UNRECOGNIZED)
+ .put(Status.DEPLOYED, Image.Status.PENDING)
+ .put(Status.PENDING_DESCRIPTOR, Image.Status.PENDING)
+ .put(Status.COPYING, Image.Status.PENDING)
+ .put(Status.PENDING_CONTENTS, Image.Status.PENDING)
+ .put(Status.QUARANTINED, Image.Status.PENDING)
+ .put(Status.QUARANTINE_EXPIRED, Image.Status.ERROR)
+ .put(Status.REJECTED, Image.Status.ERROR)
+ .put(Status.TRANSFER_TIMEOUT, Image.Status.ERROR)
+ .put(Status.ERROR, Image.Status.ERROR)
+ .put(Status.UNRESOLVED, Image.Status.PENDING).build();
+
+ @Singleton
+ @Provides
+ protected Map<Status, Image.Status> toPortableImageStatus() {
+ return toPortableImageStatus;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void configure() {
+ bind(new TypeLiteral<ComputeServiceAdapter<VApp, VAppTemplate, VAppTemplate, Location>>() {
+ }).to(VCloudComputeServiceAdapter.class);
+
+ bind(new TypeLiteral<Function<VApp, NodeMetadata>>() {
+ }).to(VAppToNodeMetadata.class);
+
+ bind(TemplateOptions.class).to(VCloudTemplateOptions.class);
+ bind(TemplateBuilder.class).to(VCloudTemplateBuilderImpl.class);
+
+ bind(new TypeLiteral<Function<VApp, Hardware>>() {
+ }).to(new TypeLiteral<HardwareForVApp>() {
+ });
+
+ bind(new TypeLiteral<Function<Org, Iterable<VAppTemplate>>>() {
+ }).to(VAppTemplatesInOrg.class);
+ bind(new TypeLiteral<Function<VAppTemplate, Image>>() {
+ }).to(ImageForVAppTemplate.class);
+ bind(new TypeLiteral<Function<VAppTemplate, Hardware>>() {
+ }).to(HardwareForVAppTemplate.class);
+
+ // we aren't converting from a provider-specific type
+ bind(new TypeLiteral<Function<Location, Location>>() {
+ }).to(Class.class.cast(IdentityFunction.class));
+ }
+
+
+ @Provides
+ @Singleton
+ public Supplier<NetworkConfig> networkConfig(@Network Supplier<ReferenceType> network,
+ final FenceMode defaultFenceMode) {
+ return Suppliers.compose(new Function<ReferenceType, NetworkConfig>() {
+
+ @Override
+ public NetworkConfig apply(ReferenceType input) {
+ return new NetworkConfig(input.getName(), input.getHref(), defaultFenceMode);
+ }
+
+ }, network);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/FindLocationForResource.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/FindLocationForResource.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/FindLocationForResource.java
new file mode 100644
index 0000000..f7e2cdf
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/FindLocationForResource.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.compute.functions;
+
+import java.net.URI;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.collect.Memoized;
+import org.jclouds.domain.Location;
+import org.jclouds.logging.Logger;
+import org.jclouds.vcloud.domain.ReferenceType;
+
+import com.google.common.base.Function;
+import com.google.common.base.Supplier;
+
+@Singleton
+public class FindLocationForResource implements Function<ReferenceType, Location> {
+
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ final Supplier<Set<? extends Location>> locations;
+
+ @Inject
+ public FindLocationForResource(@Memoized Supplier<Set<? extends Location>> locations) {
+ this.locations = locations;
+ }
+
+ /**
+ * searches for a location associated with this resource.
+ *
+ * @throws NoSuchElementException
+ * if not found
+ */
+ public Location apply(ReferenceType resource) {
+ for (Location input : locations.get()) {
+ do {
+ // The "name" isn't always present, ex inside a vApp we have a rel
+ // link that only includes href and type.
+ if (URI.create(input.getId()).equals(resource.getHref()))
+ return input;
+ } while ((input = input.getParent()) != null);
+ }
+ throw new NoSuchElementException(String.format("resource: %s not found in locations: %s", resource,
+ locations.get()));
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/HardwareForVApp.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/HardwareForVApp.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/HardwareForVApp.java
new file mode 100644
index 0000000..ebfb010
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/HardwareForVApp.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.compute.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+
+import org.jclouds.compute.domain.Hardware;
+import org.jclouds.compute.domain.HardwareBuilder;
+import org.jclouds.compute.predicates.ImagePredicates;
+import org.jclouds.domain.Location;
+import org.jclouds.logging.Logger;
+import org.jclouds.ovf.VirtualHardwareSection;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.Vm;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Iterables;
+
+public class HardwareForVApp implements Function<VApp, Hardware> {
+
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ private final Function<ReferenceType, Location> findLocationForResource;
+ private final VCloudHardwareBuilderFromResourceAllocations rasdToHardwareBuilder;
+
+ @Inject
+ protected HardwareForVApp(Function<ReferenceType, Location> findLocationForResource,
+ VCloudHardwareBuilderFromResourceAllocations rasdToHardwareBuilder) {
+ this.findLocationForResource = checkNotNull(findLocationForResource, "findLocationForResource");
+ this.rasdToHardwareBuilder = checkNotNull(rasdToHardwareBuilder, "rasdToHardwareBuilder");
+ }
+
+ @Override
+ public Hardware apply(VApp from) {
+ checkNotNull(from, "VApp");
+ // TODO make this work with composite vApps
+ Vm vm = from.getChildren().size() == 0 ? null : Iterables.get(from.getChildren(), 0);
+ if (vm == null)
+ return null;
+
+ VirtualHardwareSection hardware = vm.getVirtualHardwareSection();
+ HardwareBuilder builder = rasdToHardwareBuilder.apply(hardware.getItems());
+ builder.location(findLocationForResource.apply(checkNotNull(from, "from").getVDC()));
+ builder.ids(from.getHref().toASCIIString()).name(from.getName()).supportsImage(
+ ImagePredicates.idEquals(from.getHref().toASCIIString()));
+ builder.hypervisor("VMware");
+ return builder.build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/HardwareForVAppTemplate.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/HardwareForVAppTemplate.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/HardwareForVAppTemplate.java
new file mode 100644
index 0000000..46d1627
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/HardwareForVAppTemplate.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.compute.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.compute.domain.Hardware;
+import org.jclouds.compute.domain.HardwareBuilder;
+import org.jclouds.compute.predicates.ImagePredicates;
+import org.jclouds.logging.Logger;
+import org.jclouds.ovf.Envelope;
+import org.jclouds.ovf.VirtualHardwareSection;
+import org.jclouds.vcloud.domain.VAppTemplate;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Iterables;
+
+@Singleton
+public class HardwareForVAppTemplate implements Function<VAppTemplate, Hardware> {
+
+ @Resource
+ protected Logger logger = Logger.NULL;
+
+ private final Function<VAppTemplate, Envelope> templateToEnvelope;
+ private final FindLocationForResource findLocationForResource;
+ private final VCloudHardwareBuilderFromResourceAllocations rasdToHardwareBuilder;
+
+ @Inject
+ protected HardwareForVAppTemplate(Function<VAppTemplate, Envelope> templateToEnvelope,
+ FindLocationForResource findLocationForResource,
+ VCloudHardwareBuilderFromResourceAllocations rasdToHardwareBuilder) {
+ this.templateToEnvelope = checkNotNull(templateToEnvelope, "templateToEnvelope");
+ this.findLocationForResource = checkNotNull(findLocationForResource, "findLocationForResource");
+ this.rasdToHardwareBuilder = checkNotNull(rasdToHardwareBuilder, "rasdToHardwareBuilder");
+ }
+
+ @Override
+ public Hardware apply(VAppTemplate from) {
+ checkNotNull(from, "VAppTemplate");
+
+ Envelope ovf = templateToEnvelope.apply(from);
+
+ if (ovf.getVirtualSystem().getVirtualHardwareSections().size() > 1) {
+ logger.warn("multiple hardware choices found. using first", ovf);
+ }
+ VirtualHardwareSection hardware = Iterables.get(ovf.getVirtualSystem().getVirtualHardwareSections(), 0);
+ HardwareBuilder builder = rasdToHardwareBuilder.apply(hardware.getItems());
+ if (from.getVDC() != null) {
+ builder.location(findLocationForResource.apply(from.getVDC()));
+ } else {
+ // otherwise, it could be in a public catalog, which is not assigned to a VDC
+ }
+ builder.ids(from.getHref().toASCIIString()).name(from.getName()).supportsImage(
+ ImagePredicates.idEquals(from.getHref().toASCIIString()));
+ builder.hypervisor("VMware");
+ return builder.build();
+
+ }
+
+ protected String getName(String name) {
+ return name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/ImageForVAppTemplate.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/ImageForVAppTemplate.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/ImageForVAppTemplate.java
new file mode 100644
index 0000000..eb70f28
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/ImageForVAppTemplate.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.compute.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Map;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.compute.domain.CIMOperatingSystem;
+import org.jclouds.compute.domain.Image;
+import org.jclouds.compute.domain.ImageBuilder;
+import org.jclouds.compute.reference.ComputeServiceConstants;
+import org.jclouds.logging.Logger;
+import org.jclouds.ovf.Envelope;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.VAppTemplate;
+
+import com.google.common.base.Function;
+
+@Singleton
+public class ImageForVAppTemplate implements Function<VAppTemplate, Image> {
+
+ @Resource
+ @Named(ComputeServiceConstants.COMPUTE_LOGGER)
+ public Logger logger = Logger.NULL;
+
+ private final Map<Status, Image.Status> toPortableImageStatus;
+ private final Function<VAppTemplate, Envelope> templateToEnvelope;
+ private final FindLocationForResource findLocationForResource;
+
+
+ @Inject
+ protected ImageForVAppTemplate(Map<Status, Image.Status> toPortableImageStatus, Function<VAppTemplate, Envelope> templateToEnvelope,
+ FindLocationForResource findLocationForResource) {
+ this.toPortableImageStatus = checkNotNull(toPortableImageStatus, "toPortableImageStatus");
+ this.templateToEnvelope = checkNotNull(templateToEnvelope, "templateToEnvelope");
+ this.findLocationForResource = checkNotNull(findLocationForResource, "findLocationForResource");
+ }
+
+ @Override
+ public Image apply(VAppTemplate from) {
+ checkNotNull(from, "VAppTemplate");
+ Envelope ovf = templateToEnvelope.apply(from);
+
+ ImageBuilder builder = new ImageBuilder();
+ builder.ids(from.getHref().toASCIIString());
+ builder.uri(from.getHref());
+ builder.name(from.getName());
+ if (from.getVDC() != null) {
+ builder.location(findLocationForResource.apply(from.getVDC()));
+ } else {
+ // otherwise, it could be in a public catalog, which is not assigned to a VDC
+ }
+ builder.description(from.getDescription() != null ? from.getDescription() : from.getName());
+ builder.operatingSystem(CIMOperatingSystem.toComputeOs(ovf));
+ builder.status(toPortableImageStatus.get(from.getStatus()));
+ return builder.build();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/VAppToNodeMetadata.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/VAppToNodeMetadata.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/VAppToNodeMetadata.java
new file mode 100644
index 0000000..0947c78
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/compute/functions/VAppToNodeMetadata.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.compute.functions;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Predicates.not;
+import static com.google.common.base.Strings.isNullOrEmpty;
+import static com.google.common.collect.Iterables.filter;
+import static org.jclouds.compute.util.ComputeServiceUtils.addMetadataAndParseTagsFromCommaDelimitedValue;
+import static org.jclouds.compute.util.ComputeServiceUtils.groupFromMapOrName;
+import static org.jclouds.vcloud.compute.util.VCloudComputeUtils.getCredentialsFrom;
+import static org.jclouds.vcloud.compute.util.VCloudComputeUtils.getIpsFromVApp;
+import static org.jclouds.vcloud.compute.util.VCloudComputeUtils.toComputeOs;
+
+import java.util.Map;
+import java.util.Set;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.compute.domain.Hardware;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.domain.NodeMetadataBuilder;
+import org.jclouds.compute.functions.GroupNamingConvention;
+import org.jclouds.domain.Credentials;
+import org.jclouds.logging.Logger;
+import org.jclouds.util.InetAddresses2.IsPrivateIPAddress;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.VApp;
+
+import com.google.common.base.Function;
+import com.google.common.base.Splitter;
+import com.google.common.collect.ImmutableMap;
+
+@Singleton
+public class VAppToNodeMetadata implements Function<VApp, NodeMetadata> {
+ @Resource
+ protected static Logger logger = Logger.NULL;
+
+ protected final FindLocationForResource findLocationForResourceInVDC;
+ protected final Function<VApp, Hardware> hardwareForVApp;
+ protected final Map<Status, NodeMetadata.Status> vAppStatusToNodeStatus;
+ protected final Map<String, Credentials> credentialStore;
+ protected final GroupNamingConvention nodeNamingConvention;
+
+ @Inject
+ protected VAppToNodeMetadata(Map<Status, NodeMetadata.Status> vAppStatusToNodeStatus, Map<String, Credentials> credentialStore,
+ FindLocationForResource findLocationForResourceInVDC, Function<VApp, Hardware> hardwareForVApp,
+ GroupNamingConvention.Factory namingConvention) {
+ this.nodeNamingConvention = checkNotNull(namingConvention, "namingConvention").createWithoutPrefix();
+ this.hardwareForVApp = checkNotNull(hardwareForVApp, "hardwareForVApp");
+ this.findLocationForResourceInVDC = checkNotNull(findLocationForResourceInVDC, "findLocationForResourceInVDC");
+ this.credentialStore = checkNotNull(credentialStore, "credentialStore");
+ this.vAppStatusToNodeStatus = checkNotNull(vAppStatusToNodeStatus, "vAppStatusToNodeStatus");
+ }
+
+ public NodeMetadata apply(VApp from) {
+ NodeMetadataBuilder builder = new NodeMetadataBuilder();
+ builder.ids(from.getHref().toASCIIString());
+ builder.uri(from.getHref());
+ builder.name(from.getName());
+ String groupName = "";
+ Map<String, String> metadataMap;
+
+ if (!isNullOrEmpty(from.getDescription())
+ && from.getDescription().indexOf('=') != -1
+ && from.getDescription().indexOf('\n') != -1) {
+ try {
+ metadataMap = Splitter.on('\n').withKeyValueSeparator("=").split(from.getDescription());
+
+ addMetadataAndParseTagsFromCommaDelimitedValue(builder, metadataMap);
+ } catch (IllegalArgumentException iae) {
+ // no op
+ metadataMap = ImmutableMap.of();
+ }
+ } else {
+ metadataMap = ImmutableMap.of();
+ }
+ builder.hostname(from.getName());
+ builder.location(findLocationForResourceInVDC.apply(from.getVDC()));
+ builder.group(groupFromMapOrName(metadataMap, from.getName(), nodeNamingConvention));
+ builder.operatingSystem(toComputeOs(from, null));
+ builder.hardware(hardwareForVApp.apply(from));
+ builder.status(vAppStatusToNodeStatus.get(from.getStatus()));
+ Set<String> addresses = getIpsFromVApp(from);
+ builder.publicAddresses(filter(addresses, not(IsPrivateIPAddress.INSTANCE)));
+ builder.privateAddresses(filter(addresses, IsPrivateIPAddress.INSTANCE));
+
+ // normally, we don't affect the credential store when reading vApps.
+ // However, login user, etc, is actually in the metadata, so lets see
+ Credentials fromApi = getCredentialsFrom(from);
+ if (fromApi != null && !credentialStore.containsKey("node#" + from.getHref().toASCIIString()))
+ credentialStore.put("node#" + from.getHref().toASCIIString(), fromApi);
+ return builder.build();
+ }
+}
[05/18] stratos git commit: Jclouds vcloud api 1.8.1 clone with
custom changes
Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/NetworkConnectionHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/NetworkConnectionHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/NetworkConnectionHandlerTest.java
new file mode 100644
index 0000000..7895c81
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/NetworkConnectionHandlerTest.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.UnknownHostException;
+
+import org.jclouds.http.functions.BaseHandlerTest;
+import org.jclouds.vcloud.domain.NetworkConnection;
+import org.jclouds.vcloud.domain.network.IpAddressAllocationMode;
+import org.testng.annotations.Test;
+
+/**
+ * Tests behavior of {@code NetworkConnectionHandler}
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "NetworkConnectionHandlerTest")
+public class NetworkConnectionHandlerTest extends BaseHandlerTest {
+
+ public void testDefault() throws UnknownHostException {
+ InputStream is = getClass().getResourceAsStream("/networkconnection.xml");
+
+ NetworkConnection result = factory.create(injector.getInstance(NetworkConnectionHandler.class)).parse(is);
+
+ checkNetworkConnection(result);
+
+ }
+
+ @Test(enabled = false)
+ public static void checkNetworkConnection(NetworkConnection result) {
+ assertEquals(result.getNetwork(), "internet01");
+ assertEquals(result.getNetworkConnectionIndex(), 0);
+ assertEquals(result.getIpAddress(), "174.47.101.164");
+ assertEquals(result.getExternalIpAddress(), null);
+ assertEquals(result.isConnected(), true);
+ assertEquals(result.getMACAddress(), "00:50:56:01:01:f2");
+ assertEquals(result.getIpAddressAllocationMode(), IpAddressAllocationMode.POOL);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/NetworkConnectionSectionHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/NetworkConnectionSectionHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/NetworkConnectionSectionHandlerTest.java
new file mode 100644
index 0000000..632981e
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/NetworkConnectionSectionHandlerTest.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.NetworkConnectionSection;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.Iterables;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code NetworkConnectionSectionHandler}
+ */
+@Test(groups = "unit")
+public class NetworkConnectionSectionHandlerTest {
+ public void testVCloud1_0() {
+ InputStream is = getClass().getResourceAsStream("/networkconnectionsection.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ NetworkConnectionSection result = factory.create(injector.getInstance(NetworkConnectionSectionHandler.class))
+ .parse(is);
+ checkNetworkConnectionSection(result);
+ }
+
+ @Test(enabled = false)
+ static void checkNetworkConnectionSection(NetworkConnectionSection result) {
+ assertEquals(result.getHref(), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/networkConnectionSection/"));
+ assertEquals(result.getType(), VCloudMediaType.NETWORKCONNECTIONSECTION_XML);
+ assertEquals(result.getInfo(), "Specifies the available VM network connections");
+ assertEquals(result.getPrimaryNetworkConnectionIndex(), Integer.valueOf(0));
+ assertEquals(result.getEdit(), new ReferenceTypeImpl(null, VCloudMediaType.NETWORKCONNECTIONSECTION_XML, URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/networkConnectionSection/")));
+ NetworkConnectionHandlerTest.checkNetworkConnection(Iterables.getOnlyElement(result.getConnections()));
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/OrgHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/OrgHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/OrgHandlerTest.java
new file mode 100644
index 0000000..6c56e66
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/OrgHandlerTest.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.jclouds.vcloud.VCloudMediaType.CATALOG_XML;
+import static org.jclouds.vcloud.VCloudMediaType.TASKSLIST_XML;
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.internal.OrgImpl;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code OrgHandler}
+ */
+@Test(groups = "unit")
+public class OrgHandlerTest {
+
+ public void testApplyInputStream() {
+ InputStream is = getClass().getResourceAsStream("/org-1.0.xml");
+
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+
+ Org result = factory.create(injector.getInstance(OrgHandler.class)).parse(is);
+ assertEquals(result.getName(), "ExampleOrg");
+ assertEquals(result.getFullName(), "ExampleOrg");
+ assertEquals(result.getDescription(), "Example Corp's Primary Organization.");
+ assertEquals(result.getHref(), URI.create("http://vcloud.example.com/api/v1.0/org/5"));
+ assertEquals(result.getCatalogs(), ImmutableMap.of("Main Catalog", new ReferenceTypeImpl("Main Catalog",
+ CATALOG_XML, URI.create("http://vcloud.example.com/api/v1.0/catalog/32")), "Shared Catalog",
+ new ReferenceTypeImpl("Shared Catalog", CATALOG_XML, URI
+ .create("http://vcloud.example.com/api/v1.0/catalog/37"))));
+ assertEquals(result.getVDCs(), ImmutableMap.of("ExampleVdc01", new ReferenceTypeImpl("ExampleVdc01",
+ VCloudMediaType.VDC_XML, URI.create("http://vcloud.example.com/api/v1.0/vdc/5"))));
+ assertEquals(result.getNetworks(), ImmutableMap.of("TestNetwork", new ReferenceTypeImpl("TestNetwork",
+ VCloudMediaType.NETWORK_XML, URI.create("http://vcloud.example.com/api/v1.0/network/14")),
+ "ProductionNetwork", new ReferenceTypeImpl("ProductionNetwork", VCloudMediaType.NETWORK_XML, URI
+ .create("http://vcloud.example.com/api/v1.0/network/54"))));
+ assertEquals(result.getTasksList(), new ReferenceTypeImpl(null, TASKSLIST_XML, URI
+ .create("http://vcloud.example.com/api/v1.0/tasksList/5")));
+ }
+
+ public void testTerremark() {
+ InputStream is = getClass().getResourceAsStream("/org.xml");
+
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+
+ Org result = factory.create(injector.getInstance(OrgHandler.class)).parse(is);
+ assertEquals(result.getName(), "adrian@jclouds.org");
+ assertEquals(result.getFullName(), "adrian@jclouds.org");
+ assertEquals(result.getHref(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"));
+ assertEquals(result.getCatalogs(), ImmutableMap.of("Miami Environment 1 Catalog", new ReferenceTypeImpl(
+ "Miami Environment 1 Catalog", CATALOG_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog"))));
+ assertEquals(result.getVDCs(), ImmutableMap.of("Miami Environment 1", new ReferenceTypeImpl(
+ "Miami Environment 1", VCloudMediaType.VDC_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32"))));
+ assertEquals(result.getTasksList(), new ReferenceTypeImpl("Miami Environment 1 Tasks List", TASKSLIST_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/tasksList/32")));
+ }
+
+ public void testHosting() {
+ InputStream is = getClass().getResourceAsStream("/org-hosting.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ Org result = factory.create(injector.getInstance(OrgHandler.class)).parse(is);
+ assertEquals(result.getName(), "Customer 188849");
+ assertEquals(result.getFullName(), "Customer 188849");
+ assertEquals(result.getHref(), URI.create("https://vcloud.safesecureweb.com/api/v0.8/org/188849"));
+ assertEquals(result.getCatalogs(), ImmutableMap.of("HMS Shared Catalog", new ReferenceTypeImpl(
+ "HMS Shared Catalog", CATALOG_XML, URI.create("https://vcloud.safesecureweb.com/api/v0.8/catalog/1"))));
+ assertEquals(result.getVDCs(), ImmutableMap.of("188849 Virtual DataCenter", new ReferenceTypeImpl(
+ "188849 Virtual DataCenter", VCloudMediaType.VDC_XML, URI
+ .create("https://vcloud.safesecureweb.com/api/v0.8/vdc/188849"))));
+ assertEquals(result.getTasksList(), new ReferenceTypeImpl("188849 Task List", TASKSLIST_XML, URI
+ .create("https://vcloud.safesecureweb.com/api/v0.8/tasksList/188849")));
+ }
+
+ public void testSavvis() {
+ InputStream is = getClass().getResourceAsStream("/org-savvis.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ Org result = factory.create(injector.getInstance(OrgHandler.class)).parse(is);
+ assertEquals(result, new OrgImpl("607968.0", null, null, "607968.0", "Gravitant Inc", ImmutableMap
+ .<String, ReferenceType> of(), ImmutableMap.<String, ReferenceType> of("GravDataCenter1(Saved)",
+ new ReferenceTypeImpl("GravDataCenter1(Saved)", "application/vnd.vmware.vcloud.vdc+xml", URI
+ .create("https://api.symphonyVPDC.savvis.net/rest/api/v0.8/org/607968.0/vdc/2826"))),
+ ImmutableMap.<String, ReferenceType> of(), null, ImmutableSet.<Task> of()));
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/OrgListHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/OrgListHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/OrgListHandlerTest.java
new file mode 100644
index 0000000..68bf197
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/OrgListHandlerTest.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.util.Map;
+
+import org.jclouds.http.functions.BaseHandlerTest;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * Tests behavior of {@code OrgListHandler}
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "OrgListHandlerTest")
+public class OrgListHandlerTest extends BaseHandlerTest {
+
+ public void testApplyInputStream() {
+ InputStream is = getClass().getResourceAsStream("/orglist.xml");
+
+ Map<String, ReferenceType> result = factory.create(injector.getInstance(OrgListHandler.class)).parse(is);
+ assertEquals(result, ImmutableMap.of("adrian@jclouds.org", new ReferenceTypeImpl("adrian@jclouds.org",
+ "application/vnd.vmware.vcloud.org+xml", URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"))));
+ }
+
+
+ public void testSavvis() {
+ InputStream is = getClass().getResourceAsStream("/orglist-savvis.xml");
+
+ Map<String, ReferenceType> result = factory.create(injector.getInstance(OrgListHandler.class)).parse(is);
+ assertEquals(result, ImmutableMap.of("SAVVISStation Integration Testing", new ReferenceTypeImpl("SAVVISStation Integration Testing",
+ "application/vnd.vmware.vcloud.org+xml", URI.create("https://api.sandbox.symphonyvpdc.savvis.net/rest/api/v0.8/org/100000.0"))));
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/OrgNetworkHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/OrgNetworkHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/OrgNetworkHandlerTest.java
new file mode 100644
index 0000000..22b81c6
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/OrgNetworkHandlerTest.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.domain.network.DhcpService;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.domain.network.IpRange;
+import org.jclouds.vcloud.domain.network.IpScope;
+import org.jclouds.vcloud.domain.network.OrgNetwork;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code OrgNetworkHandler}
+ */
+@Test(groups = "unit")
+public class OrgNetworkHandlerTest {
+ public void testIsolated() {
+ InputStream is = getClass().getResourceAsStream("/orgnetwork-isolated.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ OrgNetwork result = factory.create(injector.getInstance(OrgNetworkHandler.class)).parse(is);
+ assertEquals(result.getName(), "isolation01");
+ assertEquals(result.getHref(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/990419644"));
+ assertEquals(result.getType(), "application/vnd.vmware.vcloud.network+xml");
+ assertEquals(result.getOrg(), new ReferenceTypeImpl(null, VCloudMediaType.ORG_XML, URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/org/9566014")));
+ assertEquals(result.getDescription(), null);
+ assertEquals(result.getTasks(), ImmutableList.of());
+ assert result.getConfiguration() != null;
+
+ assertEquals(result.getConfiguration().getIpScope(), new IpScope(false, "192.168.15.1", "255.255.255.0",
+ "23.172.173.113", null, null,
+ ImmutableSet.<IpRange> of(new IpRange("192.168.15.100", "192.168.15.199")), ImmutableSet.<String> of()));
+ assertEquals(result.getConfiguration().getParentNetwork(), null);
+ assertEquals(result.getConfiguration().getFenceMode(), FenceMode.ISOLATED);
+ assert result.getConfiguration().getFeatures() != null;
+
+ assertEquals(result.getConfiguration().getFeatures().getDhcpService(), new DhcpService(false, 3600, 7200,
+ new IpRange("192.168.15.2", "192.168.15.99")));
+ assertEquals(result.getConfiguration().getFeatures().getFirewallService(), null);
+ assertEquals(result.getConfiguration().getFeatures().getNatService(), null);
+
+ assertEquals(result.getNetworkPool(), null);
+ assertEquals(result.getAllowedExternalIpAddresses(), ImmutableSet.<String> of());
+
+ }
+
+ public void testBridged() {
+ InputStream is = getClass().getResourceAsStream("/orgnetwork-bridged.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ OrgNetwork result = factory.create(injector.getInstance(OrgNetworkHandler.class)).parse(is);
+ assertEquals(result.getName(), "internet01");
+ assertEquals(result.getHref(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/758634723"));
+ assertEquals(result.getType(), "application/vnd.vmware.vcloud.network+xml");
+ assertEquals(result.getOrg(), new ReferenceTypeImpl(null, VCloudMediaType.ORG_XML, URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/org/9566014")));
+ assertEquals(result.getDescription(), null);
+ assertEquals(result.getTasks(), ImmutableList.of());
+ assert result.getConfiguration() != null;
+
+ assertEquals(result.getConfiguration().getIpScope(), new IpScope(true, "174.47.101.161", "255.255.255.224",
+ "24.172.173.113", null, null,
+ ImmutableSet.<IpRange> of(new IpRange("174.47.101.164", "174.47.101.190")), ImmutableSet.<String> of()));
+ assertEquals(result.getConfiguration().getParentNetwork(), null);
+ assertEquals(result.getConfiguration().getFenceMode(), FenceMode.BRIDGED);
+ assert result.getConfiguration().getFeatures() == null;
+ assertEquals(result.getNetworkPool(), null);
+ assertEquals(result.getAllowedExternalIpAddresses(), ImmutableSet.<String> of());
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/SupportedVersionsHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/SupportedVersionsHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/SupportedVersionsHandlerTest.java
new file mode 100644
index 0000000..c264c60
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/SupportedVersionsHandlerTest.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.util.SortedMap;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSortedMap;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code SupportedVersionsHandler}
+ */
+@Test(groups = "unit")
+public class SupportedVersionsHandlerTest {
+
+ public void testApplyInputStream() {
+ InputStream is = getClass().getResourceAsStream("/versions.xml");
+
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+
+ SortedMap<String, URI> result = factory.create(
+ injector.getInstance(SupportedVersionsHandler.class)).parse(is);
+ assertEquals(result, ImmutableSortedMap.of("0.8", URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/login")));
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/TaskHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/TaskHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/TaskHandlerTest.java
new file mode 100644
index 0000000..f5a4688
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/TaskHandlerTest.java
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import org.jclouds.date.DateService;
+import org.jclouds.http.functions.BaseHandlerTest;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.TaskStatus;
+import org.jclouds.vcloud.domain.VCloudError.MinorCode;
+import org.jclouds.vcloud.domain.internal.ErrorImpl;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.domain.internal.TaskImpl;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+/**
+ * Tests behavior of {@code TaskHandler}
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "TaskHandlerTest")
+public class TaskHandlerTest extends BaseHandlerTest {
+
+ private DateService dateService;
+
+ @BeforeTest
+ @Override
+ protected void setUpInjector() {
+ super.setUpInjector();
+ dateService = injector.getInstance(DateService.class);
+ }
+
+ public void testHrefWhenTaskElementIsNamespaced() {
+ InputStream is = getClass().getResourceAsStream("/task-vcd15.xml");
+ Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);
+ assertEquals(result.getHref(), URI.create("https://mycloud.greenhousedata.com/api/v1.0/task/77a33fd4-3401-423c-8167-6711fc51ee9a"));
+ }
+
+ public void test() {
+ InputStream is = getClass().getResourceAsStream("/task-1.0.xml");
+
+ Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);
+
+ Task expects = new TaskImpl(URI.create("https://vcenterprise.bluelock.com/api/v1.0/task/3cc08ir8oczbze3n1a3"),
+ "Creating Virtual Application vApp_acole_2(607806320)", TaskStatus.RUNNING, dateService
+ .iso8601DateParse("2010-08-23T02:09:52.443-04:00"), dateService
+ .iso8601DateParse("9999-12-31T23:59:59.999-05:00"), dateService
+ .iso8601DateParse("2010-11-21T02:09:52.443-05:00"), new ReferenceTypeImpl("vApp_acole_2",
+ VCloudMediaType.VAPP_XML, URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320"))
+
+ , null
+
+ );
+ assertEquals(result, expects);
+
+ }
+
+ public void testTerremark() {
+ InputStream is = getClass().getResourceAsStream("/task.xml");
+
+ Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);
+ Task expects = new TaskImpl(URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/task/3299"), null,
+ TaskStatus.SUCCESS, dateService.iso8601DateParse("2009-08-24T21:29:32.983Z"), dateService
+ .iso8601DateParse("2009-08-24T21:29:44.65Z"), null, new ReferenceTypeImpl("Server1",
+ VCloudMediaType.VAPP_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")), null
+
+ );
+ assertEquals(result, expects);
+
+ }
+
+ public void testSelf() {
+ InputStream is = getClass().getResourceAsStream("/task-self.xml");
+
+ Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);
+
+ Task expects = new TaskImpl(URI.create("https://vcloud.safesecureweb.com/api/v0.8/task/d188849-78"), null,
+ TaskStatus.QUEUED, null, null, null, null, null);
+ assertEquals(result, expects);
+
+ }
+
+ public void testApplyInputStream2() {
+ InputStream is = getClass().getResourceAsStream("/task-hosting.xml");
+
+ Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);
+
+ Task expects = new TaskImpl(URI.create("https://vcloud.safesecureweb.com/api/v0.8/task/97806"), null,
+ TaskStatus.SUCCESS, dateService.iso8601SecondsDateParse("2010-01-14T20:04:51Z"), dateService
+ .iso8601SecondsDateParse("2010-01-14T20:05:02Z"), dateService
+ .iso8601SecondsDateParse("2010-01-15T20:05:02Z"),
+
+ new ReferenceTypeImpl("188849-96", VCloudMediaType.VAPP_XML, URI
+ .create("https://vcloud.safesecureweb.com/api/v0.8/vapp/188849-96")), null);
+ assertEquals(result, expects);
+ }
+
+ public void testError() {
+ InputStream is = getClass().getResourceAsStream("/task-error.xml");
+
+ Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);
+
+ Task expects = new TaskImpl(URI.create("http://10.150.4.49/api/v0.8/task/23"), null, TaskStatus.ERROR,
+ dateService.iso8601SecondsDateParse("2009-12-07T19:05:02Z"), dateService
+ .iso8601SecondsDateParse("2009-12-10T14:40:32Z"), null, new ReferenceTypeImpl("testapp1",
+ VCloudMediaType.VAPP_XML, URI.create("http://10.150.4.49/api/v0.8/vapp/1")), new ErrorImpl(
+ "Error processing job", 500, MinorCode.UNRECOGNIZED,
+ " Error in runDailySummaries date used:2009-12-09 19:40:30.577326+00:00", null));
+ assertEquals(result, expects);
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/TasksListHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/TasksListHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/TasksListHandlerTest.java
new file mode 100644
index 0000000..24552b0
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/TasksListHandlerTest.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import org.jclouds.date.DateService;
+import org.jclouds.http.functions.BaseHandlerTest;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Task;
+import org.jclouds.vcloud.domain.TaskStatus;
+import org.jclouds.vcloud.domain.TasksList;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.domain.internal.TaskImpl;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSortedSet;
+
+/**
+ * Tests behavior of {@code TasksListHandler}
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "TasksListHandlerTest")
+public class TasksListHandlerTest extends BaseHandlerTest {
+
+ private DateService dateService;
+
+ @BeforeTest
+ @Override
+ protected void setUpInjector() {
+ super.setUpInjector();
+ dateService = injector.getInstance(DateService.class);
+ }
+
+ public void testApplyInputStream() {
+ InputStream is = getClass().getResourceAsStream("/taskslist.xml");
+
+ TasksList result = factory.create(injector.getInstance(TasksListHandler.class)).parse(is);
+ assertEquals(result.getLocation(), URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/tasksList/1"));
+ Task task1 = new TaskImpl(URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/task/3300"),
+ null, TaskStatus.SUCCESS, dateService.iso8601DateParse("2009-08-24T21:30:19.587Z"), dateService
+ .iso8601DateParse("2009-08-24T21:30:32.63Z"), null, new ReferenceTypeImpl("Server1",
+ VCloudMediaType.VAPP_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")), null);
+ Task task2 = new TaskImpl(URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/task/3299"),
+ null, TaskStatus.SUCCESS, dateService.iso8601DateParse("2009-08-24T21:29:32.983Z"), dateService
+ .iso8601DateParse("2009-08-24T21:29:44.65Z"), null, new ReferenceTypeImpl("Server1",
+ VCloudMediaType.VAPP_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")), null);
+ assertEquals(result.getTasks(), ImmutableSortedSet.of(task1, task2));
+ }
+
+ public void testApplyInputStreamHosting() {
+ InputStream is = getClass().getResourceAsStream("/taskslist-hosting.xml");
+
+ TasksList result = factory.create(injector.getInstance(TasksListHandler.class)).parse(is);
+ assertEquals(result.getLocation(), URI.create("https://vcloud.safesecureweb.com/api/v0.8/tasksList/188849"));
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/VAppHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/VAppHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/VAppHandlerTest.java
new file mode 100644
index 0000000..992e343
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/VAppHandlerTest.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import org.jclouds.cim.xml.ResourceAllocationSettingDataHandler;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.xml.ovf.VCloudResourceAllocationSettingDataHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code VAppHandler}
+ */
+@Test(groups = "unit")
+public class VAppHandlerTest {
+
+ public void testRhelOffStatic() {
+ InputStream is = getClass().getResourceAsStream("/vapp-rhel-off-static.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule() {
+
+ @Override
+ protected void configure() {
+ super.configure();
+ bind(ResourceAllocationSettingDataHandler.class).to(VCloudResourceAllocationSettingDataHandler.class);
+ }
+ });
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
+ assertEquals(result.getName(), "vApp_acole_2");
+ assertEquals(result.getDescription(), "foo");
+ assertEquals(result.getHref(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320"));
+ assertEquals(result.getType(), "application/vnd.vmware.vcloud.vApp+xml");
+ assertEquals(result.getStatus(), Status.OFF);
+ assertEquals(
+ result.getVDC(),
+ new ReferenceTypeImpl(null, VCloudMediaType.VDC_XML, URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439")));
+ assertEquals(result.getTasks(), ImmutableList.of());
+ assert result.isOvfDescriptorUploaded();
+ assert result.getNetworkSection() != null;
+ Vm vm = Iterables.getOnlyElement(result.getChildren());
+ VmHandlerTest.checkVm(vm);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/VAppTemplateHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/VAppTemplateHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/VAppTemplateHandlerTest.java
new file mode 100644
index 0000000..c0cc110
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/VAppTemplateHandlerTest.java
@@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import org.jclouds.date.DateService;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.ovf.Network;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.GuestCustomizationSection;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.TaskStatus;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.domain.internal.TaskImpl;
+import org.jclouds.vcloud.domain.ovf.VCloudNetworkSection;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code VAppTemplateHandler}
+ */
+@Test(groups = "unit")
+public class VAppTemplateHandlerTest {
+
+ public void testUbuntuTemplate() {
+ VAppTemplate result = parseTemplate();
+ assertEquals(result.getName(), "Ubuntu Template");
+ assertEquals(result.getHref(), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921"));
+ assertEquals(result.getType(), "application/vnd.vmware.vcloud.vAppTemplate+xml");
+ assertEquals(result.getStatus(), Status.OFF);
+ assertEquals(result.getVDC(), new ReferenceTypeImpl(null, VCloudMediaType.VDC_XML, URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439")));
+ assertEquals(result.getDescription(), null);
+ assertEquals(result.getTasks(), ImmutableList.of());
+ assertEquals(result.getVAppScopedLocalId(), null);
+ assert result.isOvfDescriptorUploaded();
+ Vm vm = Iterables.getOnlyElement(result.getChildren());
+ assertEquals(vm.getName(), "Ubuntu1004");
+ assertEquals(vm.getHref(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vm-172837194"));
+ // NOTE this is vAppTemplate not VM!
+ assertEquals(vm.getType(), "application/vnd.vmware.vcloud.vAppTemplate+xml");
+ assertEquals(vm.getStatus(), null);
+ assertEquals(vm.getParent(), new ReferenceTypeImpl(null, VCloudMediaType.VAPPTEMPLATE_XML, URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921")));
+ assertEquals(vm.getDescription(), null);
+ assertEquals(vm.getTasks(), ImmutableList.of());
+ assertEquals(vm.getVAppScopedLocalId(), "02_ubuntu_template");
+
+ GuestCustomizationSection guestC = vm.getGuestCustomizationSection();
+
+ assertEquals(guestC.getType(), VCloudMediaType.GUESTCUSTOMIZATIONSECTION_XML);
+ assertEquals(
+ guestC.getHref(),
+ URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vm-172837194/guestCustomizationSection/"));
+ assertEquals(guestC.getInfo(), "Specifies Guest OS Customization Settings");
+ assertEquals(guestC.isEnabled(), Boolean.TRUE);
+ assertEquals(guestC.shouldChangeSid(), Boolean.FALSE);
+ assertEquals(guestC.getVirtualMachineId(), "172837194");
+ assertEquals(guestC.isJoinDomainEnabled(), Boolean.FALSE);
+ assertEquals(guestC.useOrgSettings(), Boolean.FALSE);
+ assertEquals(guestC.getDomainName(), null);
+ assertEquals(guestC.getDomainUserName(), null);
+ assertEquals(guestC.getDomainUserPassword(), null);
+ assertEquals(guestC.isAdminPasswordEnabled(), Boolean.TRUE);
+ assertEquals(guestC.isAdminPasswordAuto(), Boolean.TRUE);
+ assertEquals(guestC.getAdminPassword(), "%3eD%gmF");
+ assertEquals(guestC.isResetPasswordRequired(), Boolean.FALSE);
+ assertEquals(
+ guestC.getCustomizationScript(),
+ "#!/bin/bash if [ \"$1\" = \"postcustomization\" ]; then echo \"post customization\" touch /root/.postcustomization sleep 30 #regenerate keys /bin/rm /etc/ssh/ssh_host_* /usr/sbin/dpkg-reconfigure openssh-server echo \"completed\" fi");
+ assertEquals(guestC.getComputerName(), "Ubuntu1004");
+ assertEquals(guestC.getEdit(), null);
+
+ VCloudNetworkSection network = result.getNetworkSection();
+ assertEquals(
+ network.getHref(),
+ URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/networkSection/"));
+ assertEquals(network.getType(), VCloudMediaType.NETWORKSECTION_XML);
+ assertEquals(network.getInfo(), "The list of logical networks");
+ assertEquals(network.getNetworks(), ImmutableSet.of(new Network("vAppNet-vApp Internal", null)));
+
+ }
+
+ public static VAppTemplate parseTemplate() {
+ InputStream is = VAppTemplateHandlerTest.class.getResourceAsStream("/vAppTemplate.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ VAppTemplate result = factory.create(injector.getInstance(VAppTemplateHandler.class)).parse(is);
+ return result;
+ }
+
+ public void testCopyingTemplate() {
+ InputStream is = getClass().getResourceAsStream("/vAppTemplate-copying.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ DateService dateService = injector.getInstance(DateService.class);
+
+ VAppTemplate result = factory.create(injector.getInstance(VAppTemplateHandler.class)).parse(is);
+ assertEquals(result.getName(), "Ubuntu10.04_v2");
+ assertEquals(result.getHref(), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-699683881"));
+ assertEquals(result.getType(), "application/vnd.vmware.vcloud.vAppTemplate+xml");
+ assertEquals(result.getStatus(), Status.UNRESOLVED);
+ assertEquals(result.getVDC(), new ReferenceTypeImpl(null, VCloudMediaType.VDC_XML, URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/105186609")));
+ assertEquals(result.getDescription(), null);
+ assertEquals(result.getTasks(), ImmutableList.of(new TaskImpl(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/task/q62gxhi32xgd9yrqvr"),
+ "Copying Virtual Application Template Ubuntu10.04_v2(699683881)", TaskStatus.RUNNING, dateService
+ .iso8601DateParse("2010-09-17T23:20:46.039-04:00"), dateService
+ .iso8601DateParse("9999-12-31T23:59:59.999-05:00"), dateService
+ .iso8601DateParse("2010-12-16T23:20:46.039-05:00"), new ReferenceTypeImpl("Ubuntu10.04_v2",
+ "application/vnd.vmware.vcloud.vAppTemplate+xml",
+ URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-699683881")),
+ null)));
+ assertEquals(result.getVAppScopedLocalId(), null);
+ assert result.isOvfDescriptorUploaded();
+ assertEquals(result.getChildren(), ImmutableList.of());
+ assertEquals(result.getNetworkSection(), null);
+
+ }
+
+ public void testVAppTemplateWithNewlinesAndNamespacedElements() {
+ InputStream is = getClass().getResourceAsStream("/vAppTemplate1.0-vcd15_withNewlines.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+
+ factory.create(injector.getInstance(VAppTemplateHandler.class)).parse(is);
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/VDCHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/VDCHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/VDCHandlerTest.java
new file mode 100644
index 0000000..d5cc9da
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/VDCHandlerTest.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.AllocationModel;
+import org.jclouds.vcloud.domain.Capacity;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VDC;
+import org.jclouds.vcloud.domain.VDCStatus;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code VDCHandler}
+ */
+@Test(groups = "unit")
+public class VDCHandlerTest {
+ public void testVCloud1_0() {
+ InputStream is = getClass().getResourceAsStream("/vdc-1.0.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is);
+ assertEquals(result.getName(), "Jclouds-Commit-compG1xstorA01");
+ assertEquals(result.getHref(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439"));
+ assertEquals(result.getType(), "application/vnd.vmware.vcloud.vdc+xml");
+ assertEquals(result.getStatus(), VDCStatus.READY);
+ assertEquals(result.getOrg(), new ReferenceTypeImpl(null, VCloudMediaType.ORG_XML, URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/org/9566014")));
+ assertEquals(result.getDescription(), null);
+ assertEquals(result.getTasks(), ImmutableList.of());
+ assertEquals(result.getAllocationModel(), AllocationModel.ALLOCATION_POOL);
+ assertEquals(result.getStorageCapacity(), new Capacity("MB", 1024000, 1024000, 0, 0));
+ assertEquals(result.getCpuCapacity(), new Capacity("MHz", 20000, 20000, 0, 0));
+ assertEquals(result.getMemoryCapacity(), new Capacity("MB", 30720, 30720, 0, 0));
+ assertEquals(result.getResourceEntities(), ImmutableMap.<String, ReferenceType> of());
+ assertEquals(result.getAvailableNetworks(), ImmutableMap.of("isolation01", new ReferenceTypeImpl("isolation01",
+ "application/vnd.vmware.vcloud.network+xml", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/network/990419644")), "internet01",
+ new ReferenceTypeImpl("internet01", "application/vnd.vmware.vcloud.network+xml", URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/network/758634723"))));
+ assertEquals(result.getNicQuota(), 0);
+ assertEquals(result.getNetworkQuota(), 100);
+ assertEquals(result.getVmQuota(), 50);
+ assert result.isEnabled();
+ }
+
+ public void testTerremark() {
+ InputStream is = getClass().getResourceAsStream("/vdc.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is);
+ assertEquals(result.getName(), "Miami Environment 1");
+ assertEquals(result.getHref(), URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32"));
+ assertEquals(result.getDescription(), null);
+ assertEquals(result.getStorageCapacity(), new Capacity("bytes * 10^9", 100, 0, 8, 0));
+ assertEquals(result.getCpuCapacity(), new Capacity("hz * 10^6", 5000, 0, 0, 0));
+ assertEquals(result.getMemoryCapacity(), new Capacity("bytes * 2^20", 10240, 0, 0, 0));
+ assertEquals(result.getVmQuota(), 0);
+ assertEquals(result.getResourceEntities(), ImmutableMap.<String, ReferenceType> of("adriantest",
+ new ReferenceTypeImpl("adriantest", VCloudMediaType.VAPP_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/15124")), "centos-53",
+ new ReferenceTypeImpl("centos-53", VCloudMediaType.VAPP_XML, URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/15120"))));
+ assertEquals(result.getAvailableNetworks(), ImmutableMap.of("10.114.34.128/26", new ReferenceTypeImpl(
+ "10.114.34.128/26", "application/vnd.vmware.vcloud.network+xml", URI
+ .create("https://services.vcloudexpress.terremark.com/api/v0.8/network/1708"))));
+ }
+
+ public void testHostingDotCom() {
+ InputStream is = getClass().getResourceAsStream("/vdc-hosting.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule());
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ VDC result = factory.create(injector.getInstance(VDCHandler.class)).parse(is);
+ assertEquals(result.getName(), "vDC Name");
+ assertEquals(result.getHref(), URI.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/188849"));
+ assertEquals(result.getDescription(), "vDC Name");
+ assertEquals(result.getStorageCapacity(), new Capacity("bytes * 10^9", 0, 0, 40960, 0));
+ assertEquals(result.getCpuCapacity(), new Capacity("hz * 10^6", 0, 0, 2400, 0));
+ assertEquals(result.getMemoryCapacity(), new Capacity("bytes * 10^9", 0, 0, 2, 0));
+ assertEquals(result.getVmQuota(), 0);
+ assertEquals(result.getResourceEntities(), new ImmutableMap.Builder<String, ReferenceType>().put(
+ "Plesk (Linux) 64-bit Template",
+ new ReferenceTypeImpl("Plesk (Linux) 64-bit Template", "application/vnd.vmware.vcloud.vAppTemplate+xml",
+ URI.create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/1"))).put(
+
+ "Windows 2008 Datacenter 64 Bit Template",
+ new ReferenceTypeImpl("Windows 2008 Datacenter 64 Bit Template",
+ "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
+ .create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/2"))).put(
+ "Cent OS 64 Bit Template",
+ new ReferenceTypeImpl("Cent OS 64 Bit Template", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
+ .create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/3"))).put(
+ "cPanel (Linux) 64 Bit Template",
+ new ReferenceTypeImpl("cPanel (Linux) 64 Bit Template",
+ "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
+ .create("https://vcloud.safesecureweb.com/api/v0.8/vAppTemplate/4"))).put(
+ "188849-1",
+ new ReferenceTypeImpl("188849-1", "application/vnd.vmware.vcloud.vApp+xml", URI
+ .create("https://vcloud.safesecureweb.com/api/v0.8/vApp/188849-1"))).put(
+ "188849-2",
+ new ReferenceTypeImpl("188849-2", "application/vnd.vmware.vcloud.vApp+xml", URI
+ .create("https://vcloud.safesecureweb.com/api/v0.8/vApp/188849-2"))).build());
+
+ assertEquals(result.getAvailableNetworks(), ImmutableMap.<String, ReferenceType> of());
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/VmHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/VmHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/VmHandlerTest.java
new file mode 100644
index 0000000..342b04a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/VmHandlerTest.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+
+import org.jclouds.cim.xml.ResourceAllocationSettingDataHandler;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ParseSax.Factory;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Status;
+import org.jclouds.vcloud.domain.Vm;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.xml.ovf.VCloudOperatingSystemSectionHandlerTest;
+import org.jclouds.vcloud.xml.ovf.VCloudResourceAllocationSettingDataHandler;
+import org.jclouds.vcloud.xml.ovf.VCloudVirtualHardwareSectionHandlerTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code VmHandler}
+ */
+@Test(groups = "unit")
+public class VmHandlerTest {
+ public void testVCloud1_0() {
+ InputStream is = getClass().getResourceAsStream("/vm-rhel-off-static.xml");
+ Injector injector = Guice.createInjector(new SaxParserModule() {
+
+ @Override
+ protected void configure() {
+ super.configure();
+ bind(ResourceAllocationSettingDataHandler.class).to(VCloudResourceAllocationSettingDataHandler.class);
+ }
+ });
+ Factory factory = injector.getInstance(ParseSax.Factory.class);
+ Vm result = factory.create(injector.getInstance(VmHandler.class)).parse(is);
+ checkVm(result);
+ }
+
+ static void checkVm(Vm result) {
+ assertEquals(result.getName(), "RHEL5");
+ assertEquals(result.getHref(), URI.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248"));
+ assertEquals(result.getType(), "application/vnd.vmware.vcloud.vm+xml");
+ assertEquals(result.getStatus(), Status.OFF);
+ assertEquals(result.getParent(), new ReferenceTypeImpl(null, VCloudMediaType.VAPP_XML, URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vapp-607806320")));
+ assertEquals(result.getDescription(), null);
+ assertEquals(result.getTasks(), ImmutableList.of());
+ assertEquals(result.getVAppScopedLocalId(), "10_rhel_template");
+ VCloudVirtualHardwareSectionHandlerTest.checkHardware(result.getVirtualHardwareSection());
+ VCloudOperatingSystemSectionHandlerTest.checkOs(result.getOperatingSystemSection());
+ NetworkConnectionSectionHandlerTest.checkNetworkConnectionSection(result.getNetworkConnectionSection());
+ GuestCustomizationSectionHandlerTest.checkGuestCustomization(result.getGuestCustomizationSection());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/ovf/VCloudOperatingSystemSectionHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/ovf/VCloudOperatingSystemSectionHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/ovf/VCloudOperatingSystemSectionHandlerTest.java
new file mode 100644
index 0000000..307b3f1
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/ovf/VCloudOperatingSystemSectionHandlerTest.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml.ovf;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.net.UnknownHostException;
+
+import org.jclouds.http.functions.BaseHandlerTest;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.domain.ovf.VCloudOperatingSystemSection;
+import org.testng.annotations.Test;
+
+/**
+ * Tests behavior of {@code VCloudOperatingSystemSectionHandler}
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "VCloudOperatingSystemSectionHandlerTest")
+public class VCloudOperatingSystemSectionHandlerTest extends BaseHandlerTest {
+
+ public void testDefault() throws UnknownHostException {
+ InputStream is = getClass().getResourceAsStream("/os.xml");
+
+ VCloudOperatingSystemSection result = factory.create(injector.getInstance(VCloudOperatingSystemHandler.class)).parse(is);
+
+ checkOs(result);
+
+ }
+
+ @Test(enabled = false)
+ public static void checkOs(VCloudOperatingSystemSection result) {
+ assertEquals(result.getHref(), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/operatingSystemSection/"));
+ assertEquals(result.getDescription(), "Red Hat Enterprise Linux 5 (64-bit)");
+ assertEquals(result.getEdit(), new ReferenceTypeImpl(null,
+ "application/vnd.vmware.vcloud.operatingSystemSection+xml",
+ URI.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/operatingSystemSection/")));
+ assertEquals(result.getId(), Integer.valueOf(80));
+ assertEquals(result.getVmwOsType(), "rhel5_64Guest");
+ assertEquals(result.getType(), "application/vnd.vmware.vcloud.operatingSystemSection+xml");
+ assertEquals(result.getInfo(), "Specifies the operating system installed");
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/ovf/VCloudVirtualHardwareSectionHandlerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/ovf/VCloudVirtualHardwareSectionHandlerTest.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/ovf/VCloudVirtualHardwareSectionHandlerTest.java
new file mode 100644
index 0000000..72be94a
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/java/org/jclouds/vcloud/xml/ovf/VCloudVirtualHardwareSectionHandlerTest.java
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.xml.ovf;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.net.UnknownHostException;
+
+import org.jclouds.cim.ResourceAllocationSettingData;
+import org.jclouds.cim.ResourceAllocationSettingData.ResourceType;
+import org.jclouds.cim.VirtualSystemSettingData;
+import org.jclouds.cim.xml.ResourceAllocationSettingDataHandler;
+import org.jclouds.http.functions.BaseHandlerTest;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.config.SaxParserModule;
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+import org.jclouds.vcloud.domain.ovf.EditableResourceAllocationSettingData;
+import org.jclouds.vcloud.domain.ovf.VCloudHardDisk;
+import org.jclouds.vcloud.domain.ovf.VCloudNetworkAdapter;
+import org.jclouds.vcloud.domain.ovf.VCloudVirtualHardwareSection;
+import org.jclouds.vcloud.xml.VCloudVirtualHardwareHandler;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.Iterables;
+import com.google.inject.Guice;
+
+/**
+ * Tests behavior of {@code VCloudVirtualHardwareSectionHandler}
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
+@Test(groups = "unit", testName = "VCloudVirtualHardwareSectionHandlerTest")
+public class VCloudVirtualHardwareSectionHandlerTest extends BaseHandlerTest {
+ @BeforeTest
+ @Override
+ protected void setUpInjector() {
+ injector = Guice.createInjector(new SaxParserModule() {
+ public void configure() {
+ super.configure();
+ bind(ResourceAllocationSettingDataHandler.class).to(VCloudResourceAllocationSettingDataHandler.class);
+ }
+ });
+ factory = injector.getInstance(ParseSax.Factory.class);
+ assert factory != null;
+ }
+
+ public void testDefault() throws UnknownHostException {
+ InputStream is = getClass().getResourceAsStream("/virtualhardwaresection.xml");
+
+ VCloudVirtualHardwareSection result = factory.create(injector.getInstance(VCloudVirtualHardwareHandler.class))
+ .parse(is);
+
+ checkHardware(result);
+
+ }
+
+ @Test(enabled = false)
+ public static void checkHardware(VCloudVirtualHardwareSection result) {
+ VirtualSystemSettingData system = VirtualSystemSettingData.builder().instanceID("0").elementName(
+ "Virtual Hardware Family").virtualSystemIdentifier("RHEL5").virtualSystemType("vmx-07").build();
+
+ assertEquals(result.getHref(), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/"));
+ assertEquals(result.getType(), "application/vnd.vmware.vcloud.virtualHardwareSection+xml");
+ assertEquals(result.getSystem().toString(), system.toString());
+ assertEquals(result.getInfo(), "Virtual hardware requirements");
+
+ assertEquals(Iterables.get(result.getItems(), 0).toString(), VCloudNetworkAdapter.builder()
+ .instanceID("1").elementName("Network adapter 0").description("PCNet32 ethernet adapter").resourceType(
+ ResourceType.ETHERNET_ADAPTER).resourceSubType("PCNet32").automaticAllocation(true).connection(
+ "internet01").address("00:50:56:01:01:f2").addressOnParent("0").ipAddress("174.47.101.164")
+ .primaryNetworkConnection(true).ipAddressingMode("POOL").build().toString());
+
+ assertEquals(Iterables.get(result.getItems(), 1).toString(), ResourceAllocationSettingData
+ .builder().instanceID("2").elementName("SCSI Controller 0").description("SCSI Controller").resourceType(
+ ResourceType.PARALLEL_SCSI_HBA).resourceSubType("lsilogic").address("0").build().toString());
+
+ assertEquals(Iterables.get(result.getItems(), 2).toString(), VCloudHardDisk.builder().instanceID(
+ "2000").elementName("Hard disk 1").description("Hard disk").resourceType(ResourceType.DISK_DRIVE)
+ .addressOnParent("0").parent("2").capacity(30720).busType(6).busSubType("lsilogic").build().toString());
+
+ assertEquals(Iterables.get(result.getItems(), 3).toString(), ResourceAllocationSettingData
+ .builder().instanceID("3").elementName("IDE Controller 0").description("IDE Controller").resourceType(
+ ResourceType.IDE_CONTROLLER).address("0").build().toString());
+
+ assertEquals(Iterables.get(result.getItems(), 4).toString(), ResourceAllocationSettingData
+ .builder().instanceID("3002").elementName("CD/DVD Drive 1").description("CD/DVD Drive").resourceType(
+ ResourceType.CD_DRIVE).addressOnParent("0").automaticAllocation(false).parent("3").build()
+ .toString());
+
+ assertEquals(Iterables.get(result.getItems(), 5).toString(), ResourceAllocationSettingData
+ .builder().instanceID("8000").elementName("Floppy Drive 1").description("Floppy Drive").resourceType(
+ ResourceType.FLOPPY_DRIVE).addressOnParent("0").automaticAllocation(false).build().toString());
+
+ assertEquals(
+ Iterables.get(result.getItems(), 6).toString(),
+ EditableResourceAllocationSettingData
+ .builder()
+ .instanceID("4")
+ .elementName("1 virtual CPU(s)")
+ .description("Number of Virtual CPUs")
+ .resourceType(ResourceType.PROCESSOR)
+ .virtualQuantity(1l)
+ .allocationUnits("hertz * 10^6")
+ .reservation(0l)
+ .weight(0)
+ .edit(
+ new ReferenceTypeImpl(
+ null,
+ "application/vnd.vmware.vcloud.rasdItem+xml",
+ URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/cpu"),"edit"))
+ .build().toString());
+
+ assertEquals(
+ Iterables.get(result.getItems(), 7).toString(),
+ EditableResourceAllocationSettingData
+ .builder()
+ .instanceID("5")
+ .elementName("384 MB of memory")
+ .description("Memory Size")
+ .resourceType(ResourceType.MEMORY)
+ .virtualQuantity(384l)
+ .allocationUnits("byte * 2^20")
+ .reservation(0l)
+ .weight(0)
+ .edit(
+ new ReferenceTypeImpl(
+ null,
+ "application/vnd.vmware.vcloud.rasdItem+xml",
+ URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/vm-2087535248/virtualHardwareSection/memory"),"edit"))
+ .build().toString());
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/captureVApp-default.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/captureVApp-default.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/captureVApp-default.xml
new file mode 100644
index 0000000..0570872
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/captureVApp-default.xml
@@ -0,0 +1 @@
+<CaptureVAppParams xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="my-template" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcloud.safesecureweb.com/ns/vcloud.xsd"><Source href="https://vcenterprise.bluelock.com/api/v1.0/vapp/4181" type="application/vnd.vmware.vcloud.vApp+xml"/></CaptureVAppParams>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/captureVApp.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/captureVApp.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/captureVApp.xml
new file mode 100644
index 0000000..35e62d0
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/captureVApp.xml
@@ -0,0 +1 @@
+<CaptureVAppParams xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="my-template" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcloud.safesecureweb.com/ns/vcloud.xsd"><Description>The description of the new vApp Template</Description><Source href="https://vcenterprise.bluelock.com/api/v1.0/vapp/201" type="application/vnd.vmware.vcloud.vApp+xml"/></CaptureVAppParams>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalog-blank.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalog-blank.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalog-blank.xml
new file mode 100644
index 0000000..6bc4038
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalog-blank.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Catalog xmlns="http://www.vmware.com/vcloud/v1" name="Jclouds-private" type="application/vnd.vmware.vcloud.catalog+xml" href="https://vcenterprise.bluelock.com/api/v1.0/catalog/921222081" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.org+xml" href="https://vcenterprise.bluelock.com/api/v1.0/org/9566014"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcenterprise.bluelock.com/api/v1.0/catalog/921222081/catalogItems"/>
+ <CatalogItems/>
+ <IsPublished>false</IsPublished>
+</Catalog>
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalog-hosting.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalog-hosting.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalog-hosting.xml
new file mode 100644
index 0000000..be510a9
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalog-hosting.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Catalog href="https://vcloud.safesecureweb.com/api/v0.8/catalog/1"
+ name="HMSCatalog" xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8/catalog.xsd"
+ xmlns="http://www.vmware.com/vcloud/v0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <Description>HMS Shared Catalog</Description>
+
+ <Link rel="add"
+ href="https://vcloud.safesecureweb.com/api/v0.8/catalog/1/catalogItems"
+ type="application/vnd.vmware.vcloud.catalogItem+xml" />
+
+ <CatalogItems>
+ <CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml"
+ href="https://vcloud.safesecureweb.com/api/v0.8/catalogItem/1"
+ name="Plesk (Linux) 64-bit Template" />
+ <CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml"
+ href="https://vcloud.safesecureweb.com/api/v0.8/catalogItem/2"
+ name="Windows 2008 Datacenter 64 Bit Template" />
+ <CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml"
+ href="https://vcloud.safesecureweb.com/api/v0.8/catalogItem/3"
+ name="Cent OS 64 Bit Template" />
+ <CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml"
+ href="https://vcloud.safesecureweb.com/api/v0.8/catalogItem/4"
+ name="cPanel (Linux) 64 Bit Template" />
+ </CatalogItems>
+</Catalog>
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalog.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalog.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalog.xml
new file mode 100644
index 0000000..f2d5eaa
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalog.xml
@@ -0,0 +1,27 @@
+<Catalog href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog" type="application/vnd.vmware.vcloud.catalog+xml" name="Miami Environment 1" xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <CatalogItems>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/5" type="application/vnd.vmware.vcloud.catalogItem+xml" name="CentOS 5.3 (32-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/6" type="application/vnd.vmware.vcloud.catalogItem+xml" name="CentOS 5.3 (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/7" type="application/vnd.vmware.vcloud.catalogItem+xml" name="RHEL 5.3 (32-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/8" type="application/vnd.vmware.vcloud.catalogItem+xml" name="RHEL 5.3 (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/11" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Ubuntu JeOS 9.04 (32-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/12" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Ubuntu JeOS 9.04 (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/9" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Ubuntu Server 9.04 (32-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/10" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Ubuntu Server 9.04 (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/1" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows 2003 Enterprise R2 (32-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/2" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows 2003 Enterprise R2 (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/3" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows 2003 Standard R2 (32-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/4" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows 2003 Standard R2 (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/23" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows 2003 Standard R2 w.SQL 2008 Web (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/13" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows Server 2008 Enterprise (32-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/15" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows Server 2008 Enterprise (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/16" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows Server 2008 Enterprise R2 (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/17" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows Server 2008 Standard (32-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/18" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows Server 2008 Standard (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/19" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows Server 2008 Standard R2 (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/14" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows Server 2008 Standard w.SQL 2008 Web (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/20" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows Web Server 2008 (32-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/21" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows Web Server 2008 (64-bit)"/>
+ <CatalogItem href="https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/22" type="application/vnd.vmware.vcloud.catalogItem+xml" name="Windows Web Server 2008 R2 (64-bit)"/>
+ </CatalogItems>
+</Catalog>
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalog1.0-vcd15.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalog1.0-vcd15.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalog1.0-vcd15.xml
new file mode 100644
index 0000000..0208e59
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/catalog1.0-vcd15.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Catalog xmlns="http://www.vmware.com/vcloud/v1" name="jclouds" type="application/vnd.vmware.vcloud.catalog+xml" href="https://zone.myvcloud.com/api/v1.0/catalog/3155f393-1e1d-4572-8c9c-d76f72ddb658" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 https://zone.myvcloud.com/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.org+xml" href="https://zone.myvcloud.com/api/v1.0/org/c076f90a-397a-49fa-89b8-b294c1599cd0"/>
+ <Link rel="add" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://zone.myvcloud.com/api/v1.0/catalog/3155f393-1e1d-4572-8c9c-d76f72ddb658/catalogItems"/>
+ <CatalogItems>
+ <CatalogItem type="application/vnd.vmware.vcloud.catalogItem+xml" name="UbuntuServer-x64-2GB" href="https://zone.myvcloud.com/api/v1.0/catalogItem/ceb369f7-1d07-4e32-9dbd-ebb5aa6ca55c"/>
+ </CatalogItems>
+ <IsPublished>false</IsPublished>
+</Catalog>
\ No newline at end of file
[15/18] stratos git commit: Jclouds vcloud api 1.8.1 clone with
custom changes
Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/VCloudHttpApiModule.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/VCloudHttpApiModule.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/VCloudHttpApiModule.java
new file mode 100644
index 0000000..5cc6d67
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/config/VCloudHttpApiModule.java
@@ -0,0 +1,536 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.config;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
+import static com.google.common.base.Predicates.notNull;
+import static com.google.common.collect.Iterables.concat;
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Iterables.getLast;
+import static com.google.common.collect.Iterables.transform;
+import static com.google.common.collect.Maps.transformValues;
+import static com.google.common.collect.Maps.uniqueIndex;
+import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
+import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
+import static org.jclouds.util.Predicates2.retry;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_FENCEMODE;
+import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.SortedMap;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.jclouds.cim.xml.ResourceAllocationSettingDataHandler;
+import org.jclouds.domain.Location;
+import org.jclouds.http.HttpErrorHandler;
+import org.jclouds.http.annotation.ClientError;
+import org.jclouds.http.annotation.Redirection;
+import org.jclouds.http.annotation.ServerError;
+import org.jclouds.location.suppliers.ImplicitLocationSupplier;
+import org.jclouds.location.suppliers.LocationsSupplier;
+import org.jclouds.ovf.Envelope;
+import org.jclouds.rest.AuthorizationException;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.rest.annotations.ApiVersion;
+import org.jclouds.rest.config.HttpApiModule;
+import org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier;
+import org.jclouds.vcloud.VCloudApi;
+import org.jclouds.vcloud.VCloudToken;
+import org.jclouds.vcloud.VCloudVersionsApi;
+import org.jclouds.vcloud.compute.functions.FindLocationForResource;
+import org.jclouds.vcloud.compute.functions.ValidateVAppTemplateAndReturnEnvelopeOrThrowIllegalArgumentException;
+import org.jclouds.vcloud.domain.Catalog;
+import org.jclouds.vcloud.domain.CatalogItem;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VAppTemplate;
+import org.jclouds.vcloud.domain.VCloudSession;
+import org.jclouds.vcloud.domain.VDC;
+import org.jclouds.vcloud.domain.network.FenceMode;
+import org.jclouds.vcloud.endpoints.Network;
+import org.jclouds.vcloud.endpoints.OrgList;
+import org.jclouds.vcloud.functions.CatalogItemsInCatalog;
+import org.jclouds.vcloud.functions.CatalogItemsInOrg;
+import org.jclouds.vcloud.functions.CatalogsInOrg;
+import org.jclouds.vcloud.functions.DefaultNetworkNameInTemplate;
+import org.jclouds.vcloud.functions.OrgsForLocations;
+import org.jclouds.vcloud.functions.OrgsForNames;
+import org.jclouds.vcloud.functions.VAppTemplatesForCatalogItems;
+import org.jclouds.vcloud.functions.VDCsInOrg;
+import org.jclouds.vcloud.handlers.ParseVCloudErrorFromHttpResponse;
+import org.jclouds.vcloud.internal.VCloudLoginApi;
+import org.jclouds.vcloud.loaders.OVFLoader;
+import org.jclouds.vcloud.loaders.VAppTemplateLoader;
+import org.jclouds.vcloud.location.DefaultVDC;
+import org.jclouds.vcloud.location.OrgAndVDCToLocationSupplier;
+import org.jclouds.vcloud.predicates.TaskSuccess;
+import org.jclouds.vcloud.xml.ovf.VCloudResourceAllocationSettingDataHandler;
+
+import com.google.common.base.Function;
+import com.google.common.base.Objects;
+import com.google.common.base.Predicate;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMap.Builder;
+import com.google.common.collect.Lists;
+import com.google.inject.Injector;
+import com.google.inject.Provides;
+import com.google.inject.Scopes;
+import com.google.inject.TypeLiteral;
+
+/**
+ * Configures the VCloud authentication service connection, including logging and http transport.
+ */
+@ConfiguresHttpApi
+public class VCloudHttpApiModule extends HttpApiModule<VCloudApi> {
+
+
+ @Provides
+ @Singleton
+ protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
+ AtomicReference<AuthorizationException> authException, final VCloudLoginApi login) {
+ return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException,
+ new Supplier<VCloudSession>() {
+
+ @Override
+ public VCloudSession get() {
+ return login.login();
+ }
+
+ @Override
+ public String toString() {
+ return Objects.toStringHelper(login).add("method", "login").toString();
+ }
+ }, seconds, TimeUnit.SECONDS);
+ }
+
+ @Override
+ protected void configure() {
+ super.configure();
+ bind(new TypeLiteral<Function<Iterable<CatalogItem>, Iterable<VAppTemplate>>>() {
+ }).to(new TypeLiteral<VAppTemplatesForCatalogItems>() {
+ });
+ bind(ResourceAllocationSettingDataHandler.class).to(VCloudResourceAllocationSettingDataHandler.class);
+ installDefaultVCloudEndpointsModule();
+ bind(new TypeLiteral<Function<ReferenceType, Location>>() {
+ }).to(new TypeLiteral<FindLocationForResource>() {
+ });
+ bind(new TypeLiteral<Function<Org, Iterable<Catalog>>>() {
+ }).to(new TypeLiteral<CatalogsInOrg>() {
+ });
+ bind(new TypeLiteral<Function<Org, Iterable<VDC>>>() {
+ }).to(new TypeLiteral<VDCsInOrg>() {
+ });
+ bind(new TypeLiteral<Function<Iterable<String>, Iterable<Org>>>() {
+ }).to(new TypeLiteral<OrgsForNames>() {
+ });
+ bind(new TypeLiteral<Function<Iterable<Location>, Iterable<Org>>>() {
+ }).to(new TypeLiteral<OrgsForLocations>() {
+ });
+ bind(new TypeLiteral<Function<Catalog, Iterable<CatalogItem>>>() {
+ }).to(new TypeLiteral<CatalogItemsInCatalog>() {
+ });
+ bind(new TypeLiteral<Function<Org, Iterable<CatalogItem>>>() {
+ }).to(new TypeLiteral<CatalogItemsInOrg>() {
+ });
+
+ bindCacheLoaders();
+
+ bind(new TypeLiteral<Function<VAppTemplate, String>>() {
+ }).annotatedWith(Network.class).to(new TypeLiteral<DefaultNetworkNameInTemplate>() {
+ });
+
+ bind(new TypeLiteral<Function<VAppTemplate, Envelope>>() {
+ }).to(new TypeLiteral<ValidateVAppTemplateAndReturnEnvelopeOrThrowIllegalArgumentException>() {
+ });
+ bindHttpApi(binder(), VCloudApi.class);
+ bindHttpApi(binder(), VCloudVersionsApi.class);
+ bindHttpApi(binder(), VCloudLoginApi.class);
+ }
+
+ protected void bindCacheLoaders() {
+ bind(new TypeLiteral<CacheLoader<URI, VAppTemplate>>() {
+ }).to(new TypeLiteral<VAppTemplateLoader>() {
+ });
+
+ bind(new TypeLiteral<CacheLoader<URI, Envelope>>() {
+ }).to(new TypeLiteral<OVFLoader>() {
+ });
+ }
+
+ @Provides
+ @Singleton
+ @org.jclouds.vcloud.endpoints.VDC
+ protected Supplier<Map<String, String>> provideVDCtoORG(Supplier<Map<String, Org>> orgNameToOrgSupplier) {
+ return Suppliers.compose(new Function<Map<String, Org>, Map<String, String>>() {
+
+ @Override
+ public Map<String, String> apply(Map<String, Org> arg0) {
+ Builder<String, String> returnVal = ImmutableMap.builder();
+ for (Entry<String, Org> orgr : arg0.entrySet()) {
+ for (String vdc : orgr.getValue().getVDCs().keySet()) {
+ returnVal.put(vdc, orgr.getKey());
+ }
+ }
+ return returnVal.build();
+ }
+ }, orgNameToOrgSupplier);
+
+ }
+
+ @Provides
+ @Singleton
+ protected Supplier<Map<String, Org>> provideOrgMapCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
+ AtomicReference<AuthorizationException> authException, OrgMapSupplier supplier) {
+ return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, supplier, seconds,
+ TimeUnit.SECONDS);
+ }
+
+ @Provides
+ @Singleton
+ @OrgList
+ protected Supplier<URI> provideOrgListURI(Supplier<VCloudSession> sessionSupplier) {
+ return Suppliers.compose(new Function<VCloudSession, URI>() {
+
+ @Override
+ public URI apply(VCloudSession arg0) {
+ return URI.create(getLast(arg0.getOrgs().values()).getHref().toASCIIString().replaceAll("org/.*", "org"));
+ }
+
+ @Override
+ public String toString() {
+ return "orgListURI()";
+ }
+
+ }, sessionSupplier);
+ }
+
+ @Singleton
+ public static class OrgMapSupplier implements Supplier<Map<String, Org>> {
+ protected final Supplier<VCloudSession> sessionSupplier;
+ protected final Function<Iterable<String>, Iterable<Org>> organizationsForNames;
+
+ @Inject
+ protected OrgMapSupplier(Supplier<VCloudSession> sessionSupplier,
+ Function<Iterable<String>, Iterable<Org>> organizationsForNames) {
+ this.sessionSupplier = sessionSupplier;
+ this.organizationsForNames = organizationsForNames;
+ }
+
+ @Override
+ public Map<String, Org> get() {
+ return uniqueIndex(organizationsForNames.apply(sessionSupplier.get().getOrgs().keySet()), name);
+ }
+ }
+
+ protected void installDefaultVCloudEndpointsModule() {
+ install(new DefaultVCloudReferencesModule());
+ }
+
+ @Singleton
+ public static class OrgCatalogSupplier implements
+ Supplier<Map<String, Map<String, Catalog>>> {
+ protected final Supplier<Map<String, Org>> orgSupplier;
+ protected final Function<Org, Iterable<Catalog>> allCatalogsInOrg;
+
+ @Inject
+ protected OrgCatalogSupplier(Supplier<Map<String, Org>> orgSupplier,
+ Function<Org, Iterable<Catalog>> allCatalogsInOrg) {
+ this.orgSupplier = orgSupplier;
+ this.allCatalogsInOrg = allCatalogsInOrg;
+ }
+
+ @Override
+ public Map<String, Map<String, Catalog>> get() {
+ return transformValues(transformValues(orgSupplier.get(), allCatalogsInOrg),
+ new Function<Iterable<? extends Catalog>, Map<String, Catalog>>() {
+
+ @Override
+ public Map<String, Catalog> apply(Iterable<? extends Catalog> from) {
+ return ImmutableMap.copyOf(uniqueIndex(from, name));
+ }
+
+ });
+ }
+ }
+
+ @VCloudToken
+ @Provides
+ @Singleton
+ Supplier<String> provideVCloudToken(Supplier<VCloudSession> cache) {
+ return Suppliers.compose(new Function<VCloudSession, String>() {
+
+ @Override
+ public String apply(VCloudSession input) {
+ return checkNotNull(input.getVCloudToken(), "No token present in session");
+ }
+ }, cache);
+ }
+
+ @Provides
+ @org.jclouds.vcloud.endpoints.Org
+ @Singleton
+ protected Supplier<Map<String, ReferenceType>> provideVDCtoORG(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
+ AtomicReference<AuthorizationException> authException, OrgNameToOrgSupplier supplier) {
+ return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, supplier, seconds,
+ TimeUnit.SECONDS);
+ }
+
+ @Provides
+ @Singleton
+ protected Supplier<Map<URI, VDC>> provideURIToVDC(
+ @Named(PROPERTY_SESSION_INTERVAL) long seconds, AtomicReference<AuthorizationException> authException,
+ URItoVDC supplier) {
+ return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, supplier, seconds,
+ TimeUnit.SECONDS);
+ }
+
+ @Singleton
+ public static class URItoVDC implements Supplier<Map<URI, VDC>> {
+ private final Supplier<Map<String, Map<String, VDC>>> orgVDCMap;
+
+ @Inject
+ URItoVDC(Supplier<Map<String, Map<String, VDC>>> orgVDCMap) {
+ this.orgVDCMap = orgVDCMap;
+ }
+
+ @Override
+ public Map<URI, VDC> get() {
+ return uniqueIndex(concat(transform(orgVDCMap.get().values(),
+ new Function<Map<String, VDC>, Iterable<VDC>>() {
+
+ @Override
+ public Iterable<VDC> apply(
+ Map<String, VDC> from) {
+ return from.values();
+ }
+
+ })), new Function<VDC, URI>() {
+
+ @Override
+ public URI apply(VDC from) {
+ return from.getHref();
+ }
+
+ });
+ }
+
+ }
+
+ static final Function<ReferenceType, String> name = new Function<ReferenceType, String>() {
+
+ @Override
+ public String apply(ReferenceType from) {
+ return from.getName();
+ }
+
+ };
+
+ @Provides
+ @Singleton
+ @org.jclouds.vcloud.endpoints.VCloudLogin
+ protected Supplier<URI> provideAuthenticationURI(final VCloudVersionsApi versionService,
+ @ApiVersion final String version) {
+ return new Supplier<URI>() {
+
+ @Override
+ public URI get() {
+ SortedMap<String, URI> versions = versionService.getSupportedVersions();
+ checkState(versions.size() > 0, "No versions present");
+ checkState(versions.containsKey(version), "version " + version + " not present in: " + versions);
+ return versions.get(version);
+ }
+
+ public String toString() {
+ return "login()";
+ }
+ };
+ }
+
+ @Singleton
+ private static class OrgNameToOrgSupplier implements Supplier<Map<String, ReferenceType>> {
+ private final Supplier<VCloudSession> sessionSupplier;
+
+ @Inject
+ OrgNameToOrgSupplier(Supplier<VCloudSession> sessionSupplier) {
+ this.sessionSupplier = sessionSupplier;
+ }
+
+ @Override
+ public Map<String, ReferenceType> get() {
+ return sessionSupplier.get().getOrgs();
+ }
+
+ }
+
+ @Provides
+ @Singleton
+ protected Supplier<Org> provideOrg(final Supplier<Map<String, Org>> orgSupplier,
+ @org.jclouds.vcloud.endpoints.Org Supplier<ReferenceType> defaultOrg) {
+ return Suppliers.compose(new Function<ReferenceType, Org>() {
+
+ @Override
+ public Org apply(ReferenceType input) {
+ return orgSupplier.get().get(input.getName());
+
+ }
+ }, defaultOrg);
+ }
+
+ @Provides
+ @Singleton
+ protected Predicate<URI> successTester(Injector injector,
+ @Named(PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED) long completed) {
+ return retry(injector.getInstance(TaskSuccess.class), completed);
+ }
+
+ @Provides
+ @Singleton
+ protected Supplier<Map<String, Map<String, Catalog>>> provideOrgCatalogItemMapSupplierCache(
+ @Named(PROPERTY_SESSION_INTERVAL) long seconds, AtomicReference<AuthorizationException> authException,
+ OrgCatalogSupplier supplier) {
+ return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, supplier, seconds,
+ TimeUnit.SECONDS);
+ }
+
+ @Provides
+ @Singleton
+ protected Supplier<Map<String, Map<String, VDC>>> provideOrgVDCSupplierCache(
+ @Named(PROPERTY_SESSION_INTERVAL) long seconds, AtomicReference<AuthorizationException> authException,
+ OrgVDCSupplier supplier) {
+ return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, supplier, seconds,
+ TimeUnit.SECONDS);
+ }
+
+ @Singleton
+ public static class OrgVDCSupplier implements Supplier<Map<String, Map<String, VDC>>> {
+ protected final Supplier<Map<String, Org>> orgSupplier;
+ private final Function<Org, Iterable<VDC>> allVDCsInOrg;
+
+ @Inject
+ protected OrgVDCSupplier(Supplier<Map<String, Org>> orgSupplier,
+ Function<Org, Iterable<VDC>> allVDCsInOrg) {
+ this.orgSupplier = orgSupplier;
+ this.allVDCsInOrg = allVDCsInOrg;
+ }
+
+ @Override
+ public Map<String, Map<String, VDC>> get() {
+ return transformValues(transformValues(orgSupplier.get(), allVDCsInOrg),
+ new Function<Iterable<? extends VDC>, Map<String, VDC>>() {
+
+ @Override
+ public Map<String, VDC> apply(
+ Iterable<? extends VDC> from) {
+ return uniqueIndex(Lists.newArrayList(from), name);
+ }
+
+ });
+ }
+ }
+
+ @Singleton
+ public static class OrgCatalogItemSupplier implements
+ Supplier<Map<String, Map<String, Map<String, CatalogItem>>>> {
+ protected final Supplier<Map<String, Map<String, Catalog>>> catalogSupplier;
+ protected final Function<Catalog, Iterable<CatalogItem>> allCatalogItemsInCatalog;
+
+ @Inject
+ protected OrgCatalogItemSupplier(
+ Supplier<Map<String, Map<String, Catalog>>> catalogSupplier,
+ Function<Catalog, Iterable<CatalogItem>> allCatalogItemsInCatalog) {
+ this.catalogSupplier = catalogSupplier;
+ this.allCatalogItemsInCatalog = allCatalogItemsInCatalog;
+ }
+
+ @Override
+ public Map<String, Map<String, Map<String, CatalogItem>>> get() {
+ return transformValues(
+ catalogSupplier.get(),
+ new Function<Map<String, Catalog>, Map<String, Map<String, CatalogItem>>>() {
+
+ @Override
+ public Map<String, Map<String, CatalogItem>> apply(
+ Map<String, Catalog> from) {
+ return transformValues(
+ from,
+ new Function<Catalog, Map<String, CatalogItem>>() {
+
+ @Override
+ public Map<String, CatalogItem> apply(Catalog from) {
+ return uniqueIndex(filter(allCatalogItemsInCatalog.apply(from), notNull()), name);
+ }
+ });
+
+ }
+ });
+ }
+ }
+
+ @Provides
+ @Singleton
+ protected Supplier<Map<String, Map<String, Map<String, CatalogItem>>>> provideOrgCatalogItemSupplierCache(
+ @Named(PROPERTY_SESSION_INTERVAL) long seconds, AtomicReference<AuthorizationException> authException,
+ OrgCatalogItemSupplier supplier) {
+ return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, supplier, seconds,
+ TimeUnit.SECONDS);
+ }
+
+ @Provides
+ @Singleton
+ protected FenceMode defaultFenceMode(@Named(PROPERTY_VCLOUD_DEFAULT_FENCEMODE) String fenceMode) {
+ return FenceMode.fromValue(fenceMode);
+ }
+
+ @Provides
+ @Singleton
+ protected LoadingCache<URI, VAppTemplate> vAppTemplates(CacheLoader<URI, VAppTemplate> vAppTemplates) {
+ return CacheBuilder.newBuilder().build(vAppTemplates);
+ }
+
+ @Provides
+ @Singleton
+ protected LoadingCache<URI, Envelope> envelopes(CacheLoader<URI, Envelope> envelopes) {
+ return CacheBuilder.newBuilder().build(envelopes);
+ }
+
+ @Override
+ protected void bindErrorHandlers() {
+ bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseVCloudErrorFromHttpResponse.class);
+ bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseVCloudErrorFromHttpResponse.class);
+ bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseVCloudErrorFromHttpResponse.class);
+ }
+
+ @Override
+ protected void installLocations() {
+ super.installLocations();
+ bind(ImplicitLocationSupplier.class).to(DefaultVDC.class).in(Scopes.SINGLETON);
+ bind(LocationsSupplier.class).to(OrgAndVDCToLocationSupplier.class).in(Scopes.SINGLETON);
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/AllocationModel.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/AllocationModel.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/AllocationModel.java
new file mode 100644
index 0000000..aadb475
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/AllocationModel.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import com.google.common.base.CaseFormat;
+
+/**
+ * The AllocationModel element defines how resources are allocated in a vDC.
+ */
+public enum AllocationModel {
+ /**
+ * Resources are committed to a vDC only when vApps are created in it
+ */
+ ALLOCATION_VAPP,
+ /**
+ * Only a percentage of the resources you allocate are committed to the organization vDC.
+ */
+ ALLOCATION_POOL,
+ /**
+ * All the resources you allocate are committed as a pool to the organization vDC. vApps in vDCs
+ * that support this allocation model can specify values for resource and limit.
+ */
+ RESERVATION_POOL,
+ /**
+ * The VCloud API returned a model unsupported in the version 1.0 spec.
+ */
+ UNRECOGNIZED;
+
+ public String value() {
+ switch (this) {
+ case ALLOCATION_VAPP:
+ return "AllocationVApp";
+ case ALLOCATION_POOL:
+ return "AllocationPool";
+ case RESERVATION_POOL:
+ return "ReservationPool";
+ default:
+ return "UnrecognizedModel";
+ }
+ }
+
+ @Override
+ public String toString() {
+ return value();
+ }
+
+ public static AllocationModel fromValue(String model) {
+ try {
+ return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(model, "model")));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Capacity.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Capacity.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Capacity.java
new file mode 100644
index 0000000..73dd761
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Capacity.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain;
+
+/**
+ * reports storage resource consumption in a vDC.
+ */
+public class Capacity {
+
+ private final String units;
+ private final long allocated;
+ private final long limit;
+ private final int used;
+ private final long overhead;
+
+ public Capacity(String units, long allocated, long limit, int used, long overhead) {
+ this.units = units;
+ this.limit = limit;
+ this.allocated = allocated;
+ this.used = used;
+ this.overhead = overhead;
+ }
+
+ public String getUnits() {
+ return units;
+ }
+
+ public long getAllocated() {
+ return allocated;
+ }
+
+ public long getLimit() {
+ return limit;
+ }
+
+ /**
+ * percentage of the allocation in use.
+ */
+ public int getUsed() {
+ return used;
+ }
+
+ /**
+ * number of Units allocated to vShield Manager virtual machines provisioned from this vDC.
+ */
+ public long getOverhead() {
+ return overhead;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (allocated ^ (allocated >>> 32));
+ result = prime * result + (int) (limit ^ (limit >>> 32));
+ result = prime * result + (int) (overhead ^ (overhead >>> 32));
+ result = prime * result + ((units == null) ? 0 : units.hashCode());
+ result = prime * result + used;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Capacity other = (Capacity) obj;
+ if (allocated != other.allocated)
+ return false;
+ if (limit != other.limit)
+ return false;
+ if (overhead != other.overhead)
+ return false;
+ if (units == null) {
+ if (other.units != null)
+ return false;
+ } else if (!units.equals(other.units))
+ return false;
+ if (used != other.used)
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "[allocated=" + allocated + ", limit=" + limit + ", overhead=" + overhead + ", units=" + units + ", used="
+ + used + "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Catalog.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Catalog.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Catalog.java
new file mode 100644
index 0000000..5e29851
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Catalog.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain;
+
+import java.util.List;
+import java.util.Map;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.internal.CatalogImpl;
+
+import com.google.inject.ImplementedBy;
+
+@org.jclouds.vcloud.endpoints.Catalog
+@ImplementedBy(CatalogImpl.class)
+public interface Catalog extends ReferenceType, Map<String, ReferenceType> {
+ /**
+ * Reference to the org containing this vDC.
+ *
+ * @since vcloud api 1.0
+ * @return org, or null if this is a version before 1.0 where the org isn't present
+ */
+ ReferenceType getOrg();
+
+ /**
+ * optional description
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ String getDescription();
+
+ /**
+ * read‐only element, true if the catalog is published
+ *
+ * @since vcloud api 1.0
+ */
+ boolean isPublished();
+
+ /**
+ * @return true, if the current user cannot modify the catalog
+ * @since vcloud api 1.0
+ */
+ boolean isReadOnly();
+
+ /**
+ * read‐only container for Task elements. Each element in the container represents a queued,
+ * running, or failed task owned by this object.
+ *
+ * @since vcloud api 1.0
+ */
+ List<Task> getTasks();
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/CatalogItem.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/CatalogItem.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/CatalogItem.java
new file mode 100644
index 0000000..dc94dbd
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/CatalogItem.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain;
+
+import java.util.Map;
+
+import org.jclouds.vcloud.domain.internal.CatalogItemImpl;
+
+import com.google.inject.ImplementedBy;
+
+@ImplementedBy(CatalogItemImpl.class)
+public interface CatalogItem extends ReferenceType {
+
+ String getDescription();
+
+ ReferenceType getEntity();
+
+ Map<String, String> getProperties();
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/GuestCustomizationSection.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/GuestCustomizationSection.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/GuestCustomizationSection.java
new file mode 100644
index 0000000..b72c8ca
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/GuestCustomizationSection.java
@@ -0,0 +1,440 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain;
+
+import java.net.URI;
+
+import org.jclouds.vcloud.VCloudMediaType;
+
+/**
+ * The GuestCustomization of a Vm contains customization parameters for the guest operating system
+ * of the virtual machine.
+ */
+public class GuestCustomizationSection {
+ protected final String type;
+ protected final URI href;
+ protected String info;
+ protected Boolean enabled;
+ protected Boolean changeSid;
+ protected String virtualMachineId;
+ protected Boolean joinDomainEnabled;
+ protected Boolean useOrgSettings;
+ protected String domainName;
+ protected String domainUserName;
+ protected String domainUserPassword;
+ protected Boolean adminPasswordEnabled;
+ protected Boolean adminPasswordAuto;
+ protected String adminPassword;
+ protected Boolean resetPasswordRequired;
+ protected String customizationScript;
+ protected String computerName;
+ protected final ReferenceType edit;
+
+ public GuestCustomizationSection(URI href) {
+ this.href = href;
+ this.type = VCloudMediaType.GUESTCUSTOMIZATIONSECTION_XML;
+ this.info = "Specifies Guest OS Customization Settings";
+ this.edit = null;
+ }
+
+ public GuestCustomizationSection(String type, URI href, String info, Boolean enabled, Boolean changeSid,
+ String virtualMachineId, Boolean joinDomainEnabled, Boolean useOrgSettings, String domainName,
+ String domainUserName, String domainUserPassword, Boolean adminPasswordEnabled, Boolean adminPasswordAuto,
+ String adminPassword, Boolean resetPasswordRequired, String customizationScript, String computerName,
+ ReferenceType edit) {
+ this.type = type;
+ this.href = href;
+ this.info = info;
+ this.enabled = enabled;
+ this.changeSid = changeSid;
+ this.virtualMachineId = virtualMachineId;
+ this.joinDomainEnabled = joinDomainEnabled;
+ this.useOrgSettings = useOrgSettings;
+ this.domainName = domainName;
+ this.domainUserName = domainUserName;
+ this.domainUserPassword = domainUserPassword;
+ this.adminPasswordEnabled = adminPasswordEnabled;
+ this.adminPasswordAuto = adminPasswordAuto;
+ this.adminPassword = adminPassword;
+ this.resetPasswordRequired = resetPasswordRequired;
+ this.customizationScript = customizationScript;
+ this.computerName = computerName;
+ this.edit = edit;
+ }
+
+ /**
+ *
+ * @return media type of this section
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ *
+ * @return URL to access this section
+ */
+ public URI getHref() {
+ return href;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getInfo() {
+ return info;
+ }
+
+ /**
+ *
+ * @return if true, to enable guest customization at power on
+ */
+ public Boolean isEnabled() {
+ return enabled;
+ }
+
+ /**
+ *
+ * @return if true, customization will run sysprep to change the Windows SID for this virtual
+ * machine
+ */
+ public Boolean shouldChangeSid() {
+ return changeSid;
+ }
+
+ /**
+ *
+ * @return unique identifier for this virtual machine
+ */
+ public String getVirtualMachineId() {
+ return virtualMachineId;
+ }
+
+ /**
+ *
+ * @return if true, this virtual machine can join a Windows domain
+ */
+ public Boolean isJoinDomainEnabled() {
+ return joinDomainEnabled;
+ }
+
+ /**
+ *
+ * @return if true, this virtual machine uses the containing organization’s default values for
+ * Windows domain name, domain user name, and domain user password
+ */
+ public Boolean useOrgSettings() {
+ return useOrgSettings;
+ }
+
+ /**
+ *
+ * @return if UseOrgSettings is false, specifies the Windows domain to join
+ */
+ public String getDomainName() {
+ return domainName;
+ }
+
+ /**
+ *
+ * @return if UseOrgSettings is false, specifies the Windows domain user name
+ */
+ public String getDomainUserName() {
+ return domainUserName;
+ }
+
+ /**
+ *
+ * @return if UseOrgSettings is false, specifies the Windows domain user’s password
+ */
+ public String getDomainUserPassword() {
+ return domainUserPassword;
+ }
+
+ /**
+ *
+ * @return true if the guest OS allows use of a local administrator password
+ */
+ public Boolean isAdminPasswordEnabled() {
+ return adminPasswordEnabled;
+ }
+
+ /**
+ *
+ * @return true if the local administrator password should be automatically generated
+ */
+ public Boolean isAdminPasswordAuto() {
+ return adminPasswordAuto;
+ }
+
+ /**
+ *
+ * @return local administrator password for this virtual machine
+ */
+ public String getAdminPassword() {
+ return adminPassword;
+ }
+
+ /**
+ *
+ * @return if true, the local administrator must reset his password on first use
+ */
+ public Boolean isResetPasswordRequired() {
+ return resetPasswordRequired;
+ }
+
+ /**
+ *
+ * @return the customization script to run
+ */
+ public String getCustomizationScript() {
+ return customizationScript;
+ }
+
+ /**
+ *
+ * @return name of this virtual machine in DNS or Windows domain
+ */
+ public String getComputerName() {
+ return computerName;
+ }
+
+ /**
+ *
+ * @return edit link
+ */
+ public ReferenceType getEdit() {
+ return edit;
+ }
+
+ @Override
+ public String toString() {
+ return "[href=" + getHref() + ", type=" + getType() + ", info=" + getInfo() + ", enabled=" + isEnabled() + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ int prime = 31;
+ int result = 1;
+ result = prime * result + ((adminPassword == null) ? 0 : adminPassword.hashCode());
+ result = prime * result + ((adminPasswordAuto == null) ? 0 : adminPasswordAuto.hashCode());
+ result = prime * result + ((adminPasswordEnabled == null) ? 0 : adminPasswordEnabled.hashCode());
+ result = prime * result + ((changeSid == null) ? 0 : changeSid.hashCode());
+ result = prime * result + ((computerName == null) ? 0 : computerName.hashCode());
+ result = prime * result + ((customizationScript == null) ? 0 : customizationScript.hashCode());
+ result = prime * result + ((domainName == null) ? 0 : domainName.hashCode());
+ result = prime * result + ((domainUserName == null) ? 0 : domainUserName.hashCode());
+ result = prime * result + ((domainUserPassword == null) ? 0 : domainUserPassword.hashCode());
+ result = prime * result + ((edit == null) ? 0 : edit.hashCode());
+ result = prime * result + ((enabled == null) ? 0 : enabled.hashCode());
+ result = prime * result + ((href == null) ? 0 : href.hashCode());
+ result = prime * result + ((info == null) ? 0 : info.hashCode());
+ result = prime * result + ((joinDomainEnabled == null) ? 0 : joinDomainEnabled.hashCode());
+ result = prime * result + ((resetPasswordRequired == null) ? 0 : resetPasswordRequired.hashCode());
+ result = prime * result + ((type == null) ? 0 : type.hashCode());
+ result = prime * result + ((useOrgSettings == null) ? 0 : useOrgSettings.hashCode());
+ result = prime * result + ((virtualMachineId == null) ? 0 : virtualMachineId.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ GuestCustomizationSection other = (GuestCustomizationSection) obj;
+ if (adminPassword == null) {
+ if (other.adminPassword != null)
+ return false;
+ } else if (!adminPassword.equals(other.adminPassword))
+ return false;
+ if (adminPasswordAuto == null) {
+ if (other.adminPasswordAuto != null)
+ return false;
+ } else if (!adminPasswordAuto.equals(other.adminPasswordAuto))
+ return false;
+ if (adminPasswordEnabled == null) {
+ if (other.adminPasswordEnabled != null)
+ return false;
+ } else if (!adminPasswordEnabled.equals(other.adminPasswordEnabled))
+ return false;
+ if (changeSid == null) {
+ if (other.changeSid != null)
+ return false;
+ } else if (!changeSid.equals(other.changeSid))
+ return false;
+ if (computerName == null) {
+ if (other.computerName != null)
+ return false;
+ } else if (!computerName.equals(other.computerName))
+ return false;
+ if (customizationScript == null) {
+ if (other.customizationScript != null)
+ return false;
+ } else if (!customizationScript.equals(other.customizationScript))
+ return false;
+ if (domainName == null) {
+ if (other.domainName != null)
+ return false;
+ } else if (!domainName.equals(other.domainName))
+ return false;
+ if (domainUserName == null) {
+ if (other.domainUserName != null)
+ return false;
+ } else if (!domainUserName.equals(other.domainUserName))
+ return false;
+ if (domainUserPassword == null) {
+ if (other.domainUserPassword != null)
+ return false;
+ } else if (!domainUserPassword.equals(other.domainUserPassword))
+ return false;
+ if (edit == null) {
+ if (other.edit != null)
+ return false;
+ } else if (!edit.equals(other.edit))
+ return false;
+ if (enabled == null) {
+ if (other.enabled != null)
+ return false;
+ } else if (!enabled.equals(other.enabled))
+ return false;
+ if (href == null) {
+ if (other.href != null)
+ return false;
+ } else if (!href.equals(other.href))
+ return false;
+ if (info == null) {
+ if (other.info != null)
+ return false;
+ } else if (!info.equals(other.info))
+ return false;
+ if (joinDomainEnabled == null) {
+ if (other.joinDomainEnabled != null)
+ return false;
+ } else if (!joinDomainEnabled.equals(other.joinDomainEnabled))
+ return false;
+ if (resetPasswordRequired == null) {
+ if (other.resetPasswordRequired != null)
+ return false;
+ } else if (!resetPasswordRequired.equals(other.resetPasswordRequired))
+ return false;
+ if (type == null) {
+ if (other.type != null)
+ return false;
+ } else if (!type.equals(other.type))
+ return false;
+ if (useOrgSettings == null) {
+ if (other.useOrgSettings != null)
+ return false;
+ } else if (!useOrgSettings.equals(other.useOrgSettings))
+ return false;
+ if (virtualMachineId == null) {
+ if (other.virtualMachineId != null)
+ return false;
+ } else if (!virtualMachineId.equals(other.virtualMachineId))
+ return false;
+ return true;
+ }
+
+ public void setEnabled(Boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ public Boolean getChangeSid() {
+ return changeSid;
+ }
+
+ public void setChangeSid(Boolean changeSid) {
+ this.changeSid = changeSid;
+ }
+
+ public Boolean getJoinDomainEnabled() {
+ return joinDomainEnabled;
+ }
+
+ public void setJoinDomainEnabled(Boolean joinDomainEnabled) {
+ this.joinDomainEnabled = joinDomainEnabled;
+ }
+
+ public Boolean shouldUseOrgSettings() {
+ return useOrgSettings;
+ }
+
+ public void setUseOrgSettings(Boolean useOrgSettings) {
+ this.useOrgSettings = useOrgSettings;
+ }
+
+ public Boolean getAdminPasswordEnabled() {
+ return adminPasswordEnabled;
+ }
+
+ public void setAdminPasswordEnabled(Boolean adminPasswordEnabled) {
+ this.adminPasswordEnabled = adminPasswordEnabled;
+ }
+
+ public Boolean getAdminPasswordAuto() {
+ return adminPasswordAuto;
+ }
+
+ public void setAdminPasswordAuto(Boolean adminPasswordAuto) {
+ this.adminPasswordAuto = adminPasswordAuto;
+ }
+
+ public Boolean getResetPasswordRequired() {
+ return resetPasswordRequired;
+ }
+
+ public void setResetPasswordRequired(Boolean resetPasswordRequired) {
+ this.resetPasswordRequired = resetPasswordRequired;
+ }
+
+ public void setInfo(String info) {
+ this.info = info;
+ }
+
+ public void setVirtualMachineId(String virtualMachineId) {
+ this.virtualMachineId = virtualMachineId;
+ }
+
+ public void setDomainName(String domainName) {
+ this.domainName = domainName;
+ }
+
+ public void setDomainUserName(String domainUserName) {
+ this.domainUserName = domainUserName;
+ }
+
+ public void setDomainUserPassword(String domainUserPassword) {
+ this.domainUserPassword = domainUserPassword;
+ }
+
+ public void setAdminPassword(String adminPassword) {
+ this.adminPassword = adminPassword;
+ }
+
+ public void setCustomizationScript(String customizationScript) {
+ this.customizationScript = customizationScript;
+ }
+
+ public void setComputerName(String computerName) {
+ this.computerName = computerName;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/InstantiateVAppTemplateParams.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/InstantiateVAppTemplateParams.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/InstantiateVAppTemplateParams.java
new file mode 100644
index 0000000..4b024df
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/InstantiateVAppTemplateParams.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain;
+
+import java.util.Set;
+
+import org.jclouds.cim.ResourceAllocationSettingData;
+import org.jclouds.cim.VirtualSystemSettingData;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Sets;
+
+/**
+ * The InstantiateVAppTemplateParams element forms the body of an instantiateVappTemplate request.
+ */
+public class InstantiateVAppTemplateParams {
+
+ protected final String info;
+ protected final VirtualSystemSettingData virtualSystem;
+ protected final Set<ResourceAllocationSettingData> resourceAllocations = Sets.newLinkedHashSet();
+
+ public InstantiateVAppTemplateParams(String info, VirtualSystemSettingData virtualSystem, Iterable<ResourceAllocationSettingData> resourceAllocations) {
+ this.info = info;
+ this.virtualSystem = virtualSystem;
+ Iterables.addAll(this.resourceAllocations, resourceAllocations);
+ }
+
+ public String getInfo() {
+ return info;
+ }
+
+ public VirtualSystemSettingData getSystem() {
+ return virtualSystem;
+ }
+
+ public Set<ResourceAllocationSettingData> getResourceAllocationSettingDatas() {
+ return resourceAllocations;
+ }
+
+ @Override
+ public String toString() {
+ return "[info=" + getInfo() + ", virtualSystem=" + getSystem() + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((info == null) ? 0 : info.hashCode());
+ result = prime * result + ((resourceAllocations == null) ? 0 : resourceAllocations.hashCode());
+ result = prime * result + ((virtualSystem == null) ? 0 : virtualSystem.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ InstantiateVAppTemplateParams other = (InstantiateVAppTemplateParams) obj;
+ if (info == null) {
+ if (other.info != null)
+ return false;
+ } else if (!info.equals(other.info))
+ return false;
+ if (resourceAllocations == null) {
+ if (other.resourceAllocations != null)
+ return false;
+ } else if (!resourceAllocations.equals(other.resourceAllocations))
+ return false;
+ if (virtualSystem == null) {
+ if (other.virtualSystem != null)
+ return false;
+ } else if (!virtualSystem.equals(other.virtualSystem))
+ return false;
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/NetworkConnection.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/NetworkConnection.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/NetworkConnection.java
new file mode 100644
index 0000000..34aa342
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/NetworkConnection.java
@@ -0,0 +1,231 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.network.IpAddressAllocationMode;
+
+/**
+ * describes a single network connection.
+ */
+public class NetworkConnection {
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static class Builder {
+
+ private String network;
+ private int networkConnectionIndex;
+ private String ipAddress;
+ private String externalIpAddress;
+ private boolean connected;
+ private String MACAddress;
+ private IpAddressAllocationMode ipAddressAllocationMode;
+
+ public Builder network(String network) {
+ this.network = network;
+ return this;
+ }
+
+ public Builder networkConnectionIndex(int networkConnectionIndex) {
+ this.networkConnectionIndex = networkConnectionIndex;
+ return this;
+ }
+
+ public Builder ipAddress(String ipAddress) {
+ this.ipAddress = ipAddress;
+ return this;
+ }
+
+ public Builder externalIpAddress(String externalIpAddress) {
+ this.externalIpAddress = externalIpAddress;
+ return this;
+ }
+
+ public Builder connected(boolean connected) {
+ this.connected = connected;
+ return this;
+ }
+
+ public Builder MACAddress(String MACAddress) {
+ this.MACAddress = MACAddress;
+ return this;
+ }
+
+ public Builder ipAddressAllocationMode(IpAddressAllocationMode ipAddressAllocationMode) {
+ this.ipAddressAllocationMode = ipAddressAllocationMode;
+ return this;
+ }
+
+ public NetworkConnection build() {
+ return new NetworkConnection(network, networkConnectionIndex, ipAddress, externalIpAddress, connected,
+ MACAddress, ipAddressAllocationMode);
+ }
+
+ public static Builder fromNetworkConnection(NetworkConnection in) {
+ return new Builder().network(in.getNetwork()).networkConnectionIndex(in.getNetworkConnectionIndex())
+ .ipAddress(in.getIpAddress()).externalIpAddress(in.getExternalIpAddress()).connected(in.isConnected())
+ .MACAddress(in.getMACAddress()).ipAddressAllocationMode(in.getIpAddressAllocationMode());
+ }
+ }
+
+ private final String network;
+ private final int networkConnectionIndex;
+ @Nullable
+ private final String ipAddress;
+ @Nullable
+ private final String externalIpAddress;
+ private final boolean connected;
+ @Nullable
+ private final String MACAddress;
+ private final IpAddressAllocationMode ipAddressAllocationMode;
+
+ public NetworkConnection(String network, int networkConnectionIndex, @Nullable String ipAddress,
+ @Nullable String externalIpAddress, boolean connected, @Nullable String MACAddress,
+ IpAddressAllocationMode ipAddressAllocationMode) {
+ this.network = network;
+ this.networkConnectionIndex = networkConnectionIndex;
+ this.ipAddress = ipAddress;
+ this.externalIpAddress = externalIpAddress;
+ this.connected = connected;
+ this.MACAddress = MACAddress;
+ this.ipAddressAllocationMode = ipAddressAllocationMode;
+ }
+
+ /**
+ * @return The name of the network to which this connection connects.
+ */
+ public String getNetwork() {
+ return network;
+ }
+
+ /**
+ * @return The value in the rasd:AddressOnParent element of the device supporting this
+ * connection.
+ */
+ public int getNetworkConnectionIndex() {
+ return networkConnectionIndex;
+ }
+
+ /**
+ * @return IP address of this connection
+ */
+ @Nullable
+ public String getIpAddress() {
+ return ipAddress;
+ }
+
+ /**
+ * @return If the network that the NIC is connected to has NAT or port mapping, the external
+ * address is populated in this element.
+ */
+ @Nullable
+ public String getExternalIpAddress() {
+ return externalIpAddress;
+ }
+
+ /**
+ * @return If the vApp is deployed, specifies the current state of its connection. If the vApp is
+ * undeployed, specifies whether this connection should be connected at deployment time.
+ */
+ public boolean isConnected() {
+ return connected;
+ }
+
+ /**
+ * @return MAC address of this connection
+ */
+ @Nullable
+ public String getMACAddress() {
+ return MACAddress;
+ }
+
+ /**
+ * @return specifies how an IP address is allocated to this connection
+ */
+ public IpAddressAllocationMode getIpAddressAllocationMode() {
+ return ipAddressAllocationMode;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((MACAddress == null) ? 0 : MACAddress.hashCode());
+ result = prime * result + (connected ? 1231 : 1237);
+ result = prime * result + ((externalIpAddress == null) ? 0 : externalIpAddress.hashCode());
+ result = prime * result + ((ipAddress == null) ? 0 : ipAddress.hashCode());
+ result = prime * result + ((ipAddressAllocationMode == null) ? 0 : ipAddressAllocationMode.hashCode());
+ result = prime * result + ((network == null) ? 0 : network.hashCode());
+ result = prime * result + networkConnectionIndex;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ NetworkConnection other = (NetworkConnection) obj;
+ if (MACAddress == null) {
+ if (other.MACAddress != null)
+ return false;
+ } else if (!MACAddress.equals(other.MACAddress))
+ return false;
+ if (connected != other.connected)
+ return false;
+ if (externalIpAddress == null) {
+ if (other.externalIpAddress != null)
+ return false;
+ } else if (!externalIpAddress.equals(other.externalIpAddress))
+ return false;
+ if (ipAddress == null) {
+ if (other.ipAddress != null)
+ return false;
+ } else if (!ipAddress.equals(other.ipAddress))
+ return false;
+ if (ipAddressAllocationMode == null) {
+ if (other.ipAddressAllocationMode != null)
+ return false;
+ } else if (!ipAddressAllocationMode.equals(other.ipAddressAllocationMode))
+ return false;
+ if (network == null) {
+ if (other.network != null)
+ return false;
+ } else if (!network.equals(other.network))
+ return false;
+ if (networkConnectionIndex != other.networkConnectionIndex)
+ return false;
+ return true;
+ }
+
+ public Builder toBuilder() {
+ return Builder.fromNetworkConnection(this);
+ }
+
+ @Override
+ public String toString() {
+ return "[network=" + network + ", connected=" + connected + ", ipAddress=" + ipAddress + ", externalIpAddress="
+ + externalIpAddress + ", networkConnectionIndex=" + networkConnectionIndex + ", ipAddressAllocationMode="
+ + ipAddressAllocationMode + ", MACAddress=" + MACAddress + "]";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/NetworkConnectionSection.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/NetworkConnectionSection.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/NetworkConnectionSection.java
new file mode 100644
index 0000000..c6f5f37
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/NetworkConnectionSection.java
@@ -0,0 +1,218 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.net.URI;
+import java.util.Set;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * The NetworkConnectionSection element specifies how a Vm is connected to a vApp network. It
+ * extends the ovf:NetworkConnection element.
+ * <p/>
+ * NOTE The OVF NetworkSection element and the vCloud API NetworkConnectionSection element specify
+ * many of the same parameters for a network connection. If both are present in a Vm body, the
+ * values specified in the NetworkConnectionSection override those specified in the NetworkSection.
+ */
+public class NetworkConnectionSection {
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static class Builder {
+ protected String type;
+ protected URI href;
+ protected String info;
+ protected Integer primaryNetworkConnectionIndex;
+ protected Set<NetworkConnection> connections = ImmutableSet.of();
+ protected ReferenceType edit;
+
+ public Builder type(String type) {
+ this.type = type;
+ return this;
+ }
+
+ public Builder href(URI href) {
+ this.href = href;
+ return this;
+ }
+
+ public Builder info(String info) {
+ this.info = info;
+ return this;
+ }
+
+ public Builder primaryNetworkConnectionIndex(Integer primaryNetworkConnectionIndex) {
+ this.primaryNetworkConnectionIndex = primaryNetworkConnectionIndex;
+ return this;
+ }
+
+ public Builder connections(Iterable<NetworkConnection> connections) {
+ this.connections = ImmutableSet.copyOf(checkNotNull(connections, "connections"));
+ return this;
+ }
+
+ public Builder edit(ReferenceType edit) {
+ this.edit = edit;
+ return this;
+ }
+
+ public NetworkConnectionSection build() {
+ return new NetworkConnectionSection(type, href, info, primaryNetworkConnectionIndex, connections, edit);
+ }
+
+ public static Builder fromNetworkConnectionSection(NetworkConnectionSection in) {
+ return new Builder().type(in.getType()).href(in.getHref()).info(in.getInfo())
+ .primaryNetworkConnectionIndex(in.getPrimaryNetworkConnectionIndex()).connections(in.getConnections())
+ .edit(in.getEdit());
+ }
+ }
+
+ protected final String type;
+ protected final URI href;
+ protected final String info;
+ protected final Integer primaryNetworkConnectionIndex;
+ protected final Set<NetworkConnection> connections;
+ protected final ReferenceType edit;
+
+ public NetworkConnectionSection(String type, URI href, String info, Integer primaryNetworkConnectionIndex,
+ Iterable<NetworkConnection> connections, ReferenceType edit) {
+ this.type = type;
+ this.href = href;
+ this.info = info;
+ this.primaryNetworkConnectionIndex = primaryNetworkConnectionIndex;
+ this.connections = ImmutableSet.copyOf(checkNotNull(connections, "connections"));
+ this.edit = edit;
+ }
+
+ /**
+ *
+ * @return media type of this section
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ *
+ * @return URL to access this section
+ */
+ public URI getHref() {
+ return href;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getInfo() {
+ return info;
+ }
+
+ /**
+ *
+ * @return The value of the rasd:AddressOnParent element of the device (NIC) supporting the
+ * primary network connection to the containing virtual machine.
+ */
+ public Integer getPrimaryNetworkConnectionIndex() {
+ return primaryNetworkConnectionIndex;
+ }
+
+ /**
+ *
+ */
+ public Set<NetworkConnection> getConnections() {
+ return connections;
+ }
+
+ /**
+ *
+ */
+ public ReferenceType getEdit() {
+ return edit;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((connections == null) ? 0 : connections.hashCode());
+ result = prime * result + ((edit == null) ? 0 : edit.hashCode());
+ result = prime * result + ((href == null) ? 0 : href.hashCode());
+ result = prime * result + ((info == null) ? 0 : info.hashCode());
+ result = prime * result
+ + ((primaryNetworkConnectionIndex == null) ? 0 : primaryNetworkConnectionIndex.hashCode());
+ result = prime * result + ((type == null) ? 0 : type.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ NetworkConnectionSection other = (NetworkConnectionSection) obj;
+ if (connections == null) {
+ if (other.connections != null)
+ return false;
+ } else if (!connections.equals(other.connections))
+ return false;
+ if (edit == null) {
+ if (other.edit != null)
+ return false;
+ } else if (!edit.equals(other.edit))
+ return false;
+ if (href == null) {
+ if (other.href != null)
+ return false;
+ } else if (!href.equals(other.href))
+ return false;
+ if (info == null) {
+ if (other.info != null)
+ return false;
+ } else if (!info.equals(other.info))
+ return false;
+ if (primaryNetworkConnectionIndex == null) {
+ if (other.primaryNetworkConnectionIndex != null)
+ return false;
+ } else if (!primaryNetworkConnectionIndex.equals(other.primaryNetworkConnectionIndex))
+ return false;
+ if (type == null) {
+ if (other.type != null)
+ return false;
+ } else if (!type.equals(other.type))
+ return false;
+ return true;
+ }
+
+ public Builder toBuilder() {
+ return Builder.fromNetworkConnectionSection(this);
+ }
+
+ @Override
+ public String toString() {
+ return "[href=" + href + ", connections=" + connections + ", primaryNetworkConnectionIndex="
+ + primaryNetworkConnectionIndex + "]";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Org.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Org.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Org.java
new file mode 100644
index 0000000..7f4ede9
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Org.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain;
+
+import java.util.List;
+import java.util.Map;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.internal.OrgImpl;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * A vCloud organization is a high-level abstraction that provides a unit of administration for
+ * objects and resources. As viewed by a user, an organization (represented by an Org element) can
+ * contain Catalog, Network, and vDC elements. If there are any queued, running, or recently
+ * completed tasks owned by a member of the organization, it also contains a TasksList element. As
+ * viewed by an administrator, an organization also contains users, groups, and other information
+ */
+@ImplementedBy(OrgImpl.class)
+public interface Org extends ReferenceType {
+ /**
+ * optional description
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ String getDescription();
+
+ /**
+ * full name of the organization
+ *
+ * @since vcloud api 1.0
+ */
+ @Nullable
+ String getFullName();
+
+ /**
+ * @since vcloud api 0.8
+ */
+ Map<String, ReferenceType> getCatalogs();
+
+ /**
+ * @since vcloud api 0.8
+ */
+ Map<String, ReferenceType> getVDCs();
+
+ /**
+ * If there are any queued, running, or recently completed tasks owned by a member of the
+ * organization, it also contains a TasksList.
+ *
+ * @since vcloud api 0.8
+ */
+ @Nullable
+ ReferenceType getTasksList();
+
+ /**
+ * @since vcloud api 1.0
+ */
+ Map<String, ReferenceType> getNetworks();
+
+ /**
+ * read‐only container for Task elements. Each element in the container represents a queued,
+ * running, or failed task owned by this object.
+ *
+ * @since vcloud api 1.0
+ */
+ List<Task> getTasks();
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ReferenceType.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ReferenceType.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ReferenceType.java
new file mode 100644
index 0000000..d36343d
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/ReferenceType.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain;
+
+import java.net.URI;
+
+import org.jclouds.vcloud.domain.internal.ReferenceTypeImpl;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * Many container elements are populated with references to contained objects. Each reference
+ * consists of a hyperlink, an optional media type, and a name.
+ */
+@ImplementedBy(ReferenceTypeImpl.class)
+public interface ReferenceType extends Comparable<ReferenceType> {
+ /**
+ * @return hyperlink to the referenced object
+ */
+ URI getHref();
+
+ /**
+ * @return name of the referenced object.
+ *
+ */
+ String getName();
+
+ /**
+ * @return object type, expressed as the media type of the XML representing of the object
+ * @see VCloudMediaType
+ */
+ String getType();
+
+ /**
+ * @return relationship to the referenced object.
+ */
+ String getRelationship();
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Status.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Status.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Status.java
new file mode 100644
index 0000000..748099b
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Status.java
@@ -0,0 +1,244 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Objects such as vAppTemplate, vApp, and Vm have a status attribute whose value indicates the
+ * state of the object. Status for an object, such as a vAppTemplate or vApp, whose Children (Vm
+ * objects) each have a status of their own, is computed from the status of the Children.
+ *
+ * <h2>NOTE</h2>
+ * <p/>
+ * The deployment status of an object is indicated by the value of its deployed attribute.
+ *
+ * @since vcloud api 0.8
+ */
+public enum Status {
+ /**
+ * The {@link VAppTemplate}, {@link VApp}, or {@link Vm} could not be created.
+ *
+ * @since vcloud api 1.0
+ */
+ ERROR,
+ /**
+ * The {@link VAppTemplate}, {@link VApp}, or {@link Vm} is unresolved.
+ *
+ * @since vcloud api 0.8
+ */
+ UNRESOLVED,
+ /**
+ * The {@link VAppTemplate}, {@link VApp}, or {@link Vm} is resolved.
+ *
+ * @since vcloud api 0.8
+ */
+ RESOLVED,
+ /**
+ * The object is deployed.
+ * <p/>
+ * note that the documentation does not reference use of this.
+ *
+ * @since vcloud api 1.0
+ */
+ DEPLOYED,
+ /**
+ * The {@link VApp} or {@link Vm} is suspended.
+ *
+ * @since vcloud api 0.8
+ */
+ SUSPENDED,
+ /**
+ * The {@link VApp} or {@link Vm} is powered on
+ *
+ * @since vcloud api 0.8
+ */
+ ON,
+ /**
+ * The {@link VApp} or {@link Vm} waiting for user input.
+ *
+ * @since vcloud api 1.0
+ */
+ WAITING_FOR_INPUT,
+ /**
+ * The {@link VAppTemplate}, {@link VApp}, or {@link Vm} is in an unknown state.
+ *
+ * @since vcloud api 1.0
+ */
+ UNKNOWN,
+ /**
+ * The {@link VAppTemplate}, {@link VApp}, or {@link Vm} is in an unrecognized state.
+ *
+ * @since vcloud api 1.0
+ */
+ UNRECOGNIZED,
+ /**
+ * The {@link VAppTemplate}, {@link VApp}, or {@link Vm} is off.
+ *
+ * @since vcloud api 0.8
+ */
+ OFF,
+ /**
+ * The {@link VApp} or {@link Vm} is in an inconsistent state.
+ *
+ * @since vcloud api 1.0
+ */
+ INCONSISTENT,
+ /**
+ * The {@link VAppTemplate} or {@link VApp} have children do not all have the same status.
+ *
+ * @since vcloud api 1.0
+ */
+ MIXED,
+ /**
+ * The {@link VAppTemplate} Upload initiated, OVF descriptor pending
+ *
+ * @since vcloud api 1.0
+ */
+ PENDING_DESCRIPTOR,
+ /**
+ * The {@link VAppTemplate} Upload initiated, copying contents
+ *
+ * @since vcloud api 1.0
+ */
+ COPYING,
+ /**
+ * The {@link VAppTemplate} Upload initiated, disk contents pending
+ *
+ * @since vcloud api 1.0
+ */
+ PENDING_CONTENTS,
+ /**
+ * The {@link VAppTemplate} Upload has been quarantined
+ *
+ * @since vcloud api 1.0
+ */
+ QUARANTINED,
+ /**
+ * The {@link VAppTemplate} Upload quarantine period has expired
+ *
+ * @since vcloud api 1.0
+ */
+ QUARANTINE_EXPIRED,
+ /**
+ * The {@link VAppTemplate} rejected
+ *
+ * @since vcloud api 1.0
+ */
+ REJECTED,
+ /**
+ * The {@link VAppTemplate} transfer timeout
+ *
+ * @since vcloud api 1.0
+ */
+ TRANSFER_TIMEOUT;
+
+ public String value() {
+ switch (this) {
+ case UNRESOLVED:
+ return "0";
+ case RESOLVED:
+ return "1";
+ case DEPLOYED:
+ return "2";
+ case SUSPENDED:
+ return "3";
+ case ON:
+ return "4";
+ case WAITING_FOR_INPUT:
+ return "5";
+ case UNKNOWN:
+ return "6";
+ case UNRECOGNIZED:
+ return "7";
+ case OFF:
+ return "8";
+ case INCONSISTENT:
+ return "9";
+ case MIXED:
+ return "10";
+ case PENDING_DESCRIPTOR:
+ return "11";
+ case COPYING:
+ return "12";
+ case PENDING_CONTENTS:
+ return "13";
+ case QUARANTINED:
+ return "14";
+ case QUARANTINE_EXPIRED:
+ return "15";
+ case REJECTED:
+ return "16";
+ case TRANSFER_TIMEOUT:
+ return "17";
+ default:
+ return "7";
+ }
+ }
+
+ public static Status fromValue(String status) {
+ try {
+ return fromValue(Integer.parseInt(checkNotNull(status, "status")));
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+
+ public static Status fromValue(int v) {
+ switch (v) {
+ case 0:
+ return UNRESOLVED;
+ case 1:
+ return RESOLVED;
+ case 2:
+ return DEPLOYED;
+ case 3:
+ return SUSPENDED;
+ case 4:
+ return ON;
+ case 5:
+ return WAITING_FOR_INPUT;
+ case 6:
+ return UNKNOWN;
+ case 7:
+ return UNRECOGNIZED;
+ case 8:
+ return OFF;
+ case 9:
+ return INCONSISTENT;
+ case 10:
+ return MIXED;
+ case 11:
+ return PENDING_DESCRIPTOR;
+ case 12:
+ return COPYING;
+ case 13:
+ return PENDING_CONTENTS;
+ case 14:
+ return QUARANTINED;
+ case 15:
+ return QUARANTINE_EXPIRED;
+ case 16:
+ return REJECTED;
+ case 17:
+ return TRANSFER_TIMEOUT;
+ default:
+ return UNRECOGNIZED;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Task.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Task.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Task.java
new file mode 100644
index 0000000..82585d6
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/Task.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain;
+
+import java.util.Date;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.vcloud.domain.internal.TaskImpl;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * Whenever the result of a request cannot be returned immediately, the server creates a Task
+ * object. Tasks owned by an object such as a vApp or vDC are contained in the Tasks element of the
+ * object’s XML representation. This element is read‐only.
+ */
+@ImplementedBy(TaskImpl.class)
+public interface Task extends ReferenceType {
+ /**
+ * The current status of the task.
+ */
+ String getOperation();
+
+ /**
+ * The current status of the task.
+ */
+ TaskStatus getStatus();
+
+ /**
+ * date and time when the task was started.
+ */
+ Date getStartTime();
+
+ /**
+ * date and time when the task completed. Does not appear for running tasks.
+ */
+ Date getEndTime();
+
+ /**
+ * date and time at which the task expires. By default, tasks expire 24 hours after their start
+ * time. Expired tasks cannot be queried.
+ */
+ Date getExpiryTime();
+
+ /**
+ * A link to the object that owns the task. For copy operations, the owner is the copy that is
+ * being created. For delete operations, the owner is the deleted object, so this element is not
+ * included. For all other operations, the owner is the object to which the request was made.
+ */
+ ReferenceType getOwner();
+
+ /**
+ * error message or related information returned by the task
+ */
+ @Nullable
+ VCloudError getError();
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/TaskStatus.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/TaskStatus.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/TaskStatus.java
new file mode 100644
index 0000000..68ee690
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/TaskStatus.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+public enum TaskStatus {
+ /**
+ * The task has completed and returned a value indicating success.
+ */
+ SUCCESS,
+ /**
+ * The task is running.
+ */
+ RUNNING,
+
+ /**
+ * The task has been queued for execution.
+ */
+ QUEUED,
+ /**
+ * The task has completed and returned a value indicating an error.
+ */
+ ERROR,
+ /**
+ * not an official status, temporarily in.
+ */
+ CANCELLED, UNRECOGNIZED;
+ public String value() {
+ return name().toLowerCase();
+ }
+
+ @Override
+ public String toString() {
+ return value();
+ }
+
+ public static TaskStatus fromValue(String status) {
+ if ("CANCELED".equals(status.toUpperCase())) {
+ // TODO: ecloud hack
+ status = "CANCELLED";
+ } else if ("FAILED".equals(status.toUpperCase())) {
+ status = "ERROR";
+ } else if ("COMPLETED".equals(status.toUpperCase())) {
+ status = "SUCCESS";
+ }
+ try {
+ return valueOf(checkNotNull(status, "status").toUpperCase());
+ } catch (IllegalArgumentException e) {
+ return UNRECOGNIZED;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/TasksList.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/TasksList.java b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/TasksList.java
new file mode 100644
index 0000000..6405054
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/main/java/org/jclouds/vcloud/domain/TasksList.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.domain;
+
+import java.net.URI;
+import java.util.SortedSet;
+
+import org.jclouds.vcloud.domain.internal.TasksListImpl;
+
+import com.google.inject.ImplementedBy;
+
+@org.jclouds.vcloud.endpoints.TasksList
+@ImplementedBy(TasksListImpl.class)
+public interface TasksList {
+
+ URI getLocation();
+
+ SortedSet<Task> getTasks();
+
+}
[03/18] stratos git commit: Jclouds vcloud api 1.8.1 clone with
custom changes
Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/taskslist.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/taskslist.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/taskslist.xml
new file mode 100644
index 0000000..fe0d8c1
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/taskslist.xml
@@ -0,0 +1,27 @@
+<TasksList
+ href="https://services.vcloudexpress.terremark.com/api/v0.8/tasksList/1"
+ xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <Task
+ href="https://services.vcloudexpress.terremark.com/api/v0.8/task/3300"
+ type="application/vnd.vmware.vcloud.task+xml" status="success"
+ startTime="2009-08-24T21:30:19.587Z" endTime="2009-08-24T21:30:32.63Z">
+ <Owner
+ href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/1"
+ type="application/vnd.vmware.vcloud.vdc+xml" name="VDC Name" />
+ <Result
+ href="https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012"
+ type="application/vnd.vmware.vcloud.vApp+xml" name="Server1" />
+ </Task>
+ <Task
+ href="https://services.vcloudexpress.terremark.com/api/v0.8/task/3299"
+ type="application/vnd.vmware.vcloud.task+xml" status="success"
+ startTime="2009-08-24T21:29:32.983Z" endTime="2009-08-24T21:29:44.65Z">
+ <Owner
+ href="https://services.vcloudexpress.terremark.com/api/v0.8/vdc/1"
+ type="application/vnd.vmware.vcloud.vdc+xml" name="VDC Name" />
+ <Result
+ href="https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012"
+ type="application/vnd.vmware.vcloud.vApp+xml" name="Server1" />
+ </Task>
+</TasksList>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/template1.0-vcd15-multi-vm.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/template1.0-vcd15-multi-vm.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/template1.0-vcd15-multi-vm.xml
new file mode 100644
index 0000000..46b3c83
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/template1.0-vcd15-multi-vm.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<VAppTemplate xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" ovfDescriptorUploaded="true" status="8" name="Windows Server 2008 R2" type="application/vnd.vmware.vcloud.vAppTemplate+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://www.vmware.com/vcloud/v1 http://zone.myvcloud.com/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml" href="https://zone.myvcloud.com/api/v1.0/vdc/cf6a0068-b7c4-425c-9e80-46ffef58782a"/>
+ <Link rel="catalogItem" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://zone.myvcloud.com/api/v1.0/catalogItem/9c45dbbd-910d-45c8-a811-d1e0b01e9e82"/>
+ <Link rel="remove" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vAppTemplate+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728"/>
+ <Link rel="enable" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/action/enableDownload"/>
+ <Link rel="disable" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/action/disableDownload"/>
+ <Link rel="ovf" type="text/xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/ovf"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.owner+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/owner"/>
+ <Description/>
+ <Children>
+ <Vm name="Windows Server 2008 R2" type="application/vnd.vmware.vcloud.vm+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vm-24fc1b05-10f7-423e-a644-fd3368f9d0cd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.vAppTemplate+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728"/>
+ <Description/>
+ <NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vm-24fc1b05-10f7-423e-a644-fd3368f9d0cd/networkConnectionSection/" ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
+ <NetworkConnection network="none">
+ <NetworkConnectionIndex>0</NetworkConnectionIndex>
+ <IsConnected>false</IsConnected>
+ <MACAddress>00:50:56:b5:09:dc</MACAddress>
+ <IpAddressAllocationMode>NONE</IpAddressAllocationMode>
+ </NetworkConnection>
+ </NetworkConnectionSection>
+ <GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vm-24fc1b05-10f7-423e-a644-fd3368f9d0cd/guestCustomizationSection/" ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <Enabled>true</Enabled>
+ <ChangeSid>false</ChangeSid>
+ <JoinDomainEnabled>false</JoinDomainEnabled>
+ <UseOrgSettings>false</UseOrgSettings>
+ <AdminPasswordEnabled>true</AdminPasswordEnabled>
+ <AdminPasswordAuto>true</AdminPasswordAuto>
+ <ResetPasswordRequired>true</ResetPasswordRequired> <ComputerName>WindowsServ-001</ComputerName>
+ </GuestCustomizationSection>
+ <VAppScopedLocalId>Windows Server 2008 R2</VAppScopedLocalId>
+ </Vm>
+ </Children>
+ <ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/networkSection/" vcloud:type="application/vnd.vmware.vcloud.networkSection+xml"> <ovf:Info>The list of logical networks</ovf:Info>
+ <ovf:Network ovf:name="none">
+ <ovf:Description>This is a special place-holder used for disconnected network interfaces.</ovf:Description>
+ </ovf:Network> </ovf:NetworkSection>
+ <NetworkConfigSection type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/networkConfigSection/" ovf:required="false">
+ <ovf:Info>The configuration parameters for logical networks</ovf:Info>
+ <NetworkConfig networkName="none">
+ <Description>This is a special place-holder used for disconnected network interfaces.</Description>
+ <Configuration>
+ <IpScope>
+ <IsInherited>false</IsInherited>
+ <Gateway>196.254.254.254</Gateway>
+ <Netmask>255.255.0.0</Netmask>
+ <Dns1>196.254.254.254</Dns1>
+ </IpScope>
+ <FenceMode>isolated</FenceMode>
+ </Configuration>
+ <IsDeployed>false</IsDeployed>
+ </NetworkConfig>
+ </NetworkConfigSection>
+ <LeaseSettingsSection type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/leaseSettingsSection/" ovf:required="false">
+ <ovf:Info>Lease settings section</ovf:Info> <Link rel="edit" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/leaseSettingsSection/"/>
+ <StorageLeaseInSeconds>0</StorageLeaseInSeconds>
+ </LeaseSettingsSection>
+ <CustomizationSection type="application/vnd.vmware.vcloud.customizationSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/customizationSection/" ovf:required="false">
+ <ovf:Info>VApp template customization section</ovf:Info>
+ <CustomizeOnInstantiate>true</CustomizeOnInstantiate>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.customizationSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/customizationSection/"/>
+ </CustomizationSection>
+</VAppTemplate>
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/template1.0-vcd15.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/template1.0-vcd15.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/template1.0-vcd15.xml
new file mode 100644
index 0000000..35393ee
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/template1.0-vcd15.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<VAppTemplate xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" ovfDescriptorUploaded="true" status="8" name="UbuntuServer-x64-2GB" type="application/vnd.vmware.vcloud.vAppTemplate+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://www.vmware.com/vcloud/v1 https://zone.myvcloud.com/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml" href="https://zone.myvcloud.com/api/v1.0/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f"/>
+ <Link rel="catalogItem" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://zone.myvcloud.com/api/v1.0/catalogItem/ceb369f7-1d07-4e32-9dbd-ebb5aa6ca55c"/>
+ <Link rel="remove" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vAppTemplate+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728"/>
+ <Link rel="enable" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/action/enableDownload"/>
+ <Link rel="disable" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/action/disableDownload"/>
+ <Link rel="ovf" type="text/xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/ovf"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.owner+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/owner"/>
+ <Description/>
+ <Children>
+ <Vm name="UbuntuServer-x64-2GB" type="application/vnd.vmware.vcloud.vm+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vm-3aee3d0d-106a-4c63-8529-1edde335b212">
+ <Link rel="up" type="application/vnd.vmware.vcloud.vAppTemplate+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728"/>
+ <Description/>
+ <NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vm-3aee3d0d-106a-4c63-8529-1edde335b212/networkConnectionSection/" ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
+ <NetworkConnection network="none">
+ <NetworkConnectionIndex>0</NetworkConnectionIndex>
+ <IsConnected>false</IsConnected>
+ <MACAddress>00:50:56:01:02:9f</MACAddress>
+ <IpAddressAllocationMode>NONE</IpAddressAllocationMode>
+ </NetworkConnection>
+ </NetworkConnectionSection>
+ <GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vm-3aee3d0d-106a-4c63-8529-1edde335b212/guestCustomizationSection/" ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <Enabled>true</Enabled>
+ <ChangeSid>false</ChangeSid>
+ <JoinDomainEnabled>false</JoinDomainEnabled>
+ <UseOrgSettings>false</UseOrgSettings>
+ <AdminPasswordEnabled>true</AdminPasswordEnabled>
+ <AdminPasswordAuto>true</AdminPasswordAuto>
+ <ResetPasswordRequired>false</ResetPasswordRequired>
+ <ComputerName>UbuntuServer</ComputerName>
+ </GuestCustomizationSection>
+ <VAppScopedLocalId>f114ade7-a63f-4f8b-b30b-44e9ff77e068</VAppScopedLocalId>
+ </Vm>
+ </Children>
+ <ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/networkSection/" vcloud:type="application/vnd.vmware.vcloud.networkSection+xml">
+ <ovf:Info>The list of logical networks</ovf:Info>
+ <ovf:Network ovf:name="none">
+ <ovf:Description>This is a special place-holder used for disconnected network interfaces.</ovf:Description>
+ </ovf:Network>
+ </ovf:NetworkSection>
+ <NetworkConfigSection type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/networkConfigSection/" ovf:required="false">
+ <ovf:Info>The configuration parameters for logical networks</ovf:Info>
+ <NetworkConfig networkName="none">
+ <Description>This is a special place-holder used for disconnected network interfaces.</Description>
+ <Configuration>
+ <IpScope>
+ <IsInherited>false</IsInherited>
+ <Gateway>196.254.254.254</Gateway>
+ <Netmask>255.255.0.0</Netmask>
+ <Dns1>196.254.254.254</Dns1>
+ </IpScope>
+ <FenceMode>isolated</FenceMode>
+ </Configuration>
+ <IsDeployed>false</IsDeployed>
+ </NetworkConfig>
+ </NetworkConfigSection>
+ <LeaseSettingsSection type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/leaseSettingsSection/" ovf:required="false">
+ <ovf:Info>Lease settings section</ovf:Info>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/leaseSettingsSection/"/>
+ <StorageLeaseInSeconds>5184000</StorageLeaseInSeconds>
+ <StorageLeaseExpiration>2012-03-12T17:40:44.491-06:00</StorageLeaseExpiration>
+ </LeaseSettingsSection>
+ <CustomizationSection type="application/vnd.vmware.vcloud.customizationSection+xml" href="https://zone.myvcloud.com/api/v1.0/vAppTemplate/vappTemplate-51891b97-c5dd-47dc-a687-aabae354f728/customizationSection/" ovf:required="false">
+ <ovf:Info>VApp template customization section</ovf:Info>
+ <CustomizeOnInstantiate>true</CustomizeOnInstantiate>
+ </CustomizationSection>
+</VAppTemplate>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vAppTemplate-copying.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vAppTemplate-copying.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vAppTemplate-copying.xml
new file mode 100644
index 0000000..8ffa7d7
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vAppTemplate-copying.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<VAppTemplate xmlns="http://www.vmware.com/vcloud/v1"
+ xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
+ ovfDescriptorUploaded="true" status="0" name="Ubuntu10.04_v2"
+ type="application/vnd.vmware.vcloud.vAppTemplate+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-699683881"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vdc/105186609" />
+ <Description />
+ <Tasks>
+ <Task status="running" startTime="2010-09-17T23:20:46.039-04:00"
+ operation="Copying Virtual Application Template Ubuntu10.04_v2(699683881)"
+ expiryTime="2010-12-16T23:20:46.039-05:00" endTime="9999-12-31T23:59:59.999-05:00"
+ type="application/vnd.vmware.vcloud.task+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/task/q62gxhi32xgd9yrqvr">
+ <Owner type="application/vnd.vmware.vcloud.vAppTemplate+xml"
+ name="Ubuntu10.04_v2"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-699683881" />
+ </Task>
+ </Tasks>
+ <Children />
+ <LeaseSettingsSection
+ type="application/vnd.vmware.vcloud.leaseSettingsSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-699683881/leaseSettingsSection/"
+ ovf:required="false">
+ <ovf:Info>Lease settings section</ovf:Info>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.leaseSettingsSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-699683881/leaseSettingsSection/" />
+ <StorageLeaseInSeconds>0</StorageLeaseInSeconds>
+ </LeaseSettingsSection>
+ <CustomizationSection
+ type="application/vnd.vmware.vcloud.customizationSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-699683881/customizationSection/"
+ ovf:required="false">
+ <ovf:Info>VApp template customization section</ovf:Info>
+ <CustomizeOnInstantiate>true</CustomizeOnInstantiate>
+ </CustomizationSection>
+</VAppTemplate>
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vAppTemplate.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vAppTemplate.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vAppTemplate.xml
new file mode 100644
index 0000000..bb5fcaf
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vAppTemplate.xml
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<VAppTemplate xmlns="http://www.vmware.com/vcloud/v1"
+ xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
+ ovfDescriptorUploaded="true" status="8" name="Ubuntu Template"
+ type="application/vnd.vmware.vcloud.vAppTemplate+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://www.vmware.com/vcloud/v1 http://vcenterprise.bluelock.com/api/v1.0/schema/master.xsd">
+ <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vdc/1014839439" />
+ <Link rel="catalogItem" type="application/vnd.vmware.vcloud.catalogItem+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2090447518" />
+ <Link rel="remove"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921" />
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vAppTemplate+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921" />
+ <Link rel="enable"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/action/enableDownload" />
+ <Link rel="disable"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/action/disableDownload" />
+ <Link rel="ovf" type="text/xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/ovf" />
+ <Description />
+ <Children>
+ <Vm name="Ubuntu1004" type="application/vnd.vmware.vcloud.vAppTemplate+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vm-172837194">
+ <Link rel="up" type="application/vnd.vmware.vcloud.vAppTemplate+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921" />
+ <Description />
+ <NetworkConnectionSection
+ type="application/vnd.vmware.vcloud.networkConnectionSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vm-172837194/networkConnectionSection/"
+ ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
+ <NetworkConnection network="vAppNet-vApp Internal">
+ <NetworkConnectionIndex>0</NetworkConnectionIndex>
+ <IpAddress>192.168.2.100</IpAddress>
+ <IsConnected>true</IsConnected>
+ <MACAddress>00:50:56:8c:00:13</MACAddress>
+ <IpAddressAllocationMode>POOL</IpAddressAllocationMode>
+ </NetworkConnection>
+ </NetworkConnectionSection>
+ <GuestCustomizationSection
+ type="application/vnd.vmware.vcloud.guestCustomizationSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vm-172837194/guestCustomizationSection/"
+ ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <Enabled>true</Enabled>
+ <ChangeSid>false</ChangeSid>
+ <VirtualMachineId>172837194</VirtualMachineId>
+ <JoinDomainEnabled>false</JoinDomainEnabled>
+ <UseOrgSettings>false</UseOrgSettings>
+ <AdminPasswordEnabled>true</AdminPasswordEnabled>
+ <AdminPasswordAuto>true</AdminPasswordAuto>
+ <AdminPassword>%3eD%gmF</AdminPassword>
+ <ResetPasswordRequired>false</ResetPasswordRequired>
+ <CustomizationScript>#!/bin/bash if [ "$1" = "postcustomization" ]; then echo "post customization" touch /root/.postcustomization sleep 30 #regenerate keys /bin/rm /etc/ssh/ssh_host_* /usr/sbin/dpkg-reconfigure openssh-server echo "completed" fi</CustomizationScript>
+ <ComputerName>Ubuntu1004</ComputerName>
+ </GuestCustomizationSection>
+ <VAppScopedLocalId>02_ubuntu_template</VAppScopedLocalId>
+ </Vm>
+ </Children>
+ <ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1"
+ vcloud:href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/networkSection/"
+ vcloud:type="application/vnd.vmware.vcloud.networkSection+xml">
+ <ovf:Info>The list of logical networks</ovf:Info>
+ <ovf:Network ovf:name="vAppNet-vApp Internal">
+ <ovf:Description />
+ </ovf:Network>
+ </ovf:NetworkSection>
+ <NetworkConfigSection
+ type="application/vnd.vmware.vcloud.networkConfigSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/networkConfigSection/"
+ ovf:required="false">
+ <ovf:Info>The configuration parameters for logical networks</ovf:Info>
+ <NetworkConfig networkName="vAppNet-vApp Internal">
+ <Description />
+ <Configuration>
+ <IpScope>
+ <IsInherited>false</IsInherited>
+ <Gateway>192.168.2.1</Gateway>
+ <Netmask>255.255.255.0</Netmask>
+ <Dns1>8.8.8.8</Dns1>
+ <IpRanges>
+ <IpRange>
+ <StartAddress>192.168.2.100</StartAddress>
+ <EndAddress>192.168.2.199</EndAddress>
+ </IpRange>
+ </IpRanges>
+ <AllocatedIpAddresses>
+ <IpAddress>192.168.2.100</IpAddress>
+ </AllocatedIpAddresses>
+ </IpScope>
+ <FenceMode>isolated</FenceMode>
+ <Features>
+ <DhcpService>
+ <IsEnabled>false</IsEnabled>
+ <DefaultLeaseTime>7200</DefaultLeaseTime>
+ <MaxLeaseTime>7200</MaxLeaseTime>
+ <IpRange />
+ </DhcpService>
+ <FirewallService>
+ <IsEnabled>true</IsEnabled>
+ </FirewallService>
+ <NatService>
+ <IsEnabled>true</IsEnabled>
+ <NatType>ipTranslation</NatType>
+ <Policy>allowTraffic</Policy>
+ <NatRule>
+ <OneToOneVmRule>
+ <MappingMode>automatic</MappingMode>
+ <VAppScopedVmId>02_ubuntu_template</VAppScopedVmId>
+ <VmNicId>0</VmNicId>
+ </OneToOneVmRule>
+ </NatRule>
+ </NatService>
+ </Features>
+ </Configuration>
+ <IsDeployed>false</IsDeployed>
+ </NetworkConfig>
+ </NetworkConfigSection>
+ <LeaseSettingsSection
+ type="application/vnd.vmware.vcloud.leaseSettingsSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/leaseSettingsSection/"
+ ovf:required="false">
+ <ovf:Info>Lease settings section</ovf:Info>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.leaseSettingsSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/leaseSettingsSection/" />
+ <StorageLeaseInSeconds>0</StorageLeaseInSeconds>
+ </LeaseSettingsSection>
+ <CustomizationSection
+ type="application/vnd.vmware.vcloud.customizationSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/customizationSection/"
+ ovf:required="false">
+ <ovf:Info>VApp template customization section</ovf:Info>
+ <CustomizeOnInstantiate>true</CustomizeOnInstantiate>
+ <Link rel="edit"
+ type="application/vnd.vmware.vcloud.customizationSection+xml"
+ href="https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/vappTemplate-1201908921/customizationSection/" />
+ </CustomizationSection>
+</VAppTemplate>
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vAppTemplate1.0-vcd15_withNewlines.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vAppTemplate1.0-vcd15_withNewlines.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vAppTemplate1.0-vcd15_withNewlines.xml
new file mode 100644
index 0000000..9f41d81
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vAppTemplate1.0-vcd15_withNewlines.xml
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<vcloud:VAppTemplate xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" ovfDescriptorUploaded="true" status="8" name="Windows 2008 R2 Standard (base) with SP1" type="application/vnd.vmware.vcloud.vAppTempla
+te+xml" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vappTemplate-f8ca27ba-c6ee-44bd-91a9-416f464cba80" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf
+/envelope/1/dsp8023_1.1.0.xsd http://www.vmware.com/vcloud/v1 http://109.233.49.135/api/v1.0/schema/master.xsd">
+ <vcloud:Link rel="catalogItem" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcd.stratogen.net/api/v1.0/catalogItem/16bdea08-f176-48ce-9fe8-fc2265fc1068"/>
+ <vcloud:Link rel="enable" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vappTemplate-f8ca27ba-c6ee-44bd-91a9-416f464cba80/action/enableDownload"/>
+ <vcloud:Link rel="disable" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vappTemplate-f8ca27ba-c6ee-44bd-91a9-416f464cba80/action/disableDownload"/>
+ <vcloud:Link rel="ovf" type="text/xml" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vappTemplate-f8ca27ba-c6ee-44bd-91a9-416f464cba80/ovf"/>
+ <vcloud:Link rel="down" type="application/vnd.vmware.vcloud.owner+xml" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vappTemplate-f8ca27ba-c6ee-44bd-91a9-416f464cba80/owner"/>
+ <vcloud:Description>Windows 2008 R2 Standard Edition
+Service Pack 1
+Internet Explorer 9</vcloud:Description>
+ <vcloud:Children>
+ <vcloud:Vm name="Windows 2008 R2 Standard (Base) with SP1" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vm-2ac49c8b-5cd9-428d-86da-24cfe9144b94">
+ <vcloud:Link rel="up" type="application/vnd.vmware.vcloud.vAppTemplate+xml" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vappTemplate-f8ca27ba-c6ee-44bd-91a9-416f464cba80"/>
+ <vcloud:Description>Windows 2008 R2 Standard Edition
+Service Pack 1
+Internet Explorer 9</vcloud:Description>
+ <vcloud:NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vm-2ac49c8b-5cd9-428d-86da-24cfe9144b94/networkConnectionSection/" ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <vcloud:PrimaryNetworkConnectionIndex>0</vcloud:PrimaryNetworkConnectionIndex>
+ <vcloud:NetworkConnection network="StratoGen Ext Net">
+ <vcloud:NetworkConnectionIndex>0</vcloud:NetworkConnectionIndex>
+ <vcloud:IpAddress>212.54.128.56</vcloud:IpAddress>
+ <vcloud:IsConnected>true</vcloud:IsConnected>
+ <vcloud:MACAddress>00:50:56:01:0d:3c</vcloud:MACAddress>
+ <vcloud:IpAddressAllocationMode>POOL</vcloud:IpAddressAllocationMode>
+ </vcloud:NetworkConnection>
+ </vcloud:NetworkConnectionSection>
+ <vcloud:GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vm-2ac49c8b-5cd9-428d-86da-24cfe9144b94/guestCustomizationSection/" ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <vcloud:Enabled>true</vcloud:Enabled>
+ <vcloud:ChangeSid>true</vcloud:ChangeSid>
+ <vcloud:JoinDomainEnabled>false</vcloud:JoinDomainEnabled>
+ <vcloud:UseOrgSettings>false</vcloud:UseOrgSettings>
+ <vcloud:AdminPasswordEnabled>true</vcloud:AdminPasswordEnabled>
+ <vcloud:AdminPasswordAuto>true</vcloud:AdminPasswordAuto>
+ <vcloud:AdminPassword>$6fEPL93</vcloud:AdminPassword>
+ <vcloud:ResetPasswordRequired>false</vcloud:ResetPasswordRequired>
+ <vcloud:ComputerName>Win2008r2Stand</vcloud:ComputerName>
+ </vcloud:GuestCustomizationSection>
+ <vcloud:VAppScopedLocalId>ac2ce03d-0491-46f7-afc6-37ffe5b30f74</vcloud:VAppScopedLocalId>
+ </vcloud:Vm>
+ </vcloud:Children>
+ <ovf:NetworkSection vcloud:href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vappTemplate-f8ca27ba-c6ee-44bd-91a9-416f464cba80/networkSection/" vcloud:type="application/vnd.vmware.vcloud.networkSection+xml">
+ <ovf:Info>The list of logical networks</ovf:Info>
+ <ovf:Network ovf:name="StratoGen Ext Net">
+ <ovf:Description/>
+ </ovf:Network>
+ </ovf:NetworkSection>
+ <vcloud:NetworkConfigSection type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vappTemplate-f8ca27ba-c6ee-44bd-91a9-416f464cba80/networkConfigSection/" ovf:required="false">
+ <ovf:Info>The configuration parameters for logical networks</ovf:Info>
+ <vcloud:NetworkConfig networkName="StratoGen Ext Net">
+ <vcloud:Description/>
+ <vcloud:Configuration>
+ <vcloud:IpScope>
+ <vcloud:IsInherited>true</vcloud:IsInherited>
+ <vcloud:Gateway>212.54.128.1</vcloud:Gateway>
+ <vcloud:Netmask>255.255.255.0</vcloud:Netmask>
+ <vcloud:Dns1>109.233.48.141</vcloud:Dns1>
+ <vcloud:Dns2>109.233.48.142</vcloud:Dns2>
+ <vcloud:IpRanges>
+ <vcloud:IpRange>
+ <vcloud:StartAddress>212.54.128.4</vcloud:StartAddress>
+ <vcloud:EndAddress>212.54.128.220</vcloud:EndAddress>
+ </vcloud:IpRange>
+ </vcloud:IpRanges>
+ </vcloud:IpScope>
+ <vcloud:FenceMode>bridged</vcloud:FenceMode>
+ <vcloud:Features>
+ <vcloud:DhcpService>
+ <vcloud:IsEnabled>false</vcloud:IsEnabled>
+ <vcloud:DefaultLeaseTime>3600</vcloud:DefaultLeaseTime>
+ <vcloud:MaxLeaseTime>7200</vcloud:MaxLeaseTime>
+ <vcloud:IpRange>
+ <vcloud:StartAddress>212.54.128.201</vcloud:StartAddress>
+ <vcloud:EndAddress>212.54.128.254</vcloud:EndAddress>
+ </vcloud:IpRange>
+ </vcloud:DhcpService>
+ <vcloud:FirewallService>
+ <vcloud:IsEnabled>true</vcloud:IsEnabled>
+ </vcloud:FirewallService>
+ <vcloud:NatService>
+ <vcloud:IsEnabled>true</vcloud:IsEnabled>
+ <vcloud:NatType>ipTranslation</vcloud:NatType>
+ <vcloud:Policy>allowTraffic</vcloud:Policy>
+ <vcloud:NatRule>
+ <vcloud:OneToOneVmRule>
+ <vcloud:MappingMode>automatic</vcloud:MappingMode>
+ <vcloud:VAppScopedVmId>ac2ce03d-0491-46f7-afc6-37ffe5b30f74</vcloud:VAppScopedVmId>
+ <vcloud:VmNicId>0</vcloud:VmNicId>
+ </vcloud:OneToOneVmRule>
+ </vcloud:NatRule>
+ </vcloud:NatService>
+ </vcloud:Features>
+ </vcloud:Configuration>
+ <vcloud:IsDeployed>false</vcloud:IsDeployed>
+ </vcloud:NetworkConfig>
+ </vcloud:NetworkConfigSection>
+ <vcloud:LeaseSettingsSection type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vappTemplate-f8ca27ba-c6ee-44bd-91a9-416f464cba80/leaseSettingsSection/" ovf:required="false">
+ <ovf:Info>Lease settings section</ovf:Info>
+ <vcloud:Link rel="edit" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vappTemplate-f8ca27ba-c6ee-44bd-91a9-416f464cba80/leaseSettingsSection/"/>
+ <vcloud:StorageLeaseInSeconds>0</vcloud:StorageLeaseInSeconds>
+ </vcloud:LeaseSettingsSection>
+ <vcloud:CustomizationSection type="application/vnd.vmware.vcloud.customizationSection+xml" href="https://vcd.stratogen.net/api/v1.0/vAppTemplate/vappTemplate-f8ca27ba-c6ee-44bd-91a9-416f464cba80/customizationSection/" ovf:required="false">
+ <ovf:Info>VApp template customization section</ovf:Info>
+ <vcloud:CustomizeOnInstantiate>true</vcloud:CustomizeOnInstantiate>
+ </vcloud:CustomizationSection>
+</vcloud:VAppTemplate>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-hosting.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-hosting.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-hosting.xml
new file mode 100644
index 0000000..c746cba
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-hosting.xml
@@ -0,0 +1,235 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<VApp href="https://vcloud.safesecureweb.com/api/v0.8/vapp/188849-96"
+ type="application/vnd.vmware.vcloud.vApp+xml" name="188849-96"
+ status="2" xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8 vapp.xsd"
+ xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns="http://www.vmware.com/vcloud/v0.8"
+ xmlns:vmw="http://www.vmware.com/schema/ovf"
+ xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"
+ xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" size="20971520">
+
+ <NetworkConnectionSection>
+ <Info xmlns="http://schemas.dmtf.org/ovf/envelope/1">Network Information about the vApp</Info>
+ <NetworkConnection Network="Network 1">
+ <IpAddress>204.12.11.167</IpAddress>
+ </NetworkConnection>
+ </NetworkConnectionSection>
+
+ <VirtualHardwareSection xmlns="http://schemas.dmtf.org/ovf/envelope/1">
+ <Info>Virtual hardware</Info>
+ <System>
+ <AutomaticRecoveryAction xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <AutomaticShutdownAction xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <AutomaticStartupAction xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <AutomaticStartupActionDelay
+ xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <AutomaticStartupActionSequenceNumber
+ xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <Caption xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <ConfigurationDataRoot xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <ConfigurationFile xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <ConfigurationID xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <CreationTime xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <Description xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <ElementName
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData">Virtual Hardware Family</ElementName>
+ <InstanceID
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData">0</InstanceID>
+ <LogDataRoot xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <RecoveryFile xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <SnapshotDataRoot xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <SuspendDataRoot xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <SwapFileDataRoot xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" />
+ <VirtualSystemIdentifier
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData">SimpleVM</VirtualSystemIdentifier>
+ <VirtualSystemType
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData">vmx-07</VirtualSystemType>
+ </System>
+ <Item>
+ <Address xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <AddressOnParent xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <AllocationUnits
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">hertz * 10^6</AllocationUnits>
+ <AutomaticAllocation xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <AutomaticDeallocation xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Caption xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <ConsumerVisibility xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Description
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">Number of Virtual CPUs</Description>
+ <ElementName
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">1 virtual CPU(s)</ElementName>
+ <InstanceID
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">1</InstanceID>
+ <Limit xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <MappingBehavior xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <OtherResourceType xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Parent xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <PoolID xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Reservation xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <ResourceSubType xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <ResourceType
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">3</ResourceType>
+ <VirtualQuantity
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">1</VirtualQuantity>
+ <Weight xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ </Item>
+ <Item>
+ <Address xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <AddressOnParent xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <AllocationUnits
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">byte * 2^20</AllocationUnits>
+ <AutomaticAllocation xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <AutomaticDeallocation xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Caption xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <ConsumerVisibility xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Description
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">Memory Size</Description>
+ <ElementName
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">512MB of memory</ElementName>
+ <InstanceID
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">2</InstanceID>
+ <Limit xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <MappingBehavior xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <OtherResourceType xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Parent xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <PoolID xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Reservation xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <ResourceSubType xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <ResourceType
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">4</ResourceType>
+ <VirtualQuantity
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">512</VirtualQuantity>
+ <Weight xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ </Item>
+ <Item>
+ <Address
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">0</Address>
+ <AddressOnParent xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <AllocationUnits xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <AutomaticAllocation xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <AutomaticDeallocation xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Caption xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <ConsumerVisibility xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Description
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">SCSI Controller</Description>
+ <ElementName
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">SCSI Controller 0</ElementName>
+ <InstanceID
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">3</InstanceID>
+ <Limit xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <MappingBehavior xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <OtherResourceType xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Parent xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <PoolID xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Reservation xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <ResourceSubType
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">lsilogic</ResourceSubType>
+ <ResourceType
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">6</ResourceType>
+ <VirtualQuantity xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Weight xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ </Item>
+ <Item>
+ <Address xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <AddressOnParent
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">0</AddressOnParent>
+ <AllocationUnits xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <AutomaticAllocation xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <AutomaticDeallocation xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Caption xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <ConsumerVisibility xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Description xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <ElementName
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">Hard Disk 1</ElementName>
+ <HostResource
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">20971520</HostResource>
+ <InstanceID
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">9</InstanceID>
+ <Limit xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <MappingBehavior xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <OtherResourceType xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Parent
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">3</Parent>
+ <PoolID xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <Reservation xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <ResourceSubType xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ <ResourceType
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">17</ResourceType>
+ <VirtualQuantity
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData">20971520</VirtualQuantity>
+ <Weight xsi:nil="true"
+ xmlns="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" />
+ </Item>
+ </VirtualHardwareSection>
+</VApp>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/6573fbed/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-none.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-none.xml b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-none.xml
new file mode 100644
index 0000000..62b4f32
--- /dev/null
+++ b/dependencies/jclouds/apis/vcloud/1.8.1-stratos/src/test/resources/vapp-none.xml
@@ -0,0 +1,237 @@
+<VApp xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" deployed="true" status="4" name="customize-750" type="application/vnd.vmware.vcloud.vApp+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://www.vmware.com/vcloud/v1 http://1.1.1.1/api/v1.0/sch
ema/master.xsd">
+ <Link rel="power:powerOff" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/powerOff"/>
+ <Link rel="power:reboot" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/reboot"/>
+ <Link rel="power:reset" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/reset"/>
+ <Link rel="power:shutdown" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/shutdown"/>
+ <Link rel="power:suspend" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/power/action/suspend"/>
+ <Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/action/deploy"/>
+ <Link rel="undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-98934665/action/undeploy"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/controlAccess/"/>
+ <Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/action/controlAccess"/>
+ <Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml" href="https://1.1.1.1/api/v1.0/vdc/1"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vApp+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1"/>
+ <LeaseSettingsSection type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/leaseSettingsSection/" ovf:required="false">
+ <ovf:Info>Lease settings section</ovf:Info>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/leaseSettingsSection/"/>
+ <DeploymentLeaseInSeconds>0</DeploymentLeaseInSeconds>
+ <StorageLeaseInSeconds>7776000</StorageLeaseInSeconds>
+ </LeaseSettingsSection>
+ <ovf:StartupSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://1.1.1.1/api/v1.0/vApp/vapp-1/startupSection/" vcloud:type="application/vnd.vmware.vcloud.startupSection+xml">
+ <ovf:Info>VApp startup section</ovf:Info>
+ <ovf:Item ovf:stopDelay="0" ovf:stopAction="powerOff" ovf:startDelay="0" ovf:startAction="powerOn" ovf:order="0" ovf:id="Centos-5.5_x64"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.startupSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/startupSection/"/>
+ </ovf:StartupSection>
+ <ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://1.1.1.1/api/v1.0/vApp/vapp-1/networkSection/" vcloud:type="application/vnd.vmware.vcloud.networkSection+xml">
+ <ovf:Info>The list of logical networks</ovf:Info>
+ <ovf:Network ovf:name="none">
+ <ovf:Description/>
+ </ovf:Network>
+ <ovf:Network ovf:name="none">
+ <ovf:Description>This is a special place-holder used for disconnected network interfaces.</ovf:Description>
+ </ovf:Network>
+ </ovf:NetworkSection>
+ <NetworkConfigSection type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/networkConfigSection/" ovf:required="false">
+ <ovf:Info>The configuration parameters for logical networks</ovf:Info>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1/networkConfigSection/"/>
+ <NetworkConfig networkName="none">
+ <Description/>
+ <Configuration>
+ <IpScope>
+ <IsInherited>true</IsInherited>
+ <Gateway>172.16.7.1</Gateway>
+ <Netmask>255.255.255.0</Netmask>
+ <Dns1>208.95.232.10</Dns1>
+ <Dns2>208.95.232.11</Dns2>
+ <IpRanges>
+ <IpRange>
+ <StartAddress>172.16.7.230</StartAddress>
+ <EndAddress>172.16.7.239</EndAddress>
+ </IpRange>
+ </IpRanges>
+ </IpScope>
+ <ParentNetwork type="application/vnd.vmware.vcloud.network+xml" name="Direct" href="https://1.1.1.1/api/v1.0/network/282371363"/>
+ <FenceMode>bridged</FenceMode>
+ <Features>
+ <DhcpService>
+ <IsEnabled>false</IsEnabled>
+ <DefaultLeaseTime>3600</DefaultLeaseTime>
+ <MaxLeaseTime>7200</MaxLeaseTime>
+ <IpRange>
+ <StartAddress>172.16.7.2</StartAddress>
+ <EndAddress>172.16.7.229</EndAddress>
+ </IpRange>
+ </DhcpService>
+ <FirewallService>
+ <IsEnabled>true</IsEnabled>
+ </FirewallService>
+ <NatService>
+ <IsEnabled>true</IsEnabled>
+ <NatType>ipTranslation</NatType>
+ <Policy>allowTraffic</Policy>
+ </NatService>
+ </Features>
+ </Configuration>
+ <IsDeployed>true</IsDeployed>
+ </NetworkConfig>
+ <NetworkConfig networkName="none">
+ <Description>This is a special place-holder used for disconnected network interfaces.</Description>
+ <Configuration>
+ <IpScope>
+ <IsInherited>false</IsInherited>
+ <Gateway>196.254.254.254</Gateway>
+ <Netmask>255.255.0.0</Netmask>
+ <Dns1>196.254.254.254</Dns1>
+ </IpScope>
+ <FenceMode>isolated</FenceMode>
+ </Configuration>
+ <IsDeployed>false</IsDeployed>
+ </NetworkConfig>
+ </NetworkConfigSection>
+ <Children>
+ <Vm deployed="true" status="4" name="Centos-5.5_x64" type="application/vnd.vmware.vcloud.vm+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1">
+ <Link rel="power:powerOff" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/powerOff"/>
+ <Link rel="power:reboot" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/reboot"/>
+ <Link rel="power:reset" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/reset"/>
+ <Link rel="power:shutdown" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/shutdown"/>
+ <Link rel="power:suspend" href="https://1.1.1.1/api/v1.0/vApp/vm-1/power/action/suspend"/>
+ <Link rel="undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/action/undeploy"/>
+ <Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml" href="https://1.1.1.1/api/v1.0/vApp/vapp-1"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1"/>
+ <Link rel="screen:thumbnail" href="https://1.1.1.1/api/v1.0/vApp/vm-1/screen"/>
+ <Link rel="screen:acquireTicket" href="https://1.1.1.1/api/v1.0/vApp/vm-1/screen/action/acquireTicket"/>
+ <Link rel="media:insertMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/media/action/insertMedia"/>
+ <Link rel="media:ejectMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/media/action/ejectMedia"/>
+ <Description/>
+ <ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/" vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
+ <ovf:Info>Virtual hardware requirements</ovf:Info>
+ <ovf:System>
+ <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+ <vssd:InstanceID>0</vssd:InstanceID>
+ <vssd:VirtualSystemIdentifier>Centos-5.5_x64</vssd:VirtualSystemIdentifier>
+ <vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
+ </ovf:System>
+ <ovf:Item>
+ <rasd:Address>00:50:56:01:02:38</rasd:Address>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Connection vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="NONE">none</rasd:Connection>
+ <rasd:Description>PCNet32 ethernet adapter</rasd:Description>
+ <rasd:ElementName>Network adapter 0</rasd:ElementName>
+ <rasd:InstanceID>1</rasd:InstanceID>
+ <rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>SCSI Controller</rasd:Description>
+ <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
+ <rasd:InstanceID>2</rasd:InstanceID>
+ <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
+ <rasd:ResourceType>6</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:Description>Hard disk</rasd:Description>
+ <rasd:ElementName>Hard disk 1</rasd:ElementName>
+ <rasd:HostResource vcloud:capacity="15360" vcloud:busType="6" vcloud:busSubType="lsilogic"/>
+ <rasd:InstanceID>2000</rasd:InstanceID>
+ <rasd:Parent>2</rasd:Parent>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>IDE Controller</rasd:Description>
+ <rasd:ElementName>IDE Controller 0</rasd:ElementName>
+ <rasd:InstanceID>3</rasd:InstanceID>
+ <rasd:ResourceType>5</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>CD/DVD Drive</rasd:Description>
+ <rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>3002</rasd:InstanceID>
+ <rasd:Parent>3</rasd:Parent>
+ <rasd:ResourceType>15</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>Floppy Drive</rasd:Description>
+ <rasd:ElementName>Floppy Drive 1</rasd:ElementName>
+ <rasd:HostResource/>
+ <rasd:InstanceID>8000</rasd:InstanceID>
+ <rasd:ResourceType>14</rasd:ResourceType>
+ </ovf:Item>
+ <ovf:Item vcloud:href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+ <rasd:Description>Number of Virtual CPUs</rasd:Description>
+ <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
+ <rasd:InstanceID>4</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
+ </ovf:Item>
+ <ovf:Item vcloud:href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/memory" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
+ <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:ElementName>2048 MB of memory</rasd:ElementName>
+ <rasd:InstanceID>5</rasd:InstanceID>
+ <rasd:Reservation>0</rasd:Reservation>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:VirtualQuantity>2048</rasd:VirtualQuantity>
+ <rasd:Weight>0</rasd:Weight>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
+ </ovf:Item>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/disks"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/disks"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/media"/>
+ <Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/networkCards"/>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/virtualHardwareSection/networkCards"/>
+ </ovf:VirtualHardwareSection>
+ <ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="80" vcloud:href="https://1.1.1.1/api/v1.0/vApp/vm-1/operatingSystemSection/" vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml" vmw:osType="rhel5_64Guest">
+ <ovf:Info>Specifies the operating system installed</ovf:Info>
+ <ovf:Description>Red Hat Enterprise Linux 5 (64-bit)</ovf:Description>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.operatingSystemSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/operatingSystemSection/"/>
+ </ovf:OperatingSystemSection>
+ <NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/networkConnectionSection/" ovf:required="false">
+ <ovf:Info>Specifies the available VM network connections</ovf:Info>
+ <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
+ <NetworkConnection network="none">
+ <NetworkConnectionIndex>0</NetworkConnectionIndex>
+ <IsConnected>false</IsConnected>
+ <MACAddress>00:50:56:01:02:38</MACAddress>
+ <IpAddressAllocationMode>NONE</IpAddressAllocationMode>
+ </NetworkConnection>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/networkConnectionSection/"/>
+ </NetworkConnectionSection>
+ <GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/guestCustomizationSection/" ovf:required="false">
+ <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+ <Enabled>true</Enabled>
+ <ChangeSid>false</ChangeSid>
+ <VirtualMachineId>1</VirtualMachineId>
+ <JoinDomainEnabled>false</JoinDomainEnabled>
+ <UseOrgSettings>false</UseOrgSettings>
+ <AdminPasswordEnabled>true</AdminPasswordEnabled>
+ <AdminPasswordAuto>true</AdminPasswordAuto>
+ <AdminPassword>secret</AdminPassword>
+ <ResetPasswordRequired>false</ResetPasswordRequired>
+ <CustomizationScript>cat > /root/foo.txt<<EOF
+I love candy
+EOF
+</CustomizationScript>
+ <ComputerName>Centos-5.5_x64</ComputerName>
+ <Link rel="edit" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://1.1.1.1/api/v1.0/vApp/vm-1/guestCustomizationSection/"/>
+ </GuestCustomizationSection>
+ <VAppScopedLocalId>Centos-5.5_x64</VAppScopedLocalId>
+ </Vm>
+ </Children>
+</VApp>