mirror of https://github.com/apache/jclouds.git
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:
parent
15c147cd25
commit
e2235e48f8
|
@ -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,16 +83,30 @@ 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)
|
||||
@Path("/vAppTemplate/{vAppTemplateId}")
|
||||
|
|
|
@ -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();
|
||||
|
||||
Organization getOrganization(String orgId);
|
||||
|
||||
Catalog getCatalog();
|
||||
Catalog getDefaultCatalog();
|
||||
|
||||
Catalog getCatalog(String catalogId);
|
||||
|
||||
CatalogItem getCatalogItem(String catalogItemId);
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ public class BindInstantiateVAppTemplateParamsToXmlPayload implements MapBinder
|
|||
}
|
||||
|
||||
protected void addNetworkConfig(XMLBuilder instantiationParamsBuilder, String name,
|
||||
String network) {
|
||||
String network) {
|
||||
XMLBuilder networkConfigBuilder = instantiationParamsBuilder.e("NetworkConfigSection").e(
|
||||
"NetworkConfig").a("name", name);
|
||||
XMLBuilder featuresBuilder = networkConfigBuilder.e("Features");
|
||||
|
|
|
@ -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,7 +83,9 @@ import com.google.inject.Provides;
|
|||
@RequiresHttp
|
||||
@ConfiguresRestClient
|
||||
public class VCloudRestClientModule extends AbstractModule {
|
||||
|
||||
@Resource
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
protected Predicate<InetSocketAddress> socketTester(SocketOpen open) {
|
||||
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -126,90 +126,96 @@ public class ResourceAllocation implements Comparable<ResourceAllocation> {
|
|||
}
|
||||
|
||||
@Override
|
||||
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 + ((connected == null) ? 0 : connected.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());
|
||||
return result;
|
||||
}
|
||||
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 + ((connected == null) ? 0 : connected.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());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ResourceAllocation other = (ResourceAllocation) obj;
|
||||
if (address == null) {
|
||||
if (other.address != null)
|
||||
return false;
|
||||
} else if (!address.equals(other.address))
|
||||
return false;
|
||||
if (addressOnParent == null) {
|
||||
if (other.addressOnParent != null)
|
||||
return false;
|
||||
} else if (!addressOnParent.equals(other.addressOnParent))
|
||||
return false;
|
||||
if (connected == null) {
|
||||
if (other.connected != null)
|
||||
return false;
|
||||
} else if (!connected.equals(other.connected))
|
||||
return false;
|
||||
if (description == null) {
|
||||
if (other.description != null)
|
||||
return false;
|
||||
} else if (!description.equals(other.description))
|
||||
return false;
|
||||
if (hostResource == null) {
|
||||
if (other.hostResource != null)
|
||||
return false;
|
||||
} else if (!hostResource.equals(other.hostResource))
|
||||
return false;
|
||||
if (id != other.id)
|
||||
return false;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
} else if (!name.equals(other.name))
|
||||
return false;
|
||||
if (parent == null) {
|
||||
if (other.parent != null)
|
||||
return false;
|
||||
} else if (!parent.equals(other.parent))
|
||||
return false;
|
||||
if (subType == null) {
|
||||
if (other.subType != null)
|
||||
return false;
|
||||
} else if (!subType.equals(other.subType))
|
||||
return false;
|
||||
if (type == null) {
|
||||
if (other.type != null)
|
||||
return false;
|
||||
} else if (!type.equals(other.type))
|
||||
return false;
|
||||
if (virtualQuantity != other.virtualQuantity)
|
||||
return false;
|
||||
if (virtualQuantityUnits == null) {
|
||||
if (other.virtualQuantityUnits != null)
|
||||
return false;
|
||||
} else if (!virtualQuantityUnits.equals(other.virtualQuantityUnits))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ResourceAllocation other = (ResourceAllocation) obj;
|
||||
if (address == null) {
|
||||
if (other.address != null)
|
||||
return false;
|
||||
} else if (!address.equals(other.address))
|
||||
return false;
|
||||
if (addressOnParent == null) {
|
||||
if (other.addressOnParent != null)
|
||||
return false;
|
||||
} else if (!addressOnParent.equals(other.addressOnParent))
|
||||
return false;
|
||||
if (connected == null) {
|
||||
if (other.connected != null)
|
||||
return false;
|
||||
} else if (!connected.equals(other.connected))
|
||||
return false;
|
||||
if (description == null) {
|
||||
if (other.description != null)
|
||||
return false;
|
||||
} else if (!description.equals(other.description))
|
||||
return false;
|
||||
if (hostResource == null) {
|
||||
if (other.hostResource != null)
|
||||
return false;
|
||||
} else if (!hostResource.equals(other.hostResource))
|
||||
return false;
|
||||
if (id != other.id)
|
||||
return false;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
} else if (!name.equals(other.name))
|
||||
return false;
|
||||
if (parent == null) {
|
||||
if (other.parent != null)
|
||||
return false;
|
||||
} else if (!parent.equals(other.parent))
|
||||
return false;
|
||||
if (subType == null) {
|
||||
if (other.subType != null)
|
||||
return false;
|
||||
} else if (!subType.equals(other.subType))
|
||||
return false;
|
||||
if (type == null) {
|
||||
if (other.type != null)
|
||||
return false;
|
||||
} else if (!type.equals(other.type))
|
||||
return false;
|
||||
if (virtualQuantity != other.virtualQuantity)
|
||||
return false;
|
||||
if (virtualQuantityUnits == null) {
|
||||
if (other.virtualQuantityUnits != null)
|
||||
return false;
|
||||
} else if (!virtualQuantityUnits.equals(other.virtualQuantityUnits))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -50,44 +50,45 @@ public class VirtualSystem {
|
|||
}
|
||||
|
||||
@Override
|
||||
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 + ((name == null) ? 0 : name.hashCode());
|
||||
result = prime * result + ((type == null) ? 0 : type.hashCode());
|
||||
return result;
|
||||
}
|
||||
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 + ((name == null) ? 0 : name.hashCode());
|
||||
result = prime * result + ((type == null) ? 0 : type.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
VirtualSystem other = (VirtualSystem) obj;
|
||||
if (id != other.id)
|
||||
return false;
|
||||
if (identifier == null) {
|
||||
if (other.identifier != null)
|
||||
return false;
|
||||
} else if (!identifier.equals(other.identifier))
|
||||
return false;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
} else if (!name.equals(other.name))
|
||||
return false;
|
||||
if (type == null) {
|
||||
if (other.type != null)
|
||||
return false;
|
||||
} else if (!type.equals(other.type))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
VirtualSystem other = (VirtualSystem) obj;
|
||||
if (id != other.id)
|
||||
return false;
|
||||
if (identifier == null) {
|
||||
if (other.identifier != null)
|
||||
return false;
|
||||
} else if (!identifier.equals(other.identifier))
|
||||
return false;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
} else if (!name.equals(other.name))
|
||||
return false;
|
||||
if (type == null) {
|
||||
if (other.type != null)
|
||||
return false;
|
||||
} else if (!type.equals(other.type))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -30,135 +30,217 @@ 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 {
|
||||
private final String id;
|
||||
private final URI location;
|
||||
private final TaskStatus status;
|
||||
private final Date startTime;
|
||||
@Nullable
|
||||
private final Date endTime;
|
||||
private final NamedResource owner;
|
||||
@Nullable
|
||||
private final NamedResource result;
|
||||
|
||||
public TaskImpl(String id, URI location, TaskStatus status, Date startTime,
|
||||
@Nullable Date endTime, NamedResource owner,
|
||||
@Nullable NamedResource result) {
|
||||
this.id = checkNotNull(id, "id");
|
||||
this.location = checkNotNull(location, "location");
|
||||
this.status = checkNotNull(status, "status");
|
||||
this.startTime = startTime;
|
||||
this.endTime = endTime;
|
||||
this.owner = owner;
|
||||
this.result = result;
|
||||
}
|
||||
public static class ErrorImpl implements Error {
|
||||
private final String message;
|
||||
private final String majorErrorCode;
|
||||
private final String minorErrorCode;
|
||||
|
||||
public TaskStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
public ErrorImpl(String message, String majorErrorCode,
|
||||
String minorErrorCode) {
|
||||
this.message = message;
|
||||
this.majorErrorCode = majorErrorCode;
|
||||
this.minorErrorCode = minorErrorCode;
|
||||
}
|
||||
|
||||
public Date getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public NamedResource getOwner() {
|
||||
return owner;
|
||||
}
|
||||
public String getMajorErrorCode() {
|
||||
return majorErrorCode;
|
||||
}
|
||||
|
||||
public NamedResource getResult() {
|
||||
return result;
|
||||
}
|
||||
public String getMinorErrorCode() {
|
||||
return minorErrorCode;
|
||||
}
|
||||
|
||||
public Date getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
@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;
|
||||
}
|
||||
|
||||
public int compareTo(Task o) {
|
||||
return (this == o) ? 0 : getId().compareTo(o.getId());
|
||||
}
|
||||
@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;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ErrorImpl [majorErrorCode=" + majorErrorCode + ", message="
|
||||
+ message + ", minorErrorCode=" + minorErrorCode + "]";
|
||||
}
|
||||
}
|
||||
|
||||
public URI getLocation() {
|
||||
return location;
|
||||
}
|
||||
private final String id;
|
||||
private final URI location;
|
||||
private final TaskStatus status;
|
||||
private final Date startTime;
|
||||
@Nullable
|
||||
private final Date endTime;
|
||||
private final NamedResource owner;
|
||||
@Nullable
|
||||
private final NamedResource result;
|
||||
@Nullable
|
||||
private final Error error;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((endTime == null) ? 0 : endTime.hashCode());
|
||||
result = prime * result + ((id == null) ? 0 : id.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());
|
||||
result = prime * result
|
||||
+ ((startTime == null) ? 0 : startTime.hashCode());
|
||||
result = prime * result + ((status == null) ? 0 : status.hashCode());
|
||||
return result;
|
||||
}
|
||||
public TaskImpl(String id, URI location, TaskStatus status, Date startTime,
|
||||
@Nullable Date endTime, NamedResource owner,
|
||||
@Nullable NamedResource result, Error error) {
|
||||
this.id = checkNotNull(id, "id");
|
||||
this.location = checkNotNull(location, "location");
|
||||
this.status = checkNotNull(status, "status");
|
||||
this.startTime = startTime;
|
||||
this.endTime = endTime;
|
||||
this.owner = owner;
|
||||
this.result = result;
|
||||
this.error = error;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
TaskImpl other = (TaskImpl) obj;
|
||||
if (endTime == null) {
|
||||
if (other.endTime != null)
|
||||
return false;
|
||||
} else if (!endTime.equals(other.endTime))
|
||||
return false;
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
return false;
|
||||
if (location == null) {
|
||||
if (other.location != null)
|
||||
return false;
|
||||
} else if (!location.equals(other.location))
|
||||
return false;
|
||||
if (owner == null) {
|
||||
if (other.owner != null)
|
||||
return false;
|
||||
} else if (!owner.equals(other.owner))
|
||||
return false;
|
||||
if (result == null) {
|
||||
if (other.result != null)
|
||||
return false;
|
||||
} else if (!result.equals(other.result))
|
||||
return false;
|
||||
if (startTime == null) {
|
||||
if (other.startTime != null)
|
||||
return false;
|
||||
} else if (!startTime.equals(other.startTime))
|
||||
return false;
|
||||
if (status == null) {
|
||||
if (other.status != null)
|
||||
return false;
|
||||
} else if (!status.equals(other.status))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
public TaskStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TaskImpl [endTime=" + endTime + ", id=" + id + ", location="
|
||||
+ location + ", owner=" + owner + ", result=" + result
|
||||
+ ", startTime=" + startTime + ", status=" + status + "]";
|
||||
}
|
||||
public Date getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public NamedResource getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public NamedResource getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public Date getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public int compareTo(Task o) {
|
||||
return (this == o) ? 0 : getId().compareTo(o.getId());
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public URI getLocation() {
|
||||
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 + ((owner == null) ? 0 : owner.hashCode());
|
||||
result = prime * result
|
||||
+ ((this.result == null) ? 0 : this.result.hashCode());
|
||||
result = prime * result
|
||||
+ ((startTime == null) ? 0 : startTime.hashCode());
|
||||
result = prime * result + ((status == null) ? 0 : status.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
TaskImpl other = (TaskImpl) obj;
|
||||
if (endTime == null) {
|
||||
if (other.endTime != null)
|
||||
return false;
|
||||
} else if (!endTime.equals(other.endTime))
|
||||
return false;
|
||||
if (error == null) {
|
||||
if (other.error != null)
|
||||
return false;
|
||||
} else if (!error.equals(other.error))
|
||||
return false;
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
return false;
|
||||
if (location == null) {
|
||||
if (other.location != null)
|
||||
return false;
|
||||
} else if (!location.equals(other.location))
|
||||
return false;
|
||||
if (owner == null) {
|
||||
if (other.owner != null)
|
||||
return false;
|
||||
} else if (!owner.equals(other.owner))
|
||||
return false;
|
||||
if (result == null) {
|
||||
if (other.result != null)
|
||||
return false;
|
||||
} else if (!result.equals(other.result))
|
||||
return false;
|
||||
if (startTime == null) {
|
||||
if (other.startTime != null)
|
||||
return false;
|
||||
} else if (!startTime.equals(other.startTime))
|
||||
return false;
|
||||
if (status == null) {
|
||||
if (other.status != null)
|
||||
return false;
|
||||
} else if (!status.equals(other.status))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TaskImpl [endTime=" + endTime + ", error=" + error + ", id=" + id
|
||||
+ ", location=" + location + ", owner=" + owner + ", result="
|
||||
+ result + ", startTime=" + startTime + ", status=" + status + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -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,79 +102,95 @@ public class VAppImpl implements VApp {
|
|||
}
|
||||
|
||||
@Override
|
||||
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 + ((size == null) ? 0 : size.hashCode());
|
||||
result = prime * result + ((status == null) ? 0 : status.hashCode());
|
||||
result = prime * result + ((system == null) ? 0 : system.hashCode());
|
||||
return result;
|
||||
}
|
||||
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
|
||||
+ ((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) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
VAppImpl other = (VAppImpl) obj;
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
return false;
|
||||
if (location == null) {
|
||||
if (other.location != null)
|
||||
return false;
|
||||
} else if (!location.equals(other.location))
|
||||
return false;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
} else if (!name.equals(other.name))
|
||||
return false;
|
||||
if (networkToAddresses == null) {
|
||||
if (other.networkToAddresses != null)
|
||||
return false;
|
||||
} else if (!networkToAddresses.equals(other.networkToAddresses))
|
||||
return false;
|
||||
if (operatingSystemDescription == null) {
|
||||
if (other.operatingSystemDescription != null)
|
||||
return false;
|
||||
} else if (!operatingSystemDescription.equals(other.operatingSystemDescription))
|
||||
return false;
|
||||
if (resourceAllocations == null) {
|
||||
if (other.resourceAllocations != null)
|
||||
return false;
|
||||
} else if (!resourceAllocations.equals(other.resourceAllocations))
|
||||
return false;
|
||||
if (size == null) {
|
||||
if (other.size != null)
|
||||
return false;
|
||||
} else if (!size.equals(other.size))
|
||||
return false;
|
||||
if (status == null) {
|
||||
if (other.status != null)
|
||||
return false;
|
||||
} else if (!status.equals(other.status))
|
||||
return false;
|
||||
if (system == null) {
|
||||
if (other.system != null)
|
||||
return false;
|
||||
} else if (!system.equals(other.system))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
VAppImpl other = (VAppImpl) obj;
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
return false;
|
||||
if (location == null) {
|
||||
if (other.location != null)
|
||||
return false;
|
||||
} else if (!location.equals(other.location))
|
||||
return false;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
} else if (!name.equals(other.name))
|
||||
return false;
|
||||
if (networkToAddresses == null) {
|
||||
if (other.networkToAddresses != null)
|
||||
return false;
|
||||
} else if (!networkToAddresses.equals(other.networkToAddresses))
|
||||
return false;
|
||||
if (operatingSystemDescription == null) {
|
||||
if (other.operatingSystemDescription != null)
|
||||
return false;
|
||||
} 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)
|
||||
return false;
|
||||
} else if (!resourceAllocations.equals(other.resourceAllocations))
|
||||
return false;
|
||||
if (size == null) {
|
||||
if (other.size != null)
|
||||
return false;
|
||||
} else if (!size.equals(other.size))
|
||||
return false;
|
||||
if (status == null) {
|
||||
if (other.status != null)
|
||||
return false;
|
||||
} else if (!status.equals(other.status))
|
||||
return false;
|
||||
if (system == null) {
|
||||
if (other.system != null)
|
||||
return false;
|
||||
} else if (!system.equals(other.system))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
|
|
|
@ -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
|
||||
.getValue(attributes.getIndex("type")), URI.create(uri));
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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")));
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
@ -175,9 +175,24 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
|||
|
||||
checkFilters(httpMethod);
|
||||
}
|
||||
|
||||
public void testOrganization() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("getOrganization", String.class);
|
||||
GeneratedHttpRequest<VCloudAsyncClient> httpMethod = processor.createRequest(method, "1");
|
||||
|
||||
public void testCatalog() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Method method = VCloudAsyncClient.class.getMethod("getCatalog");
|
||||
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");
|
||||
|
@ -190,6 +205,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);
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
.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
|
||||
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
|
||||
.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
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/task/d188849-78"),
|
||||
TaskStatus.QUEUED, null, null, null, null
|
||||
);
|
||||
Task expects = new TaskImpl(
|
||||
"d188849-78",
|
||||
URI
|
||||
.create("https://vcloud.safesecureweb.com/api/v0.8/task/d188849-78"),
|
||||
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
|
||||
.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);
|
||||
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, 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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,144 +1,149 @@
|
|||
<?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">
|
||||
<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">
|
||||
<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"/>
|
||||
<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>
|
||||
</System>
|
||||
<Item>
|
||||
<rasd:Address xsi:nil="true" />
|
||||
<rasd:AddressOnParent xsi:nil="true" />
|
||||
<rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
|
||||
<rasd:AutomaticAllocation xsi:nil="true" />
|
||||
<rasd:AutomaticDeallocation xsi:nil="true" />
|
||||
<rasd:Caption xsi:nil="true" />
|
||||
<rasd:ConsumerVisibility xsi:nil="true" />
|
||||
<rasd:Description>Number of Virtual CPUs</rasd:Description>
|
||||
<rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
|
||||
<rasd:InstanceID>1</rasd:InstanceID>
|
||||
<rasd:Limit xsi:nil="true" />
|
||||
<rasd:MappingBehavior xsi:nil="true" />
|
||||
<rasd:OtherResourceType xsi:nil="true" />
|
||||
<rasd:Parent xsi:nil="true" />
|
||||
<rasd:PoolID xsi:nil="true" />
|
||||
<rasd:Reservation xsi:nil="true" />
|
||||
<rasd:ResourceSubType xsi:nil="true" />
|
||||
<rasd:ResourceType>3</rasd:ResourceType>
|
||||
<rasd:VirtualQuantity>1</rasd:VirtualQuantity>
|
||||
<rasd:VirtualQuantityUnits>count</rasd:VirtualQuantityUnits>
|
||||
<rasd:Weight xsi:nil="true" />
|
||||
</Item>
|
||||
<Item>
|
||||
<rasd:Address xsi:nil="true" />
|
||||
<rasd:AddressOnParent xsi:nil="true" />
|
||||
<rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
|
||||
<rasd:AutomaticAllocation xsi:nil="true" />
|
||||
<rasd:AutomaticDeallocation xsi:nil="true" />
|
||||
<rasd:Caption xsi:nil="true" />
|
||||
<rasd:ConsumerVisibility xsi:nil="true" />
|
||||
<rasd:Description>Memory Size</rasd:Description>
|
||||
<rasd:ElementName>16MB of memory</rasd:ElementName>
|
||||
<rasd:InstanceID>2</rasd:InstanceID>
|
||||
<rasd:Limit xsi:nil="true" />
|
||||
<rasd:MappingBehavior xsi:nil="true" />
|
||||
<rasd:OtherResourceType xsi:nil="true" />
|
||||
<rasd:Parent xsi:nil="true" />
|
||||
<rasd:PoolID xsi:nil="true" />
|
||||
<rasd:Reservation xsi:nil="true" />
|
||||
<rasd:ResourceSubType xsi:nil="true" />
|
||||
<rasd:ResourceType>4</rasd:ResourceType>
|
||||
<rasd:VirtualQuantity>16</rasd:VirtualQuantity>
|
||||
<rasd:VirtualQuantityUnits>byte * 2^20</rasd:VirtualQuantityUnits>
|
||||
<rasd:Weight xsi:nil="true" />
|
||||
</Item>
|
||||
<Item>
|
||||
<rasd:Address>0</rasd:Address>
|
||||
<rasd:AddressOnParent xsi:nil="true" />
|
||||
<rasd:AllocationUnits xsi:nil="true" />
|
||||
<rasd:AutomaticAllocation xsi:nil="true" />
|
||||
<rasd:AutomaticDeallocation xsi:nil="true" />
|
||||
<rasd:Caption xsi:nil="true" />
|
||||
<rasd:ConsumerVisibility xsi:nil="true" />
|
||||
<rasd:Description>SCSI Controller</rasd:Description>
|
||||
<rasd:ElementName>SCSI Controller 0</rasd:ElementName>
|
||||
<rasd:InstanceID>3</rasd:InstanceID>
|
||||
<rasd:Limit xsi:nil="true" />
|
||||
<rasd:MappingBehavior xsi:nil="true" />
|
||||
<rasd:OtherResourceType xsi:nil="true" />
|
||||
<rasd:Parent xsi:nil="true" />
|
||||
<rasd:PoolID xsi:nil="true" />
|
||||
<rasd:Reservation xsi:nil="true" />
|
||||
<rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
|
||||
<rasd:ResourceType>6</rasd:ResourceType>
|
||||
<rasd:VirtualQuantity xsi:nil="true" />
|
||||
<rasd:VirtualQuantityUnits xsi:nil="true" />
|
||||
<rasd:Weight xsi:nil="true" />
|
||||
</Item>
|
||||
<Item>
|
||||
<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:ElementName>Network Adapter 1</rasd:ElementName>
|
||||
<rasd:InstanceID>8</rasd:InstanceID>
|
||||
<rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
|
||||
<rasd:ResourceType>10</rasd:ResourceType>
|
||||
</Item>
|
||||
<Item>
|
||||
<rasd:Address xsi:nil="true" />
|
||||
<rasd:AddressOnParent>0</rasd:AddressOnParent>
|
||||
<rasd:AllocationUnits xsi:nil="true" />
|
||||
<rasd:AutomaticAllocation xsi:nil="true" />
|
||||
<rasd:AutomaticDeallocation xsi:nil="true" />
|
||||
<rasd:Caption xsi:nil="true" />
|
||||
<rasd:ConsumerVisibility xsi:nil="true" />
|
||||
<rasd:Description xsi:nil="true" />
|
||||
<rasd:ElementName>Hard Disk 1</rasd:ElementName>
|
||||
<rasd:HostResource>104857</rasd:HostResource>
|
||||
<rasd:InstanceID>9</rasd:InstanceID>
|
||||
<rasd:Limit xsi:nil="true" />
|
||||
<rasd:MappingBehavior xsi:nil="true" />
|
||||
<rasd:OtherResourceType xsi:nil="true" />
|
||||
<rasd:Parent>3</rasd:Parent>
|
||||
<rasd:PoolID xsi:nil="true" />
|
||||
<rasd:Reservation xsi:nil="true" />
|
||||
<rasd:ResourceSubType xsi:nil="true" />
|
||||
<rasd:ResourceType>17</rasd:ResourceType>
|
||||
<rasd:VirtualQuantity>104857</rasd:VirtualQuantity>
|
||||
<rasd:VirtualQuantityUnits xsi:nil="true" />
|
||||
<rasd:Weight xsi:nil="true" />
|
||||
</Item>
|
||||
</VirtualHardwareSection>
|
||||
<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">
|
||||
<Info>Virtual hardware</Info>
|
||||
<Link rel="edit" href="http://10.150.4.49/api/v0.8/vApp/4"
|
||||
type="application/vnd.vmware.ovf.virtualHardwareSection+xml" />
|
||||
<System>
|
||||
<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" />
|
||||
<rasd:AddressOnParent xsi:nil="true" />
|
||||
<rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
|
||||
<rasd:AutomaticAllocation xsi:nil="true" />
|
||||
<rasd:AutomaticDeallocation xsi:nil="true" />
|
||||
<rasd:Caption xsi:nil="true" />
|
||||
<rasd:ConsumerVisibility xsi:nil="true" />
|
||||
<rasd:Description>Number of Virtual CPUs</rasd:Description>
|
||||
<rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
|
||||
<rasd:InstanceID>1</rasd:InstanceID>
|
||||
<rasd:Limit xsi:nil="true" />
|
||||
<rasd:MappingBehavior xsi:nil="true" />
|
||||
<rasd:OtherResourceType xsi:nil="true" />
|
||||
<rasd:Parent xsi:nil="true" />
|
||||
<rasd:PoolID xsi:nil="true" />
|
||||
<rasd:Reservation xsi:nil="true" />
|
||||
<rasd:ResourceSubType xsi:nil="true" />
|
||||
<rasd:ResourceType>3</rasd:ResourceType>
|
||||
<rasd:VirtualQuantity>1</rasd:VirtualQuantity>
|
||||
<rasd:VirtualQuantityUnits>count</rasd:VirtualQuantityUnits>
|
||||
<rasd:Weight xsi:nil="true" />
|
||||
</Item>
|
||||
<Item>
|
||||
<rasd:Address xsi:nil="true" />
|
||||
<rasd:AddressOnParent xsi:nil="true" />
|
||||
<rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
|
||||
<rasd:AutomaticAllocation xsi:nil="true" />
|
||||
<rasd:AutomaticDeallocation xsi:nil="true" />
|
||||
<rasd:Caption xsi:nil="true" />
|
||||
<rasd:ConsumerVisibility xsi:nil="true" />
|
||||
<rasd:Description>Memory Size</rasd:Description>
|
||||
<rasd:ElementName>16MB of memory</rasd:ElementName>
|
||||
<rasd:InstanceID>2</rasd:InstanceID>
|
||||
<rasd:Limit xsi:nil="true" />
|
||||
<rasd:MappingBehavior xsi:nil="true" />
|
||||
<rasd:OtherResourceType xsi:nil="true" />
|
||||
<rasd:Parent xsi:nil="true" />
|
||||
<rasd:PoolID xsi:nil="true" />
|
||||
<rasd:Reservation xsi:nil="true" />
|
||||
<rasd:ResourceSubType xsi:nil="true" />
|
||||
<rasd:ResourceType>4</rasd:ResourceType>
|
||||
<rasd:VirtualQuantity>16</rasd:VirtualQuantity>
|
||||
<rasd:VirtualQuantityUnits>byte * 2^20</rasd:VirtualQuantityUnits>
|
||||
<rasd:Weight xsi:nil="true" />
|
||||
</Item>
|
||||
<Item>
|
||||
<rasd:Address>0</rasd:Address>
|
||||
<rasd:AddressOnParent xsi:nil="true" />
|
||||
<rasd:AllocationUnits xsi:nil="true" />
|
||||
<rasd:AutomaticAllocation xsi:nil="true" />
|
||||
<rasd:AutomaticDeallocation xsi:nil="true" />
|
||||
<rasd:Caption xsi:nil="true" />
|
||||
<rasd:ConsumerVisibility xsi:nil="true" />
|
||||
<rasd:Description>SCSI Controller</rasd:Description>
|
||||
<rasd:ElementName>SCSI Controller 0</rasd:ElementName>
|
||||
<rasd:InstanceID>3</rasd:InstanceID>
|
||||
<rasd:Limit xsi:nil="true" />
|
||||
<rasd:MappingBehavior xsi:nil="true" />
|
||||
<rasd:OtherResourceType xsi:nil="true" />
|
||||
<rasd:Parent xsi:nil="true" />
|
||||
<rasd:PoolID xsi:nil="true" />
|
||||
<rasd:Reservation xsi:nil="true" />
|
||||
<rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
|
||||
<rasd:ResourceType>6</rasd:ResourceType>
|
||||
<rasd:VirtualQuantity xsi:nil="true" />
|
||||
<rasd:VirtualQuantityUnits xsi:nil="true" />
|
||||
<rasd:Weight xsi:nil="true" />
|
||||
</Item>
|
||||
<Item>
|
||||
<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:ElementName>Network Adapter 1</rasd:ElementName>
|
||||
<rasd:InstanceID>8</rasd:InstanceID>
|
||||
<rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
|
||||
<rasd:ResourceType>10</rasd:ResourceType>
|
||||
</Item>
|
||||
<Item>
|
||||
<rasd:Address xsi:nil="true" />
|
||||
<rasd:AddressOnParent>0</rasd:AddressOnParent>
|
||||
<rasd:AllocationUnits xsi:nil="true" />
|
||||
<rasd:AutomaticAllocation xsi:nil="true" />
|
||||
<rasd:AutomaticDeallocation xsi:nil="true" />
|
||||
<rasd:Caption xsi:nil="true" />
|
||||
<rasd:ConsumerVisibility xsi:nil="true" />
|
||||
<rasd:Description xsi:nil="true" />
|
||||
<rasd:ElementName>Hard Disk 1</rasd:ElementName>
|
||||
<rasd:HostResource>104857</rasd:HostResource>
|
||||
<rasd:InstanceID>9</rasd:InstanceID>
|
||||
<rasd:Limit xsi:nil="true" />
|
||||
<rasd:MappingBehavior xsi:nil="true" />
|
||||
<rasd:OtherResourceType xsi:nil="true" />
|
||||
<rasd:Parent>3</rasd:Parent>
|
||||
<rasd:PoolID xsi:nil="true" />
|
||||
<rasd:Reservation xsi:nil="true" />
|
||||
<rasd:ResourceSubType xsi:nil="true" />
|
||||
<rasd:ResourceType>17</rasd:ResourceType>
|
||||
<rasd:VirtualQuantity>104857</rasd:VirtualQuantity>
|
||||
<rasd:VirtualQuantityUnits xsi:nil="true" />
|
||||
<rasd:Weight xsi:nil="true" />
|
||||
</Item>
|
||||
</VirtualHardwareSection>
|
||||
</VApp>
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue