terremark related changes for Issue 826

This commit is contained in:
Adrian Cole 2012-02-02 07:34:42 -08:00
parent 9bcbb87604
commit 65336339e5
10 changed files with 235 additions and 159 deletions

View File

@ -18,27 +18,15 @@
*/
package org.jclouds.trmk.vcloud_0_8.compute.config;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Iterables.find;
import java.util.Set;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.collect.Memoized;
import org.jclouds.compute.config.BindComputeSuppliersByClass;
import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.Image;
import org.jclouds.domain.Location;
import org.jclouds.domain.LocationScope;
import org.jclouds.trmk.vcloud_0_8.compute.suppliers.OrgAndVDCToLocationSupplier;
import org.jclouds.trmk.vcloud_0_8.compute.suppliers.StaticHardwareSupplier;
import org.jclouds.trmk.vcloud_0_8.compute.suppliers.VAppTemplatesInOrgs;
import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
import org.jclouds.trmk.vcloud_0_8.endpoints.VDC;
import com.google.common.base.Predicate;
import com.google.common.base.Supplier;
/**
@ -50,54 +38,6 @@ public class TerremarkBindComputeSuppliersByClass extends BindComputeSuppliersBy
return StaticHardwareSupplier.class;
}
@Override
protected Class<? extends Supplier<Set<? extends Location>>> defineLocationSupplier() {
return OrgAndVDCToLocationSupplier.class;
}
@Override
protected Class<? extends Supplier<Location>> defineDefaultLocationSupplier() {
return DefaultVDC.class;
}
@Singleton
public static class DefaultVDC implements Supplier<Location> {
@Singleton
public static final class IsDefaultVDC implements Predicate<Location> {
private final ReferenceType defaultVDC;
@Inject
IsDefaultVDC(@VDC ReferenceType defaultVDC) {
this.defaultVDC = checkNotNull(defaultVDC, "defaultVDC");
}
@Override
public boolean apply(Location input) {
return input.getScope() == LocationScope.ZONE && input.getId().equals(defaultVDC.getHref().toASCIIString());
}
@Override
public String toString() {
return "isDefaultVDC()";
}
}
private final Supplier<Set<? extends Location>> locationsSupplier;
private final IsDefaultVDC isDefaultVDC;
@Inject
DefaultVDC(@Memoized Supplier<Set<? extends Location>> locationsSupplier, IsDefaultVDC isDefaultVDC) {
this.locationsSupplier = checkNotNull(locationsSupplier, "locationsSupplierSupplier");
this.isDefaultVDC = checkNotNull(isDefaultVDC, "isDefaultVDC");
}
@Override
public Location get() {
return find(locationsSupplier.get(), isDefaultVDC);
}
}
@Override
protected Class<? extends Supplier<Set<? extends Image>>> defineImageSupplier() {
return VAppTemplatesInOrgs.class;

View File

@ -20,7 +20,6 @@ package org.jclouds.trmk.vcloud_0_8.config;
import static com.google.common.base.Preconditions.checkNotNull;
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.getLast;
import static com.google.common.collect.Iterables.transform;
@ -28,16 +27,14 @@ import static com.google.common.collect.Maps.transformValues;
import static com.google.common.collect.Maps.uniqueIndex;
import static org.jclouds.Constants.PROPERTY_API_VERSION;
import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient;
import static org.jclouds.trmk.vcloud_0_8.reference.VCloudConstants.PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED;
import java.io.IOException;
import java.net.URI;
import java.util.Map;
import java.util.Map.Entry;
import java.util.SortedMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.Map.Entry;
import java.util.concurrent.atomic.AtomicReference;
import javax.inject.Inject;
@ -49,8 +46,9 @@ import org.jclouds.http.HttpErrorHandler;
import org.jclouds.http.annotation.ClientError;
import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError;
import org.jclouds.location.suppliers.ImplicitLocationSupplier;
import org.jclouds.location.suppliers.LocationsSupplier;
import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.rest.AsyncClientFactory;
import org.jclouds.rest.AuthorizationException;
import org.jclouds.rest.config.RestClientModule;
import org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier;
@ -67,6 +65,7 @@ import org.jclouds.trmk.vcloud_0_8.domain.VDC;
import org.jclouds.trmk.vcloud_0_8.endpoints.Keys;
import org.jclouds.trmk.vcloud_0_8.endpoints.Org;
import org.jclouds.trmk.vcloud_0_8.endpoints.OrgList;
import org.jclouds.trmk.vcloud_0_8.endpoints.VCloudLogin;
import org.jclouds.trmk.vcloud_0_8.functions.AllCatalogItemsInCatalog;
import org.jclouds.trmk.vcloud_0_8.functions.AllCatalogItemsInOrg;
import org.jclouds.trmk.vcloud_0_8.functions.AllCatalogsInOrg;
@ -76,7 +75,11 @@ import org.jclouds.trmk.vcloud_0_8.functions.OrgsForNames;
import org.jclouds.trmk.vcloud_0_8.functions.VAppTemplatesForCatalogItems;
import org.jclouds.trmk.vcloud_0_8.handlers.ParseTerremarkVCloudErrorFromHttpResponse;
import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudLoginAsyncClient;
import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudLoginClient;
import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudVersionsAsyncClient;
import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudVersionsClient;
import org.jclouds.trmk.vcloud_0_8.location.DefaultVDC;
import org.jclouds.trmk.vcloud_0_8.location.OrgAndVDCToLocationSupplier;
import org.jclouds.trmk.vcloud_0_8.predicates.TaskSuccess;
import org.jclouds.util.Strings2;
@ -85,10 +88,11 @@ import com.google.common.base.Predicate;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMap.Builder;
import com.google.common.collect.Maps;
import com.google.common.collect.ImmutableMap.Builder;
import com.google.inject.Injector;
import com.google.inject.Provides;
import com.google.inject.Scopes;
import com.google.inject.TypeLiteral;
public class TerremarkVCloudRestClientModule<S extends TerremarkVCloudClient, A extends TerremarkVCloudAsyncClient>
@ -109,9 +113,6 @@ public class TerremarkVCloudRestClientModule<S extends TerremarkVCloudClient, A
bind(new TypeLiteral<Function<Iterable<? extends CatalogItem>, Iterable<? extends VAppTemplate>>>() {
}).to(new TypeLiteral<VAppTemplatesForCatalogItems>() {
});
// Ensures we don't retry on authorization failures
bind(new TypeLiteral<AtomicReference<AuthorizationException>>() {
}).toInstance(new AtomicReference<AuthorizationException>());
installDefaultVCloudEndpointsModule();
bind(new TypeLiteral<Function<ReferenceType, Location>>() {
}).to(new TypeLiteral<FindLocationForResource>() {
@ -135,6 +136,8 @@ public class TerremarkVCloudRestClientModule<S extends TerremarkVCloudClient, A
bind(new TypeLiteral<Function<org.jclouds.trmk.vcloud_0_8.domain.Org, Iterable<? extends CatalogItem>>>() {
}).to(new TypeLiteral<AllCatalogItemsInOrg>() {
});
bindClientAndAsyncClient(binder(), TerremarkVCloudVersionsClient.class, TerremarkVCloudVersionsAsyncClient.class);
bindClientAndAsyncClient(binder(), TerremarkVCloudLoginClient.class, TerremarkVCloudLoginAsyncClient.class);
}
@Provides
@ -171,9 +174,20 @@ public class TerremarkVCloudRestClientModule<S extends TerremarkVCloudClient, A
@Provides
@Singleton
@OrgList
URI provideOrgListURI(Supplier<VCloudSession> sessionSupplier) {
VCloudSession session = sessionSupplier.get();
return URI.create(getLast(session.getOrgs().values()).getHref().toASCIIString().replaceAll("org/.*", "org"));
protected Supplier<URI> provideOrgListURI(Supplier<VCloudSession> sessionSupplier) {
return Suppliers.compose(new Function<VCloudSession, URI>() {
@Override
public URI apply(VCloudSession arg0) {
return URI.create(getLast(arg0.getOrgs().values()).getHref().toASCIIString().replaceAll("org/.*", "org"));
}
@Override
public String toString() {
return "orgListURI()";
}
}, sessionSupplier);
}
@Singleton
@ -296,17 +310,29 @@ public class TerremarkVCloudRestClientModule<S extends TerremarkVCloudClient, A
};
@Provides
@Singleton
@org.jclouds.trmk.vcloud_0_8.endpoints.VCloudLogin
protected URI provideAuthenticationURI(TerremarkVCloudVersionsAsyncClient versionService,
@Named(PROPERTY_API_VERSION) String version) throws InterruptedException, ExecutionException, TimeoutException {
SortedMap<String, URI> versions = versionService.getSupportedVersions().get(180, TimeUnit.SECONDS);
@VCloudLogin
protected Supplier<URI> provideAuthenticationURI(final TerremarkVCloudVersionsClient versionService,
@Named(PROPERTY_API_VERSION) final String version) {
return new Supplier<URI>() {
@Override
public URI get() {
SortedMap<String, URI> versions = versionService.getSupportedVersions();
checkState(versions.size() > 0, "No versions present");
checkState(versions.containsKey(version), "version " + version + " not present in: " + versions);
return versions.get(version);
}
public String toString() {
return "login()";
}
};
}
@Singleton
private static class OrgNameToOrgSupplier implements Supplier<Map<String, ReferenceType>> {
private final Supplier<VCloudSession> sessionSupplier;
@ -324,12 +350,6 @@ public class TerremarkVCloudRestClientModule<S extends TerremarkVCloudClient, A
}
@Provides
@Singleton
protected TerremarkVCloudVersionsAsyncClient provideVCloudVersions(AsyncClientFactory factory) {
return factory.create(TerremarkVCloudVersionsAsyncClient.class);
}
@Provides
@Singleton
protected org.jclouds.trmk.vcloud_0_8.domain.Org provideOrg(
@ -451,28 +471,17 @@ public class TerremarkVCloudRestClientModule<S extends TerremarkVCloudClient, A
return sessionSupplier.get().getOrgs();
}
@Provides
@Singleton
protected TerremarkVCloudLoginAsyncClient provideVCloudLogin(AsyncClientFactory factory) {
return factory.create(TerremarkVCloudLoginAsyncClient.class);
}
@Provides
@Singleton
protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
AtomicReference<AuthorizationException> authException, final TerremarkVCloudLoginAsyncClient login) {
AtomicReference<AuthorizationException> authException, final TerremarkVCloudLoginClient login) {
return new MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier<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;
}
return login.login();
}
});
@ -539,4 +548,11 @@ public class TerremarkVCloudRestClientModule<S extends TerremarkVCloudClient, A
String provideCreateKey() throws IOException {
return Strings2.toStringAndClose(getClass().getResourceAsStream("/CreateKey.xml"));
}
@Override
protected void installLocations() {
super.installLocations();
bind(ImplicitLocationSupplier.class).to(DefaultVDC.class).in(Scopes.SINGLETON);
bind(LocationsSupplier.class).to(OrgAndVDCToLocationSupplier.class).in(Scopes.SINGLETON);
}
}

View File

@ -0,0 +1,30 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.trmk.vcloud_0_8.internal;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
import org.jclouds.trmk.vcloud_0_8.domain.VCloudSession;
@Timeout(duration = 10, timeUnit = TimeUnit.SECONDS)
public interface TerremarkVCloudLoginClient {
VCloudSession login();
}

View File

@ -0,0 +1,31 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.trmk.vcloud_0_8.internal;
import java.net.URI;
import java.util.SortedMap;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
@Timeout(duration = 10, timeUnit = TimeUnit.SECONDS)
public interface TerremarkVCloudVersionsClient {
SortedMap<String, URI> getSupportedVersions();
}

View File

@ -0,0 +1,75 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.trmk.vcloud_0_8.location;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Iterables.find;
import java.util.Set;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.collect.Memoized;
import org.jclouds.domain.Location;
import org.jclouds.domain.LocationScope;
import org.jclouds.location.suppliers.ImplicitLocationSupplier;
import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
import org.jclouds.trmk.vcloud_0_8.endpoints.VDC;
import com.google.common.base.Predicate;
import com.google.common.base.Supplier;
@Singleton
public class DefaultVDC implements ImplicitLocationSupplier {
@Singleton
public static final class IsDefaultVDC implements Predicate<Location> {
private final ReferenceType defaultVDC;
@Inject
IsDefaultVDC(@VDC ReferenceType defaultVDC) {
this.defaultVDC = checkNotNull(defaultVDC, "defaultVDC");
}
@Override
public boolean apply(Location input) {
return input.getScope() == LocationScope.ZONE && input.getId().equals(defaultVDC.getHref().toASCIIString());
}
@Override
public String toString() {
return "isDefaultVDC()";
}
}
private final Supplier<Set<? extends Location>> locationsSupplier;
private final DefaultVDC.IsDefaultVDC isDefaultVDC;
@Inject
DefaultVDC(@Memoized Supplier<Set<? extends Location>> locationsSupplier, DefaultVDC.IsDefaultVDC isDefaultVDC) {
this.locationsSupplier = checkNotNull(locationsSupplier, "locationsSupplierSupplier");
this.isDefaultVDC = checkNotNull(isDefaultVDC, "isDefaultVDC");
}
@Override
public Location get() {
return find(locationsSupplier.get(), isDefaultVDC);
}
}

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.trmk.vcloud_0_8.compute.suppliers;
package org.jclouds.trmk.vcloud_0_8.location;
import static com.google.common.base.Preconditions.checkNotNull;
@ -32,7 +32,8 @@ import org.jclouds.domain.LocationBuilder;
import org.jclouds.domain.LocationScope;
import org.jclouds.location.Iso3166;
import org.jclouds.location.Provider;
import org.jclouds.location.suppliers.JustProvider;
import org.jclouds.location.suppliers.LocationsSupplier;
import org.jclouds.location.suppliers.all.JustProvider;
import org.jclouds.trmk.vcloud_0_8.domain.Org;
import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
@ -45,20 +46,21 @@ import com.google.common.collect.ImmutableSet.Builder;
* @author Adrian Cole
*/
@Singleton
public class OrgAndVDCToLocationSupplier extends JustProvider {
public class OrgAndVDCToLocationSupplier extends JustProvider implements LocationsSupplier {
private final Supplier<Map<String, ReferenceType>> orgNameToResource;
private final Supplier<Map<String, ? extends Org>> orgNameToVDCResource;
private final Map<String, Set<String>> isoCodesById;
private final Supplier<Map<String, Supplier<Set<String>>>> isoCodesByIdSupplier;
@Inject
OrgAndVDCToLocationSupplier(@Iso3166 Set<String> isoCodes, @Provider String providerName, @Provider URI endpoint,
@org.jclouds.trmk.vcloud_0_8.endpoints.Org Supplier<Map<String, ReferenceType>> orgNameToResource,
Supplier<Map<String, ? extends Org>> orgNameToVDCResource, @Iso3166 Map<String, Set<String>> isoCodesById) {
Supplier<Map<String, ? extends Org>> orgNameToVDCResource,
@Iso3166 Supplier<Map<String, Supplier<Set<String>>>> isoCodesByIdSupplier) {
super(providerName, endpoint, isoCodes);
this.orgNameToResource = checkNotNull(orgNameToResource, "orgNameToResource");
this.orgNameToVDCResource = checkNotNull(orgNameToVDCResource, "orgNameToVDCResource");
this.isoCodesById = checkNotNull(isoCodesById, "isoCodesById");
this.isoCodesByIdSupplier = checkNotNull(isoCodesByIdSupplier, "isoCodesByIdSupplier");
}
@Override
@ -71,18 +73,18 @@ public class OrgAndVDCToLocationSupplier extends JustProvider {
Location provider = Iterables.getOnlyElement(super.get());
if (orgNameToResource.get().size() == 0)
return locations.add(provider);
else
Map<String, Supplier<Set<String>>> isoCodesById = isoCodesByIdSupplier.get();
for (ReferenceType org : orgNameToResource.get().values()) {
LocationBuilder builder = new LocationBuilder().scope(LocationScope.REGION).id(
org.getHref().toASCIIString()).description((org.getName())).parent(provider);
LocationBuilder builder = new LocationBuilder().scope(LocationScope.REGION).id(org.getHref().toASCIIString())
.description((org.getName())).parent(provider);
if (isoCodesById.containsKey(org.getHref().toASCIIString()))
builder.iso3166Codes(isoCodesById.get(org.getHref().toASCIIString()));
builder.iso3166Codes(isoCodesById.get(org.getHref().toASCIIString()).get());
Location orgL = builder.build();
for (ReferenceType vdc : orgNameToVDCResource.get().get(org.getName()).getVDCs().values()) {
builder = new LocationBuilder().scope(LocationScope.ZONE).id(vdc.getHref().toASCIIString()).description(
(vdc.getName())).parent(orgL);
if (isoCodesById.containsKey(vdc.getHref().toASCIIString()))
builder.iso3166Codes(isoCodesById.get(vdc.getHref().toASCIIString()));
builder.iso3166Codes(isoCodesById.get(vdc.getHref().toASCIIString()).get());
locations.add(builder.build());
}
}

View File

@ -24,23 +24,21 @@ import static org.testng.Assert.assertEquals;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.URI;
import java.util.concurrent.TimeUnit;
import javax.ws.rs.core.HttpHeaders;
import org.jclouds.concurrent.Timeout;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.location.Provider;
import org.jclouds.rest.RestClientTest;
import org.jclouds.rest.RestContextSpec;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.jclouds.trmk.vcloud_0_8.domain.VCloudSession;
import org.jclouds.trmk.vcloud_0_8.endpoints.VCloudLogin;
import org.jclouds.trmk.vcloud_0_8.functions.ParseLoginResponseFromHeaders;
import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudLoginAsyncClient;
import org.testng.annotations.Test;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.google.inject.Binder;
import com.google.inject.Module;
import com.google.inject.Provides;
@ -93,22 +91,17 @@ public class TerremarkVCloudLoginAsyncClientTest extends RestClientTest<Terremar
@SuppressWarnings("unused")
@Provides
@VCloudLogin
URI provideURI(@Provider URI uri) {
return uri;
Supplier<URI> provideURI(@Provider URI uri) {
return Suppliers.ofInstance(uri);
}
};
}
@Timeout(duration = 10, timeUnit = TimeUnit.SECONDS)
public interface VCloudLoginClient {
VCloudSession login();
}
@Override
public RestContextSpec<VCloudLoginClient, TerremarkVCloudLoginAsyncClient> createContextSpec() {
public RestContextSpec<TerremarkVCloudLoginClient, TerremarkVCloudLoginAsyncClient> createContextSpec() {
return contextSpec("test", "http://localhost:8080/login", "1", "", "", "identity", "credential",
VCloudLoginClient.class, TerremarkVCloudLoginAsyncClient.class);
TerremarkVCloudLoginClient.class, TerremarkVCloudLoginAsyncClient.class);
}
}

View File

@ -23,17 +23,12 @@ import static org.testng.Assert.assertEquals;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.URI;
import java.util.SortedMap;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseSax;
import org.jclouds.rest.RestClientTest;
import org.jclouds.rest.RestContextSpec;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudVersionsAsyncClient;
import org.jclouds.trmk.vcloud_0_8.xml.SupportedVersionsHandler;
import org.testng.annotations.Test;
@ -74,16 +69,10 @@ public class TerremarkVCloudVersionsAsyncClientTest extends RestClientTest<Terre
};
}
@Timeout(duration = 10, timeUnit = TimeUnit.SECONDS)
public interface VCloudVersionsClient {
SortedMap<String, URI> getSupportedVersions();
}
@Override
public RestContextSpec<VCloudVersionsClient, TerremarkVCloudVersionsAsyncClient> createContextSpec() {
public RestContextSpec<TerremarkVCloudVersionsClient, TerremarkVCloudVersionsAsyncClient> createContextSpec() {
return contextSpec("test", "http://localhost:8080", "1", "", "", "identity", "credential",
VCloudVersionsClient.class, TerremarkVCloudVersionsAsyncClient.class);
TerremarkVCloudVersionsClient.class, TerremarkVCloudVersionsAsyncClient.class);
}
}

