Issue 112: fixed catalog and orgs to be plural; added error to task

git-svn-id: http://jclouds.googlecode.com/svn/trunk@2605 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
adrian.f.cole 2010-01-06 01:28:14 +00:00
parent 15c147cd25
commit e2235e48f8
32 changed files with 842 additions and 561 deletions

View File

@ -18,6 +18,7 @@
*/
package org.jclouds.vcloud;
import static org.jclouds.vcloud.VCloudMediaType.ORG_XML;
import static org.jclouds.vcloud.VCloudMediaType.CATALOGITEM_XML;
import static org.jclouds.vcloud.VCloudMediaType.CATALOG_XML;
import static org.jclouds.vcloud.VCloudMediaType.NETWORK_XML;
@ -82,15 +83,29 @@ public interface VCloudAsyncClient {
@GET
@Endpoint(Org.class)
@Consumes(VCloudMediaType.ORG_XML)
@Consumes(ORG_XML)
@XMLResponseParser(OrgHandler.class)
Future<? extends Organization> getOrganization();
Future<? extends Organization> getDefaultOrganization();
@GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/org/{orgId}")
@XMLResponseParser(OrgHandler.class)
@Consumes(ORG_XML)
Future<? extends Organization> getOrganization(@PathParam("orgId") String orgId);
@GET
@Endpoint(org.jclouds.vcloud.endpoints.Catalog.class)
@Consumes(CATALOG_XML)
@XMLResponseParser(CatalogHandler.class)
Future<? extends Catalog> getCatalog();
Future<? extends Catalog> getDefaultCatalog();
@GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)
@Path("/catalog/{catalogId}")
@XMLResponseParser(CatalogHandler.class)
@Consumes(CATALOG_XML)
Future<? extends Catalog> getCatalog(@PathParam("catalogId") String catalogId);
@GET
@Endpoint(org.jclouds.vcloud.endpoints.VCloudApi.class)

View File

@ -46,9 +46,13 @@ public interface VCloudClient {
* This call returns a list of all vCloud Data Centers (vdcs), catalogs, and task lists within
* the organization.
*/
Organization getOrganization();
Organization getDefaultOrganization();
Catalog getCatalog();
Organization getOrganization(String orgId);
Catalog getDefaultCatalog();
Catalog getCatalog(String catalogId);
CatalogItem getCatalogItem(String catalogItemId);

View File

@ -33,6 +33,7 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import javax.annotation.Resource;
import javax.inject.Named;
import javax.inject.Singleton;
@ -41,6 +42,7 @@ import org.jclouds.concurrent.internal.SyncProxy;
import org.jclouds.encryption.EncryptionService;
import org.jclouds.http.RequiresHttp;
import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.logging.Logger;
import org.jclouds.predicates.AddressReachable;
import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.predicates.SocketOpen;
@ -81,6 +83,8 @@ import com.google.inject.Provides;
@RequiresHttp
@ConfiguresRestClient
public class VCloudRestClientModule extends AbstractModule {
@Resource
protected Logger logger = Logger.NULL;
@Provides
@Singleton
@ -102,6 +106,7 @@ public class VCloudRestClientModule extends AbstractModule {
@Override
protected void configure() {
requestInjection(this);
}
@VCloudToken
@ -217,21 +222,21 @@ public class VCloudRestClientModule extends AbstractModule {
@Singleton
protected Organization provideOrganization(VCloudClient discovery) throws ExecutionException,
TimeoutException, InterruptedException {
return discovery.getOrganization();
return discovery.getDefaultOrganization();
}
@Provides
@VDC
@Singleton
protected URI provideDefaultVDC(Organization org) {
return org.getVDCs().values().iterator().next().getLocation();
return Iterables.get(org.getVDCs().values(), 0).getLocation();
}
@Provides
@Catalog
@Singleton
protected URI provideCatalog(Organization org) {
return org.getCatalog().getLocation();
return Iterables.get(org.getCatalogs().values(), 0).getLocation();
}
@Provides
@ -239,8 +244,7 @@ public class VCloudRestClientModule extends AbstractModule {
@Singleton
protected URI provideDefaultNetwork(VCloudAsyncClient client) throws InterruptedException,
ExecutionException, TimeoutException {
return client.getDefaultVDC().get(180, TimeUnit.SECONDS).getAvailableNetworks().values()
.iterator().next().getLocation();
return Iterables.get(client.getDefaultVDC().get(180, TimeUnit.SECONDS).getAvailableNetworks().values(), 0).getLocation();
}
@Provides

View File

@ -36,7 +36,7 @@ import com.google.inject.ImplementedBy;
public interface Organization extends NamedResource {
@Catalog
NamedResource getCatalog();
Map<String, NamedResource> getCatalogs();
@VDC
Map<String, NamedResource> getVDCs();

View File

@ -126,27 +126,33 @@ public class ResourceAllocation implements Comparable<ResourceAllocation> {
}
@Override
public int hashCode() {
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((address == null) ? 0 : address.hashCode());
result = prime * result + ((addressOnParent == null) ? 0 : addressOnParent.hashCode());
result = prime * result
+ ((addressOnParent == null) ? 0 : addressOnParent.hashCode());
result = prime * result + ((connected == null) ? 0 : connected.hashCode());
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((hostResource == null) ? 0 : hostResource.hashCode());
result = prime * result
+ ((description == null) ? 0 : description.hashCode());
result = prime * result
+ ((hostResource == null) ? 0 : hostResource.hashCode());
result = prime * result + id;
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((parent == null) ? 0 : parent.hashCode());
result = prime * result + ((subType == null) ? 0 : subType.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + (int) (virtualQuantity ^ (virtualQuantity >>> 32));
result = prime * result
+ ((virtualQuantityUnits == null) ? 0 : virtualQuantityUnits.hashCode());
+ (int) (virtualQuantity ^ (virtualQuantity >>> 32));
result = prime
* result
+ ((virtualQuantityUnits == null) ? 0 : virtualQuantityUnits
.hashCode());
return result;
}
}
@Override
public boolean equals(Object obj) {
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
@ -209,7 +215,7 @@ public class ResourceAllocation implements Comparable<ResourceAllocation> {
} else if (!virtualQuantityUnits.equals(other.virtualQuantityUnits))
return false;
return true;
}
}
@Override
public String toString() {

View File

@ -49,4 +49,13 @@ public interface Task extends Comparable<Task> {
* A link to the result of the task
*/
NamedResource getResult();
Error getError();
@ImplementedBy(TaskImpl.ErrorImpl.class)
static interface Error {
String getMessage();
String getMajorErrorCode();
String getMinorErrorCode();
}
}

View File

@ -19,7 +19,7 @@
package org.jclouds.vcloud.domain;
import java.net.InetAddress;
import java.util.SortedSet;
import java.util.Set;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Multimap;
@ -43,7 +43,7 @@ public interface VApp extends NamedResource {
VirtualSystem getSystem();
SortedSet<ResourceAllocation> getResourceAllocations();
Set<ResourceAllocation> getResourceAllocations();
Multimap<ResourceType, ResourceAllocation> getResourceAllocationByType();

View File

@ -50,18 +50,19 @@ public class VirtualSystem {
}
@Override
public int hashCode() {
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + id;
result = prime * result + ((identifier == null) ? 0 : identifier.hashCode());
result = prime * result
+ ((identifier == null) ? 0 : identifier.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
return result;
}
}
@Override
public boolean equals(Object obj) {
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
@ -87,7 +88,7 @@ public class VirtualSystem {
} else if (!type.equals(other.type))
return false;
return true;
}
}
@Override
public String toString() {

View File

@ -38,16 +38,16 @@ public class OrganizationImpl implements Organization {
private final String id;
private final String name;
private final URI location;
private final NamedResource catalog;
private final Map<String, NamedResource> catalogs;
private final Map<String, NamedResource> vdcs;
private final Map<String, NamedResource> tasksLists;
public OrganizationImpl(String id, String name, URI location, NamedResource catalog,
public OrganizationImpl(String id, String name, URI location, Map<String, NamedResource> catalogs,
Map<String, NamedResource> vdcs, Map<String, NamedResource> tasksLists) {
this.id = id;
this.name = name;
this.location = location;
this.catalog = catalog;
this.catalogs = catalogs;
this.vdcs = vdcs;
this.tasksLists = tasksLists;
}
@ -65,8 +65,8 @@ public class OrganizationImpl implements Organization {
}
@Catalog
public NamedResource getCatalog() {
return catalog;
public Map<String, NamedResource> getCatalogs() {
return catalogs;
}
@VDC
@ -83,7 +83,7 @@ public class OrganizationImpl implements Organization {
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((catalog == null) ? 0 : catalog.hashCode());
result = prime * result + ((catalogs == null) ? 0 : catalogs.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((location == null) ? 0 : location.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
@ -101,10 +101,10 @@ public class OrganizationImpl implements Organization {
if (getClass() != obj.getClass())
return false;
OrganizationImpl other = (OrganizationImpl) obj;
if (catalog == null) {
if (other.catalog != null)
if (catalogs == null) {
if (other.catalogs != null)
return false;
} else if (!catalog.equals(other.catalog))
} else if (!catalogs.equals(other.catalogs))
return false;
if (id == null) {
if (other.id != null)

View File

@ -30,12 +30,82 @@ import org.jclouds.vcloud.domain.TaskStatus;
import com.google.inject.internal.Nullable;
/**
* Locations of resources in vCloud
*
* @author Adrian Cole
*
*/
public class TaskImpl implements Task {
public static class ErrorImpl implements Error {
private final String message;
private final String majorErrorCode;
private final String minorErrorCode;
public ErrorImpl(String message, String majorErrorCode,
String minorErrorCode) {
this.message = message;
this.majorErrorCode = majorErrorCode;
this.minorErrorCode = minorErrorCode;
}
public String getMessage() {
return message;
}
public String getMajorErrorCode() {
return majorErrorCode;
}
public String getMinorErrorCode() {
return minorErrorCode;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((majorErrorCode == null) ? 0 : majorErrorCode.hashCode());
result = prime * result + ((message == null) ? 0 : message.hashCode());
result = prime * result
+ ((minorErrorCode == null) ? 0 : minorErrorCode.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 == null) {
if (other.majorErrorCode != null)
return false;
} else if (!majorErrorCode.equals(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;
return true;
}
@Override
public String toString() {
return "ErrorImpl [majorErrorCode=" + majorErrorCode + ", message="
+ message + ", minorErrorCode=" + minorErrorCode + "]";
}
}
private final String id;
private final URI location;
private final TaskStatus status;
@ -45,10 +115,12 @@ public class TaskImpl implements Task {
private final NamedResource owner;
@Nullable
private final NamedResource result;
@Nullable
private final Error error;
public TaskImpl(String id, URI location, TaskStatus status, Date startTime,
@Nullable Date endTime, NamedResource owner,
@Nullable NamedResource result) {
@Nullable NamedResource result, Error error) {
this.id = checkNotNull(id, "id");
this.location = checkNotNull(location, "location");
this.status = checkNotNull(status, "status");
@ -56,6 +128,7 @@ public class TaskImpl implements Task {
this.endTime = endTime;
this.owner = owner;
this.result = result;
this.error = error;
}
public TaskStatus getStatus() {
@ -90,14 +163,18 @@ public class TaskImpl implements Task {
return location;
}
public Error getError() {
return error;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((endTime == null) ? 0 : endTime.hashCode());
result = prime * result + ((error == null) ? 0 : error.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result
+ ((location == null) ? 0 : location.hashCode());
result = prime * result + ((location == null) ? 0 : location.hashCode());
result = prime * result + ((owner == null) ? 0 : owner.hashCode());
result = prime * result
+ ((this.result == null) ? 0 : this.result.hashCode());
@ -121,6 +198,11 @@ public class TaskImpl implements Task {
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 (id == null) {
if (other.id != null)
return false;
@ -156,9 +238,9 @@ public class TaskImpl implements Task {
@Override
public String toString() {
return "TaskImpl [endTime=" + endTime + ", id=" + id + ", location="
+ location + ", owner=" + owner + ", result=" + result
+ ", startTime=" + startTime + ", status=" + status + "]";
return "TaskImpl [endTime=" + endTime + ", error=" + error + ", id=" + id
+ ", location=" + location + ", owner=" + owner + ", result="
+ result + ", startTime=" + startTime + ", status=" + status + "]";
}
}

View File

@ -20,7 +20,7 @@ package org.jclouds.vcloud.domain.internal;
import java.net.InetAddress;
import java.net.URI;
import java.util.SortedSet;
import java.util.Set;
import org.jclouds.vcloud.VCloudMediaType;
import org.jclouds.vcloud.domain.NamedResource;
@ -49,7 +49,7 @@ public class VAppImpl implements VApp {
private final ListMultimap<String, InetAddress> networkToAddresses;
private final String operatingSystemDescription;
private final VirtualSystem system;
private final SortedSet<ResourceAllocation> resourceAllocations;
private final Set<ResourceAllocation> resourceAllocations;
private final ListMultimap<ResourceType, ResourceAllocation> resourceAllocationByType;
/** The serialVersionUID */
@ -58,7 +58,7 @@ public class VAppImpl implements VApp {
public VAppImpl(String id, String name, URI location, VAppStatus status, Long size,
ListMultimap<String, InetAddress> networkToAddresses,
String operatingSystemDescription, VirtualSystem system,
SortedSet<ResourceAllocation> resourceAllocations) {
Set<ResourceAllocation> resourceAllocations) {
this.id = id;
this.name = name;
this.location = location;
@ -93,7 +93,7 @@ public class VAppImpl implements VApp {
return system;
}
public SortedSet<ResourceAllocation> getResourceAllocations() {
public Set<ResourceAllocation> getResourceAllocations() {
return resourceAllocations;
}
@ -102,25 +102,35 @@ public class VAppImpl implements VApp {
}
@Override
public int hashCode() {
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((location == null) ? 0 : location.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((networkToAddresses == null) ? 0 : networkToAddresses.hashCode());
result = prime * result
+ ((operatingSystemDescription == null) ? 0 : operatingSystemDescription.hashCode());
result = prime * result
+ ((resourceAllocations == null) ? 0 : resourceAllocations.hashCode());
result = prime
* result
+ ((networkToAddresses == null) ? 0 : networkToAddresses.hashCode());
result = prime
* result
+ ((operatingSystemDescription == null) ? 0
: operatingSystemDescription.hashCode());
result = prime
* result
+ ((resourceAllocationByType == null) ? 0
: resourceAllocationByType.hashCode());
result = prime
* result
+ ((resourceAllocations == null) ? 0 : resourceAllocations
.hashCode());
result = prime * result + ((size == null) ? 0 : size.hashCode());
result = prime * result + ((status == null) ? 0 : status.hashCode());
result = prime * result + ((system == null) ? 0 : system.hashCode());
return result;
}
}
@Override
public boolean equals(Object obj) {
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
@ -151,7 +161,13 @@ public class VAppImpl implements VApp {
if (operatingSystemDescription == null) {
if (other.operatingSystemDescription != null)
return false;
} else if (!operatingSystemDescription.equals(other.operatingSystemDescription))
} else if (!operatingSystemDescription
.equals(other.operatingSystemDescription))
return false;
if (resourceAllocationByType == null) {
if (other.resourceAllocationByType != null)
return false;
} else if (!resourceAllocationByType.equals(other.resourceAllocationByType))
return false;
if (resourceAllocations == null) {
if (other.resourceAllocations != null)
@ -174,7 +190,7 @@ public class VAppImpl implements VApp {
} else if (!system.equals(other.system))
return false;
return true;
}
}
public String getId() {
return id;

View File

@ -22,7 +22,9 @@ import java.net.URI;
import java.util.Map;
import org.jclouds.vcloud.domain.NamedResource;
import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.internal.NamedResourceImpl;
import org.jclouds.vcloud.domain.internal.TaskImpl.ErrorImpl;
import org.xml.sax.Attributes;
/**
@ -31,15 +33,28 @@ import org.xml.sax.Attributes;
*/
public class Utils {
public static NamedResource newNamedResource(Attributes attributes) {
String uri = attributes.getValue(attributes.getIndex("href"));
String id = uri.substring(uri.lastIndexOf('/') + 1);
return new NamedResourceImpl(id, attributes.getValue(attributes.getIndex("name")), attributes
return new NamedResourceImpl(id, attributes.getValue(attributes
.getIndex("name")), attributes
.getValue(attributes.getIndex("type")), URI.create(uri));
}
public static void putNamedResource(Map<String, NamedResource> map, Attributes attributes) {
map.put(attributes.getValue(attributes.getIndex("name")), newNamedResource(attributes));
public static Task.Error newError(Attributes attributes) {
return new ErrorImpl(attrOrNull(attributes, "message"), attrOrNull(
attributes, "majorErrorCode"), attrOrNull(attributes,
"minorErrorCode"));
}
private static String attrOrNull(Attributes attributes, String attr) {
return attributes.getIndex(attr) >= 0 ? attributes.getValue(attributes
.getIndex(attr)) : null;
}
public static void putNamedResource(Map<String, NamedResource> map,
Attributes attributes) {
map.put(attributes.getValue(attributes.getIndex("name")),
newNamedResource(attributes));
}
}

View File

@ -40,12 +40,12 @@ import com.google.common.collect.Maps;
*/
public class OrgHandler extends ParseSax.HandlerWithResult<Organization> {
private NamedResource org;
private Map<String, NamedResource> vdcs = Maps.newHashMap();
private Map<String, NamedResource> tasksLists = Maps.newHashMap();
private NamedResource catalog;
private Map<String, NamedResource> vdcs = Maps.newLinkedHashMap();
private Map<String, NamedResource> tasksLists = Maps.newLinkedHashMap();
private Map<String, NamedResource> catalogs = Maps.newLinkedHashMap();
public Organization getResult() {
return new OrganizationImpl(org.getId(), org.getName(), org.getLocation(), catalog, vdcs,
return new OrganizationImpl(org.getId(), org.getName(), org.getLocation(), catalogs, vdcs,
tasksLists);
}
@ -60,7 +60,7 @@ public class OrgHandler extends ParseSax.HandlerWithResult<Organization> {
if (attributes.getValue(typeIndex).equals(VDC_XML)) {
putNamedResource(vdcs, attributes);
} else if (attributes.getValue(typeIndex).equals(CATALOG_XML)) {
catalog = newNamedResource(attributes);
putNamedResource(catalogs, attributes);
} else if (attributes.getValue(typeIndex).equals(TASKSLIST_XML)) {
putNamedResource(tasksLists, attributes);
}

View File

@ -54,7 +54,7 @@ public class ResourceAllocationHandler extends ParseSax.HandlerWithResult<Resour
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes)
throws SAXException {
if (qName.equals("Connection")) {
if (qName.endsWith("Connection")) {
connected = new Boolean(attributes.getValue(attributes.getIndex("connected")));
}
}
@ -63,34 +63,34 @@ public class ResourceAllocationHandler extends ParseSax.HandlerWithResult<Resour
public void endElement(String uri, String localName, String qName) throws SAXException {
String current = currentOrNull();
if (current != null) {
if (qName.equals("Address")) {
if (qName.endsWith("Address")) {
address = Integer.parseInt(current);
} else if (qName.equals("AddressOnParent")) {
} else if (qName.endsWith("AddressOnParent")) {
addressOnParent = Integer.parseInt(current);
} else if (qName.equals("AllocationUnits")) {
} else if (qName.endsWith("AllocationUnits")) {
allocationUnits = current;
} else if (qName.equals("Description")) {
} else if (qName.endsWith("Description")) {
description = current;
} else if (qName.equals("ElementName")) {
} else if (qName.endsWith("ElementName")) {
elementName = current;
} else if (qName.equals("InstanceID")) {
} else if (qName.endsWith("InstanceID")) {
instanceID = Integer.parseInt(current);
} else if (qName.equals("Parent")) {
} else if (qName.endsWith("Parent")) {
parent = Integer.parseInt(current);
} else if (qName.equals("ResourceSubType")) {
} else if (qName.endsWith("ResourceSubType")) {
resourceSubType = current;
} else if (qName.equals("ResourceType")) {
} else if (qName.endsWith("ResourceType")) {
resourceType = ResourceType.fromValue(current);
} else if (qName.equals("VirtualQuantity")) {
} else if (qName.endsWith("VirtualQuantity")) {
virtualQuantity = Long.parseLong(current);
} else if (qName.equals("VirtualQuantityUnits")) {
} else if (qName.endsWith("VirtualQuantityUnits")) {
virtualQuantityUnits = current;
} else if (qName.equals("HostResource")) {
} else if (qName.endsWith("HostResource")) {
hostResource = currentText.toString().trim();
virtualQuantity = Long.parseLong(current);
virtualQuantityUnits = "byte * 2^20";
}
} else if (qName.equals("Item")) {
} else if (qName.endsWith("Item")) {
if (allocationUnits != null)
virtualQuantityUnits = allocationUnits;
this.allocation = new ResourceAllocation(instanceID, elementName, description,

View File

@ -30,6 +30,7 @@ import org.jclouds.logging.Logger;
import org.jclouds.vcloud.domain.NamedResource;
import org.jclouds.vcloud.domain.Task;
import org.jclouds.vcloud.domain.TaskStatus;
import org.jclouds.vcloud.domain.Task.Error;
import org.jclouds.vcloud.domain.internal.TaskImpl;
import org.jclouds.vcloud.util.Utils;
import org.xml.sax.Attributes;
@ -48,10 +49,12 @@ public class TaskHandler extends ParseSax.HandlerWithResult<Task> {
private Date startTime;
private Date endTime;
private Task task;
private Error error;
@Resource
protected Logger logger = Logger.NULL;
@Inject
public TaskHandler(DateService dateService) {
this.dateService = dateService;
@ -80,18 +83,21 @@ public class TaskHandler extends ParseSax.HandlerWithResult<Task> {
taskLink = Utils.newNamedResource(attributes);
} else if (qName.equals("Result")) {
result = Utils.newNamedResource(attributes);
} else if (qName.equals("Error")) {
error = Utils.newError(attributes);
}
}
private Date parseDate(Attributes attributes, String attribute) {
String toParse =attributes.getValue(attributes.getIndex(attribute));
try {
return dateService.iso8601DateParse(attributes.getValue(attributes.getIndex(attribute)));
return dateService.iso8601DateParse(toParse);
} catch (RuntimeException e) {
if (e.getCause() instanceof ParseException) {
try {
return dateService.iso8601SecondsDateParse(attributes.getValue(attributes
.getIndex(attribute)));
if (!toParse.endsWith("Z"))
toParse+="Z";
return dateService.iso8601SecondsDateParse(toParse);
} catch (RuntimeException ex) {
logger.error(e, "error parsing date");
}
@ -105,13 +111,14 @@ public class TaskHandler extends ParseSax.HandlerWithResult<Task> {
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if (qName.equalsIgnoreCase("Task")) {
this.task = new TaskImpl(taskLink.getId(), taskLink.getLocation(), status, startTime, endTime, owner, result);
this.task = new TaskImpl(taskLink.getId(), taskLink.getLocation(), status, startTime, endTime, owner, result, error);
taskLink = null;
status = null;
startTime = null;
endTime = null;
owner = null;
result = null;
error = null;
}
}

View File

@ -21,18 +21,20 @@ package org.jclouds.vcloud.xml;
import java.net.InetAddress;
import java.net.URI;
import java.net.UnknownHostException;
import java.util.SortedSet;
import java.util.Set;
import javax.annotation.Resource;
import javax.inject.Inject;
import org.jclouds.http.functions.ParseSax;
import org.jclouds.logging.Logger;
import org.jclouds.vcloud.domain.NamedResource;
import org.jclouds.vcloud.domain.ResourceAllocation;
import org.jclouds.vcloud.domain.VApp;
import org.jclouds.vcloud.domain.VAppStatus;
import org.jclouds.vcloud.domain.VirtualSystem;
import org.jclouds.vcloud.domain.internal.VAppImpl;
import org.jclouds.vcloud.util.Utils;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
@ -58,7 +60,7 @@ public class VAppHandler extends ParseSax.HandlerWithResult<VApp> {
}
protected VirtualSystem system;
protected SortedSet<ResourceAllocation> allocations = Sets.newTreeSet();
protected Set<ResourceAllocation> allocations = Sets.newLinkedHashSet();
protected VAppStatus status;
protected final ListMultimap<String, InetAddress> networkToAddresses = ArrayListMultimap
.create();
@ -79,8 +81,10 @@ public class VAppHandler extends ParseSax.HandlerWithResult<VApp> {
public void startElement(String uri, String localName, String qName, Attributes attributes)
throws SAXException {
if (qName.equals("VApp")) {
name = id = attributes.getValue(attributes.getIndex("name"));
location = URI.create(attributes.getValue(attributes.getIndex("href")));
NamedResource resource = Utils.newNamedResource(attributes);
name = resource.getName();
id = resource.getId();
location = resource.getLocation();
status = VAppStatus.fromValue(attributes.getValue(attributes.getIndex("status")));
if (attributes.getIndex("size") != -1)
size = new Long(attributes.getValue(attributes.getIndex("size")));

View File

@ -42,15 +42,15 @@ public class VirtualSystemHandler extends ParseSax.HandlerWithResult<VirtualSyst
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if (qName.equals("ElementName")) {
if (qName.endsWith("ElementName")) {
this.elementName = currentText.toString().trim();
} else if (qName.equals("InstanceID")) {
} else if (qName.endsWith("InstanceID")) {
this.instanceID = Integer.parseInt(currentText.toString().trim());
} else if (qName.equals("VirtualSystemIdentifier")) {
} else if (qName.endsWith("VirtualSystemIdentifier")) {
this.virtualSystemIdentifier = currentText.toString().trim();
} else if (qName.equals("VirtualSystemType")) {
} else if (qName.endsWith("VirtualSystemType")) {
this.virtualSystemType = currentText.toString().trim();
} else if (qName.equals("System")) {
} else if (qName.endsWith("System")) {
this.system = new org.jclouds.vcloud.domain.VirtualSystem(instanceID, elementName,
virtualSystemIdentifier, virtualSystemType);
this.elementName = null;

View File

@ -161,8 +161,8 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
checkFilters(httpMethod);
}
public void testOrganization() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudAsyncClient.class.getMethod("getOrganization");
public void testDefaultOrganization() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudAsyncClient.class.getMethod("getDefaultOrganization");
GeneratedHttpRequest<VCloudAsyncClient> httpMethod = processor.createRequest(method);
assertRequestLineEquals(httpMethod, "GET http://org HTTP/1.1");
@ -176,8 +176,23 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
checkFilters(httpMethod);
}
public void testCatalog() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudAsyncClient.class.getMethod("getCatalog");
public void testOrganization() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudAsyncClient.class.getMethod("getOrganization", String.class);
GeneratedHttpRequest<VCloudAsyncClient> httpMethod = processor.createRequest(method, "1");
assertRequestLineEquals(httpMethod, "GET http://vcloud/org/1 HTTP/1.1");
assertHeadersEqual(httpMethod, "Accept: application/vnd.vmware.vcloud.org+xml\n");
assertPayloadEquals(httpMethod, null);
assertResponseParserClassEquals(method, httpMethod, ParseSax.class);
assertSaxResponseParserClassEquals(method, OrgHandler.class);
assertExceptionParserClassEquals(method, null);
checkFilters(httpMethod);
}
public void testDefaultCatalog() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudAsyncClient.class.getMethod("getDefaultCatalog");
GeneratedHttpRequest<VCloudAsyncClient> httpMethod = processor.createRequest(method);
assertRequestLineEquals(httpMethod, "GET http://catalog HTTP/1.1");
@ -191,6 +206,21 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
checkFilters(httpMethod);
}
public void testCatalog() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudAsyncClient.class.getMethod("getCatalog", String.class);
GeneratedHttpRequest<VCloudAsyncClient> httpMethod = processor.createRequest(method, "1");
assertRequestLineEquals(httpMethod, "GET http://vcloud/catalog/1 HTTP/1.1");
assertHeadersEqual(httpMethod, "Accept: application/vnd.vmware.vcloud.catalog+xml\n");
assertPayloadEquals(httpMethod, null);
assertResponseParserClassEquals(method, httpMethod, ParseSax.class);
assertSaxResponseParserClassEquals(method, CatalogHandler.class);
assertExceptionParserClassEquals(method, null);
checkFilters(httpMethod);
}
public void testNetwork() throws SecurityException, NoSuchMethodException, IOException {
Method method = VCloudAsyncClient.class.getMethod("getNetwork", String.class);
GeneratedHttpRequest<VCloudAsyncClient> httpMethod = processor.createRequest(method, "2");

View File

@ -49,23 +49,25 @@ public class VCloudClientLiveTest {
@Test
public void testOrganization() throws Exception {
Organization response = connection.getOrganization();
Organization response = connection.getDefaultOrganization();
assertNotNull(response);
assertNotNull(response.getId());
assertNotNull(account);
assertNotNull(response.getCatalog());
assertEquals(response.getTasksLists().size(), 1);
assertEquals(response.getVDCs().size(), 1);
assert response.getCatalogs().size() >=1;
assert response.getTasksLists().size() >=1;
assert response.getVDCs().size() >=1;
assertEquals(connection.getOrganization(response.getId()), response);
}
@Test
public void testCatalog() throws Exception {
Catalog response = connection.getCatalog();
Catalog response = connection.getDefaultCatalog();
assertNotNull(response);
assertNotNull(response.getId());
assertNotNull(response.getName());
assertNotNull(response.getLocation());
assert response.size() > 0;
assertEquals(connection.getCatalog(response.getId()), response);
}
@Test
@ -81,7 +83,7 @@ public class VCloudClientLiveTest {
@Test
public void testGetCatalogItem() throws Exception {
Catalog response = connection.getCatalog();
Catalog response = connection.getDefaultCatalog();
for (NamedResource resource : response.values()) {
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
CatalogItem item = connection.getCatalogItem(resource.getId());
@ -97,7 +99,7 @@ public class VCloudClientLiveTest {
@Test
public void testGetVAppTemplate() throws Exception {
Catalog response = connection.getCatalog();
Catalog response = connection.getDefaultCatalog();
for (NamedResource resource : response.values()) {
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
CatalogItem item = connection.getCatalogItem(resource.getId());

View File

@ -47,7 +47,7 @@ import com.google.inject.TypeLiteral;
import com.google.inject.internal.ImmutableMap;
/**
* Tests behavior of {@code HostingDotComVCloudClient}
* Tests behavior of {@code VCloudComputeClientLiveTest}
*
* @author Adrian Cole
*/

View File

@ -130,7 +130,7 @@ public class VCloudLoginLiveTest {
@BeforeClass
void setupFactory() {
final String endpoint = checkNotNull(System.getProperty("jclouds.test.endpoint"),
"jclouds.test.endpoint");
"jclouds.test.endpoint")+"/v0.8/login";
final String account = checkNotNull(System.getProperty("jclouds.test.user"),
"jclouds.test.user");
final String key = checkNotNull(System.getProperty("jclouds.test.key"), "jclouds.test.key");

View File

@ -77,9 +77,9 @@ public class OrgHandlerTest {
assertEquals(result.getId(), 48 + "");
assertEquals(result.getLocation(), URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/org/48"));
assertEquals(result.getCatalog(), new NamedResourceImpl("catalog",
assertEquals(result.getCatalogs(), ImmutableMap.of("Miami Environment 1 Catalog",new NamedResourceImpl("catalog",
"Miami Environment 1 Catalog", CATALOG_XML,
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog")));
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog"))));
assertEquals(result.getVDCs(), ImmutableMap.of("Miami Environment 1", new NamedResourceImpl(
"32", "Miami Environment 1", VCloudMediaType.VDC_XML, URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32"))));
@ -121,8 +121,8 @@ public class OrgHandlerTest {
assertEquals(result.getId(), 188849 + "");
assertEquals(result.getLocation(), URI
.create("https://vcloud.safesecureweb.com/api/v0.8/org/188849"));
assertEquals(result.getCatalog(), new NamedResourceImpl("1", "HMS Shared Catalog",
CATALOG_XML, URI.create("https://vcloud.safesecureweb.com/api/v0.8/catalog/1")));
assertEquals(result.getCatalogs(), ImmutableMap.of( "HMS Shared Catalog", new NamedResourceImpl("1", "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 NamedResourceImpl("188849", "188849 Virtual DataCenter",
VCloudMediaType.VDC_XML, URI

View File

@ -53,18 +53,30 @@ public class TaskHandlerTest extends BaseHandlerTest {
public void testApplyInputStream() {
InputStream is = getClass().getResourceAsStream("/task.xml");
Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);
Task result = factory.create(injector.getInstance(TaskHandler.class))
.parse(is);
Task expects = new TaskImpl("3299", URI
Task expects = new TaskImpl(
"3299",
URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/task/3299"),
TaskStatus.SUCCESS, dateService.iso8601DateParse("2009-08-24T21:29:32.983Z"),
dateService.iso8601DateParse("2009-08-24T21:29:44.65Z"), new NamedResourceImpl("1",
"VDC Name", VCloudMediaType.VDC_XML,
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/1")),
new NamedResourceImpl("4012", "Server1", VCloudMediaType.VAPP_XML, URI
TaskStatus.SUCCESS,
dateService.iso8601DateParse("2009-08-24T21:29:32.983Z"),
dateService.iso8601DateParse("2009-08-24T21:29:44.65Z"),
new NamedResourceImpl(
"1",
"VDC Name",
VCloudMediaType.VDC_XML,
URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/1")),
new NamedResourceImpl(
"4012",
"Server1",
VCloudMediaType.VAPP_XML,
URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")
)
), null
);
assertEquals(result, expects);
@ -74,12 +86,14 @@ public class TaskHandlerTest extends BaseHandlerTest {
public void testSelf() {
InputStream is = getClass().getResourceAsStream("/task-self.xml");
Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);
Task result = factory.create(injector.getInstance(TaskHandler.class))
.parse(is);
Task expects = new TaskImpl("d188849-78", URI
Task expects = new TaskImpl(
"d188849-78",
URI
.create("https://vcloud.safesecureweb.com/api/v0.8/task/d188849-78"),
TaskStatus.QUEUED, null, null, null, null
);
TaskStatus.QUEUED, null, null, null, null, null);
assertEquals(result, expects);
}
@ -87,13 +101,45 @@ public class TaskHandlerTest extends BaseHandlerTest {
public void testApplyInputStream2() {
InputStream is = getClass().getResourceAsStream("/task-hosting.xml");
Task result = factory.create(injector.getInstance(TaskHandler.class)).parse(is);
Task result = factory.create(injector.getInstance(TaskHandler.class))
.parse(is);
Task expects = new TaskImpl("d188849-72", URI
Task expects = new TaskImpl(
"d188849-72",
URI
.create("https://vcloud.safesecureweb.com/api/v0.8/task/d188849-72"),
TaskStatus.RUNNING, dateService.iso8601SecondsDateParse("2001-01-01T05:00:00Z"),
null, new NamedResourceImpl("188849", "188849", VCloudMediaType.VDC_XML, URI
.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/188849")), null);
TaskStatus.RUNNING,
dateService.iso8601SecondsDateParse("2001-01-01T05:00:00Z"),
null,
new NamedResourceImpl(
"188849",
"188849",
VCloudMediaType.VDC_XML,
URI
.create("https://vcloud.safesecureweb.com/api/v0.8/vdc/188849")),
null, 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(
"23",
URI.create("http://10.150.4.49/api/v0.8/task/23"),
TaskStatus.ERROR,
dateService.iso8601SecondsDateParse("2009-12-07T19:05:02Z"),
dateService.iso8601SecondsDateParse("2009-12-10T14:40:32Z"),
new NamedResourceImpl("1", "APIOrg", VCloudMediaType.ORG_XML, URI
.create("http://10.150.4.49/api/v0.8/org/1")),
new NamedResourceImpl("1", "testapp1", VCloudMediaType.VAPP_XML,
URI.create("http://10.150.4.49/api/v0.8/vapp/1")),
new TaskImpl.ErrorImpl("Error processing job", "500",
" Error in runDailySummaries date used:2009-12-09 19:40:30.577326+00:00"));
assertEquals(result, expects);
}

View File

@ -67,7 +67,7 @@ public class TasksListHandlerTest extends BaseHandlerTest {
"VDC Name", VCloudMediaType.VDC_XML,
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/1")),
new NamedResourceImpl("4012", "Server1", VCloudMediaType.VAPP_XML, URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")));
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")),null);
Task task2 = new TaskImpl("3299", URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/task/3299"),
TaskStatus.SUCCESS, dateService.iso8601DateParse("2009-08-24T21:29:32.983Z"),
@ -76,9 +76,7 @@ public class TasksListHandlerTest extends BaseHandlerTest {
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/1")),
new NamedResourceImpl("4012", "Server1", VCloudMediaType.VAPP_XML, URI
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vapp/4012")
)
), null
);
assertEquals(result.getTasks(), ImmutableSortedSet.of(task1, task2));
assertEquals(

View File

@ -48,7 +48,7 @@ import com.google.common.collect.ListMultimap;
public class VAppHandlerTest extends BaseHandlerTest {
// TODO why does this fail?
@Test(enabled = false)
public void testApplyInputStream() throws UnknownHostException {
public void testHosting() throws UnknownHostException {
InputStream is = getClass().getResourceAsStream("/vapp-hosting.xml");
VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
@ -80,6 +80,43 @@ public class VAppHandlerTest extends BaseHandlerTest {
new Long(20971520), networkToAddresses, null, system, resourceAllocations);
assertEquals(result, expects);
}
// TODO why does this fail?
@Test(enabled = false)
public void testDefault() throws UnknownHostException {
InputStream is = getClass().getResourceAsStream("/vapp.xml");
VApp result = factory.create(injector.getInstance(VAppHandler.class)).parse(is);
ListMultimap<String, InetAddress> networkToAddresses = ImmutableListMultimap
.<String, InetAddress> of();
VirtualSystem system = new VirtualSystem(0, "Virtual Hardware Family", "Oracle", "vmx-07");
SortedSet<ResourceAllocation> resourceAllocations = ImmutableSortedSet
.<ResourceAllocation> naturalOrder().add(
new ResourceAllocation(1, "1 virtual CPU(s)", "Number of Virtual CPUs",
ResourceType.PROCESSOR, null, null, null, null, null, null, 1,
"hertz * 10^6"),
new ResourceAllocation(2, "16MB of memory", "Memory Size",
ResourceType.MEMORY, null, null, null, null, null, null, 16,
"byte * 2^20")).add(
new ResourceAllocation(3, "SCSI Controller 0", "SCSI Controller",
ResourceType.SCSI_CONTROLLER, "lsilogic", null, 0, null, null,
null, 1, null)).add(
new ResourceAllocation(8, "Network Adapter 1", "PCNet32 ethernet adapter on \"Internal\" network",
ResourceType.ETHERNET_ADAPTER, "PCNet32", null, null, 7, null,
true, 1, null)).add(
new ResourceAllocation(9, "Hard Disk 1", null, ResourceType.DISK_DRIVE,
null, "104857", null, 0, 3, null, 104857, "byte * 2^20"))
.build();
VApp expects = new VAppImpl("4", "Oracle", URI
.create("http://10.150.4.49/api/v0.8/vApp/4"), VAppStatus.ON,
new Long(104857), networkToAddresses, "Other Linux (32-bit)", system, resourceAllocations);
assertEquals(result, expects);
}
}

View File

@ -1,41 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<VApp href="http://10.150.4.49/api/v0.8/vApp/5" type="application/vnd.vmware.vcloud.vApp+xml"
name="SQL" status="4"
xmlns="http://www.vmware.com/vcloud/v0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Link rel="up"
href="http://10.150.4.49/api/v0.8/vdc/3"
type="application/vnd.vmware.vcloud.vdc+xml"/>
<OperatingSystemSection ovf:id="36" xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1">
<VApp href="http://10.150.4.49/api/v0.8/vApp/4" type="application/vnd.vmware.vcloud.vApp+xml"
name="Oracle" status="4"
xsi:schemaLocation="http://www.vmware.com/vcloud/v0.8 http://10.150.4.49/api/v0.8/vcloud/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="104857">
<Link rel="up" href="http://10.150.4.49/api/v0.8/vdc/4" type="application/vnd.vmware.vcloud.vdc+xml" />
<OperatingSystemSection d2p1:id="36"
xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:d2p1="http://schemas.dmtf.org/ovf/envelope/1">
<Info>The kind of installed guest operating system</Info>
<Description>Other Linux (32-bit)</Description>
</OperatingSystemSection>
<VirtualHardwareSection xmlns="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">
<VirtualHardwareSection xmlns="http://schemas.dmtf.org/ovf/envelope/1">
<Info>Virtual hardware</Info>
<Link rel="edit" href="http://10.150.4.49/api/v0.8/vApp/5" type="application/vnd.vmware.ovf.virtualHardwareSection+xml"/>
<Link rel="edit" href="http://10.150.4.49/api/v0.8/vApp/4"
type="application/vnd.vmware.ovf.virtualHardwareSection+xml" />
<System>
<rasd:AutomaticRecoveryAction xsi:nil="true" />
<rasd:AutomaticShutdownAction xsi:nil="true" />
<rasd:AutomaticStartupAction xsi:nil="true" />
<rasd:AutomaticStartupActionDelay xsi:nil="true" />
<rasd:AutomaticStartupActionSequenceNumber xsi:nil="true" />
<rasd:Caption xsi:nil="true" />
<rasd:ConfigurationDataRoot xsi:nil="true" />
<rasd:ConfigurationFile xsi:nil="true" />
<rasd:ConfigurationID xsi:nil="true" />
<rasd:CreationTime xsi:nil="true" />
<rasd:Description xsi:nil="true" />
<rasd:ElementName>Virtual Hardware Family</rasd:ElementName>
<rasd:InstanceID>0</rasd:InstanceID>
<rasd:LogDataRoot xsi:nil="true" />
<rasd:RecoveryFile xsi:nil="true" />
<rasd:SnapshotDataRoot xsi:nil="true" />
<rasd:SuspendDataRoot xsi:nil="true" />
<rasd:SwapFileDataRoot xsi:nil="true" />
<rasd:VirtualSystemIdentifier>SQL</rasd:VirtualSystemIdentifier>
<rasd:VirtualSystemType>vmx-07</rasd:VirtualSystemType>
<vssd:AutomaticRecoveryAction xsi:nil="true" />
<vssd:AutomaticShutdownAction xsi:nil="true" />
<vssd:AutomaticStartupAction xsi:nil="true" />
<vssd:AutomaticStartupActionDelay
xsi:nil="true" />
<vssd:AutomaticStartupActionSequenceNumber
xsi:nil="true" />
<vssd:Caption xsi:nil="true" />
<vssd:ConfigurationDataRoot xsi:nil="true" />
<vssd:ConfigurationFile xsi:nil="true" />
<vssd:ConfigurationID xsi:nil="true" />
<vssd:CreationTime xsi:nil="true" />
<vssd:Description xsi:nil="true" />
<vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
<vssd:InstanceID>0</vssd:InstanceID>
<vssd:LogDataRoot xsi:nil="true" />
<vssd:RecoveryFile xsi:nil="true" />
<vssd:SnapshotDataRoot xsi:nil="true" />
<vssd:SuspendDataRoot xsi:nil="true" />
<vssd:SwapFileDataRoot xsi:nil="true" />
<vssd:VirtualSystemIdentifier>Oracle</vssd:VirtualSystemIdentifier>
<vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
</System>
<Item>
<rasd:Address xsi:nil="true" />
@ -110,7 +114,8 @@
<rasd:AddressOnParent>7</rasd:AddressOnParent>
<rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
<rasd:Connection connected="true">Internal</rasd:Connection>
<rasd:Description>PCNet32 ethernet adapter on "Internal" network</rasd:Description>
<rasd:Description>PCNet32 ethernet adapter on "Internal" network
</rasd:Description>
<rasd:ElementName>Network Adapter 1</rasd:ElementName>
<rasd:InstanceID>8</rasd:InstanceID>
<rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>

View File

@ -63,7 +63,7 @@ public interface HostingDotComVCloudAsyncClient extends VCloudAsyncClient {
// produces is incorrect, but required for hosting.com to operate
@XMLResponseParser(CatalogHandler.class)
@Override
Future<? extends Catalog> getCatalog();
Future<? extends Catalog> getDefaultCatalog();
@GET
@Consumes(VAPP_XML)

View File

@ -20,7 +20,7 @@ package org.jclouds.vcloud.hostingdotcom.domain.internal;
import java.net.InetAddress;
import java.net.URI;
import java.util.SortedSet;
import java.util.Set;
import org.jclouds.vcloud.domain.ResourceAllocation;
import org.jclouds.vcloud.domain.VAppStatus;
@ -47,7 +47,7 @@ public class HostingDotComVAppImpl extends VAppImpl implements HostingDotComVApp
public HostingDotComVAppImpl(String id, String name, URI location, VAppStatus status, Long size,
ListMultimap<String, InetAddress> networkToAddresses,
String operatingSystemDescription, VirtualSystem system,
SortedSet<ResourceAllocation> resourceAllocations, String username, String password) {
Set<ResourceAllocation> resourceAllocations, String username, String password) {
super(id, name, location, status, size, networkToAddresses, operatingSystemDescription,
system, resourceAllocations);
this.username = username;

View File

@ -59,7 +59,7 @@ import com.google.inject.TypeLiteral;
public class HostingDotComVCloudAsyncClientTest extends
RestClientTest<HostingDotComVCloudAsyncClient> {
public void testCatalog() throws SecurityException, NoSuchMethodException, IOException {
Method method = HostingDotComVCloudAsyncClient.class.getMethod("getCatalog");
Method method = HostingDotComVCloudAsyncClient.class.getMethod("getDefaultCatalog");
GeneratedHttpRequest<HostingDotComVCloudAsyncClient> httpMethod = processor
.createRequest(method);

View File

@ -44,7 +44,7 @@ public class ParseTaskFromLocationHeader implements Function<HttpResponse, Task>
if (location != null) {
String taskId = location.substring(location.lastIndexOf('/') + 1);
return new TaskImpl(taskId, URI.create(location), TaskStatus.QUEUED, new Date(), null,
null, null);
null, null, null);
} else {
throw new HttpResponseException("no uri in headers or content", null, from);
}

View File

@ -130,7 +130,7 @@ public class TerremarkVCloudClientLiveTest extends VCloudClientLiveTest {
@Test
public void testGetConfigCustomizationOptions() throws Exception {
Catalog response = connection.getCatalog();
Catalog response = connection.getDefaultCatalog();
for (NamedResource resource : response.values()) {
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
CatalogItem item = connection.getCatalogItem(resource.getId());
@ -168,7 +168,7 @@ public class TerremarkVCloudClientLiveTest extends VCloudClientLiveTest {
String vDCId = tmClient.getDefaultVDC().getId();
// lookup the id of the item in the catalog you wish to deploy by name
String itemId = tmClient.getCatalog().get("Ubuntu JeOS 9.04 (32-bit)").getId();
String itemId = tmClient.getDefaultCatalog().get("Ubuntu JeOS 9.04 (32-bit)").getId();
// determine the cheapest configuration size
SortedSet<ComputeOptions> sizeOptions = tmClient.getComputeOptionsOfCatalogItem(itemId);