You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ad...@apache.org on 2014/11/17 17:19:26 UTC
[10/19] jclouds git commit: JCLOUDS-780 Remove vcloud.
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/VAppTemplateHandler.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/VAppTemplateHandler.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/VAppTemplateHandler.java
deleted file mode 100644
index d0cd121..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/VAppTemplateHandler.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * 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.setLength(0);
- }
-
- 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/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/VCloudVirtualHardwareHandler.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/VCloudVirtualHardwareHandler.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/VCloudVirtualHardwareHandler.java
deleted file mode 100644
index cf6f6e5..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/VCloudVirtualHardwareHandler.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/VDCHandler.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/VDCHandler.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/VDCHandler.java
deleted file mode 100644
index b529f0c..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/VDCHandler.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * 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.setLength(0);
- }
-
- 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/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/VmHandler.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/VmHandler.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/VmHandler.java
deleted file mode 100644
index f68ee07..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/VmHandler.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * 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.setLength(0);
- }
-
- 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/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudNetworkSectionHandler.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudNetworkSectionHandler.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudNetworkSectionHandler.java
deleted file mode 100644
index 39013bf..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudNetworkSectionHandler.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudOperatingSystemHandler.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudOperatingSystemHandler.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudOperatingSystemHandler.java
deleted file mode 100644
index 37866de..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudOperatingSystemHandler.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.setLength(0);
- }
-
- public void characters(char ch[], int start, int length) {
- currentText.append(ch, start, length);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudResourceAllocationSettingDataHandler.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudResourceAllocationSettingDataHandler.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudResourceAllocationSettingDataHandler.java
deleted file mode 100644
index 5331a34..0000000
--- a/apis/vcloud/src/main/java/org/jclouds/vcloud/xml/ovf/VCloudResourceAllocationSettingDataHandler.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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.isEmpty()) {
- capacity = Long.parseLong(attributes.get("capacity"));
- busType = Integer.parseInt(attributes.get("busType"));
- busSubType = attributes.get("busSubType");
- } else if (qName.endsWith("Connection") && !attributes.isEmpty()) {
- 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/jclouds/blob/6f974f34/apis/vcloud/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata b/apis/vcloud/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
deleted file mode 100644
index d800a94..0000000
--- a/apis/vcloud/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
+++ /dev/null
@@ -1 +0,0 @@
-org.jclouds.vcloud.VCloudApiMetadata
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudApiMetadataTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudApiMetadataTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudApiMetadataTest.java
deleted file mode 100644
index 8e3f826..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudApiMetadataTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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/jclouds/blob/6f974f34/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudApiTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudApiTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudApiTest.java
deleted file mode 100644
index 049b3d9..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudApiTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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/jclouds/blob/6f974f34/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudSessionRefreshLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudSessionRefreshLiveTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudSessionRefreshLiveTest.java
deleted file mode 100644
index dcd3e8e..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudSessionRefreshLiveTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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/jclouds/blob/6f974f34/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudVersionsApiTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudVersionsApiTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudVersionsApiTest.java
deleted file mode 100644
index 6095e1d..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudVersionsApiTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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(), 0);
- }
-
- @Override
- protected ProviderMetadata createProviderMetadata() {
- return AnonymousProviderMetadata.forApiOnEndpoint(VCloudVersionsApi.class,
- "http://localhost:8080");
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindCatalogItemToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindCatalogItemToXmlPayloadTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindCatalogItemToXmlPayloadTest.java
deleted file mode 100644
index 599f4a1..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindCatalogItemToXmlPayloadTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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/jclouds/blob/6f974f34/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppParamsToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppParamsToXmlPayloadTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppParamsToXmlPayloadTest.java
deleted file mode 100644
index 8d6042d..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppParamsToXmlPayloadTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/6f974f34/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayloadTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayloadTest.java
deleted file mode 100644
index 73d6342..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindCloneVAppTemplateParamsToXmlPayloadTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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/jclouds/blob/6f974f34/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayloadTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayloadTest.java
deleted file mode 100644
index f145e97..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindDeployVAppParamsToXmlPayloadTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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/jclouds/blob/6f974f34/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayloadTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayloadTest.java
deleted file mode 100644
index ead0bad..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindInstantiateVAppTemplateParamsToXmlPayloadTest.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * 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/jclouds/blob/6f974f34/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayloadTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayloadTest.java
deleted file mode 100644
index 77059b0..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindNetworkConnectionSectionToXmlPayloadTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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/jclouds/blob/6f974f34/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayloadTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayloadTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayloadTest.java
deleted file mode 100644
index 59a4141..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/binders/BindUndeployVAppParamsToXmlPayloadTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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/jclouds/blob/6f974f34/apis/vcloud/src/test/java/org/jclouds/vcloud/compute/BaseVCloudComputeServiceExpectTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/compute/BaseVCloudComputeServiceExpectTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/compute/BaseVCloudComputeServiceExpectTest.java
deleted file mode 100644
index f343d6e..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/compute/BaseVCloudComputeServiceExpectTest.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * 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")).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, VCloudMediaType.ORGLIST_XML)
- .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)
- .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)
- .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)
- .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)
- .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)
- .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)
- .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/jclouds/blob/6f974f34/apis/vcloud/src/test/java/org/jclouds/vcloud/compute/VCloudComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/compute/VCloudComputeServiceLiveTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/compute/VCloudComputeServiceLiveTest.java
deleted file mode 100644
index f5d3ec6..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/compute/VCloudComputeServiceLiveTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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();
- }
-
-}