View File

@ -48,8 +48,8 @@ import org.jclouds.trmk.vcloud_0_8.domain.internal.CatalogItemImpl;
import org.jclouds.trmk.vcloud_0_8.domain.internal.ReferenceTypeImpl;
import org.jclouds.trmk.vcloud_0_8.domain.internal.VDCImpl;
import org.jclouds.trmk.vcloud_0_8.filters.SetVCloudTokenCookie;
import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudLoginAsyncClient;
import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudVersionsAsyncClient;
import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudLoginClient;
import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudVersionsClient;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
@ -133,8 +133,8 @@ public abstract class BaseTerremarkECloudAsyncClientTest<T> extends RestClientTe
protected static class TerremarkECloudRestClientModuleExtension extends TerremarkECloudRestClientModule {
@Override
protected URI provideAuthenticationURI(TerremarkVCloudVersionsAsyncClient versionService, String version) {
return URI.create("https://vcloud.safesecureweb.com/api/v0.8/login");
protected Supplier<URI> provideAuthenticationURI(TerremarkVCloudVersionsClient versionService, String version) {
return Suppliers.ofInstance(URI.create("https://vcloud.safesecureweb.com/api/v0.8/login"));
}
@Override
@ -166,7 +166,7 @@ public abstract class BaseTerremarkECloudAsyncClientTest<T> extends RestClientTe
@Override
protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
AtomicReference<AuthorizationException> authException, TerremarkVCloudLoginAsyncClient login) {
AtomicReference<AuthorizationException> authException, TerremarkVCloudLoginClient login) {
return Suppliers.<VCloudSession> ofInstance(new VCloudSession() {
@Override

View File

@ -64,8 +64,8 @@ import org.jclouds.trmk.vcloud_0_8.domain.internal.ReferenceTypeImpl;
import org.jclouds.trmk.vcloud_0_8.domain.internal.VDCImpl;
import org.jclouds.trmk.vcloud_0_8.filters.SetVCloudTokenCookie;
import org.jclouds.trmk.vcloud_0_8.functions.ParseTaskFromLocationHeader;
import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudLoginAsyncClient;
import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudVersionsAsyncClient;
import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudLoginClient;
import org.jclouds.trmk.vcloud_0_8.internal.TerremarkVCloudVersionsClient;
import org.jclouds.trmk.vcloud_0_8.options.AddInternetServiceOptions;
import org.jclouds.trmk.vcloud_0_8.options.AddNodeOptions;
import org.jclouds.trmk.vcloud_0_8.options.InstantiateVAppTemplateOptions;
@ -675,8 +675,8 @@ public class TerremarkVCloudExpressAsyncClientTest extends RestClientTest<Terrem
protected static class TerremarkVCloudRestClientModuleExtension extends TerremarkVCloudExpressRestClientModule {
@Override
protected URI provideAuthenticationURI(TerremarkVCloudVersionsAsyncClient versionService, String version) {
return URI.create("https://vcloud.safesecureweb.com/api/v0.8/login");
protected Supplier<URI> provideAuthenticationURI(TerremarkVCloudVersionsClient versionService, String version) {
return Suppliers.ofInstance(URI.create("https://vcloud.safesecureweb.com/api/v0.8/login"));
}
@Override
@ -708,7 +708,7 @@ public class TerremarkVCloudExpressAsyncClientTest extends RestClientTest<Terrem
@Override
protected Supplier<VCloudSession> provideVCloudTokenCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
AtomicReference<AuthorizationException> authException, TerremarkVCloudLoginAsyncClient login) {
AtomicReference<AuthorizationException> authException, TerremarkVCloudLoginClient login) {
return Suppliers.<VCloudSession> ofInstance(new VCloudSession() {
@Override