mirror of https://github.com/apache/jclouds.git
Issue 280: ported more organization code from 0.8 -> 1.0
This commit is contained in:
parent
80da64b65c
commit
72a0bb58a7
|
@ -0,0 +1,55 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
package domain;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.ws.rs.Consumes;
|
||||||
|
import javax.ws.rs.POST;
|
||||||
|
|
||||||
|
import org.jclouds.http.filters.BasicAuthentication;
|
||||||
|
import org.jclouds.rest.annotations.Endpoint;
|
||||||
|
import org.jclouds.rest.annotations.RequestFilters;
|
||||||
|
import org.jclouds.rest.annotations.ResponseParser;
|
||||||
|
import org.jclouds.vcloud.VCloudExpressMediaType;
|
||||||
|
import org.jclouds.vcloud.domain.VCloudSession;
|
||||||
|
import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders;
|
||||||
|
|
||||||
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Establishes a context with a VCloud endpoint.
|
||||||
|
* <p/>
|
||||||
|
*
|
||||||
|
* @see <a href="https://community.vcloudexpress.terremark.com/en-us/discussion_forums/f/60.aspx" />
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Endpoint(org.jclouds.vcloud.endpoints.VCloudLogin.class)
|
||||||
|
@RequestFilters(BasicAuthentication.class)
|
||||||
|
public interface VCloudExpressLoginAsyncClient {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This request returns a token to use in subsequent requests. After ten minutes of inactivity,
|
||||||
|
* the token expires and you have to request a new token with this call.
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@ResponseParser(ParseLoginResponseFromHeaders.class)
|
||||||
|
@Consumes(VCloudExpressMediaType.ORGLIST_XML)
|
||||||
|
ListenableFuture<VCloudSession> login();
|
||||||
|
}
|
|
@ -17,9 +17,7 @@
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jclouds.vcloud.internal;
|
package domain;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.POST;
|
import javax.ws.rs.POST;
|
||||||
|
@ -28,10 +26,8 @@ import org.jclouds.http.filters.BasicAuthentication;
|
||||||
import org.jclouds.rest.annotations.Endpoint;
|
import org.jclouds.rest.annotations.Endpoint;
|
||||||
import org.jclouds.rest.annotations.RequestFilters;
|
import org.jclouds.rest.annotations.RequestFilters;
|
||||||
import org.jclouds.rest.annotations.ResponseParser;
|
import org.jclouds.rest.annotations.ResponseParser;
|
||||||
import org.jclouds.vcloud.VCloudExpressMediaType;
|
import org.jclouds.vcloud.VCloudMediaType;
|
||||||
import org.jclouds.vcloud.VCloudToken;
|
import org.jclouds.vcloud.domain.VCloudSession;
|
||||||
import org.jclouds.vcloud.domain.NamedResource;
|
|
||||||
import org.jclouds.vcloud.endpoints.Org;
|
|
||||||
import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders;
|
import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders;
|
||||||
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
|
@ -47,20 +43,12 @@ import com.google.common.util.concurrent.ListenableFuture;
|
||||||
@RequestFilters(BasicAuthentication.class)
|
@RequestFilters(BasicAuthentication.class)
|
||||||
public interface VCloudLoginAsyncClient {
|
public interface VCloudLoginAsyncClient {
|
||||||
|
|
||||||
public interface VCloudSession {
|
|
||||||
@VCloudToken
|
|
||||||
String getVCloudToken();
|
|
||||||
|
|
||||||
@Org
|
|
||||||
Map<String, NamedResource> getOrgs();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This request returns a token to use in subsequent requests. After ten minutes of inactivity,
|
* This request returns a token to use in subsequent requests. After ten minutes of inactivity,
|
||||||
* the token expires and you have to request a new token with this call.
|
* the token expires and you have to request a new token with this call.
|
||||||
*/
|
*/
|
||||||
@POST
|
@POST
|
||||||
@ResponseParser(ParseLoginResponseFromHeaders.class)
|
@ResponseParser(ParseLoginResponseFromHeaders.class)
|
||||||
@Consumes(VCloudExpressMediaType.ORGLIST_XML)
|
@Consumes(VCloudMediaType.ORGLIST_XML)
|
||||||
ListenableFuture<VCloudSession> login();
|
ListenableFuture<VCloudSession> login();
|
||||||
}
|
}
|
|
@ -17,7 +17,7 @@
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jclouds.vcloud.internal;
|
package domain;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.SortedMap;
|
import java.util.SortedMap;
|
|
@ -27,14 +27,10 @@ import javax.inject.Singleton;
|
||||||
import org.jclouds.compute.LoadBalancerService;
|
import org.jclouds.compute.LoadBalancerService;
|
||||||
import org.jclouds.compute.config.BaseComputeServiceContextModule;
|
import org.jclouds.compute.config.BaseComputeServiceContextModule;
|
||||||
import org.jclouds.compute.config.ComputeServiceTimeoutsModule;
|
import org.jclouds.compute.config.ComputeServiceTimeoutsModule;
|
||||||
import org.jclouds.compute.domain.Image;
|
|
||||||
import org.jclouds.compute.domain.NodeState;
|
import org.jclouds.compute.domain.NodeState;
|
||||||
import org.jclouds.compute.domain.Size;
|
import org.jclouds.compute.domain.Size;
|
||||||
import org.jclouds.domain.Location;
|
|
||||||
import org.jclouds.vcloud.compute.BaseVCloudComputeClient;
|
import org.jclouds.vcloud.compute.BaseVCloudComputeClient;
|
||||||
import org.jclouds.vcloud.compute.suppliers.OrgAndVDCToLocationSupplier;
|
|
||||||
import org.jclouds.vcloud.compute.suppliers.StaticSizeSupplier;
|
import org.jclouds.vcloud.compute.suppliers.StaticSizeSupplier;
|
||||||
import org.jclouds.vcloud.compute.suppliers.VCloudImageSupplier;
|
|
||||||
import org.jclouds.vcloud.domain.VAppStatus;
|
import org.jclouds.vcloud.domain.VAppStatus;
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
@ -50,7 +46,7 @@ import com.google.inject.util.Providers;
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class CommonVCloudComputeServiceContextModule extends BaseComputeServiceContextModule {
|
public abstract class CommonVCloudComputeServiceContextModule extends BaseComputeServiceContextModule {
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static final Map<VAppStatus, NodeState> vAppStatusToNodeState = ImmutableMap.<VAppStatus, NodeState> builder().put(
|
static final Map<VAppStatus, NodeState> vAppStatusToNodeState = ImmutableMap.<VAppStatus, NodeState> builder().put(
|
||||||
|
@ -74,16 +70,6 @@ public class CommonVCloudComputeServiceContextModule extends BaseComputeServiceC
|
||||||
bind(LoadBalancerService.class).toProvider(Providers.<LoadBalancerService> of(null));
|
bind(LoadBalancerService.class).toProvider(Providers.<LoadBalancerService> of(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Supplier<Set<? extends Image>> getSourceImageSupplier(Injector injector) {
|
|
||||||
return injector.getInstance(VCloudImageSupplier.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Supplier<Set<? extends Location>> getSourceLocationSupplier(Injector injector) {
|
|
||||||
return injector.getInstance(OrgAndVDCToLocationSupplier.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Supplier<Set<? extends Size>> getSourceSizeSupplier(Injector injector) {
|
protected Supplier<Set<? extends Size>> getSourceSizeSupplier(Injector injector) {
|
||||||
return injector.getInstance(StaticSizeSupplier.class);
|
return injector.getInstance(StaticSizeSupplier.class);
|
||||||
|
|
|
@ -19,7 +19,10 @@
|
||||||
|
|
||||||
package org.jclouds.vcloud.compute.config;
|
package org.jclouds.vcloud.compute.config;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.compute.ComputeServiceContext;
|
import org.jclouds.compute.ComputeServiceContext;
|
||||||
|
import org.jclouds.compute.domain.Image;
|
||||||
import org.jclouds.compute.internal.ComputeServiceContextImpl;
|
import org.jclouds.compute.internal.ComputeServiceContextImpl;
|
||||||
import org.jclouds.compute.strategy.AddNodeWithTagStrategy;
|
import org.jclouds.compute.strategy.AddNodeWithTagStrategy;
|
||||||
import org.jclouds.compute.strategy.DestroyNodeStrategy;
|
import org.jclouds.compute.strategy.DestroyNodeStrategy;
|
||||||
|
@ -28,6 +31,7 @@ import org.jclouds.compute.strategy.ListNodesStrategy;
|
||||||
import org.jclouds.compute.strategy.RebootNodeStrategy;
|
import org.jclouds.compute.strategy.RebootNodeStrategy;
|
||||||
import org.jclouds.compute.strategy.RunNodesAndAddToSetStrategy;
|
import org.jclouds.compute.strategy.RunNodesAndAddToSetStrategy;
|
||||||
import org.jclouds.compute.strategy.impl.EncodeTagIntoNameRunNodesAndAddToSetStrategy;
|
import org.jclouds.compute.strategy.impl.EncodeTagIntoNameRunNodesAndAddToSetStrategy;
|
||||||
|
import org.jclouds.domain.Location;
|
||||||
import org.jclouds.rest.RestContext;
|
import org.jclouds.rest.RestContext;
|
||||||
import org.jclouds.rest.internal.RestContextImpl;
|
import org.jclouds.rest.internal.RestContextImpl;
|
||||||
import org.jclouds.vcloud.VCloudClient;
|
import org.jclouds.vcloud.VCloudClient;
|
||||||
|
@ -37,7 +41,11 @@ import org.jclouds.vcloud.compute.strategy.VCloudDestroyNodeStrategy;
|
||||||
import org.jclouds.vcloud.compute.strategy.VCloudGetNodeMetadataStrategy;
|
import org.jclouds.vcloud.compute.strategy.VCloudGetNodeMetadataStrategy;
|
||||||
import org.jclouds.vcloud.compute.strategy.VCloudListNodesStrategy;
|
import org.jclouds.vcloud.compute.strategy.VCloudListNodesStrategy;
|
||||||
import org.jclouds.vcloud.compute.strategy.VCloudRebootNodeStrategy;
|
import org.jclouds.vcloud.compute.strategy.VCloudRebootNodeStrategy;
|
||||||
|
import org.jclouds.vcloud.compute.suppliers.OrgAndVDCToLocationSupplier;
|
||||||
|
import org.jclouds.vcloud.compute.suppliers.VCloudImageSupplier;
|
||||||
|
|
||||||
|
import com.google.common.base.Supplier;
|
||||||
|
import com.google.inject.Injector;
|
||||||
import com.google.inject.Scopes;
|
import com.google.inject.Scopes;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
|
|
||||||
|
@ -65,4 +73,15 @@ public class VCloudComputeServiceContextModule extends CommonVCloudComputeServic
|
||||||
bind(GetNodeMetadataStrategy.class).to(VCloudGetNodeMetadataStrategy.class);
|
bind(GetNodeMetadataStrategy.class).to(VCloudGetNodeMetadataStrategy.class);
|
||||||
bind(RebootNodeStrategy.class).to(VCloudRebootNodeStrategy.class);
|
bind(RebootNodeStrategy.class).to(VCloudRebootNodeStrategy.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Supplier<Set<? extends Location>> getSourceLocationSupplier(Injector injector) {
|
||||||
|
return injector.getInstance(OrgAndVDCToLocationSupplier.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Supplier<Set<? extends Image>> getSourceImageSupplier(Injector injector) {
|
||||||
|
return injector.getInstance(VCloudImageSupplier.class);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,10 @@
|
||||||
|
|
||||||
package org.jclouds.vcloud.compute.config;
|
package org.jclouds.vcloud.compute.config;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jclouds.compute.ComputeServiceContext;
|
import org.jclouds.compute.ComputeServiceContext;
|
||||||
|
import org.jclouds.compute.domain.Image;
|
||||||
import org.jclouds.compute.internal.ComputeServiceContextImpl;
|
import org.jclouds.compute.internal.ComputeServiceContextImpl;
|
||||||
import org.jclouds.compute.strategy.AddNodeWithTagStrategy;
|
import org.jclouds.compute.strategy.AddNodeWithTagStrategy;
|
||||||
import org.jclouds.compute.strategy.DestroyNodeStrategy;
|
import org.jclouds.compute.strategy.DestroyNodeStrategy;
|
||||||
|
@ -28,6 +31,7 @@ import org.jclouds.compute.strategy.ListNodesStrategy;
|
||||||
import org.jclouds.compute.strategy.RebootNodeStrategy;
|
import org.jclouds.compute.strategy.RebootNodeStrategy;
|
||||||
import org.jclouds.compute.strategy.RunNodesAndAddToSetStrategy;
|
import org.jclouds.compute.strategy.RunNodesAndAddToSetStrategy;
|
||||||
import org.jclouds.compute.strategy.impl.EncodeTagIntoNameRunNodesAndAddToSetStrategy;
|
import org.jclouds.compute.strategy.impl.EncodeTagIntoNameRunNodesAndAddToSetStrategy;
|
||||||
|
import org.jclouds.domain.Location;
|
||||||
import org.jclouds.rest.RestContext;
|
import org.jclouds.rest.RestContext;
|
||||||
import org.jclouds.rest.internal.RestContextImpl;
|
import org.jclouds.rest.internal.RestContextImpl;
|
||||||
import org.jclouds.vcloud.VCloudExpressClient;
|
import org.jclouds.vcloud.VCloudExpressClient;
|
||||||
|
@ -37,7 +41,11 @@ import org.jclouds.vcloud.compute.strategy.VCloudExpressDestroyNodeStrategy;
|
||||||
import org.jclouds.vcloud.compute.strategy.VCloudExpressGetNodeMetadataStrategy;
|
import org.jclouds.vcloud.compute.strategy.VCloudExpressGetNodeMetadataStrategy;
|
||||||
import org.jclouds.vcloud.compute.strategy.VCloudExpressListNodesStrategy;
|
import org.jclouds.vcloud.compute.strategy.VCloudExpressListNodesStrategy;
|
||||||
import org.jclouds.vcloud.compute.strategy.VCloudExpressRebootNodeStrategy;
|
import org.jclouds.vcloud.compute.strategy.VCloudExpressRebootNodeStrategy;
|
||||||
|
import org.jclouds.vcloud.compute.suppliers.OrganizationAndVDCToLocationSupplier;
|
||||||
|
import org.jclouds.vcloud.compute.suppliers.VCloudExpressImageSupplier;
|
||||||
|
|
||||||
|
import com.google.common.base.Supplier;
|
||||||
|
import com.google.inject.Injector;
|
||||||
import com.google.inject.Scopes;
|
import com.google.inject.Scopes;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
|
|
||||||
|
@ -66,4 +74,14 @@ public class VCloudExpressComputeServiceContextModule extends CommonVCloudComput
|
||||||
bind(RebootNodeStrategy.class).to(VCloudExpressRebootNodeStrategy.class);
|
bind(RebootNodeStrategy.class).to(VCloudExpressRebootNodeStrategy.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Supplier<Set<? extends Location>> getSourceLocationSupplier(Injector injector) {
|
||||||
|
return injector.getInstance(OrganizationAndVDCToLocationSupplier.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Supplier<Set<? extends Image>> getSourceImageSupplier(Injector injector) {
|
||||||
|
return injector.getInstance(VCloudExpressImageSupplier.class);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jclouds.vcloud.compute.functions;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Provider;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.jclouds.compute.domain.Image;
|
||||||
|
import org.jclouds.vcloud.domain.CatalogItem;
|
||||||
|
import org.jclouds.vcloud.domain.Org;
|
||||||
|
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||||
|
import org.jclouds.vcloud.functions.AllCatalogItemsInOrg;
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Singleton
|
||||||
|
public class ImagesInOrg implements Function<Org, Iterable<? extends Image>> {
|
||||||
|
|
||||||
|
private final AllCatalogItemsInOrg allCatalogItemsInOrg;
|
||||||
|
private final Function<Iterable<? extends CatalogItem>, Iterable<? extends VAppTemplate>> vAppTemplatesForCatalogItems;
|
||||||
|
private final Provider<ImageForVAppTemplate> imageForVAppTemplateProvider;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
ImagesInOrg(AllCatalogItemsInOrg allCatalogItemsInOrg,
|
||||||
|
Provider<ImageForVAppTemplate> imageForVAppTemplateProvider,
|
||||||
|
Function<Iterable<? extends CatalogItem>, Iterable<? extends VAppTemplate>> vAppTemplatesForCatalogItems) {
|
||||||
|
this.imageForVAppTemplateProvider = imageForVAppTemplateProvider;
|
||||||
|
this.allCatalogItemsInOrg = allCatalogItemsInOrg;
|
||||||
|
this.vAppTemplatesForCatalogItems = vAppTemplatesForCatalogItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterable<? extends Image> apply(Org from) {
|
||||||
|
Iterable<? extends CatalogItem> catalogs = allCatalogItemsInOrg.apply(from);
|
||||||
|
Iterable<? extends VAppTemplate> vAppTemplates = vAppTemplatesForCatalogItems.apply(catalogs);
|
||||||
|
return Iterables.transform(vAppTemplates, imageForVAppTemplateProvider.get().withParent(from));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -30,8 +30,7 @@ import org.jclouds.domain.LocationScope;
|
||||||
import org.jclouds.domain.internal.LocationImpl;
|
import org.jclouds.domain.internal.LocationImpl;
|
||||||
import org.jclouds.vcloud.compute.domain.VCloudLocation;
|
import org.jclouds.vcloud.compute.domain.VCloudLocation;
|
||||||
import org.jclouds.vcloud.domain.NamedResource;
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
import org.jclouds.vcloud.domain.Organization;
|
import org.jclouds.vcloud.domain.Org;
|
||||||
import org.jclouds.vcloud.endpoints.Org;
|
|
||||||
|
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
@ -43,12 +42,12 @@ import com.google.common.collect.Sets;
|
||||||
public class OrgAndVDCToLocationSupplier implements Supplier<Set<? extends Location>> {
|
public class OrgAndVDCToLocationSupplier implements Supplier<Set<? extends Location>> {
|
||||||
private final String providerName;
|
private final String providerName;
|
||||||
private final Supplier<Map<String, NamedResource>> orgNameToResource;
|
private final Supplier<Map<String, NamedResource>> orgNameToResource;
|
||||||
private final Supplier<Map<String, ? extends Organization>> orgNameToVDCResource;
|
private final Supplier<Map<String, ? extends Org>> orgNameToVDCResource;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
OrgAndVDCToLocationSupplier(@org.jclouds.rest.annotations.Provider String providerName,
|
OrgAndVDCToLocationSupplier(@org.jclouds.rest.annotations.Provider String providerName,
|
||||||
@Org Supplier<Map<String, NamedResource>> orgNameToResource,
|
@org.jclouds.vcloud.endpoints.Org Supplier<Map<String, NamedResource>> orgNameToResource,
|
||||||
Supplier<Map<String, ? extends Organization>> orgNameToVDCResource) {
|
Supplier<Map<String, ? extends Org>> orgNameToVDCResource) {
|
||||||
this.providerName = providerName;
|
this.providerName = providerName;
|
||||||
this.orgNameToResource = orgNameToResource;
|
this.orgNameToResource = orgNameToResource;
|
||||||
this.orgNameToVDCResource = orgNameToVDCResource;
|
this.orgNameToVDCResource = orgNameToVDCResource;
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jclouds.vcloud.compute.suppliers;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.jclouds.domain.Location;
|
||||||
|
import org.jclouds.domain.LocationScope;
|
||||||
|
import org.jclouds.domain.internal.LocationImpl;
|
||||||
|
import org.jclouds.vcloud.compute.domain.VCloudLocation;
|
||||||
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
|
import org.jclouds.vcloud.domain.Organization;
|
||||||
|
import org.jclouds.vcloud.endpoints.Org;
|
||||||
|
|
||||||
|
import com.google.common.base.Supplier;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Singleton
|
||||||
|
public class OrganizationAndVDCToLocationSupplier implements Supplier<Set<? extends Location>> {
|
||||||
|
private final String providerName;
|
||||||
|
private final Supplier<Map<String, NamedResource>> orgNameToResource;
|
||||||
|
private final Supplier<Map<String, ? extends Organization>> orgNameToVDCResource;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
OrganizationAndVDCToLocationSupplier(@org.jclouds.rest.annotations.Provider String providerName,
|
||||||
|
@Org Supplier<Map<String, NamedResource>> orgNameToResource,
|
||||||
|
Supplier<Map<String, ? extends Organization>> orgNameToVDCResource) {
|
||||||
|
this.providerName = providerName;
|
||||||
|
this.orgNameToResource = orgNameToResource;
|
||||||
|
this.orgNameToVDCResource = orgNameToVDCResource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<? extends Location> get() {
|
||||||
|
Location provider = new LocationImpl(LocationScope.PROVIDER, providerName, providerName, null);
|
||||||
|
Set<Location> locations = Sets.newLinkedHashSet();
|
||||||
|
|
||||||
|
for (NamedResource org : orgNameToResource.get().values()) {
|
||||||
|
Location orgL = new VCloudLocation(org, provider);
|
||||||
|
for (NamedResource vdc : orgNameToVDCResource.get().get(org.getName()).getVDCs().values()) {
|
||||||
|
locations.add(new VCloudLocation(vdc, orgL));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return locations;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jclouds.vcloud.compute.suppliers;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
import static com.google.common.collect.Iterables.concat;
|
||||||
|
import static com.google.common.collect.Sets.newLinkedHashSet;
|
||||||
|
import static org.jclouds.concurrent.FutureIterables.transformParallel;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.jclouds.Constants;
|
||||||
|
import org.jclouds.compute.domain.Image;
|
||||||
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
|
import org.jclouds.logging.Logger;
|
||||||
|
import org.jclouds.vcloud.compute.functions.ImagesInOrganization;
|
||||||
|
import org.jclouds.vcloud.domain.Organization;
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
|
import com.google.common.base.Supplier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Singleton
|
||||||
|
public class VCloudExpressImageSupplier implements Supplier<Set<? extends Image>> {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||||
|
public Logger logger = Logger.NULL;
|
||||||
|
|
||||||
|
private final Supplier<Map<String, ? extends Organization>> orgMap;
|
||||||
|
private final ImagesInOrganization imagesInOrganization;
|
||||||
|
private final ExecutorService executor;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
VCloudExpressImageSupplier(Supplier<Map<String, ? extends Organization>> orgMap, ImagesInOrganization imagesInOrganization,
|
||||||
|
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
|
||||||
|
this.orgMap = checkNotNull(orgMap, "orgMap");
|
||||||
|
this.imagesInOrganization = checkNotNull(imagesInOrganization, "imagesInOrganization");
|
||||||
|
this.executor = checkNotNull(executor, "executor");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<? extends Image> get() {
|
||||||
|
Iterable<? extends Organization> orgs = checkNotNull(orgMap.get().values(), "orgs");
|
||||||
|
Iterable<Iterable<? extends Image>> images = transformParallel(orgs,
|
||||||
|
new Function<Organization, Future<Iterable<? extends Image>>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Future<Iterable<? extends Image>> apply(final Organization from) {
|
||||||
|
checkNotNull(from, "org");
|
||||||
|
return executor.submit(new Callable<Iterable<? extends Image>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterable<? extends Image> call() throws Exception {
|
||||||
|
return imagesInOrganization.apply(from);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}, executor, null, logger, "images in " + orgs);
|
||||||
|
return newLinkedHashSet(concat(images));
|
||||||
|
}
|
||||||
|
}
|
|
@ -39,8 +39,8 @@ import org.jclouds.Constants;
|
||||||
import org.jclouds.compute.domain.Image;
|
import org.jclouds.compute.domain.Image;
|
||||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.vcloud.compute.functions.ImagesInOrganization;
|
import org.jclouds.vcloud.compute.functions.ImagesInOrg;
|
||||||
import org.jclouds.vcloud.domain.Organization;
|
import org.jclouds.vcloud.domain.Org;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
|
@ -55,32 +55,32 @@ public class VCloudImageSupplier implements Supplier<Set<? extends Image>> {
|
||||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||||
public Logger logger = Logger.NULL;
|
public Logger logger = Logger.NULL;
|
||||||
|
|
||||||
private final Supplier<Map<String, ? extends Organization>> orgMap;
|
private final Supplier<Map<String, ? extends Org>> orgMap;
|
||||||
private final ImagesInOrganization imagesInOrganization;
|
private final ImagesInOrg imagesInOrg;
|
||||||
private final ExecutorService executor;
|
private final ExecutorService executor;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
VCloudImageSupplier(Supplier<Map<String, ? extends Organization>> orgMap, ImagesInOrganization imagesInOrganization,
|
VCloudImageSupplier(Supplier<Map<String, ? extends Org>> orgMap, ImagesInOrg imagesInOrg,
|
||||||
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
|
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor) {
|
||||||
this.orgMap = checkNotNull(orgMap, "orgMap");
|
this.orgMap = checkNotNull(orgMap, "orgMap");
|
||||||
this.imagesInOrganization = checkNotNull(imagesInOrganization, "imagesInOrganization");
|
this.imagesInOrg = checkNotNull(imagesInOrg, "imagesInOrg");
|
||||||
this.executor = checkNotNull(executor, "executor");
|
this.executor = checkNotNull(executor, "executor");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<? extends Image> get() {
|
public Set<? extends Image> get() {
|
||||||
Iterable<? extends Organization> orgs = checkNotNull(orgMap.get().values(), "orgs");
|
Iterable<? extends Org> orgs = checkNotNull(orgMap.get().values(), "orgs");
|
||||||
Iterable<Iterable<? extends Image>> images = transformParallel(orgs,
|
Iterable<Iterable<? extends Image>> images = transformParallel(orgs,
|
||||||
new Function<Organization, Future<Iterable<? extends Image>>>() {
|
new Function<Org, Future<Iterable<? extends Image>>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Future<Iterable<? extends Image>> apply(final Organization from) {
|
public Future<Iterable<? extends Image>> apply(final Org from) {
|
||||||
checkNotNull(from, "org");
|
checkNotNull(from, "org");
|
||||||
return executor.submit(new Callable<Iterable<? extends Image>>() {
|
return executor.submit(new Callable<Iterable<? extends Image>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<? extends Image> call() throws Exception {
|
public Iterable<? extends Image> call() throws Exception {
|
||||||
return imagesInOrganization.apply(from);
|
return imagesInOrg.apply(from);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
package org.jclouds.vcloud.config;
|
package org.jclouds.vcloud.config;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkState;
|
import static com.google.common.base.Preconditions.checkState;
|
||||||
|
import static com.google.common.base.Throwables.propagate;
|
||||||
import static com.google.common.collect.Iterables.get;
|
import static com.google.common.collect.Iterables.get;
|
||||||
import static com.google.common.collect.Maps.newLinkedHashMap;
|
import static com.google.common.collect.Maps.newLinkedHashMap;
|
||||||
import static com.google.common.collect.Maps.transformValues;
|
import static com.google.common.collect.Maps.transformValues;
|
||||||
|
@ -31,6 +32,7 @@ import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_TIMEO
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
@ -39,6 +41,7 @@ import javax.inject.Singleton;
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
import org.jclouds.http.RequiresHttp;
|
import org.jclouds.http.RequiresHttp;
|
||||||
import org.jclouds.predicates.RetryablePredicate;
|
import org.jclouds.predicates.RetryablePredicate;
|
||||||
|
import org.jclouds.rest.AsyncClientFactory;
|
||||||
import org.jclouds.rest.AuthorizationException;
|
import org.jclouds.rest.AuthorizationException;
|
||||||
import org.jclouds.rest.ConfiguresRestClient;
|
import org.jclouds.rest.ConfiguresRestClient;
|
||||||
import org.jclouds.rest.suppliers.RetryOnTimeOutButNotOnAuthorizationExceptionSupplier;
|
import org.jclouds.rest.suppliers.RetryOnTimeOutButNotOnAuthorizationExceptionSupplier;
|
||||||
|
@ -49,6 +52,7 @@ import org.jclouds.vcloud.domain.CatalogItem;
|
||||||
import org.jclouds.vcloud.domain.NamedResource;
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
import org.jclouds.vcloud.domain.Organization;
|
import org.jclouds.vcloud.domain.Organization;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||||
|
import org.jclouds.vcloud.domain.VCloudSession;
|
||||||
import org.jclouds.vcloud.domain.VDC;
|
import org.jclouds.vcloud.domain.VDC;
|
||||||
import org.jclouds.vcloud.endpoints.TasksList;
|
import org.jclouds.vcloud.endpoints.TasksList;
|
||||||
import org.jclouds.vcloud.functions.VCloudExpressAllCatalogItemsInCatalog;
|
import org.jclouds.vcloud.functions.VCloudExpressAllCatalogItemsInCatalog;
|
||||||
|
@ -57,7 +61,6 @@ import org.jclouds.vcloud.functions.VCloudExpressAllVDCsInOrganization;
|
||||||
import org.jclouds.vcloud.functions.VCloudExpressOrganizationsForNames;
|
import org.jclouds.vcloud.functions.VCloudExpressOrganizationsForNames;
|
||||||
import org.jclouds.vcloud.functions.VCloudExpressOrganizatonsForLocations;
|
import org.jclouds.vcloud.functions.VCloudExpressOrganizatonsForLocations;
|
||||||
import org.jclouds.vcloud.functions.VCloudExpressVAppTemplatesForCatalogItems;
|
import org.jclouds.vcloud.functions.VCloudExpressVAppTemplatesForCatalogItems;
|
||||||
import org.jclouds.vcloud.internal.VCloudLoginAsyncClient.VCloudSession;
|
|
||||||
import org.jclouds.vcloud.predicates.VCloudExpressTaskSuccess;
|
import org.jclouds.vcloud.predicates.VCloudExpressTaskSuccess;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
@ -67,9 +70,10 @@ import com.google.inject.Injector;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
|
|
||||||
|
import domain.VCloudExpressLoginAsyncClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures the VCloud authentication service connection, including logging
|
* Configures the VCloud authentication service connection, including logging and http transport.
|
||||||
* and http transport.
|
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
|
@ -257,7 +261,8 @@ public abstract class BaseVCloudExpressRestClientModule<S extends VCloudExpressC
|
||||||
protected Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> provideOrganizationVDCSupplierCache(
|
protected Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> provideOrganizationVDCSupplierCache(
|
||||||
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final OrganizationVDCSupplier supplier) {
|
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final OrganizationVDCSupplier supplier) {
|
||||||
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>>(
|
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>>(
|
||||||
authException, seconds, new Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>>() {
|
authException, seconds,
|
||||||
|
new Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>>() {
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>> get() {
|
public Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>> get() {
|
||||||
return supplier.get();
|
return supplier.get();
|
||||||
|
@ -323,7 +328,8 @@ public abstract class BaseVCloudExpressRestClientModule<S extends VCloudExpressC
|
||||||
new Function<org.jclouds.vcloud.domain.Catalog, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>() {
|
new Function<org.jclouds.vcloud.domain.Catalog, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, ? extends CatalogItem> apply(org.jclouds.vcloud.domain.Catalog from) {
|
public Map<String, ? extends CatalogItem> apply(
|
||||||
|
org.jclouds.vcloud.domain.Catalog from) {
|
||||||
return uniqueIndex(allCatalogItemsInCatalog.apply(from), name);
|
return uniqueIndex(allCatalogItemsInCatalog.apply(from), name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -347,6 +353,33 @@ public abstract class BaseVCloudExpressRestClientModule<S extends VCloudExpressC
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
protected VCloudExpressLoginAsyncClient provideVCloudLogin(AsyncClientFactory factory) {
|
||||||
|
return factory.create(VCloudExpressLoginAsyncClient.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
|
||||||
|
final VCloudExpressLoginAsyncClient login) {
|
||||||
|
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<VCloudSession>(authException, seconds,
|
||||||
|
new Supplier<VCloudSession>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VCloudSession get() {
|
||||||
|
try {
|
||||||
|
return login.login().get(10, TimeUnit.SECONDS);
|
||||||
|
} catch (Exception e) {
|
||||||
|
propagate(e);
|
||||||
|
assert false : e;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@TasksList
|
@TasksList
|
||||||
@Singleton
|
@Singleton
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
package org.jclouds.vcloud.config;
|
package org.jclouds.vcloud.config;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkState;
|
import static com.google.common.base.Preconditions.checkState;
|
||||||
|
import static com.google.common.base.Throwables.propagate;
|
||||||
import static com.google.common.collect.Iterables.get;
|
import static com.google.common.collect.Iterables.get;
|
||||||
import static com.google.common.collect.Maps.newLinkedHashMap;
|
import static com.google.common.collect.Maps.newLinkedHashMap;
|
||||||
import static com.google.common.collect.Maps.transformValues;
|
import static com.google.common.collect.Maps.transformValues;
|
||||||
|
@ -31,6 +32,7 @@ import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_TIMEO
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
@ -39,6 +41,7 @@ import javax.inject.Singleton;
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
import org.jclouds.http.RequiresHttp;
|
import org.jclouds.http.RequiresHttp;
|
||||||
import org.jclouds.predicates.RetryablePredicate;
|
import org.jclouds.predicates.RetryablePredicate;
|
||||||
|
import org.jclouds.rest.AsyncClientFactory;
|
||||||
import org.jclouds.rest.AuthorizationException;
|
import org.jclouds.rest.AuthorizationException;
|
||||||
import org.jclouds.rest.ConfiguresRestClient;
|
import org.jclouds.rest.ConfiguresRestClient;
|
||||||
import org.jclouds.rest.suppliers.RetryOnTimeOutButNotOnAuthorizationExceptionSupplier;
|
import org.jclouds.rest.suppliers.RetryOnTimeOutButNotOnAuthorizationExceptionSupplier;
|
||||||
|
@ -49,6 +52,7 @@ import org.jclouds.vcloud.domain.CatalogItem;
|
||||||
import org.jclouds.vcloud.domain.NamedResource;
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
import org.jclouds.vcloud.domain.Org;
|
import org.jclouds.vcloud.domain.Org;
|
||||||
import org.jclouds.vcloud.domain.VAppTemplate;
|
import org.jclouds.vcloud.domain.VAppTemplate;
|
||||||
|
import org.jclouds.vcloud.domain.VCloudSession;
|
||||||
import org.jclouds.vcloud.domain.VDC;
|
import org.jclouds.vcloud.domain.VDC;
|
||||||
import org.jclouds.vcloud.endpoints.TasksList;
|
import org.jclouds.vcloud.endpoints.TasksList;
|
||||||
import org.jclouds.vcloud.functions.AllCatalogItemsInCatalog;
|
import org.jclouds.vcloud.functions.AllCatalogItemsInCatalog;
|
||||||
|
@ -57,7 +61,6 @@ import org.jclouds.vcloud.functions.AllVDCsInOrg;
|
||||||
import org.jclouds.vcloud.functions.OrgsForLocations;
|
import org.jclouds.vcloud.functions.OrgsForLocations;
|
||||||
import org.jclouds.vcloud.functions.OrgsForNames;
|
import org.jclouds.vcloud.functions.OrgsForNames;
|
||||||
import org.jclouds.vcloud.functions.VAppTemplatesForCatalogItems;
|
import org.jclouds.vcloud.functions.VAppTemplatesForCatalogItems;
|
||||||
import org.jclouds.vcloud.internal.VCloudLoginAsyncClient.VCloudSession;
|
|
||||||
import org.jclouds.vcloud.predicates.TaskSuccess;
|
import org.jclouds.vcloud.predicates.TaskSuccess;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
@ -67,9 +70,10 @@ import com.google.inject.Injector;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
|
|
||||||
|
import domain.VCloudLoginAsyncClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures the VCloud authentication service connection, including logging
|
* Configures the VCloud authentication service connection, including logging and http transport.
|
||||||
* and http transport.
|
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
|
@ -257,7 +261,8 @@ public abstract class BaseVCloudRestClientModule<S extends VCloudClient, A exten
|
||||||
protected Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> provideOrgVDCSupplierCache(
|
protected Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> provideOrgVDCSupplierCache(
|
||||||
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final OrgVDCSupplier supplier) {
|
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final OrgVDCSupplier supplier) {
|
||||||
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>>(
|
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>>(
|
||||||
authException, seconds, new Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>>() {
|
authException, seconds,
|
||||||
|
new Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>>() {
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>> get() {
|
public Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>> get() {
|
||||||
return supplier.get();
|
return supplier.get();
|
||||||
|
@ -323,7 +328,8 @@ public abstract class BaseVCloudRestClientModule<S extends VCloudClient, A exten
|
||||||
new Function<org.jclouds.vcloud.domain.Catalog, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>() {
|
new Function<org.jclouds.vcloud.domain.Catalog, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, ? extends CatalogItem> apply(org.jclouds.vcloud.domain.Catalog from) {
|
public Map<String, ? extends CatalogItem> apply(
|
||||||
|
org.jclouds.vcloud.domain.Catalog from) {
|
||||||
return uniqueIndex(allCatalogItemsInCatalog.apply(from), name);
|
return uniqueIndex(allCatalogItemsInCatalog.apply(from), name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -353,4 +359,31 @@ public abstract class BaseVCloudRestClientModule<S extends VCloudClient, A exten
|
||||||
protected URI provideDefaultTasksList(Org org) {
|
protected URI provideDefaultTasksList(Org org) {
|
||||||
return org.getTasksList().getId();
|
return org.getTasksList().getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
protected VCloudLoginAsyncClient provideVCloudLogin(AsyncClientFactory factory) {
|
||||||
|
return factory.create(VCloudLoginAsyncClient.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
|
||||||
|
final VCloudLoginAsyncClient login) {
|
||||||
|
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<VCloudSession>(authException, seconds,
|
||||||
|
new Supplier<VCloudSession>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VCloudSession get() {
|
||||||
|
try {
|
||||||
|
return login.login().get(10, TimeUnit.SECONDS);
|
||||||
|
} catch (Exception e) {
|
||||||
|
propagate(e);
|
||||||
|
assert false : e;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@ package org.jclouds.vcloud.config;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static com.google.common.base.Preconditions.checkState;
|
import static com.google.common.base.Preconditions.checkState;
|
||||||
import static com.google.common.base.Throwables.propagate;
|
|
||||||
import static com.google.common.collect.Iterables.concat;
|
import static com.google.common.collect.Iterables.concat;
|
||||||
import static com.google.common.collect.Iterables.getLast;
|
import static com.google.common.collect.Iterables.getLast;
|
||||||
import static com.google.common.collect.Iterables.transform;
|
import static com.google.common.collect.Iterables.transform;
|
||||||
|
@ -58,13 +57,11 @@ import org.jclouds.rest.config.RestClientModule;
|
||||||
import org.jclouds.rest.suppliers.RetryOnTimeOutButNotOnAuthorizationExceptionSupplier;
|
import org.jclouds.rest.suppliers.RetryOnTimeOutButNotOnAuthorizationExceptionSupplier;
|
||||||
import org.jclouds.vcloud.VCloudToken;
|
import org.jclouds.vcloud.VCloudToken;
|
||||||
import org.jclouds.vcloud.domain.NamedResource;
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
|
import org.jclouds.vcloud.domain.VCloudSession;
|
||||||
import org.jclouds.vcloud.endpoints.Catalog;
|
import org.jclouds.vcloud.endpoints.Catalog;
|
||||||
import org.jclouds.vcloud.endpoints.Network;
|
import org.jclouds.vcloud.endpoints.Network;
|
||||||
import org.jclouds.vcloud.endpoints.Org;
|
import org.jclouds.vcloud.endpoints.Org;
|
||||||
import org.jclouds.vcloud.handlers.ParseVCloudErrorFromHttpResponse;
|
import org.jclouds.vcloud.handlers.ParseVCloudErrorFromHttpResponse;
|
||||||
import org.jclouds.vcloud.internal.VCloudLoginAsyncClient;
|
|
||||||
import org.jclouds.vcloud.internal.VCloudVersionsAsyncClient;
|
|
||||||
import org.jclouds.vcloud.internal.VCloudLoginAsyncClient.VCloudSession;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
@ -72,9 +69,10 @@ import com.google.common.base.Supplier;
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
|
|
||||||
|
import domain.VCloudVersionsAsyncClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures the VCloud authentication service connection, including logging
|
* Configures the VCloud authentication service connection, including logging and http transport.
|
||||||
* and http transport.
|
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
|
@ -192,27 +190,6 @@ public abstract class CommonVCloudRestClientModule<S, A> extends RestClientModul
|
||||||
|
|
||||||
protected AtomicReference<AuthorizationException> authException = new AtomicReference<AuthorizationException>();
|
protected AtomicReference<AuthorizationException> authException = new AtomicReference<AuthorizationException>();
|
||||||
|
|
||||||
@Provides
|
|
||||||
@Singleton
|
|
||||||
protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
|
|
||||||
final VCloudLoginAsyncClient login) {
|
|
||||||
return new RetryOnTimeOutButNotOnAuthorizationExceptionSupplier<VCloudSession>(authException, seconds,
|
|
||||||
new Supplier<VCloudSession>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VCloudSession get() {
|
|
||||||
try {
|
|
||||||
return login.login().get(10, TimeUnit.SECONDS);
|
|
||||||
} catch (Exception e) {
|
|
||||||
propagate(e);
|
|
||||||
assert false : e;
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
final static Function<NamedResource, String> name = new Function<NamedResource, String>() {
|
final static Function<NamedResource, String> name = new Function<NamedResource, String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -226,7 +203,8 @@ public abstract class CommonVCloudRestClientModule<S, A> extends RestClientModul
|
||||||
@Singleton
|
@Singleton
|
||||||
@org.jclouds.vcloud.endpoints.VCloudLogin
|
@org.jclouds.vcloud.endpoints.VCloudLogin
|
||||||
protected URI provideAuthenticationURI(VCloudVersionsAsyncClient versionService,
|
protected URI provideAuthenticationURI(VCloudVersionsAsyncClient versionService,
|
||||||
@Named(PROPERTY_API_VERSION) String version) throws InterruptedException, ExecutionException, TimeoutException {
|
@Named(PROPERTY_API_VERSION) String version) throws InterruptedException, ExecutionException,
|
||||||
|
TimeoutException {
|
||||||
SortedMap<String, URI> versions = versionService.getSupportedVersions().get(180, TimeUnit.SECONDS);
|
SortedMap<String, URI> versions = versionService.getSupportedVersions().get(180, TimeUnit.SECONDS);
|
||||||
checkState(versions.size() > 0, "No versions present");
|
checkState(versions.size() > 0, "No versions present");
|
||||||
checkState(versions.containsKey(version), "version " + version + " not present in: " + versions);
|
checkState(versions.containsKey(version), "version " + version + " not present in: " + versions);
|
||||||
|
@ -250,12 +228,6 @@ public abstract class CommonVCloudRestClientModule<S, A> extends RestClientModul
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
|
||||||
@Singleton
|
|
||||||
protected VCloudLoginAsyncClient provideVCloudLogin(AsyncClientFactory factory) {
|
|
||||||
return factory.create(VCloudLoginAsyncClient.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
protected VCloudVersionsAsyncClient provideVCloudVersions(AsyncClientFactory factory) {
|
protected VCloudVersionsAsyncClient provideVCloudVersions(AsyncClientFactory factory) {
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* ====================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jclouds.vcloud.domain;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
public interface VCloudSession {
|
||||||
|
String getVCloudToken();
|
||||||
|
|
||||||
|
Map<String, NamedResource> getOrgs();
|
||||||
|
}
|
|
@ -37,8 +37,8 @@ import org.jclouds.http.functions.ParseSax;
|
||||||
import org.jclouds.http.functions.ParseSax.Factory;
|
import org.jclouds.http.functions.ParseSax.Factory;
|
||||||
import org.jclouds.vcloud.VCloudToken;
|
import org.jclouds.vcloud.VCloudToken;
|
||||||
import org.jclouds.vcloud.domain.NamedResource;
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
|
import org.jclouds.vcloud.domain.VCloudSession;
|
||||||
import org.jclouds.vcloud.endpoints.Org;
|
import org.jclouds.vcloud.endpoints.Org;
|
||||||
import org.jclouds.vcloud.internal.VCloudLoginAsyncClient.VCloudSession;
|
|
||||||
import org.jclouds.vcloud.xml.OrgListHandler;
|
import org.jclouds.vcloud.xml.OrgListHandler;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
|
|
@ -51,15 +51,13 @@ import org.jclouds.util.Utils;
|
||||||
import org.jclouds.vcloud.config.VCloudRestClientModule;
|
import org.jclouds.vcloud.config.VCloudRestClientModule;
|
||||||
import org.jclouds.vcloud.domain.NamedResource;
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
import org.jclouds.vcloud.domain.Org;
|
import org.jclouds.vcloud.domain.Org;
|
||||||
|
import org.jclouds.vcloud.domain.VCloudSession;
|
||||||
import org.jclouds.vcloud.domain.internal.CatalogImpl;
|
import org.jclouds.vcloud.domain.internal.CatalogImpl;
|
||||||
import org.jclouds.vcloud.domain.internal.CatalogItemImpl;
|
import org.jclouds.vcloud.domain.internal.CatalogItemImpl;
|
||||||
import org.jclouds.vcloud.domain.internal.NamedResourceImpl;
|
import org.jclouds.vcloud.domain.internal.NamedResourceImpl;
|
||||||
import org.jclouds.vcloud.domain.internal.OrgImpl;
|
import org.jclouds.vcloud.domain.internal.OrgImpl;
|
||||||
import org.jclouds.vcloud.domain.internal.VDCImpl;
|
import org.jclouds.vcloud.domain.internal.VDCImpl;
|
||||||
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
||||||
import org.jclouds.vcloud.internal.VCloudLoginAsyncClient;
|
|
||||||
import org.jclouds.vcloud.internal.VCloudVersionsAsyncClient;
|
|
||||||
import org.jclouds.vcloud.internal.VCloudLoginAsyncClient.VCloudSession;
|
|
||||||
import org.jclouds.vcloud.options.CloneVAppOptions;
|
import org.jclouds.vcloud.options.CloneVAppOptions;
|
||||||
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||||
import org.jclouds.vcloud.xml.CatalogHandler;
|
import org.jclouds.vcloud.xml.CatalogHandler;
|
||||||
|
@ -79,6 +77,9 @@ import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
|
|
||||||
|
import domain.VCloudLoginAsyncClient;
|
||||||
|
import domain.VCloudVersionsAsyncClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code VCloudAsyncClient}
|
* Tests behavior of {@code VCloudAsyncClient}
|
||||||
*
|
*
|
||||||
|
@ -111,10 +112,11 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
IOException {
|
IOException {
|
||||||
Method method = VCloudAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class,
|
Method method = VCloudAsyncClient.class.getMethod("instantiateVAppTemplateInVDC", URI.class, URI.class,
|
||||||
String.class, InstantiateVAppTemplateOptions[].class);
|
String.class, InstantiateVAppTemplateOptions[].class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
.createRequest(method, URI.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3"), "my-vapp", processorCount(1).memory(
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3"), "my-vapp",
|
||||||
512).disk(1024).inNetwork(URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/1990")));
|
processorCount(1).memory(512).disk(1024).inNetwork(
|
||||||
|
URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/1990")));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/instantiateVAppTemplate HTTP/1.1");
|
"POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/instantiateVAppTemplate HTTP/1.1");
|
||||||
|
@ -164,8 +166,8 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
CloneVAppOptions[].class);
|
CloneVAppOptions[].class);
|
||||||
HttpRequest request = processor.createRequest(method, URI
|
HttpRequest request = processor.createRequest(method, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), "new-linux-server", new CloneVAppOptions()
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), "new-linux-server",
|
||||||
.deploy().powerOn().withDescription("The description of the new vApp"));
|
new CloneVAppOptions().deploy().powerOn().withDescription("The description of the new vApp"));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVApp HTTP/1.1");
|
"POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVApp HTTP/1.1");
|
||||||
|
@ -663,11 +665,6 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Iterable<NamedResource> provideOrgs(Supplier<VCloudSession> cache, @Named(PROPERTY_IDENTITY) String user) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected URI provideDefaultTasksList(Org org) {
|
protected URI provideDefaultTasksList(Org org) {
|
||||||
return URI.create("https://vcenterprise.bluelock.com/api/v1.0/taskslist");
|
return URI.create("https://vcenterprise.bluelock.com/api/v1.0/taskslist");
|
||||||
|
@ -714,16 +711,39 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
protected Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> provideOrgVDCSupplierCache(
|
protected Supplier<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> provideOrgVDCSupplierCache(
|
||||||
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final OrgVDCSupplier supplier) {
|
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final OrgVDCSupplier supplier) {
|
||||||
|
|
||||||
return Suppliers.<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> ofInstance(ImmutableMap
|
return Suppliers
|
||||||
.<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>> of("org",
|
.<Map<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>>> ofInstance(ImmutableMap
|
||||||
|
.<String, Map<String, ? extends org.jclouds.vcloud.domain.VDC>> of(
|
||||||
|
"org",
|
||||||
|
|
||||||
ImmutableMap.<String, org.jclouds.vcloud.domain.VDC> of("vdc", new VDCImpl("vdc", URI
|
ImmutableMap
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "description", null, null, null,
|
.<String, org.jclouds.vcloud.domain.VDC> of(
|
||||||
null, null, ImmutableMap.<String, NamedResource> of("vapp", new NamedResourceImpl("vapp",
|
"vdc",
|
||||||
"application/vnd.vmware.vcloud.vApp+xml", URI
|
new VDCImpl(
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/188849-1")), "network",
|
"vdc",
|
||||||
new NamedResourceImpl("network", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
|
URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdcItem/2"))), null))));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"),
|
||||||
|
"description",
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
ImmutableMap
|
||||||
|
.<String, NamedResource> of(
|
||||||
|
"vapp",
|
||||||
|
new NamedResourceImpl(
|
||||||
|
"vapp",
|
||||||
|
"application/vnd.vmware.vcloud.vApp+xml",
|
||||||
|
URI
|
||||||
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/188849-1")),
|
||||||
|
"network",
|
||||||
|
new NamedResourceImpl(
|
||||||
|
"network",
|
||||||
|
"application/vnd.vmware.vcloud.vAppTemplate+xml",
|
||||||
|
URI
|
||||||
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vdcItem/2"))),
|
||||||
|
null))));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -738,13 +758,15 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
public Map<String, Org> get() {
|
public Map<String, Org> get() {
|
||||||
return ImmutableMap.<String, Org> of("org", new OrgImpl("org", URI
|
return ImmutableMap.<String, Org> of("org", new OrgImpl("org", URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/org/1"), "description", ImmutableMap
|
.create("https://vcenterprise.bluelock.com/api/v1.0/org/1"), "description", ImmutableMap
|
||||||
.<String, NamedResource> of("catalog", new NamedResourceImpl("catalog", VCloudMediaType.CATALOG_XML,
|
.<String, NamedResource> of("catalog", new NamedResourceImpl("catalog",
|
||||||
URI.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"))), ImmutableMap
|
VCloudMediaType.CATALOG_XML, URI
|
||||||
|
.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"))), ImmutableMap
|
||||||
.<String, NamedResource> of("vdc", new NamedResourceImpl("vdc", VCloudMediaType.VDC_XML, URI
|
.<String, NamedResource> of("vdc", new NamedResourceImpl("vdc", VCloudMediaType.VDC_XML, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"))), ImmutableMap
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"))), ImmutableMap
|
||||||
.<String, NamedResource> of("network", new NamedResourceImpl("network", VCloudMediaType.NETWORK_XML,
|
.<String, NamedResource> of("network", new NamedResourceImpl("network",
|
||||||
URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/1"))), new NamedResourceImpl(
|
VCloudMediaType.NETWORK_XML, URI
|
||||||
"tasksList", VCloudMediaType.TASKSLIST_XML, URI
|
.create("https://vcenterprise.bluelock.com/api/v1.0/network/1"))),
|
||||||
|
new NamedResourceImpl("tasksList", VCloudMediaType.TASKSLIST_XML, URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/tasksList/1"))));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/tasksList/1"))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -758,14 +780,31 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>> get() {
|
public Map<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>> get() {
|
||||||
return ImmutableMap.<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>> of("org",
|
return ImmutableMap
|
||||||
|
.<String, Map<String, ? extends org.jclouds.vcloud.domain.Catalog>> of(
|
||||||
|
"org",
|
||||||
|
|
||||||
ImmutableMap.<String, org.jclouds.vcloud.domain.Catalog> of("catalog", new CatalogImpl("catalog", URI
|
ImmutableMap
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"), "description", ImmutableMap
|
.<String, org.jclouds.vcloud.domain.Catalog> of(
|
||||||
.<String, NamedResource> of("item", new NamedResourceImpl("item",
|
"catalog",
|
||||||
"application/vnd.vmware.vcloud.catalogItem+xml", URI
|
new CatalogImpl(
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/1")), "template",
|
"catalog",
|
||||||
new NamedResourceImpl("template", "application/vnd.vmware.vcloud.vAppTemplate+xml", URI
|
URI
|
||||||
|
.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"),
|
||||||
|
"description",
|
||||||
|
ImmutableMap
|
||||||
|
.<String, NamedResource> of(
|
||||||
|
"item",
|
||||||
|
new NamedResourceImpl(
|
||||||
|
"item",
|
||||||
|
"application/vnd.vmware.vcloud.catalogItem+xml",
|
||||||
|
URI
|
||||||
|
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/1")),
|
||||||
|
"template",
|
||||||
|
new NamedResourceImpl(
|
||||||
|
"template",
|
||||||
|
"application/vnd.vmware.vcloud.vAppTemplate+xml",
|
||||||
|
URI
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"))))));
|
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"))))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -778,18 +817,35 @@ public class VCloudAsyncClientTest extends RestClientTest<VCloudAsyncClient> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> get() {
|
public Map<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> get() {
|
||||||
return ImmutableMap.<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> of(
|
return ImmutableMap
|
||||||
"org", ImmutableMap.<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>> of(
|
.<String, Map<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>>> of(
|
||||||
"catalog", ImmutableMap.<String, org.jclouds.vcloud.domain.CatalogItem> of("template",
|
"org",
|
||||||
new CatalogItemImpl("template", URI
|
ImmutableMap
|
||||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"), "description",
|
.<String, Map<String, ? extends org.jclouds.vcloud.domain.CatalogItem>> of(
|
||||||
new NamedResourceImpl("template", "application/vnd.vmware.vcloud.vAppTemplate+xml",
|
"catalog",
|
||||||
URI.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2")),
|
ImmutableMap
|
||||||
|
.<String, org.jclouds.vcloud.domain.CatalogItem> of(
|
||||||
|
"template",
|
||||||
|
new CatalogItemImpl(
|
||||||
|
"template",
|
||||||
|
URI
|
||||||
|
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"),
|
||||||
|
"description",
|
||||||
|
new NamedResourceImpl(
|
||||||
|
"template",
|
||||||
|
"application/vnd.vmware.vcloud.vAppTemplate+xml",
|
||||||
|
URI
|
||||||
|
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2")),
|
||||||
ImmutableMap.<String, String> of()))));
|
ImmutableMap.<String, String> of()))));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Iterable<NamedResource> provideOrgs(Supplier<VCloudSession> cache, String user) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ import org.jclouds.util.Utils;
|
||||||
import org.jclouds.vcloud.config.VCloudExpressRestClientModule;
|
import org.jclouds.vcloud.config.VCloudExpressRestClientModule;
|
||||||
import org.jclouds.vcloud.domain.NamedResource;
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
import org.jclouds.vcloud.domain.Organization;
|
import org.jclouds.vcloud.domain.Organization;
|
||||||
|
import org.jclouds.vcloud.domain.VCloudSession;
|
||||||
import org.jclouds.vcloud.domain.internal.CatalogImpl;
|
import org.jclouds.vcloud.domain.internal.CatalogImpl;
|
||||||
import org.jclouds.vcloud.domain.internal.CatalogItemImpl;
|
import org.jclouds.vcloud.domain.internal.CatalogItemImpl;
|
||||||
import org.jclouds.vcloud.domain.internal.NamedResourceImpl;
|
import org.jclouds.vcloud.domain.internal.NamedResourceImpl;
|
||||||
|
@ -58,9 +59,6 @@ import org.jclouds.vcloud.domain.internal.OrganizationImpl;
|
||||||
import org.jclouds.vcloud.domain.internal.VDCImpl;
|
import org.jclouds.vcloud.domain.internal.VDCImpl;
|
||||||
import org.jclouds.vcloud.endpoints.Org;
|
import org.jclouds.vcloud.endpoints.Org;
|
||||||
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
||||||
import org.jclouds.vcloud.internal.VCloudLoginAsyncClient;
|
|
||||||
import org.jclouds.vcloud.internal.VCloudVersionsAsyncClient;
|
|
||||||
import org.jclouds.vcloud.internal.VCloudLoginAsyncClient.VCloudSession;
|
|
||||||
import org.jclouds.vcloud.options.CloneVAppOptions;
|
import org.jclouds.vcloud.options.CloneVAppOptions;
|
||||||
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||||
import org.jclouds.vcloud.xml.CatalogHandler;
|
import org.jclouds.vcloud.xml.CatalogHandler;
|
||||||
|
@ -80,6 +78,9 @@ import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
|
|
||||||
|
import domain.VCloudExpressLoginAsyncClient;
|
||||||
|
import domain.VCloudVersionsAsyncClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code VCloudExpressAsyncClient}
|
* Tests behavior of {@code VCloudExpressAsyncClient}
|
||||||
*
|
*
|
||||||
|
@ -746,7 +747,7 @@ public class VCloudExpressAsyncClientTest extends RestClientTest<VCloudExpressAs
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
|
protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
|
||||||
final VCloudLoginAsyncClient login) {
|
final VCloudExpressLoginAsyncClient login) {
|
||||||
return Suppliers.<VCloudSession> ofInstance(new VCloudSession() {
|
return Suppliers.<VCloudSession> ofInstance(new VCloudSession() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -37,7 +37,6 @@ import org.jclouds.rest.internal.RestAnnotationProcessor;
|
||||||
import org.jclouds.vcloud.VCloudLoginLiveTest.VCloudLoginClient;
|
import org.jclouds.vcloud.VCloudLoginLiveTest.VCloudLoginClient;
|
||||||
import org.jclouds.vcloud.endpoints.VCloudLogin;
|
import org.jclouds.vcloud.endpoints.VCloudLogin;
|
||||||
import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders;
|
import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders;
|
||||||
import org.jclouds.vcloud.internal.VCloudLoginAsyncClient;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.inject.Binder;
|
import com.google.inject.Binder;
|
||||||
|
@ -45,16 +44,18 @@ import com.google.inject.Module;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
|
|
||||||
|
import domain.VCloudExpressLoginAsyncClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code VCloudLogin}
|
* Tests behavior of {@code VCloudLogin}
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "unit", testName = "vcloud.VCloudLoginTest")
|
@Test(groups = "unit", testName = "vcloud.VCloudLoginTest")
|
||||||
public class VCloudLoginAsyncClientTest extends RestClientTest<VCloudLoginAsyncClient> {
|
public class VCloudLoginAsyncClientTest extends RestClientTest<VCloudExpressLoginAsyncClient> {
|
||||||
|
|
||||||
public void testLogin() throws SecurityException, NoSuchMethodException, IOException {
|
public void testLogin() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VCloudLoginAsyncClient.class.getMethod("login");
|
Method method = VCloudExpressLoginAsyncClient.class.getMethod("login");
|
||||||
HttpRequest request = processor.createRequest(method);
|
HttpRequest request = processor.createRequest(method);
|
||||||
|
|
||||||
assertEquals(request.getRequestLine(), "POST http://localhost:8080/login HTTP/1.1");
|
assertEquals(request.getRequestLine(), "POST http://localhost:8080/login HTTP/1.1");
|
||||||
|
@ -76,8 +77,8 @@ public class VCloudLoginAsyncClientTest extends RestClientTest<VCloudLoginAsyncC
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected TypeLiteral<RestAnnotationProcessor<VCloudLoginAsyncClient>> createTypeLiteral() {
|
protected TypeLiteral<RestAnnotationProcessor<VCloudExpressLoginAsyncClient>> createTypeLiteral() {
|
||||||
return new TypeLiteral<RestAnnotationProcessor<VCloudLoginAsyncClient>>() {
|
return new TypeLiteral<RestAnnotationProcessor<VCloudExpressLoginAsyncClient>>() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,8 +101,8 @@ public class VCloudLoginAsyncClientTest extends RestClientTest<VCloudLoginAsyncC
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ContextSpec<VCloudLoginClient, VCloudLoginAsyncClient> createContextSpec() {
|
public ContextSpec<VCloudLoginClient, VCloudExpressLoginAsyncClient> createContextSpec() {
|
||||||
return contextSpec("test", "http://localhost:8080/login", "1", "identity", "credential", VCloudLoginClient.class,
|
return contextSpec("test", "http://localhost:8080/login", "1", "identity", "credential", VCloudLoginClient.class,
|
||||||
VCloudLoginAsyncClient.class);
|
VCloudExpressLoginAsyncClient.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,8 @@ import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||||
import org.jclouds.rest.RestContext;
|
import org.jclouds.rest.RestContext;
|
||||||
import org.jclouds.rest.RestContextFactory.ContextSpec;
|
import org.jclouds.rest.RestContextFactory.ContextSpec;
|
||||||
import org.jclouds.rest.annotations.Provider;
|
import org.jclouds.rest.annotations.Provider;
|
||||||
|
import org.jclouds.vcloud.domain.VCloudSession;
|
||||||
import org.jclouds.vcloud.endpoints.VCloudLogin;
|
import org.jclouds.vcloud.endpoints.VCloudLogin;
|
||||||
import org.jclouds.vcloud.internal.VCloudLoginAsyncClient;
|
|
||||||
import org.jclouds.vcloud.internal.VCloudLoginAsyncClient.VCloudSession;
|
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -45,6 +44,8 @@ import com.google.inject.AbstractModule;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
|
|
||||||
|
import domain.VCloudExpressLoginAsyncClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code VCloudLogin}
|
* Tests behavior of {@code VCloudLogin}
|
||||||
*
|
*
|
||||||
|
@ -53,11 +54,11 @@ import com.google.inject.Provides;
|
||||||
@Test(groups = "live", testName = "vcloud.VCloudLoginLiveTest")
|
@Test(groups = "live", testName = "vcloud.VCloudLoginLiveTest")
|
||||||
public class VCloudLoginLiveTest {
|
public class VCloudLoginLiveTest {
|
||||||
|
|
||||||
private RestContext<VCloudLoginClient, VCloudLoginAsyncClient> context;
|
private RestContext<VCloudLoginClient, VCloudExpressLoginAsyncClient> context;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLogin() throws Exception {
|
public void testLogin() throws Exception {
|
||||||
VCloudLoginAsyncClient authentication = context.getAsyncApi();
|
VCloudExpressLoginAsyncClient authentication = context.getAsyncApi();
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
VCloudSession response = authentication.login().get(45, TimeUnit.SECONDS);
|
VCloudSession response = authentication.login().get(45, TimeUnit.SECONDS);
|
||||||
assertNotNull(response);
|
assertNotNull(response);
|
||||||
|
@ -80,8 +81,8 @@ public class VCloudLoginLiveTest {
|
||||||
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity");
|
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity");
|
||||||
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential");
|
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential");
|
||||||
|
|
||||||
ContextSpec<VCloudLoginClient, VCloudLoginAsyncClient> contextSpec = contextSpec("test", endpoint, "1", identity,
|
ContextSpec<VCloudLoginClient, VCloudExpressLoginAsyncClient> contextSpec = contextSpec("test", endpoint, "1", identity,
|
||||||
credential, VCloudLoginClient.class, VCloudLoginAsyncClient.class);
|
credential, VCloudLoginClient.class, VCloudExpressLoginAsyncClient.class);
|
||||||
|
|
||||||
context = createContextBuilder(
|
context = createContextBuilder(
|
||||||
contextSpec,
|
contextSpec,
|
||||||
|
|
|
@ -31,12 +31,13 @@ import org.jclouds.rest.RestClientTest;
|
||||||
import org.jclouds.rest.RestContextFactory.ContextSpec;
|
import org.jclouds.rest.RestContextFactory.ContextSpec;
|
||||||
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
||||||
import org.jclouds.vcloud.VCloudVersionsLiveTest.VCloudVersionsClient;
|
import org.jclouds.vcloud.VCloudVersionsLiveTest.VCloudVersionsClient;
|
||||||
import org.jclouds.vcloud.internal.VCloudVersionsAsyncClient;
|
|
||||||
import org.jclouds.vcloud.xml.SupportedVersionsHandler;
|
import org.jclouds.vcloud.xml.SupportedVersionsHandler;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
|
|
||||||
|
import domain.VCloudVersionsAsyncClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code VCloudVersions}
|
* Tests behavior of {@code VCloudVersions}
|
||||||
*
|
*
|
||||||
|
|
|
@ -34,13 +34,14 @@ import org.jclouds.concurrent.config.ExecutorServiceModule;
|
||||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||||
import org.jclouds.rest.RestContext;
|
import org.jclouds.rest.RestContext;
|
||||||
import org.jclouds.rest.RestContextFactory.ContextSpec;
|
import org.jclouds.rest.RestContextFactory.ContextSpec;
|
||||||
import org.jclouds.vcloud.internal.VCloudVersionsAsyncClient;
|
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
|
|
||||||
|
import domain.VCloudVersionsAsyncClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code VCloudVersions}
|
* Tests behavior of {@code VCloudVersions}
|
||||||
*
|
*
|
||||||
|
|
|
@ -29,8 +29,8 @@ import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.http.functions.BaseHandlerTest;
|
import org.jclouds.http.functions.BaseHandlerTest;
|
||||||
import org.jclouds.io.Payloads;
|
import org.jclouds.io.Payloads;
|
||||||
import org.jclouds.vcloud.VCloudExpressMediaType;
|
import org.jclouds.vcloud.VCloudExpressMediaType;
|
||||||
|
import org.jclouds.vcloud.domain.VCloudSession;
|
||||||
import org.jclouds.vcloud.domain.internal.NamedResourceImpl;
|
import org.jclouds.vcloud.domain.internal.NamedResourceImpl;
|
||||||
import org.jclouds.vcloud.internal.VCloudLoginAsyncClient.VCloudSession;
|
|
||||||
import org.testng.annotations.BeforeTest;
|
import org.testng.annotations.BeforeTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
|
|
@ -41,11 +41,10 @@ import org.jclouds.rest.internal.RestAnnotationProcessor;
|
||||||
import org.jclouds.vcloud.VCloudExpressClient;
|
import org.jclouds.vcloud.VCloudExpressClient;
|
||||||
import org.jclouds.vcloud.domain.NamedResource;
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
import org.jclouds.vcloud.domain.Organization;
|
import org.jclouds.vcloud.domain.Organization;
|
||||||
|
import org.jclouds.vcloud.domain.VCloudSession;
|
||||||
import org.jclouds.vcloud.endpoints.Org;
|
import org.jclouds.vcloud.endpoints.Org;
|
||||||
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
||||||
import org.jclouds.vcloud.hostingdotcom.config.HostingDotComVCloudRestClientModule;
|
import org.jclouds.vcloud.hostingdotcom.config.HostingDotComVCloudRestClientModule;
|
||||||
import org.jclouds.vcloud.internal.VCloudVersionsAsyncClient;
|
|
||||||
import org.jclouds.vcloud.internal.VCloudLoginAsyncClient.VCloudSession;
|
|
||||||
import org.jclouds.vcloud.xml.CatalogHandler;
|
import org.jclouds.vcloud.xml.CatalogHandler;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -53,6 +52,8 @@ import com.google.common.base.Supplier;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
|
|
||||||
|
import domain.VCloudVersionsAsyncClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code HostingDotComVCloudAsyncClient}
|
* Tests behavior of {@code HostingDotComVCloudAsyncClient}
|
||||||
*
|
*
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.jclouds.util.Utils;
|
||||||
import org.jclouds.vcloud.VCloudExpressAsyncClient;
|
import org.jclouds.vcloud.VCloudExpressAsyncClient;
|
||||||
import org.jclouds.vcloud.VCloudExpressClient;
|
import org.jclouds.vcloud.VCloudExpressClient;
|
||||||
import org.jclouds.vcloud.domain.NamedResource;
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
import org.jclouds.vcloud.internal.VCloudLoginAsyncClient.VCloudSession;
|
import org.jclouds.vcloud.domain.VCloudSession;
|
||||||
import org.jclouds.vcloud.terremark.TerremarkVCloudAsyncClient;
|
import org.jclouds.vcloud.terremark.TerremarkVCloudAsyncClient;
|
||||||
import org.jclouds.vcloud.terremark.TerremarkVCloudClient;
|
import org.jclouds.vcloud.terremark.TerremarkVCloudClient;
|
||||||
import org.jclouds.vcloud.terremark.TerremarkVCloudExpressAsyncClient;
|
import org.jclouds.vcloud.terremark.TerremarkVCloudExpressAsyncClient;
|
||||||
|
|
|
@ -49,10 +49,9 @@ import org.jclouds.vcloud.VCloudExpressAsyncClientTest.VCloudRestClientModuleExt
|
||||||
import org.jclouds.vcloud.VCloudExpressAsyncClientTest.VCloudRestClientModuleExtension.TestOrganizationCatalogSupplier;
|
import org.jclouds.vcloud.VCloudExpressAsyncClientTest.VCloudRestClientModuleExtension.TestOrganizationCatalogSupplier;
|
||||||
import org.jclouds.vcloud.domain.NamedResource;
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
import org.jclouds.vcloud.domain.Organization;
|
import org.jclouds.vcloud.domain.Organization;
|
||||||
|
import org.jclouds.vcloud.domain.VCloudSession;
|
||||||
import org.jclouds.vcloud.endpoints.Org;
|
import org.jclouds.vcloud.endpoints.Org;
|
||||||
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
||||||
import org.jclouds.vcloud.internal.VCloudVersionsAsyncClient;
|
|
||||||
import org.jclouds.vcloud.internal.VCloudLoginAsyncClient.VCloudSession;
|
|
||||||
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||||
import org.jclouds.vcloud.terremark.TerremarkVCloudExpressAsyncClientTest.TerremarkVCloudRestClientModuleExtension.TestOrgNameToKeysListSupplier;
|
import org.jclouds.vcloud.terremark.TerremarkVCloudExpressAsyncClientTest.TerremarkVCloudRestClientModuleExtension.TestOrgNameToKeysListSupplier;
|
||||||
import org.jclouds.vcloud.terremark.TerremarkVCloudExpressAsyncClientTest.TerremarkVCloudRestClientModuleExtension.TestTerremarkOrganizationMapSupplier;
|
import org.jclouds.vcloud.terremark.TerremarkVCloudExpressAsyncClientTest.TerremarkVCloudRestClientModuleExtension.TestTerremarkOrganizationMapSupplier;
|
||||||
|
@ -77,6 +76,8 @@ import com.google.common.base.Supplier;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
|
|
||||||
|
import domain.VCloudVersionsAsyncClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code TerremarkECloudAsyncClient}
|
* Tests behavior of {@code TerremarkECloudAsyncClient}
|
||||||
*
|
*
|
||||||
|
|
|
@ -54,11 +54,10 @@ import org.jclouds.vcloud.VCloudExpressAsyncClientTest.VCloudRestClientModuleExt
|
||||||
import org.jclouds.vcloud.domain.Catalog;
|
import org.jclouds.vcloud.domain.Catalog;
|
||||||
import org.jclouds.vcloud.domain.NamedResource;
|
import org.jclouds.vcloud.domain.NamedResource;
|
||||||
import org.jclouds.vcloud.domain.Organization;
|
import org.jclouds.vcloud.domain.Organization;
|
||||||
|
import org.jclouds.vcloud.domain.VCloudSession;
|
||||||
import org.jclouds.vcloud.domain.internal.NamedResourceImpl;
|
import org.jclouds.vcloud.domain.internal.NamedResourceImpl;
|
||||||
import org.jclouds.vcloud.endpoints.Org;
|
import org.jclouds.vcloud.endpoints.Org;
|
||||||
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
import org.jclouds.vcloud.filters.SetVCloudTokenCookie;
|
||||||
import org.jclouds.vcloud.internal.VCloudVersionsAsyncClient;
|
|
||||||
import org.jclouds.vcloud.internal.VCloudLoginAsyncClient.VCloudSession;
|
|
||||||
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
|
||||||
import org.jclouds.vcloud.terremark.config.TerremarkVCloudExpressRestClientModule;
|
import org.jclouds.vcloud.terremark.config.TerremarkVCloudExpressRestClientModule;
|
||||||
import org.jclouds.vcloud.terremark.domain.Protocol;
|
import org.jclouds.vcloud.terremark.domain.Protocol;
|
||||||
|
@ -88,6 +87,8 @@ import com.google.common.collect.Maps;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
|
|
||||||
|
import domain.VCloudVersionsAsyncClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code TerremarkVCloudExpressAsyncClient}
|
* Tests behavior of {@code TerremarkVCloudExpressAsyncClient}
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue