mirror of https://github.com/apache/jclouds.git
Issue 112: simplified instantiate instance
git-svn-id: http://jclouds.googlecode.com/svn/trunk@2281 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
5e6ef2d068
commit
a260d15115
|
@ -24,6 +24,9 @@
|
||||||
package org.jclouds.vcloud.config;
|
package org.jclouds.vcloud.config;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.concurrent.TimeoutException;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
@ -33,8 +36,11 @@ import org.jclouds.rest.RestClientFactory;
|
||||||
import org.jclouds.vcloud.VCloudClient;
|
import org.jclouds.vcloud.VCloudClient;
|
||||||
import org.jclouds.vcloud.VCloudDiscovery;
|
import org.jclouds.vcloud.VCloudDiscovery;
|
||||||
import org.jclouds.vcloud.endpoints.Catalog;
|
import org.jclouds.vcloud.endpoints.Catalog;
|
||||||
|
import org.jclouds.vcloud.endpoints.Network;
|
||||||
import org.jclouds.vcloud.endpoints.TasksList;
|
import org.jclouds.vcloud.endpoints.TasksList;
|
||||||
|
import org.jclouds.vcloud.endpoints.VCloud;
|
||||||
import org.jclouds.vcloud.endpoints.VDC;
|
import org.jclouds.vcloud.endpoints.VDC;
|
||||||
|
import org.jclouds.vcloud.endpoints.internal.CatalogItemRoot;
|
||||||
|
|
||||||
import com.google.inject.AbstractModule;
|
import com.google.inject.AbstractModule;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
|
@ -65,6 +71,15 @@ public class VCloudRestClientModule extends AbstractModule {
|
||||||
return discovery.getOrganization().getCatalog().getLocation();
|
return discovery.getOrganization().getCatalog().getLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@CatalogItemRoot
|
||||||
|
@Singleton
|
||||||
|
String provideCatalogItemRoot(@VCloud URI vcloudUri) {
|
||||||
|
return vcloudUri.toASCIIString()+"/catalogItem";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@VDC
|
@VDC
|
||||||
@Singleton
|
@Singleton
|
||||||
|
@ -72,6 +87,15 @@ public class VCloudRestClientModule extends AbstractModule {
|
||||||
return discovery.getOrganization().getVDCs().values().iterator().next().getLocation();
|
return discovery.getOrganization().getVDCs().values().iterator().next().getLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Network
|
||||||
|
@Singleton
|
||||||
|
protected URI provideDefaultNetwork(VCloudClient client) throws InterruptedException,
|
||||||
|
ExecutionException, TimeoutException {
|
||||||
|
return client.getDefaultVDC().get(45, TimeUnit.SECONDS).getAvailableNetworks().values()
|
||||||
|
.iterator().next().getLocation();
|
||||||
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@TasksList
|
@TasksList
|
||||||
@Singleton
|
@Singleton
|
||||||
|
|
|
@ -35,6 +35,6 @@ import com.google.inject.ImplementedBy;
|
||||||
*/
|
*/
|
||||||
@org.jclouds.vcloud.endpoints.Catalog
|
@org.jclouds.vcloud.endpoints.Catalog
|
||||||
@ImplementedBy(CatalogImpl.class)
|
@ImplementedBy(CatalogImpl.class)
|
||||||
public interface Catalog extends NamedLink, Map<String, NamedLink> {
|
public interface Catalog extends NamedLink, Map<String, NamedResource> {
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package org.jclouds.vcloud.domain;
|
||||||
|
|
||||||
|
import org.jclouds.rest.domain.NamedLink;
|
||||||
|
import org.jclouds.vcloud.domain.internal.NamedResourceImpl;
|
||||||
|
|
||||||
|
import com.google.inject.ImplementedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Location of a Rest resource
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ImplementedBy(NamedResourceImpl.class)
|
||||||
|
public interface NamedResource extends NamedLink, Comparable<NamedResource> {
|
||||||
|
int getId();
|
||||||
|
}
|
|
@ -26,12 +26,13 @@ package org.jclouds.vcloud.domain.internal;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.HashMap;
|
import java.util.SortedMap;
|
||||||
import java.util.Map;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import org.jclouds.rest.domain.NamedLink;
|
import org.jclouds.rest.domain.NamedLink;
|
||||||
import org.jclouds.rest.domain.internal.NamedLinkImpl;
|
import org.jclouds.rest.domain.internal.NamedLinkImpl;
|
||||||
import org.jclouds.vcloud.domain.Catalog;
|
import org.jclouds.vcloud.domain.Catalog;
|
||||||
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Locations of resources in vCloud
|
* Locations of resources in vCloud
|
||||||
|
@ -39,14 +40,15 @@ import org.jclouds.vcloud.domain.Catalog;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CatalogImpl extends HashMap<String, NamedLink> implements Catalog {
|
public class CatalogImpl extends TreeMap<String, NamedResource> implements Catalog {
|
||||||
|
|
||||||
/** The serialVersionUID */
|
/** The serialVersionUID */
|
||||||
private static final long serialVersionUID = 8464716396538298809L;
|
private static final long serialVersionUID = 8464716396538298809L;
|
||||||
private final NamedLink catalog;
|
private final NamedLink catalog;
|
||||||
|
|
||||||
public CatalogImpl(String name, String type, URI location, Map<String, NamedLink> contents) {
|
public CatalogImpl(String name, String type, URI location,
|
||||||
super(contents.size());
|
SortedMap<String, NamedResource> contents) {
|
||||||
|
super();
|
||||||
this.catalog = new NamedLinkImpl(checkNotNull(name, "name"), checkNotNull(type, "type"),
|
this.catalog = new NamedLinkImpl(checkNotNull(name, "name"), checkNotNull(type, "type"),
|
||||||
checkNotNull(location, "location"));
|
checkNotNull(location, "location"));
|
||||||
putAll(checkNotNull(contents, "contents"));
|
putAll(checkNotNull(contents, "contents"));
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
package org.jclouds.vcloud.domain.internal;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
|
import org.jclouds.rest.domain.internal.NamedLinkImpl;
|
||||||
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Location of a Rest resource
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class NamedResourceImpl extends NamedLinkImpl implements NamedResource {
|
||||||
|
private final int id;
|
||||||
|
|
||||||
|
public NamedResourceImpl(int id, String name, String type, URI location) {
|
||||||
|
super(name, type, location);
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int compareTo(NamedResource that) {
|
||||||
|
final int BEFORE = -1;
|
||||||
|
final int EQUAL = 0;
|
||||||
|
final int AFTER = 1;
|
||||||
|
|
||||||
|
if (this == that)
|
||||||
|
return EQUAL;
|
||||||
|
|
||||||
|
if (this.id < that.getId())
|
||||||
|
return BEFORE;
|
||||||
|
if (this.id > that.getId())
|
||||||
|
return AFTER;
|
||||||
|
return EQUAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = super.hashCode();
|
||||||
|
result = prime * result + id;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (!super.equals(obj))
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
NamedResourceImpl other = (NamedResourceImpl) obj;
|
||||||
|
if (id != other.id)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -50,7 +50,7 @@ public class TaskImpl extends LinkImpl implements Task {
|
||||||
@Nullable
|
@Nullable
|
||||||
private final NamedLink result;
|
private final NamedLink result;
|
||||||
|
|
||||||
public TaskImpl(String type, URI location, TaskStatus status, DateTime startTime,
|
public TaskImpl(String type, URI location, TaskStatus status, DateTime startTime,
|
||||||
@Nullable DateTime endTime, NamedLink owner, @Nullable NamedLink result) {
|
@Nullable DateTime endTime, NamedLink owner, @Nullable NamedLink result) {
|
||||||
super(type, location);
|
super(type, location);
|
||||||
this.status = checkNotNull(status, "status");
|
this.status = checkNotNull(status, "status");
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
package org.jclouds.vcloud.endpoints;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
import javax.inject.Qualifier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Related to a VCloud Network.
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Retention(value = RetentionPolicy.RUNTIME)
|
||||||
|
@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
|
||||||
|
@Qualifier
|
||||||
|
public @interface Network {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
package org.jclouds.vcloud.endpoints.internal;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
import javax.inject.Qualifier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Root path where all catalog items exist.
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Retention(value = RetentionPolicy.RUNTIME)
|
||||||
|
@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
|
||||||
|
@Qualifier
|
||||||
|
public @interface CatalogItemRoot {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package org.jclouds.vcloud.functions;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.jclouds.vcloud.endpoints.internal.CatalogItemRoot;
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Singleton
|
||||||
|
public class CatalogIdToUri implements Function<Object, String> {
|
||||||
|
@Inject
|
||||||
|
@CatalogItemRoot
|
||||||
|
private String catalogItemRoot;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String apply(Object from) {
|
||||||
|
checkArgument(checkNotNull(from, "from") instanceof Integer,
|
||||||
|
"this binder is only valid for Integers!");
|
||||||
|
return String.format("%s/%d",catalogItemRoot,from);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -25,7 +25,6 @@ package org.jclouds.vcloud.terremark;
|
||||||
|
|
||||||
import static org.jclouds.vcloud.VCloudMediaType.VDC_XML;
|
import static org.jclouds.vcloud.VCloudMediaType.VDC_XML;
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
|
@ -37,13 +36,15 @@ import javax.ws.rs.Produces;
|
||||||
import org.jclouds.rest.annotations.Endpoint;
|
import org.jclouds.rest.annotations.Endpoint;
|
||||||
import org.jclouds.rest.annotations.MapBinder;
|
import org.jclouds.rest.annotations.MapBinder;
|
||||||
import org.jclouds.rest.annotations.MapEntityParam;
|
import org.jclouds.rest.annotations.MapEntityParam;
|
||||||
|
import org.jclouds.rest.annotations.ParamParser;
|
||||||
import org.jclouds.rest.annotations.RequestFilters;
|
import org.jclouds.rest.annotations.RequestFilters;
|
||||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||||
import org.jclouds.vcloud.VCloudClient;
|
import org.jclouds.vcloud.VCloudClient;
|
||||||
import org.jclouds.vcloud.domain.VDC;
|
import org.jclouds.vcloud.domain.VDC;
|
||||||
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
||||||
import org.jclouds.vcloud.terremark.binders.BindInstantiateVAppTemplateParamsToXmlEntity;
|
import org.jclouds.vcloud.functions.CatalogIdToUri;
|
||||||
import org.jclouds.vcloud.terremark.domain.VApp;
|
import org.jclouds.vcloud.terremark.domain.VApp;
|
||||||
|
import org.jclouds.vcloud.terremark.options.InstantiateVAppTemplateOptions;
|
||||||
import org.jclouds.vcloud.terremark.xml.TerremarkVAppHandler;
|
import org.jclouds.vcloud.terremark.xml.TerremarkVAppHandler;
|
||||||
import org.jclouds.vcloud.terremark.xml.TerremarkVDCHandler;
|
import org.jclouds.vcloud.terremark.xml.TerremarkVDCHandler;
|
||||||
|
|
||||||
|
@ -68,9 +69,8 @@ public interface TerremarkVCloudClient extends VCloudClient {
|
||||||
@Path("/action/instantiatevAppTemplate")
|
@Path("/action/instantiatevAppTemplate")
|
||||||
@Produces("application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")
|
@Produces("application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml")
|
||||||
@XMLResponseParser(TerremarkVAppHandler.class)
|
@XMLResponseParser(TerremarkVAppHandler.class)
|
||||||
@MapBinder(BindInstantiateVAppTemplateParamsToXmlEntity.class)
|
@MapBinder(InstantiateVAppTemplateOptions.class)
|
||||||
Future<? extends VApp> instantiateVAppTemplate(@MapEntityParam("name") String appName,
|
Future<? extends VApp> instantiateVAppTemplate(@MapEntityParam("name") String appName,
|
||||||
@MapEntityParam("template") URI vAppTemplate, @MapEntityParam("count") int cpuCount,
|
@MapEntityParam("template") @ParamParser(CatalogIdToUri.class) int templateId);
|
||||||
@MapEntityParam("megabytes") int megabytesMemory, @MapEntityParam("network") URI network);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
package org.jclouds.vcloud.terremark.options;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import org.jclouds.http.HttpRequest;
|
||||||
|
import org.jclouds.vcloud.endpoints.Network;
|
||||||
|
import org.jclouds.vcloud.terremark.binders.BindInstantiateVAppTemplateParamsToXmlEntity;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class InstantiateVAppTemplateOptions extends BindInstantiateVAppTemplateParamsToXmlEntity {
|
||||||
|
@Inject
|
||||||
|
@Network
|
||||||
|
private URI defaultNetwork;
|
||||||
|
|
||||||
|
public void bindToRequest(HttpRequest request, Map<String, String> postParams) {
|
||||||
|
Map<String, String> copy = Maps.newHashMap();
|
||||||
|
copy.putAll(postParams);
|
||||||
|
if (postParams.get("count") == null)
|
||||||
|
copy.put("count", "1");
|
||||||
|
if (postParams.get("megabytes") == null)
|
||||||
|
copy.put("megabytes", "512");
|
||||||
|
if (postParams.get("network") == null)
|
||||||
|
copy.put("network", defaultNetwork.toASCIIString());
|
||||||
|
|
||||||
|
super.bindToRequest(request, copy);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -23,16 +23,20 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.vcloud.xml;
|
package org.jclouds.vcloud.xml;
|
||||||
|
|
||||||
import static org.jclouds.rest.util.Utils.putNamedLink;
|
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.SortedMap;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.jclouds.http.functions.ParseSax;
|
import org.jclouds.http.functions.ParseSax;
|
||||||
import org.jclouds.rest.domain.NamedLink;
|
import org.jclouds.rest.domain.NamedLink;
|
||||||
import org.jclouds.rest.domain.internal.NamedLinkImpl;
|
import org.jclouds.rest.domain.internal.NamedLinkImpl;
|
||||||
import org.jclouds.vcloud.domain.Catalog;
|
import org.jclouds.vcloud.domain.Catalog;
|
||||||
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
import org.jclouds.vcloud.domain.internal.CatalogImpl;
|
import org.jclouds.vcloud.domain.internal.CatalogImpl;
|
||||||
|
import org.jclouds.vcloud.domain.internal.NamedResourceImpl;
|
||||||
|
import org.jclouds.vcloud.endpoints.internal.CatalogItemRoot;
|
||||||
import org.xml.sax.Attributes;
|
import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
|
@ -43,7 +47,10 @@ import com.google.common.collect.Maps;
|
||||||
*/
|
*/
|
||||||
public class CatalogHandler extends ParseSax.HandlerWithResult<Catalog> {
|
public class CatalogHandler extends ParseSax.HandlerWithResult<Catalog> {
|
||||||
private NamedLink Catalog;
|
private NamedLink Catalog;
|
||||||
private Map<String, NamedLink> contents = Maps.newHashMap();
|
private SortedMap<String, NamedResource> contents = Maps.newTreeMap();
|
||||||
|
@Inject
|
||||||
|
@CatalogItemRoot
|
||||||
|
private String catalogItemRoot;
|
||||||
|
|
||||||
public Catalog getResult() {
|
public Catalog getResult() {
|
||||||
return new CatalogImpl(Catalog.getName(), Catalog.getType(), Catalog.getLocation(), contents);
|
return new CatalogImpl(Catalog.getName(), Catalog.getType(), Catalog.getLocation(), contents);
|
||||||
|
@ -57,8 +64,19 @@ public class CatalogHandler extends ParseSax.HandlerWithResult<Catalog> {
|
||||||
.getValue(attributes.getIndex("type")), URI.create(attributes.getValue(attributes
|
.getValue(attributes.getIndex("type")), URI.create(attributes.getValue(attributes
|
||||||
.getIndex("href"))));
|
.getIndex("href"))));
|
||||||
} else if (qName.equals("CatalogItem")) {
|
} else if (qName.equals("CatalogItem")) {
|
||||||
putNamedLink(contents, attributes);
|
putNamedResource(contents, attributes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public NamedResource newNamedResource(Attributes attributes) {
|
||||||
|
return new NamedResourceImpl(Integer.parseInt(attributes
|
||||||
|
.getValue(attributes.getIndex("href")).replace(catalogItemRoot+"/", "")), attributes
|
||||||
|
.getValue(attributes.getIndex("name")), attributes.getValue(attributes
|
||||||
|
.getIndex("type")), URI.create(attributes.getValue(attributes.getIndex("href"))));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void putNamedResource(Map<String, NamedResource> map, Attributes attributes) {
|
||||||
|
map.put(attributes.getValue(attributes.getIndex("name")), newNamedResource(attributes));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,17 +68,9 @@ public class TaskHandler extends ParseSax.HandlerWithResult<Task> {
|
||||||
if (qName.equals("Task")) {
|
if (qName.equals("Task")) {
|
||||||
taskLink = Utils.newLink(attributes);
|
taskLink = Utils.newLink(attributes);
|
||||||
status = TaskStatus.fromValue(attributes.getValue(attributes.getIndex("status")));
|
status = TaskStatus.fromValue(attributes.getValue(attributes.getIndex("status")));
|
||||||
startTime = dateService.iso8601DateParse(attributes.getValue(attributes
|
startTime = parseDate(attributes, "startTime");
|
||||||
.getIndex("startTime")));
|
|
||||||
if (attributes.getIndex("endTime") != -1) {
|
if (attributes.getIndex("endTime") != -1) {
|
||||||
try {
|
endTime = parseDate(attributes, "endTime");
|
||||||
endTime = dateService.iso8601DateParse(attributes.getValue(attributes
|
|
||||||
.getIndex("endTime")));
|
|
||||||
} catch (RuntimeException e) {
|
|
||||||
if (!(e.getCause() instanceof ParseException)) // TODO.. format doesn't parse
|
|
||||||
// endTime="2009-11-11T02:27:25Z"
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (qName.equals("Owner")) {
|
} else if (qName.equals("Owner")) {
|
||||||
owner = Utils.newNamedLink(attributes);
|
owner = Utils.newNamedLink(attributes);
|
||||||
|
@ -87,6 +79,20 @@ public class TaskHandler extends ParseSax.HandlerWithResult<Task> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DateTime parseDate(Attributes attributes, String attribute) {
|
||||||
|
try {
|
||||||
|
return dateService.iso8601DateParse(attributes.getValue(attributes.getIndex(attribute)));
|
||||||
|
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
if (e.getCause() instanceof ParseException) {
|
||||||
|
return dateService.iso8601SecondsDateParse(attributes.getValue(attributes
|
||||||
|
.getIndex(attribute)));
|
||||||
|
} else {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void endElement(String uri, String localName, String qName) throws SAXException {
|
public void endElement(String uri, String localName, String qName) throws SAXException {
|
||||||
if (qName.equals("Task")) {
|
if (qName.equals("Task")) {
|
||||||
|
|
|
@ -41,6 +41,7 @@ import org.jclouds.rest.internal.RestAnnotationProcessor;
|
||||||
import org.jclouds.vcloud.endpoints.Catalog;
|
import org.jclouds.vcloud.endpoints.Catalog;
|
||||||
import org.jclouds.vcloud.endpoints.TasksList;
|
import org.jclouds.vcloud.endpoints.TasksList;
|
||||||
import org.jclouds.vcloud.endpoints.VDC;
|
import org.jclouds.vcloud.endpoints.VDC;
|
||||||
|
import org.jclouds.vcloud.endpoints.internal.CatalogItemRoot;
|
||||||
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
||||||
import org.jclouds.vcloud.xml.CatalogHandler;
|
import org.jclouds.vcloud.xml.CatalogHandler;
|
||||||
import org.jclouds.vcloud.xml.TaskHandler;
|
import org.jclouds.vcloud.xml.TaskHandler;
|
||||||
|
@ -294,6 +295,8 @@ public class VCloudClientTest extends RestClientTest<VCloudClient> {
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bind(URI.class).annotatedWith(Catalog.class).toInstance(URI.create("http://catalog"));
|
bind(URI.class).annotatedWith(Catalog.class).toInstance(URI.create("http://catalog"));
|
||||||
|
bind(String.class).annotatedWith(CatalogItemRoot.class)
|
||||||
|
.toInstance("http://catalogItem");
|
||||||
bind(URI.class).annotatedWith(VDC.class).toInstance(URI.create("http://vdc"));
|
bind(URI.class).annotatedWith(VDC.class).toInstance(URI.create("http://vdc"));
|
||||||
bind(URI.class).annotatedWith(TasksList.class).toInstance(
|
bind(URI.class).annotatedWith(TasksList.class).toInstance(
|
||||||
URI.create("http://tasksList"));
|
URI.create("http://tasksList"));
|
||||||
|
|
|
@ -52,8 +52,8 @@ import com.google.inject.Injector;
|
||||||
/**
|
/**
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "unit", testName = "vcloud.RestVCloudAuthenticationModuleTest")
|
@Test(groups = "unit", testName = "vcloud.VCloudDiscoveryRestClientModuleTest")
|
||||||
public class RestVCloudAuthenticationModuleTest {
|
public class VCloudDiscoveryRestClientModuleTest {
|
||||||
|
|
||||||
Injector createInjector() {
|
Injector createInjector() {
|
||||||
return Guice.createInjector(new VCloudDiscoveryRestClientModule(), new ParserModule(),
|
return Guice.createInjector(new VCloudDiscoveryRestClientModule(), new ParserModule(),
|
|
@ -0,0 +1,69 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
package org.jclouds.vcloud.config;
|
||||||
|
|
||||||
|
import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_ENDPOINT;
|
||||||
|
import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_KEY;
|
||||||
|
import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_SESSIONINTERVAL;
|
||||||
|
import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_USER;
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
|
import org.jclouds.http.functions.config.ParserModule;
|
||||||
|
import org.jclouds.util.Jsr330;
|
||||||
|
import org.jclouds.vcloud.endpoints.internal.CatalogItemRoot;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.inject.AbstractModule;
|
||||||
|
import com.google.inject.Guice;
|
||||||
|
import com.google.inject.Injector;
|
||||||
|
import com.google.inject.Key;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Test(groups = "unit", testName = "vcloud.VCloudRestClientModuleTest")
|
||||||
|
public class VCloudRestClientModuleTest extends VCloudDiscoveryRestClientModuleTest {
|
||||||
|
|
||||||
|
Injector createInjector() {
|
||||||
|
return Guice.createInjector(new VCloudRestClientModule(),
|
||||||
|
new VCloudDiscoveryRestClientModule(), new ParserModule(), new AbstractModule() {
|
||||||
|
@Override
|
||||||
|
protected void configure() {
|
||||||
|
bindConstant().annotatedWith(Jsr330.named(PROPERTY_VCLOUD_USER)).to("user");
|
||||||
|
bindConstant().annotatedWith(Jsr330.named(PROPERTY_VCLOUD_KEY)).to("secret");
|
||||||
|
bindConstant().annotatedWith(Jsr330.named(PROPERTY_VCLOUD_ENDPOINT)).to(
|
||||||
|
"http://localhost");
|
||||||
|
bindConstant().annotatedWith(Jsr330.named(PROPERTY_VCLOUD_SESSIONINTERVAL))
|
||||||
|
.to("2");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testCatalogItemRoot() {
|
||||||
|
assertEquals(createInjector().getInstance(Key.get(String.class, CatalogItemRoot.class)),
|
||||||
|
"http://localhost/catalogItem");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -69,19 +69,17 @@ public class TerremarkVCloudClientLiveTest extends VCloudClientLiveTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInstantiate() throws InterruptedException, ExecutionException, TimeoutException {
|
public void testInstantiate() throws InterruptedException, ExecutionException, TimeoutException {
|
||||||
String serverName = "adriantest4";
|
String serverName = "adriantest";
|
||||||
int processorCount = 1;
|
int processorCount = 1;
|
||||||
int memory = 512;
|
int memory = 512;
|
||||||
String catalogOs = "Ubuntu Server 9.04 (32-bit)";
|
String catalogOs = "Ubuntu Server 9.04 (32-bit)";
|
||||||
String expectedOs = "Ubuntu Linux (32-bit)";
|
String expectedOs = "Ubuntu Linux (32-bit)";
|
||||||
|
|
||||||
URI template = tmClient.getCatalog().get(45, TimeUnit.SECONDS).get(catalogOs).getLocation();
|
int templateId = tmClient.getCatalog().get(45, TimeUnit.SECONDS).get(catalogOs).getId();
|
||||||
|
|
||||||
URI network = tmClient.getDefaultVDC().get(45, TimeUnit.SECONDS).getAvailableNetworks()
|
VApp vApp = tmClient.instantiateVAppTemplate(serverName, templateId)
|
||||||
.values().iterator().next().getLocation();
|
.get(45, TimeUnit.SECONDS);
|
||||||
|
|
||||||
VApp vApp = tmClient.instantiateVAppTemplate(serverName, template, processorCount, memory,
|
|
||||||
network).get(45, TimeUnit.SECONDS);
|
|
||||||
assertEquals(vApp.getStatus(), VAppStatus.CREATING);
|
assertEquals(vApp.getStatus(), VAppStatus.CREATING);
|
||||||
|
|
||||||
Task instantiateTask = getLastTaskFor(vApp.getVDC().getLocation());
|
Task instantiateTask = getLastTaskFor(vApp.getVDC().getLocation());
|
||||||
|
@ -146,7 +144,7 @@ public class TerremarkVCloudClientLiveTest extends VCloudClientLiveTest {
|
||||||
assertEquals(vApp.getStatus(), VAppStatus.OFF);
|
assertEquals(vApp.getStatus(), VAppStatus.OFF);
|
||||||
|
|
||||||
tmClient.delete(deployTask.getResult().getLocation()).get(45, TimeUnit.SECONDS);
|
tmClient.delete(deployTask.getResult().getLocation()).get(45, TimeUnit.SECONDS);
|
||||||
//TODO verify not present anymore
|
// TODO verify not present anymore
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyConfigurationOfVApp(VApp vApp, String serverName, String expectedOs,
|
private void verifyConfigurationOfVApp(VApp vApp, String serverName, String expectedOs,
|
||||||
|
|
|
@ -43,7 +43,9 @@ import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||||
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
||||||
import org.jclouds.util.Utils;
|
import org.jclouds.util.Utils;
|
||||||
import org.jclouds.vcloud.endpoints.Catalog;
|
import org.jclouds.vcloud.endpoints.Catalog;
|
||||||
|
import org.jclouds.vcloud.endpoints.Network;
|
||||||
import org.jclouds.vcloud.endpoints.VDC;
|
import org.jclouds.vcloud.endpoints.VDC;
|
||||||
|
import org.jclouds.vcloud.endpoints.internal.CatalogItemRoot;
|
||||||
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
||||||
import org.jclouds.vcloud.terremark.xml.TerremarkVAppHandler;
|
import org.jclouds.vcloud.terremark.xml.TerremarkVAppHandler;
|
||||||
import org.jclouds.vcloud.terremark.xml.TerremarkVDCHandler;
|
import org.jclouds.vcloud.terremark.xml.TerremarkVDCHandler;
|
||||||
|
@ -80,17 +82,14 @@ public class TerremarkVCloudClientTest extends RestClientTest<TerremarkVCloudCli
|
||||||
public void testInstantiateVAppTemplate() throws SecurityException, NoSuchMethodException,
|
public void testInstantiateVAppTemplate() throws SecurityException, NoSuchMethodException,
|
||||||
IOException {
|
IOException {
|
||||||
Method method = TerremarkVCloudClient.class.getMethod("instantiateVAppTemplate",
|
Method method = TerremarkVCloudClient.class.getMethod("instantiateVAppTemplate",
|
||||||
|
String.class, int.class);
|
||||||
String.class, URI.class, int.class, int.class, URI.class
|
|
||||||
|
|
||||||
);
|
|
||||||
GeneratedHttpRequest<TerremarkVCloudClient> httpMethod = processor.createRequest(method,
|
GeneratedHttpRequest<TerremarkVCloudClient> httpMethod = processor.createRequest(method,
|
||||||
"name", URI.create("http://template"), 1, 512, URI.create("http://network"));
|
"name", 3);
|
||||||
|
|
||||||
assertRequestLineEquals(httpMethod, "POST http://vdc/action/instantiatevAppTemplate HTTP/1.1");
|
assertRequestLineEquals(httpMethod, "POST http://vdc/action/instantiatevAppTemplate HTTP/1.1");
|
||||||
assertHeadersEqual(
|
assertHeadersEqual(
|
||||||
httpMethod,
|
httpMethod,
|
||||||
"Content-Length: 2242\nContent-Type: application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml\n");
|
"Content-Length: 2247\nContent-Type: application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml\n");
|
||||||
assertEntityEquals(httpMethod, IOUtils.toString(getClass().getResourceAsStream(
|
assertEntityEquals(httpMethod, IOUtils.toString(getClass().getResourceAsStream(
|
||||||
"/terremark/InstantiateVAppTemplateParams-test.xml")));
|
"/terremark/InstantiateVAppTemplateParams-test.xml")));
|
||||||
|
|
||||||
|
@ -119,7 +118,10 @@ public class TerremarkVCloudClientTest extends RestClientTest<TerremarkVCloudCli
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bind(URI.class).annotatedWith(Catalog.class).toInstance(URI.create("http://catalog"));
|
bind(URI.class).annotatedWith(Catalog.class).toInstance(URI.create("http://catalog"));
|
||||||
|
bind(String.class).annotatedWith(CatalogItemRoot.class)
|
||||||
|
.toInstance("http://catalogItem");
|
||||||
bind(URI.class).annotatedWith(VDC.class).toInstance(URI.create("http://vdc"));
|
bind(URI.class).annotatedWith(VDC.class).toInstance(URI.create("http://vdc"));
|
||||||
|
bind(URI.class).annotatedWith(Network.class).toInstance(URI.create("http://network"));
|
||||||
bind(SetVCloudTokenCookie.class).toInstance(
|
bind(SetVCloudTokenCookie.class).toInstance(
|
||||||
new SetVCloudTokenCookie(new Provider<String>() {
|
new SetVCloudTokenCookie(new Provider<String>() {
|
||||||
|
|
||||||
|
|
|
@ -78,13 +78,13 @@ public class BindInstantiateVAppTemplateParamsToXmlEntityTest {
|
||||||
|
|
||||||
Map<String, String> map = Maps.newHashMap();
|
Map<String, String> map = Maps.newHashMap();
|
||||||
map.put("name", "name");
|
map.put("name", "name");
|
||||||
map.put("template", "http://template");
|
map.put("template", "http://catalogItem/3");
|
||||||
map.put("count", "1");
|
map.put("count", "1");
|
||||||
map.put("megabytes", "512");
|
map.put("megabytes", "512");
|
||||||
map.put("network", "http://network");
|
map.put("network", "http://network");
|
||||||
binder.bindToRequest(request, map);
|
binder.bindToRequest(request, map);
|
||||||
assertEquals(request.getFirstHeaderOrNull(HttpHeaders.CONTENT_TYPE), "application/unknown");
|
assertEquals(request.getFirstHeaderOrNull(HttpHeaders.CONTENT_TYPE), "application/unknown");
|
||||||
assertEquals(request.getFirstHeaderOrNull(HttpHeaders.CONTENT_LENGTH), "2242");
|
assertEquals(request.getFirstHeaderOrNull(HttpHeaders.CONTENT_LENGTH), "2247");
|
||||||
assertEquals(request.getEntity(), expected);
|
assertEquals(request.getEntity(), expected);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,11 +30,18 @@ import java.io.InputStream;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import org.jclouds.http.functions.BaseHandlerTest;
|
import org.jclouds.http.functions.BaseHandlerTest;
|
||||||
import org.jclouds.rest.domain.internal.NamedLinkImpl;
|
import org.jclouds.http.functions.ParseSax;
|
||||||
|
import org.jclouds.http.functions.config.ParserModule;
|
||||||
import org.jclouds.vcloud.domain.Catalog;
|
import org.jclouds.vcloud.domain.Catalog;
|
||||||
|
import org.jclouds.vcloud.domain.internal.NamedResourceImpl;
|
||||||
|
import org.jclouds.vcloud.endpoints.internal.CatalogItemRoot;
|
||||||
import org.testng.annotations.BeforeTest;
|
import org.testng.annotations.BeforeTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.inject.AbstractModule;
|
||||||
|
import com.google.inject.Guice;
|
||||||
|
import com.google.inject.Provides;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code CatalogHandler}
|
* Tests behavior of {@code CatalogHandler}
|
||||||
*
|
*
|
||||||
|
@ -46,7 +53,21 @@ public class CatalogHandlerTest extends BaseHandlerTest {
|
||||||
@BeforeTest
|
@BeforeTest
|
||||||
@Override
|
@Override
|
||||||
protected void setUpInjector() {
|
protected void setUpInjector() {
|
||||||
super.setUpInjector();
|
injector = Guice.createInjector(new ParserModule(), new AbstractModule() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
@Provides
|
||||||
|
@CatalogItemRoot
|
||||||
|
String provide() {
|
||||||
|
return "https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem";
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
factory = injector.getInstance(ParseSax.Factory.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testApplyInputStream() {
|
public void testApplyInputStream() {
|
||||||
|
@ -59,77 +80,83 @@ public class CatalogHandlerTest extends BaseHandlerTest {
|
||||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog"));
|
.create("https://services.vcloudexpress.terremark.com/api/v0.8/vdc/32/catalog"));
|
||||||
assertEquals(result.getType(), "application/vnd.vmware.vcloud.catalog+xml");
|
assertEquals(result.getType(), "application/vnd.vmware.vcloud.catalog+xml");
|
||||||
|
|
||||||
assertEquals(result.get("CentOS 5.3 (32-bit)"), new NamedLinkImpl("CentOS 5.3 (32-bit)",
|
assertEquals(result.get("CentOS 5.3 (32-bit)"), new NamedResourceImpl(5,
|
||||||
CATALOGITEM_XML,
|
"CentOS 5.3 (32-bit)", CATALOGITEM_XML,
|
||||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/5")));
|
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/5")));
|
||||||
assertEquals(result.get("CentOS 5.3 (64-bit)"), new NamedLinkImpl("CentOS 5.3 (64-bit)",
|
assertEquals(result.get("CentOS 5.3 (64-bit)"), new NamedResourceImpl(6,
|
||||||
CATALOGITEM_XML,
|
"CentOS 5.3 (64-bit)", CATALOGITEM_XML,
|
||||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/6")));
|
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/6")));
|
||||||
assertEquals(result.get("RHEL 5.3 (32-bit)"), new NamedLinkImpl("RHEL 5.3 (32-bit)",
|
assertEquals(result.get("RHEL 5.3 (32-bit)"), new NamedResourceImpl(7, "RHEL 5.3 (32-bit)",
|
||||||
CATALOGITEM_XML,
|
CATALOGITEM_XML,
|
||||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/7")));
|
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/7")));
|
||||||
assertEquals(result.get("RHEL 5.3 (64-bit)"), new NamedLinkImpl("RHEL 5.3 (64-bit)",
|
assertEquals(result.get("RHEL 5.3 (64-bit)"), new NamedResourceImpl(8, "RHEL 5.3 (64-bit)",
|
||||||
CATALOGITEM_XML,
|
CATALOGITEM_XML,
|
||||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/8")));
|
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/8")));
|
||||||
assertEquals(result.get("Ubuntu JeOS 9.04 (32-bit)"), new NamedLinkImpl(
|
assertEquals(result.get("Ubuntu JeOS 9.04 (32-bit)"), new NamedResourceImpl(11,
|
||||||
"Ubuntu JeOS 9.04 (32-bit)", CATALOGITEM_XML,
|
"Ubuntu JeOS 9.04 (32-bit)", CATALOGITEM_XML,
|
||||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/11")));
|
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/11")));
|
||||||
assertEquals(result.get("Ubuntu JeOS 9.04 (64-bit)"), new NamedLinkImpl(
|
assertEquals(result.get("Ubuntu JeOS 9.04 (64-bit)"), new NamedResourceImpl(12,
|
||||||
"Ubuntu JeOS 9.04 (64-bit)", CATALOGITEM_XML,
|
"Ubuntu JeOS 9.04 (64-bit)", CATALOGITEM_XML,
|
||||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/12")));
|
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/12")));
|
||||||
assertEquals(result.get("Ubuntu Server 9.04 (32-bit)"), new NamedLinkImpl(
|
assertEquals(result.get("Ubuntu Server 9.04 (32-bit)"), new NamedResourceImpl(9,
|
||||||
"Ubuntu Server 9.04 (32-bit)", CATALOGITEM_XML,
|
"Ubuntu Server 9.04 (32-bit)", CATALOGITEM_XML,
|
||||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/9")));
|
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/9")));
|
||||||
assertEquals(result.get("Ubuntu Server 9.04 (64-bit)"), new NamedLinkImpl(
|
assertEquals(result.get("Ubuntu Server 9.04 (64-bit)"), new NamedResourceImpl(10,
|
||||||
"Ubuntu Server 9.04 (64-bit)", CATALOGITEM_XML,
|
"Ubuntu Server 9.04 (64-bit)", CATALOGITEM_XML,
|
||||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/10")));
|
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/10")));
|
||||||
assertEquals(result.get("Windows 2003 Enterprise R2 (32-bit)"), new NamedLinkImpl(
|
assertEquals(result.get("Windows 2003 Enterprise R2 (32-bit)"), new NamedResourceImpl(1,
|
||||||
"Windows 2003 Enterprise R2 (32-bit)", CATALOGITEM_XML,
|
"Windows 2003 Enterprise R2 (32-bit)", CATALOGITEM_XML,
|
||||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/1")));
|
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/1")));
|
||||||
assertEquals(result.get("Windows 2003 Enterprise R2 (64-bit)"), new NamedLinkImpl(
|
assertEquals(result.get("Windows 2003 Enterprise R2 (64-bit)"), new NamedResourceImpl(2,
|
||||||
"Windows 2003 Enterprise R2 (64-bit)", CATALOGITEM_XML,
|
"Windows 2003 Enterprise R2 (64-bit)", CATALOGITEM_XML,
|
||||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/2")));
|
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/2")));
|
||||||
assertEquals(result.get("Windows 2003 Standard R2 (32-bit)"), new NamedLinkImpl(
|
assertEquals(result.get("Windows 2003 Standard R2 (32-bit)"), new NamedResourceImpl(3,
|
||||||
"Windows 2003 Standard R2 (32-bit)", CATALOGITEM_XML,
|
"Windows 2003 Standard R2 (32-bit)", CATALOGITEM_XML,
|
||||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/3")));
|
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/3")));
|
||||||
assertEquals(result.get("Windows 2003 Standard R2 (64-bit)"), new NamedLinkImpl(
|
assertEquals(result.get("Windows 2003 Standard R2 (64-bit)"), new NamedResourceImpl(4,
|
||||||
"Windows 2003 Standard R2 (64-bit)", CATALOGITEM_XML,
|
"Windows 2003 Standard R2 (64-bit)", CATALOGITEM_XML,
|
||||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/4")));
|
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/4")));
|
||||||
assertEquals(result.get("Windows 2003 Standard R2 w.SQL 2008 Web (64-bit)"), new NamedLinkImpl(
|
assertEquals(
|
||||||
"Windows 2003 Standard R2 w.SQL 2008 Web (64-bit)", CATALOGITEM_XML,
|
result.get("Windows 2003 Standard R2 w.SQL 2008 Web (64-bit)"),
|
||||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/23")));
|
new NamedResourceImpl(
|
||||||
assertEquals(result.get("Windows Server 2008 Enterprise (32-bit)"), new NamedLinkImpl(
|
23,
|
||||||
|
"Windows 2003 Standard R2 w.SQL 2008 Web (64-bit)",
|
||||||
|
CATALOGITEM_XML,
|
||||||
|
URI
|
||||||
|
.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/23")));
|
||||||
|
assertEquals(result.get("Windows Server 2008 Enterprise (32-bit)"), new NamedResourceImpl(13,
|
||||||
"Windows Server 2008 Enterprise (32-bit)", CATALOGITEM_XML,
|
"Windows Server 2008 Enterprise (32-bit)", CATALOGITEM_XML,
|
||||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/13")));
|
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/13")));
|
||||||
assertEquals(result.get("Windows Server 2008 Enterprise (64-bit)"), new NamedLinkImpl(
|
assertEquals(result.get("Windows Server 2008 Enterprise (64-bit)"), new NamedResourceImpl(15,
|
||||||
"Windows Server 2008 Enterprise (64-bit)", CATALOGITEM_XML,
|
"Windows Server 2008 Enterprise (64-bit)", CATALOGITEM_XML,
|
||||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/15")));
|
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/15")));
|
||||||
assertEquals(result.get("Windows Server 2008 Enterprise R2 (64-bit)"), new NamedLinkImpl(
|
assertEquals(result.get("Windows Server 2008 Enterprise R2 (64-bit)"), new NamedResourceImpl(
|
||||||
"Windows Server 2008 Enterprise R2 (64-bit)", CATALOGITEM_XML,
|
16, "Windows Server 2008 Enterprise R2 (64-bit)", CATALOGITEM_XML,
|
||||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/16")));
|
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/16")));
|
||||||
assertEquals(result.get("Windows Server 2008 Standard (32-bit)"), new NamedLinkImpl(
|
assertEquals(result.get("Windows Server 2008 Standard (32-bit)"), new NamedResourceImpl(17,
|
||||||
"Windows Server 2008 Standard (32-bit)", CATALOGITEM_XML,
|
"Windows Server 2008 Standard (32-bit)", CATALOGITEM_XML,
|
||||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/17")));
|
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/17")));
|
||||||
assertEquals(result.get("Windows Server 2008 Standard (64-bit)"), new NamedLinkImpl(
|
assertEquals(result.get("Windows Server 2008 Standard (64-bit)"), new NamedResourceImpl(18,
|
||||||
"Windows Server 2008 Standard (64-bit)", CATALOGITEM_XML,
|
"Windows Server 2008 Standard (64-bit)", CATALOGITEM_XML,
|
||||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/18")));
|
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/18")));
|
||||||
assertEquals(result.get("Windows Server 2008 Standard R2 (64-bit)"), new NamedLinkImpl(
|
assertEquals(result.get("Windows Server 2008 Standard R2 (64-bit)"), new NamedResourceImpl(
|
||||||
"Windows Server 2008 Standard R2 (64-bit)", CATALOGITEM_XML,
|
19, "Windows Server 2008 Standard R2 (64-bit)", CATALOGITEM_XML,
|
||||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/19")));
|
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/19")));
|
||||||
assertEquals(
|
assertEquals(
|
||||||
result.get("Windows Server 2008 Standard w.SQL 2008 Web (64-bit)"),
|
result.get("Windows Server 2008 Standard w.SQL 2008 Web (64-bit)"),
|
||||||
new NamedLinkImpl(
|
new NamedResourceImpl(
|
||||||
|
14,
|
||||||
"Windows Server 2008 Standard w.SQL 2008 Web (64-bit)",
|
"Windows Server 2008 Standard w.SQL 2008 Web (64-bit)",
|
||||||
CATALOGITEM_XML,
|
CATALOGITEM_XML,
|
||||||
URI
|
URI
|
||||||
.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/14")));
|
.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/14")));
|
||||||
assertEquals(result.get("Windows Web Server 2008 (32-bit)"), new NamedLinkImpl(
|
assertEquals(result.get("Windows Web Server 2008 (32-bit)"), new NamedResourceImpl(20,
|
||||||
"Windows Web Server 2008 (32-bit)", CATALOGITEM_XML,
|
"Windows Web Server 2008 (32-bit)", CATALOGITEM_XML,
|
||||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/20")));
|
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/20")));
|
||||||
assertEquals(result.get("Windows Web Server 2008 (64-bit)"), new NamedLinkImpl(
|
assertEquals(result.get("Windows Web Server 2008 (64-bit)"), new NamedResourceImpl(21,
|
||||||
"Windows Web Server 2008 (64-bit)", CATALOGITEM_XML,
|
"Windows Web Server 2008 (64-bit)", CATALOGITEM_XML,
|
||||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/21")));
|
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/21")));
|
||||||
assertEquals(result.get("Windows Web Server 2008 R2 (64-bit)"), new NamedLinkImpl(
|
assertEquals(result.get("Windows Web Server 2008 R2 (64-bit)"), new NamedResourceImpl(22,
|
||||||
"Windows Web Server 2008 R2 (64-bit)", CATALOGITEM_XML,
|
"Windows Web Server 2008 R2 (64-bit)", CATALOGITEM_XML,
|
||||||
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/22")));
|
URI.create("https://services.vcloudexpress.terremark.com/api/v0.8/catalogItem/22")));
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<InstantiateVAppTemplateParams name="name"
|
<InstantiateVAppTemplateParams name="name"
|
||||||
xml:lang="en" xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
xml:lang="en" xmlns="http://www.vmware.com/vcloud/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
<VAppTemplate href="http://template" />
|
<VAppTemplate href="http://catalogItem/3" />
|
||||||
<InstantiationParams>
|
<InstantiationParams>
|
||||||
<ProductSection xmlns:q1="http://www.vmware.com/vcloud/v1"
|
<ProductSection xmlns:q1="http://www.vmware.com/vcloud/v1"
|
||||||
xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1">
|
xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1">
|
||||||
|
|
Loading…
Reference in New Issue