diff --git a/antcontrib/src/main/java/org/jclouds/tools/ant/taskdefs/compute/ComputeTaskUtils.java b/antcontrib/src/main/java/org/jclouds/tools/ant/taskdefs/compute/ComputeTaskUtils.java
index 9e67de8d7f..0c4b3c2a3b 100644
--- a/antcontrib/src/main/java/org/jclouds/tools/ant/taskdefs/compute/ComputeTaskUtils.java
+++ b/antcontrib/src/main/java/org/jclouds/tools/ant/taskdefs/compute/ComputeTaskUtils.java
@@ -18,8 +18,6 @@
*/
package org.jclouds.tools.ant.taskdefs.compute;
-import static org.jclouds.rest.RestContextFactory.getPropertiesFromResource;
-
import java.io.IOException;
import java.net.URI;
import java.util.NoSuchElementException;
@@ -73,13 +71,13 @@ public class ComputeTaskUtils {
@SuppressWarnings("unchecked")
@Override
public ComputeServiceContext load(URI from) {
- Properties props = getPropertiesFromResource("/rest.properties");
+ Properties props = new Properties();
props.putAll(projectProvider.get().getProperties());
// adding the properties to the factory will allow us to pass
// alternate endpoints
String provider = from.getHost();
Credentials creds = Credentials.parse(from);
- return new ComputeServiceContextFactory(props).createContext(provider, creds.identity, creds.credential,
+ return new ComputeServiceContextFactory().createContext(provider, creds.identity, creds.credential,
ImmutableSet.of((Module) new AntLoggingModule(projectProvider.get(),
ComputeServiceConstants.COMPUTE_LOGGER), new JschSshClientModule()), props);
diff --git a/apis/atmos/pom.xml b/apis/atmos/pom.xml
index a754e53222..9ec2016cff 100644
--- a/apis/atmos/pom.xml
+++ b/apis/atmos/pom.xml
@@ -34,8 +34,7 @@
bundle
- org.jclouds.atmos.blobstore.integration.AtmosStorageTestInitializer
- https://accesspoint.atmos.com
+ https://accesspoint.atmosonline.com
1.3.0
FIXME
diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/AtmosApiMetadata.java b/apis/atmos/src/main/java/org/jclouds/atmos/AtmosApiMetadata.java
index 20fe7cd5e3..c4f6f01201 100644
--- a/apis/atmos/src/main/java/org/jclouds/atmos/AtmosApiMetadata.java
+++ b/apis/atmos/src/main/java/org/jclouds/atmos/AtmosApiMetadata.java
@@ -18,50 +18,86 @@
*/
package org.jclouds.atmos;
+import static org.jclouds.blobstore.reference.BlobStoreConstants.PROPERTY_USER_METADATA_PREFIX;
+import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS;
+
import java.net.URI;
+import java.util.Properties;
import org.jclouds.apis.ApiMetadata;
-import org.jclouds.apis.ApiType;
-import org.jclouds.apis.BaseApiMetadata;
+import org.jclouds.atmos.blobstore.config.AtmosBlobStoreContextModule;
+import org.jclouds.atmos.config.AtmosRestClientModule;
+import org.jclouds.blobstore.BlobStoreContext;
+import org.jclouds.rest.RestContext;
+import org.jclouds.rest.internal.BaseRestApiMetadata;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.reflect.TypeToken;
+import com.google.inject.Module;
/**
- * Implementation of {@link ApiMetadata} for EMC's Atmos API.
+ * Implementation of {@link ApiMetadata} for Rackspace Cloud Files API
*
* @author Adrian Cole
*/
-public class AtmosApiMetadata extends BaseApiMetadata {
+public class AtmosApiMetadata extends BaseRestApiMetadata {
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 8067252472547486854L;
- public AtmosApiMetadata() {
- this(builder()
- .id("atmos")
- .type(ApiType.BLOBSTORE)
- .name("EMC's Atmos API")
- .identityName("Subtenant ID (UID)")
- .credentialName("Shared Secret")
- .documentation(URI.create("https://community.emc.com/docs/DOC-10508")));
+ public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() {
+ private static final long serialVersionUID = -5070937833892503232L;
+ };
+
+
+ private static Builder builder() {
+ return new Builder();
}
- // below are so that we can reuse builders, toString, hashCode, etc.
- // we have to set concrete classes here, as our base class cannot be
- // concrete due to serviceLoader
- protected AtmosApiMetadata(Builder> builder) {
+ @Override
+ public Builder toBuilder() {
+ return builder().fromApiMetadata(this);
+ }
+
+ public AtmosApiMetadata() {
+ this(builder());
+ }
+
+ protected AtmosApiMetadata(Builder builder) {
super(builder);
}
- private static class ConcreteBuilder extends Builder {
+ public static Properties defaultProperties() {
+ Properties properties = BaseRestApiMetadata.defaultProperties();
+ properties.setProperty(PROPERTY_REGIONS, "DEFAULT");
+ properties.setProperty(PROPERTY_USER_METADATA_PREFIX, "X-Object-Meta-");
+ return properties;
+ }
+
+ public static class Builder extends BaseRestApiMetadata.Builder {
+ protected Builder() {
+ super(AtmosClient.class, AtmosAsyncClient.class);
+ id("atmos")
+ .name("EMC's Atmos API")
+ .identityName("Subtenant ID (UID)")
+ .credentialName("Shared Secret")
+ .documentation(URI.create("https://community.emc.com/docs/DOC-10508"))
+ .version("1.4.0")
+ .defaultEndpoint("https://accesspoint.atmosonline.com")
+ .defaultProperties(AtmosApiMetadata.defaultProperties())
+ .wrapper(TypeToken.of(BlobStoreContext.class))
+ .defaultModules(ImmutableSet.>of(AtmosRestClientModule.class, AtmosBlobStoreContextModule.class));
+ }
@Override
public AtmosApiMetadata build() {
return new AtmosApiMetadata(this);
}
- }
- public static ConcreteBuilder builder() {
- return new ConcreteBuilder();
- }
-
- @Override
- public ConcreteBuilder toBuilder() {
- return builder().fromApiMetadata(this);
+ @Override
+ public Builder fromApiMetadata(ApiMetadata in) {
+ super.fromApiMetadata(in);
+ return this;
+ }
}
}
\ No newline at end of file
diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/AtmosContextBuilder.java b/apis/atmos/src/main/java/org/jclouds/atmos/AtmosContextBuilder.java
deleted file mode 100644
index 19c7a16d7a..0000000000
--- a/apis/atmos/src/main/java/org/jclouds/atmos/AtmosContextBuilder.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * 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.atmos;
-
-import java.util.List;
-import java.util.Properties;
-
-import org.jclouds.atmos.blobstore.config.AtmosBlobStoreContextModule;
-import org.jclouds.atmos.config.AtmosRestClientModule;
-import org.jclouds.blobstore.BlobStoreContextBuilder;
-import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
-import org.jclouds.logging.jdk.config.JDKLoggingModule;
-
-import com.google.inject.Injector;
-import com.google.inject.Module;
-
-/**
- * Creates {@link AtmosBlobStoreContext} or {@link Injector} instances based on the most commonly
- * requested arguments.
- *
- * Note that Threadsafe objects will be bound as singletons to the Injector or Context provided.
- *
- *
- * If no Module
s are specified, the default {@link JDKLoggingModule logging} and
- * {@link JavaUrlHttpCommandExecutorServiceModule http transports} will be installed.
- *
- * @author Adrian Cole, Andrew Newdigate
- * @see AtmosBlobStoreContext
- */
-public class AtmosContextBuilder extends
- BlobStoreContextBuilder {
-
- public AtmosContextBuilder(Properties props) {
- super(AtmosClient.class, AtmosAsyncClient.class, props);
- }
-
- @Override
- protected void addContextModule(List modules) {
- modules.add(new AtmosBlobStoreContextModule());
- }
-
- @Override
- protected void addClientModule(List modules) {
- modules.add(new AtmosRestClientModule());
- }
-}
diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/binders/BindUserMetadataToHeaders.java b/apis/atmos/src/main/java/org/jclouds/atmos/binders/BindUserMetadataToHeaders.java
index ea0a08b1d9..982ef6b5d6 100644
--- a/apis/atmos/src/main/java/org/jclouds/atmos/binders/BindUserMetadataToHeaders.java
+++ b/apis/atmos/src/main/java/org/jclouds/atmos/binders/BindUserMetadataToHeaders.java
@@ -33,8 +33,8 @@ import org.jclouds.rest.Binder;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMap.Builder;
import com.google.common.collect.Multimaps;
+import com.google.common.collect.ImmutableMap.Builder;
/**
* @author Adrian Cole
@@ -52,7 +52,7 @@ public class BindUserMetadataToHeaders implements Binder, Function apply(UserMetadata md) {
- Builder headers = ImmutableMap. builder();
+ Builder headers = ImmutableMap.builder();
if (md.getMetadata().size() > 0) {
String header = Joiner.on(',').withKeyValueSeparator("=").join(md.getMetadata());
headers.put("x-emc-meta", header);
diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreContextModule.java b/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreContextModule.java
index d9e84e51e7..5ca4c57d49 100644
--- a/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreContextModule.java
+++ b/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreContextModule.java
@@ -22,7 +22,6 @@ import java.util.concurrent.TimeUnit;
import javax.inject.Singleton;
-import org.jclouds.atmos.AtmosAsyncClient;
import org.jclouds.atmos.AtmosClient;
import org.jclouds.atmos.blobstore.AtmosAsyncBlobStore;
import org.jclouds.atmos.blobstore.AtmosBlobRequestSigner;
@@ -31,10 +30,8 @@ import org.jclouds.atmos.blobstore.strategy.FindMD5InUserMetadata;
import org.jclouds.blobstore.AsyncBlobStore;
import org.jclouds.blobstore.BlobRequestSigner;
import org.jclouds.blobstore.BlobStore;
-import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.attr.ConsistencyModel;
import org.jclouds.blobstore.config.BlobStoreMapModule;
-import org.jclouds.blobstore.internal.BlobStoreContextImpl;
import org.jclouds.blobstore.strategy.ContainsValueInListStrategy;
import com.google.common.cache.CacheBuilder;
@@ -43,7 +40,6 @@ import com.google.common.cache.LoadingCache;
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.Scopes;
-import com.google.inject.TypeLiteral;
/**
* Configures the {@link AtmosBlobStoreContext}; requires {@link AtmosAsyncBlobStore} bound.
@@ -58,8 +54,6 @@ public class AtmosBlobStoreContextModule extends AbstractModule {
bind(ConsistencyModel.class).toInstance(ConsistencyModel.EVENTUAL);
bind(AsyncBlobStore.class).to(AtmosAsyncBlobStore.class).in(Scopes.SINGLETON);
bind(BlobStore.class).to(AtmosBlobStore.class).in(Scopes.SINGLETON);
- bind(BlobStoreContext.class).to(new TypeLiteral>() {
- }).in(Scopes.SINGLETON);
bind(ContainsValueInListStrategy.class).to(FindMD5InUserMetadata.class);
bind(BlobRequestSigner.class).to(AtmosBlobRequestSigner.class);
}
diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/functions/ObjectToBlobMetadata.java b/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/functions/ObjectToBlobMetadata.java
index 5f1f772933..6338fff02b 100644
--- a/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/functions/ObjectToBlobMetadata.java
+++ b/apis/atmos/src/main/java/org/jclouds/atmos/blobstore/functions/ObjectToBlobMetadata.java
@@ -19,8 +19,8 @@
package org.jclouds.atmos.blobstore.functions;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.Set;
+import java.util.Map.Entry;
import javax.inject.Inject;
import javax.inject.Singleton;
diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/config/AtmosRestClientModule.java b/apis/atmos/src/main/java/org/jclouds/atmos/config/AtmosRestClientModule.java
index b36f1c8d03..b9d52d486c 100644
--- a/apis/atmos/src/main/java/org/jclouds/atmos/config/AtmosRestClientModule.java
+++ b/apis/atmos/src/main/java/org/jclouds/atmos/config/AtmosRestClientModule.java
@@ -32,7 +32,6 @@ import org.jclouds.date.DateService;
import org.jclouds.date.TimeStamp;
import org.jclouds.http.HttpErrorHandler;
import org.jclouds.http.HttpRetryHandler;
-import org.jclouds.http.RequiresHttp;
import org.jclouds.http.annotation.ClientError;
import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError;
@@ -50,7 +49,6 @@ import com.google.inject.Provides;
* @author Adrian Cole
*/
@ConfiguresRestClient
-@RequiresHttp
public class AtmosRestClientModule extends RestClientModule {
public AtmosRestClientModule() {
super(AtmosClient.class, AtmosAsyncClient.class);
diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/filters/SignRequest.java b/apis/atmos/src/main/java/org/jclouds/atmos/filters/SignRequest.java
index 568a1e50fd..94be6d2c57 100644
--- a/apis/atmos/src/main/java/org/jclouds/atmos/filters/SignRequest.java
+++ b/apis/atmos/src/main/java/org/jclouds/atmos/filters/SignRequest.java
@@ -51,8 +51,8 @@ import org.jclouds.util.Strings2;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMap.Builder;
import com.google.common.collect.Multimaps;
+import com.google.common.collect.ImmutableMap.Builder;
/**
* Signs the EMC Atmos Online Storage request.
diff --git a/apis/atmos/src/main/java/org/jclouds/atmos/functions/ParseUserMetadataFromHeaders.java b/apis/atmos/src/main/java/org/jclouds/atmos/functions/ParseUserMetadataFromHeaders.java
index 7fb167c16b..c726f2e8b3 100644
--- a/apis/atmos/src/main/java/org/jclouds/atmos/functions/ParseUserMetadataFromHeaders.java
+++ b/apis/atmos/src/main/java/org/jclouds/atmos/functions/ParseUserMetadataFromHeaders.java
@@ -33,9 +33,9 @@ import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMap.Builder;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
+import com.google.common.collect.ImmutableMap.Builder;
/**
* @author Adrian Cole
@@ -74,7 +74,7 @@ public class ParseUserMetadataFromHeaders implements Function getMetaMap(String meta) {
- Builder metaMap = ImmutableMap. builder();
+ Builder metaMap = ImmutableMap.builder();
for (String entry : Splitter.on(", ").split(meta)) {
String[] entrySplit = entry.split("=");
metaMap.put(entrySplit[0], entrySplit[1]);
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/AtmosApiMetadataTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/AtmosApiMetadataTest.java
index 9f5f407922..c9fedebe65 100644
--- a/apis/atmos/src/test/java/org/jclouds/atmos/AtmosApiMetadataTest.java
+++ b/apis/atmos/src/test/java/org/jclouds/atmos/AtmosApiMetadataTest.java
@@ -18,8 +18,7 @@
*/
package org.jclouds.atmos;
-import org.jclouds.apis.ApiType;
-import org.jclouds.apis.BaseApiMetadataTest;
+import org.jclouds.blobstore.internal.BaseBlobStoreApiMetadataTest;
import org.testng.annotations.Test;
/**
@@ -27,9 +26,9 @@ import org.testng.annotations.Test;
* @author Adrian Cole
*/
@Test(groups = "unit", testName = "AtmosApiMetadataTest")
-public class AtmosApiMetadataTest extends BaseApiMetadataTest {
+public class AtmosApiMetadataTest extends BaseBlobStoreApiMetadataTest {
public AtmosApiMetadataTest() {
- super(new AtmosApiMetadata(), ApiType.BLOBSTORE);
+ super(new AtmosApiMetadata());
}
}
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/AtmosAsyncClientTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/AtmosAsyncClientTest.java
index 7f41fe9b34..878e0e7e8f 100644
--- a/apis/atmos/src/test/java/org/jclouds/atmos/AtmosAsyncClientTest.java
+++ b/apis/atmos/src/test/java/org/jclouds/atmos/AtmosAsyncClientTest.java
@@ -22,10 +22,10 @@ import static org.testng.Assert.assertEquals;
import java.io.IOException;
import java.lang.reflect.Method;
-import java.util.Properties;
import javax.ws.rs.core.HttpHeaders;
+import org.jclouds.apis.ApiMetadata;
import org.jclouds.atmos.blobstore.functions.BlobToObject;
import org.jclouds.atmos.config.AtmosRestClientModule;
import org.jclouds.atmos.domain.AtmosObject;
@@ -42,17 +42,14 @@ import org.jclouds.blobstore.functions.ThrowContainerNotFoundOn404;
import org.jclouds.blobstore.functions.ThrowKeyNotFoundOn404;
import org.jclouds.date.TimeStamp;
import org.jclouds.http.HttpRequest;
-import org.jclouds.http.RequiresHttp;
import org.jclouds.http.functions.ParseURIFromListOrLocationHeaderIf20x;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.http.options.GetOptions;
import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.RestClientTest;
-import org.jclouds.rest.RestContextFactory;
-import org.jclouds.rest.RestContextSpec;
import org.jclouds.rest.functions.ReturnFalseOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
+import org.jclouds.rest.internal.BaseAsyncClientTest;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -68,7 +65,7 @@ import com.google.inject.TypeLiteral;
*/
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
@Test(groups = "unit", testName = "AtmosAsyncClientTest")
-public class AtmosAsyncClientTest extends RestClientTest {
+public class AtmosAsyncClientTest extends BaseAsyncClientTest {
private BlobToObject blobToObject;
@@ -322,8 +319,7 @@ public class AtmosAsyncClientTest extends RestClientTest {
return new TestAtmosRestClientModule();
}
- @RequiresHttp
- @ConfiguresRestClient
+ @ConfiguresRestClient
private static final class TestAtmosRestClientModule extends AtmosRestClientModule {
@Override
protected void configure() {
@@ -339,10 +335,8 @@ public class AtmosAsyncClientTest extends RestClientTest {
protected String provider = "atmos";
@Override
- public RestContextSpec, ?> createContextSpec() {
- Properties props = new Properties();
- props.setProperty(provider + ".endpoint", "https://accesspoint.atmosonline.com");
- return new RestContextFactory().createContextSpec(provider, "identity", "credential", props);
+ public ApiMetadata createApiMetadata() {
+ return new AtmosApiMetadata();
}
}
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/AtmosClientLiveTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/AtmosClientLiveTest.java
index 6d02a88be8..fc9adafdb9 100644
--- a/apis/atmos/src/test/java/org/jclouds/atmos/AtmosClientLiveTest.java
+++ b/apis/atmos/src/test/java/org/jclouds/atmos/AtmosClientLiveTest.java
@@ -57,7 +57,7 @@ import com.google.common.collect.Sets;
public class AtmosClientLiveTest extends BaseBlobStoreIntegrationTest {
public AtmosClient getApi() {
- return (AtmosClient) context.getProviderSpecificContext().getApi();
+ return context.unwrap(AtmosApiMetadata.CONTEXT_TOKEN).getApi();
}
private static final class HeadMatches implements Runnable {
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSignerTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSignerTest.java
index 44c1a03591..79555eae05 100644
--- a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSignerTest.java
+++ b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/AtmosBlobRequestSignerTest.java
@@ -21,8 +21,9 @@ package org.jclouds.atmos.blobstore;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
-import java.util.Properties;
+import org.jclouds.apis.ApiMetadata;
+import org.jclouds.atmos.AtmosApiMetadata;
import org.jclouds.atmos.AtmosAsyncClient;
import org.jclouds.atmos.config.AtmosRestClientModule;
import org.jclouds.atmos.filters.SignRequest;
@@ -31,11 +32,8 @@ import org.jclouds.blobstore.domain.Blob;
import org.jclouds.blobstore.domain.Blob.Factory;
import org.jclouds.date.TimeStamp;
import org.jclouds.http.HttpRequest;
-import org.jclouds.http.RequiresHttp;
import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.RestClientTest;
-import org.jclouds.rest.RestContextFactory;
-import org.jclouds.rest.RestContextSpec;
+import org.jclouds.rest.internal.BaseAsyncClientTest;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -51,7 +49,7 @@ import com.google.inject.TypeLiteral;
*/
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
@Test(groups = "unit", testName = "AtmosBlobRequestSignerTest")
-public class AtmosBlobRequestSignerTest extends RestClientTest {
+public class AtmosBlobRequestSignerTest extends BaseAsyncClientTest {
private BlobRequestSigner signer;
private Factory blobFactory;
@@ -129,8 +127,7 @@ public class AtmosBlobRequestSignerTest extends RestClientTest
return new TestAtmosRestClientModule();
}
- @RequiresHttp
- @ConfiguresRestClient
+ @ConfiguresRestClient
private static final class TestAtmosRestClientModule extends AtmosRestClientModule {
@Override
protected void configure() {
@@ -144,8 +141,8 @@ public class AtmosBlobRequestSignerTest extends RestClientTest
}
@Override
- public RestContextSpec, ?> createContextSpec() {
- return new RestContextFactory().createContextSpec("atmos", "identity", "credential", new Properties());
+ public ApiMetadata createApiMetadata() {
+ return new AtmosApiMetadata();
}
}
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreModuleTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreModuleTest.java
index 7c87d6eeb9..6b40259d08 100644
--- a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreModuleTest.java
+++ b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/config/AtmosBlobStoreModuleTest.java
@@ -20,13 +20,14 @@ package org.jclouds.atmos.blobstore.config;
import static org.testng.Assert.assertEquals;
+import org.jclouds.ContextBuilder;
+import org.jclouds.atmos.AtmosApiMetadata;
import org.jclouds.atmos.blobstore.strategy.FindMD5InUserMetadata;
import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.internal.BlobStoreContextImpl;
import org.jclouds.blobstore.strategy.ContainsValueInListStrategy;
import org.jclouds.logging.config.NullLoggingModule;
-import org.jclouds.rest.BaseRestClientTest.MockModule;
-import org.jclouds.rest.RestContextFactory;
+import org.jclouds.rest.internal.BaseRestClientTest.MockModule;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
@@ -40,8 +41,12 @@ import com.google.inject.Module;
public class AtmosBlobStoreModuleTest {
Injector createInjector() {
- return new RestContextFactory().createContextBuilder("atmos", "uid", "key",
- ImmutableSet. of(new MockModule(), new NullLoggingModule())).buildInjector();
+ return ContextBuilder
+ .newBuilder(new AtmosApiMetadata())
+ .credentials("uid", "key")
+ .modules(
+ ImmutableSet. of(new MockModule(),new NullLoggingModule()))
+ .buildInjector();
}
@Test
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosBlobSignerLiveTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosBlobSignerLiveTest.java
index df8da0418c..8521358067 100644
--- a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosBlobSignerLiveTest.java
+++ b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosBlobSignerLiveTest.java
@@ -27,5 +27,7 @@ import org.testng.annotations.Test;
*/
@Test(groups = { "live" })
public class AtmosBlobSignerLiveTest extends BaseBlobSignerLiveTest {
-
+ public AtmosBlobSignerLiveTest() {
+ provider = "atmos";
+ }
}
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosContainerIntegrationLiveTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosContainerIntegrationLiveTest.java
index a2f31c766b..a134e0fab6 100644
--- a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosContainerIntegrationLiveTest.java
+++ b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosContainerIntegrationLiveTest.java
@@ -31,7 +31,9 @@ import org.testng.annotations.Test;
*/
@Test(groups = "live")
public class AtmosContainerIntegrationLiveTest extends BaseContainerIntegrationTest {
-
+ public AtmosContainerIntegrationLiveTest() {
+ provider = "atmos";
+ }
@Override
public void testListContainerMaxResults() throws InterruptedException {
// Not currently working
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosContainerLiveTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosContainerLiveTest.java
index 57a690d067..90c28d9b7a 100644
--- a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosContainerLiveTest.java
+++ b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosContainerLiveTest.java
@@ -26,5 +26,7 @@ import org.testng.annotations.Test;
*/
@Test(groups = { "live" })
public class AtmosContainerLiveTest extends BaseContainerLiveTest {
-
+ public AtmosContainerLiveTest() {
+ provider = "atmos";
+ }
}
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosInputStreamMapIntegrationLiveTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosInputStreamMapIntegrationLiveTest.java
index 5e8cfd49ea..ec4fcf4e57 100644
--- a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosInputStreamMapIntegrationLiveTest.java
+++ b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosInputStreamMapIntegrationLiveTest.java
@@ -29,7 +29,10 @@ import org.testng.annotations.Test;
*/
@Test(groups = "live")
public class AtmosInputStreamMapIntegrationLiveTest extends BaseInputStreamMapIntegrationTest {
-
+ public AtmosInputStreamMapIntegrationLiveTest() {
+ provider = "atmos";
+ }
+
@Override
@Test(enabled = false)
public void testContainsBytesValue() throws InterruptedException, ExecutionException,
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosIntegrationLiveTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosIntegrationLiveTest.java
index aad3085662..56246296de 100644
--- a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosIntegrationLiveTest.java
+++ b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosIntegrationLiveTest.java
@@ -35,7 +35,9 @@ import org.testng.annotations.Test;
*/
@Test(groups = { "integration", "live" })
public class AtmosIntegrationLiveTest extends BaseBlobIntegrationTest {
-
+ public AtmosIntegrationLiveTest() {
+ provider = "atmos";
+ }
@DataProvider(name = "delete")
// no unicode support
@Override
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosLiveTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosLiveTest.java
index 06cf5c12c6..4c17e48f31 100644
--- a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosLiveTest.java
+++ b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosLiveTest.java
@@ -29,6 +29,9 @@ import org.testng.annotations.Test;
*/
@Test(groups = { "live" })
public class AtmosLiveTest extends BaseBlobLiveTest {
+ public AtmosLiveTest() {
+ provider = "atmos";
+ }
protected void checkMD5(String container, String name, byte[] md5) {
// atmos does not support content-md5 yet
assertEquals(context.getBlobStore().blobMetadata(container, name).getContentMetadata().getContentMD5(), null);
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosMapIntegrationLiveTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosMapIntegrationLiveTest.java
index ada6ffb7b3..86d9dc5680 100644
--- a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosMapIntegrationLiveTest.java
+++ b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosMapIntegrationLiveTest.java
@@ -30,7 +30,9 @@ import org.testng.annotations.Test;
*/
@Test(groups = "live")
public class AtmosMapIntegrationLiveTest extends BaseBlobMapIntegrationTest {
-
+ public AtmosMapIntegrationLiveTest() {
+ provider = "atmos";
+ }
@Override
// NO support for Content-MD5, so contains cannot work
public void testContains() throws InterruptedException, ExecutionException, TimeoutException, IOException {
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosServiceIntegrationLiveTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosServiceIntegrationLiveTest.java
index 47e58e83cc..a36d98e76e 100644
--- a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosServiceIntegrationLiveTest.java
+++ b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosServiceIntegrationLiveTest.java
@@ -26,5 +26,7 @@ import org.testng.annotations.Test;
*/
@Test(groups = "live")
public class AtmosServiceIntegrationLiveTest extends BaseServiceIntegrationTest {
-
+ public AtmosServiceIntegrationLiveTest() {
+ provider = "atmos";
+ }
}
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosTestInitializer.java b/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosTestInitializer.java
deleted file mode 100644
index 1cc02f150e..0000000000
--- a/apis/atmos/src/test/java/org/jclouds/atmos/blobstore/integration/AtmosTestInitializer.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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.atmos.blobstore.integration;
-
-import java.io.IOException;
-
-import org.jclouds.blobstore.BlobStoreContext;
-import org.jclouds.blobstore.BlobStoreContextFactory;
-import org.jclouds.blobstore.integration.TransientBlobStoreTestInitializer;
-import org.jclouds.logging.log4j.config.Log4JLoggingModule;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-
-/**
- *
- * @author Adrian Cole
- */
-public class AtmosTestInitializer extends TransientBlobStoreTestInitializer {
- public AtmosTestInitializer() {
- provider = "synaptic";
- }
-
- @Override
- protected BlobStoreContext createLiveContext(Module configurationModule, String endpoint, String apiVersion,
- String buildVersion, String app, String identity, String credential) throws IOException {
- return new BlobStoreContextFactory().createContext(provider, ImmutableSet.of(configurationModule,
- new Log4JLoggingModule()), setupProperties(endpoint, apiVersion, buildVersion, identity, credential));
- }
-
-}
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/filters/SignRequestTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/filters/SignRequestTest.java
index 8e4caeb019..903cba2de1 100644
--- a/apis/atmos/src/test/java/org/jclouds/atmos/filters/SignRequestTest.java
+++ b/apis/atmos/src/test/java/org/jclouds/atmos/filters/SignRequestTest.java
@@ -24,29 +24,27 @@ import java.io.IOException;
import java.net.URI;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
-import java.util.Properties;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
+import org.jclouds.ContextBuilder;
import org.jclouds.atmos.config.AtmosRestClientModule;
import org.jclouds.atmos.reference.AtmosHeaders;
import org.jclouds.date.TimeStamp;
import org.jclouds.http.HttpRequest;
-import org.jclouds.http.RequiresHttp;
import org.jclouds.logging.config.NullLoggingModule;
-import org.jclouds.rest.BaseRestClientTest.MockModule;
import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.RestContextFactory;
+import org.jclouds.rest.internal.BaseRestClientTest.MockModule;
import org.jclouds.util.Strings2;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableMultimap;
-import com.google.common.collect.ImmutableMultimap.Builder;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;
+import com.google.common.collect.ImmutableMultimap.Builder;
import com.google.inject.Injector;
import com.google.inject.Module;
@@ -98,20 +96,18 @@ public class SignRequestTest {
@BeforeClass
protected void createFilter() {
- Injector injector = new RestContextFactory()
- .createContextBuilder(
- "atmos",
- UID,
- KEY,
- ImmutableSet. of(new MockModule(), new TestAtmosRestClientModule(),
- new NullLoggingModule()), new Properties()).buildInjector();
+ Injector injector = ContextBuilder
+ .newBuilder("atmos")
+ .credentials(UID, KEY)
+ .modules(
+ ImmutableSet. of(new MockModule(), new TestAtmosRestClientModule(), new NullLoggingModule()))
+ .buildInjector();
filter = injector.getInstance(SignRequest.class);
}
- @RequiresHttp
- @ConfiguresRestClient
+ @ConfiguresRestClient
private static final class TestAtmosRestClientModule extends AtmosRestClientModule {
@Override
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/functions/AtmosObjectNameTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/functions/AtmosObjectNameTest.java
index b1690107fe..1f9a5a56e1 100644
--- a/apis/atmos/src/test/java/org/jclouds/atmos/functions/AtmosObjectNameTest.java
+++ b/apis/atmos/src/test/java/org/jclouds/atmos/functions/AtmosObjectNameTest.java
@@ -23,9 +23,9 @@ import static org.testng.Assert.assertEquals;
import java.io.File;
import org.jclouds.atmos.domain.AtmosObject;
-import org.jclouds.atmos.domain.AtmosObject.Factory;
import org.jclouds.atmos.domain.SystemMetadata;
import org.jclouds.atmos.domain.UserMetadata;
+import org.jclouds.atmos.domain.AtmosObject.Factory;
import org.testng.annotations.Test;
import com.google.inject.Guice;
diff --git a/apis/atmos/src/test/java/org/jclouds/atmos/functions/ParseDirectoryListFromContentAndHeadersTest.java b/apis/atmos/src/test/java/org/jclouds/atmos/functions/ParseDirectoryListFromContentAndHeadersTest.java
index 4bd7874a72..01d03cea75 100644
--- a/apis/atmos/src/test/java/org/jclouds/atmos/functions/ParseDirectoryListFromContentAndHeadersTest.java
+++ b/apis/atmos/src/test/java/org/jclouds/atmos/functions/ParseDirectoryListFromContentAndHeadersTest.java
@@ -69,7 +69,7 @@ public class ParseDirectoryListFromContentAndHeadersTest extends BaseHandlerTest
}
protected Set values() {
- Builder expected = ImmutableSet.builder();
+ Builder expected = ImmutableSet.builder();
expected.add(new DirectoryEntry("4980cdb2a411106a04a4538c92a1b204ad92077de6e3", FileType.DIRECTORY,
"adriancole-blobstore-2096685753"));
expected.add(new DirectoryEntry("4980cdb2a410105404980d99e53a0504ad93939e7dc3", FileType.DIRECTORY,
diff --git a/apis/byon/src/main/java/org/jclouds/byon/BYONApiMetadata.java b/apis/byon/src/main/java/org/jclouds/byon/BYONApiMetadata.java
index b818a6ef33..1aa7293702 100644
--- a/apis/byon/src/main/java/org/jclouds/byon/BYONApiMetadata.java
+++ b/apis/byon/src/main/java/org/jclouds/byon/BYONApiMetadata.java
@@ -20,48 +20,71 @@ package org.jclouds.byon;
import java.net.URI;
+import org.jclouds.JcloudsVersion;
import org.jclouds.apis.ApiMetadata;
-import org.jclouds.apis.ApiType;
-import org.jclouds.apis.BaseApiMetadata;
+import org.jclouds.apis.internal.BaseApiMetadata;
+import org.jclouds.byon.config.BYONComputeServiceContextModule;
+import org.jclouds.byon.config.YamlNodeStoreModule;
+import org.jclouds.compute.ComputeServiceContext;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Module;
/**
* Implementation of {@link ApiMetadata} for jclouds BYON API
*
+ * note
+ *
+ * This class is not setup to allow a subclasses to override the type of api,
+ * asyncapi, or context. This is an optimization for s.
+ *
* @author Adrian Cole
*/
public class BYONApiMetadata extends BaseApiMetadata {
- public BYONApiMetadata() {
- this(builder()
- .id("byon")
- .type(ApiType.COMPUTE)
- .name("Bring Your Own Node (BYON) API")
- .identityName("Unused")
- .documentation(URI.create("https://github.com/jclouds/jclouds/tree/master/apis/byon")));
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -4059125995177393819L;
+
+ @Override
+ public Builder toBuilder() {
+ return new Builder().fromApiMetadata(this);
}
- // below are so that we can reuse builders, toString, hashCode, etc.
- // we have to set concrete classes here, as our base class cannot be
- // concrete due to serviceLoader
- protected BYONApiMetadata(Builder> builder) {
+ public BYONApiMetadata() {
+ this(new Builder());
+ }
+
+ protected BYONApiMetadata(Builder builder) {
super(builder);
}
- private static class ConcreteBuilder extends Builder {
+ public static class Builder extends BaseApiMetadata.Builder {
+
+ protected Builder() {
+ id("byon")
+ .name("Bring Your Own Node (BYON) API")
+ .identityName("Unused")
+ .defaultIdentity("foo")
+ .defaultCredential("bar")
+ .defaultEndpoint("file://byon.yaml")
+ .documentation(URI.create("https://github.com/jclouds/jclouds/tree/master/apis/byon"))
+ .version(String.format("%s.%s", JcloudsVersion.get().majorVersion, JcloudsVersion.get().minorVersion))
+ .buildVersion(JcloudsVersion.get().toString())
+ .wrapper(ComputeServiceContext.class)
+ .defaultModules(ImmutableSet.>of(YamlNodeStoreModule.class, BYONComputeServiceContextModule.class));
+ }
@Override
public BYONApiMetadata build() {
return new BYONApiMetadata(this);
}
- }
- public static ConcreteBuilder builder() {
- return new ConcreteBuilder();
- }
+ @Override
+ public Builder fromApiMetadata(ApiMetadata in) {
+ super.fromApiMetadata(in);
+ return this;
+ }
- @Override
- public ConcreteBuilder toBuilder() {
- return builder().fromApiMetadata(this);
}
}
\ No newline at end of file
diff --git a/apis/byon/src/main/java/org/jclouds/byon/BYONComputeServiceContextBuilder.java b/apis/byon/src/main/java/org/jclouds/byon/BYONComputeServiceContextBuilder.java
deleted file mode 100644
index 15bdb626a9..0000000000
--- a/apis/byon/src/main/java/org/jclouds/byon/BYONComputeServiceContextBuilder.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * 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.byon;
-
-import java.util.List;
-import java.util.Properties;
-
-import org.jclouds.byon.config.BYONComputeServiceContextModule;
-import org.jclouds.byon.config.ConfiguresNodeStore;
-import org.jclouds.byon.config.YamlNodeStoreModule;
-import org.jclouds.compute.StandaloneComputeServiceContextBuilder;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.collect.Iterables;
-import com.google.inject.Module;
-
-/**
- *
- * @author Adrian Cole
- */
-@SuppressWarnings("rawtypes")
-public class BYONComputeServiceContextBuilder extends StandaloneComputeServiceContextBuilder {
-
- public BYONComputeServiceContextBuilder(Properties props) {
- super(Supplier.class, props);
- }
-
- @Override
- protected void addContextModule(List modules) {
- modules.add(new BYONComputeServiceContextModule());
- addNodeStoreModuleIfNotPresent(modules);
- }
-
- protected void addNodeStoreModuleIfNotPresent(List modules) {
- if (!Iterables.any(modules, new Predicate() {
- public boolean apply(Module input) {
- return input.getClass().isAnnotationPresent(ConfiguresNodeStore.class);
- }
-
- })) {
- addNodeStoreModule(modules);
- }
- }
-
- protected void addNodeStoreModule(List modules) {
- modules.add(new YamlNodeStoreModule());
- }
-}
diff --git a/apis/byon/src/main/java/org/jclouds/byon/BYONPropertiesBuilder.java b/apis/byon/src/main/java/org/jclouds/byon/BYONPropertiesBuilder.java
deleted file mode 100644
index 5965595704..0000000000
--- a/apis/byon/src/main/java/org/jclouds/byon/BYONPropertiesBuilder.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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.byon;
-
-import static org.jclouds.Constants.PROPERTY_API_VERSION;
-import static org.jclouds.Constants.PROPERTY_CREDENTIAL;
-import static org.jclouds.Constants.PROPERTY_IDENTITY;
-
-import java.util.Properties;
-
-import org.jclouds.PropertiesBuilder;
-
-/**
- * Builds properties used in byon Clients
- *
- * @author Adrian Cole
- */
-public class BYONPropertiesBuilder extends PropertiesBuilder {
- @Override
- protected Properties defaultProperties() {
- Properties properties = super.defaultProperties();
- properties.setProperty(PROPERTY_API_VERSION, "1.0");
- properties.setProperty(PROPERTY_IDENTITY, "foo");
- properties.setProperty(PROPERTY_CREDENTIAL, "bar");
- return properties;
- }
-
- public BYONPropertiesBuilder(Properties properties) {
- super(properties);
- }
-
-}
diff --git a/apis/byon/src/main/java/org/jclouds/byon/config/BYONComputeServiceContextModule.java b/apis/byon/src/main/java/org/jclouds/byon/config/BYONComputeServiceContextModule.java
index f00b3db1e7..8168e645f3 100644
--- a/apis/byon/src/main/java/org/jclouds/byon/config/BYONComputeServiceContextModule.java
+++ b/apis/byon/src/main/java/org/jclouds/byon/config/BYONComputeServiceContextModule.java
@@ -21,9 +21,6 @@ package org.jclouds.byon.config;
import java.io.InputStream;
import java.net.URI;
-import javax.inject.Singleton;
-
-import org.jclouds.byon.Node;
import org.jclouds.byon.internal.BYONComputeServiceAdapter;
import org.jclouds.byon.suppliers.SupplyFromProviderURIOrNodesProperty;
import org.jclouds.compute.config.JCloudsNativeComputeServiceAdapterContextModule;
@@ -36,27 +33,17 @@ import org.jclouds.location.Provider;
import com.google.common.base.Function;
import com.google.common.base.Supplier;
-import com.google.common.cache.LoadingCache;
-import com.google.inject.Provides;
import com.google.inject.TypeLiteral;
/**
*
* @author Adrian Cole
*/
-@SuppressWarnings("unchecked")
@SingleThreaded
-public class BYONComputeServiceContextModule extends
- JCloudsNativeComputeServiceAdapterContextModule {
+public class BYONComputeServiceContextModule extends JCloudsNativeComputeServiceAdapterContextModule {
public BYONComputeServiceContextModule() {
- super(Supplier.class, Supplier.class, BYONComputeServiceAdapter.class);
- }
-
- @Provides
- @Singleton
- Supplier provideApi(Supplier> in) {
- return in;
+ super(BYONComputeServiceAdapter.class);
}
@Override
@@ -68,6 +55,7 @@ public class BYONComputeServiceContextModule extends
}).annotatedWith(Provider.class).to(SupplyFromProviderURIOrNodesProperty.class);
bind(new TypeLiteral>() {
}).to(SupplyFromProviderURIOrNodesProperty.class);
- install(new LocationsFromComputeServiceAdapterModule(){});
+ install(new LocationsFromComputeServiceAdapterModule() {
+ });
}
}
diff --git a/apis/byon/src/main/java/org/jclouds/byon/domain/YamlNode.java b/apis/byon/src/main/java/org/jclouds/byon/domain/YamlNode.java
index e9b9173d77..318fc515ac 100644
--- a/apis/byon/src/main/java/org/jclouds/byon/domain/YamlNode.java
+++ b/apis/byon/src/main/java/org/jclouds/byon/domain/YamlNode.java
@@ -33,9 +33,9 @@ import org.yaml.snakeyaml.constructor.Constructor;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMap.Builder;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
+import com.google.common.collect.ImmutableMap.Builder;
import com.google.common.io.Closeables;
/**
@@ -130,7 +130,7 @@ public class YamlNode {
public InputStream apply(YamlNode in) {
if (in == null)
return null;
- Builder prettier = ImmutableMap. builder();
+ Builder prettier = ImmutableMap.builder();
if (in.id != null)
prettier.put("id", in.id);
if (in.name != null)
diff --git a/apis/byon/src/main/java/org/jclouds/byon/internal/BYONComputeServiceAdapter.java b/apis/byon/src/main/java/org/jclouds/byon/internal/BYONComputeServiceAdapter.java
index 6ae9ecdd4a..19837550e7 100644
--- a/apis/byon/src/main/java/org/jclouds/byon/internal/BYONComputeServiceAdapter.java
+++ b/apis/byon/src/main/java/org/jclouds/byon/internal/BYONComputeServiceAdapter.java
@@ -42,8 +42,8 @@ import com.google.common.base.Predicates;
import com.google.common.base.Supplier;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.ImmutableSet.Builder;
import com.google.common.collect.Iterables;
+import com.google.common.collect.ImmutableSet.Builder;
import com.google.common.util.concurrent.UncheckedExecutionException;
/**
diff --git a/apis/byon/src/main/java/org/jclouds/byon/suppliers/SupplyFromProviderURIOrNodesProperty.java b/apis/byon/src/main/java/org/jclouds/byon/suppliers/SupplyFromProviderURIOrNodesProperty.java
index 106a7efed8..d6f2df5c0c 100644
--- a/apis/byon/src/main/java/org/jclouds/byon/suppliers/SupplyFromProviderURIOrNodesProperty.java
+++ b/apis/byon/src/main/java/org/jclouds/byon/suppliers/SupplyFromProviderURIOrNodesProperty.java
@@ -81,9 +81,8 @@ public class SupplyFromProviderURIOrNodesProperty implements Supplier of(
- new SshjSshClientModule(), new Log4JLoggingModule()), contextProperties);
+ context = ContextBuilder.newBuilder(new BYONApiMetadata()).overrides(contextProperties).modules(
+ ImmutableSet. of(new SshjSshClientModule(), new Log4JLoggingModule())).build(
+ ComputeServiceContext.class);
}
public void testCanRunCommandAsCurrentUser() throws Exception {
diff --git a/apis/byon/src/test/java/org/jclouds/byon/BYONComputeServiceTest.java b/apis/byon/src/test/java/org/jclouds/byon/BYONComputeServiceTest.java
index 2a86fb13d0..9a6b4077cd 100644
--- a/apis/byon/src/test/java/org/jclouds/byon/BYONComputeServiceTest.java
+++ b/apis/byon/src/test/java/org/jclouds/byon/BYONComputeServiceTest.java
@@ -23,13 +23,11 @@ import static org.jclouds.byon.functions.NodeToNodeMetadataTest.expectedProvider
import static org.jclouds.byon.functions.NodeToNodeMetadataTest.zoneCalled;
import static org.testng.Assert.assertEquals;
-import java.net.URI;
-import java.util.Properties;
-
+import org.jclouds.ContextBuilder;
+import org.jclouds.byon.config.BYONComputeServiceContextModule;
import org.jclouds.byon.config.CacheNodeStoreModule;
import org.jclouds.byon.functions.NodesFromYamlTest;
import org.jclouds.compute.ComputeServiceContext;
-import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.domain.Location;
import org.jclouds.domain.LoginCredentials;
@@ -40,7 +38,9 @@ import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
+import com.google.inject.Key;
import com.google.inject.Module;
+import com.google.inject.TypeLiteral;
/**
*
@@ -51,36 +51,31 @@ public class BYONComputeServiceTest {
@Test
public void testNodesParseNodeMap() throws Exception {
- assertNodesParse(
- "foo",
- ImmutableSet. of(new CacheNodeStoreModule(ImmutableMap. of(
- NodesFromYamlTest.TEST1.getId(), NodesFromYamlTest.TEST1))));
+ assertNodesParse("foo", ContextBuilder.newBuilder(
+ new BYONApiMetadata().toBuilder().defaultModule(BYONComputeServiceContextModule.class).build())
+ .endpoint("foo").modules(
+ ImmutableSet. of(new CacheNodeStoreModule(ImmutableMap. of(
+ NodesFromYamlTest.TEST1.getId(), NodesFromYamlTest.TEST1)))).build(
+ ComputeServiceContext.class));
}
@Test
public void testNodesParseWithFileUrl() throws Exception {
- assertNodesParse("file://" + getClass().getResource("/test1.yaml").getPath(), ImmutableSet. of());
+ assertNodesParse("file://" + getClass().getResource("/test1.yaml").getPath(), ContextBuilder.newBuilder(new BYONApiMetadata()).endpoint(
+ "file://" + getClass().getResource("/test1.yaml").getPath()).build(ComputeServiceContext.class));
}
@Test
public void testNodesParseWithClasspathUrl() throws Exception {
- assertNodesParse("classpath:///test1.yaml", ImmutableSet. of());
+ assertNodesParse("classpath:///test1.yaml", ContextBuilder.newBuilder(new BYONApiMetadata()).endpoint(
+ "classpath:///test1.yaml").build(ComputeServiceContext.class));
}
- private void assertNodesParse(String endpoint, Iterable modules) {
- ComputeServiceContext context = null;
+ private void assertNodesParse(String endpoint, ComputeServiceContext context) {
try {
Location providerLocation = expectedProviderLocationFromResource(endpoint);
- Properties props = new Properties();
- props.setProperty("byon.endpoint", endpoint);
- context = new ComputeServiceContextFactory().createContext("byon", "foo", "bar", modules, props);
-
- assertEquals(context.getProviderSpecificContext().getEndpoint(), URI.create(endpoint));
-
- @SuppressWarnings("unchecked")
- Supplier> supplier = (Supplier>) context.getProviderSpecificContext()
- .getApi();
+ Supplier> supplier = supplier(context);
assertEquals(supplier.get().size(), context.getComputeService().listNodes().size());
assertEquals(supplier.get().asMap(),
@@ -99,16 +94,9 @@ public class BYONComputeServiceTest {
ComputeServiceContext context = null;
try {
String endpoint = "file://" + getClass().getResource("/test_location.yaml").getPath();
- Properties props = new Properties();
- props.setProperty("byon.endpoint", endpoint);
- context = new ComputeServiceContextFactory().createContext("byon", "foo", "bar", ImmutableSet. of(),
- props);
+ context = ContextBuilder.newBuilder(new BYONApiMetadata()).endpoint(endpoint).build(ComputeServiceContext.class);
- assertEquals(context.getProviderSpecificContext().getEndpoint(), URI.create(endpoint));
-
- @SuppressWarnings("unchecked")
- Supplier> supplier = (Supplier>) context.getProviderSpecificContext()
- .getApi();
+ Supplier> supplier = supplier(context);
assertEquals(supplier.get().size(), context.getComputeService().listNodes().size());
assertEquals(supplier.get().asMap(), ImmutableMap. of(NodesFromYamlTest.TEST2.getId(),
@@ -145,4 +133,11 @@ public class BYONComputeServiceTest {
context.close();
}
}
+
+ private Supplier> supplier(ComputeServiceContext context) {
+ Supplier> supplier = context.utils().injector().getInstance(
+ Key.get(new TypeLiteral>>() {
+ }));
+ return supplier;
+ }
}
diff --git a/apis/cloudfiles/pom.xml b/apis/cloudfiles/pom.xml
index fdabf2f7fd..0b1ef22a34 100644
--- a/apis/cloudfiles/pom.xml
+++ b/apis/cloudfiles/pom.xml
@@ -34,7 +34,6 @@
bundle
- org.jclouds.cloudfiles.blobstore.integration.CloudFilesTestInitializer
https://auth.api.rackspacecloud.com
1.0
@@ -107,7 +106,6 @@
- ${test.initializer}
${jclouds.blobstore.httpstream.url}
${jclouds.blobstore.httpstream.md5}
${test.cloudfiles.endpoint}
diff --git a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesApiMetadata.java b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesApiMetadata.java
index 654c040c04..85bbdd6fd0 100644
--- a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesApiMetadata.java
+++ b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesApiMetadata.java
@@ -18,51 +18,84 @@
*/
package org.jclouds.cloudfiles;
+import static org.jclouds.blobstore.reference.BlobStoreConstants.PROPERTY_USER_METADATA_PREFIX;
+import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS;
+
import java.net.URI;
+import java.util.Properties;
import org.jclouds.apis.ApiMetadata;
-import org.jclouds.apis.ApiType;
-import org.jclouds.apis.BaseApiMetadata;
+import org.jclouds.blobstore.BlobStoreContext;
+import org.jclouds.cloudfiles.blobstore.config.CloudFilesBlobStoreContextModule;
+import org.jclouds.cloudfiles.config.CloudFilesRestClientModule;
+import org.jclouds.openstack.OpenStackAuthAsyncClient;
+import org.jclouds.rest.RestContext;
+import org.jclouds.rest.internal.BaseRestApiMetadata;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.reflect.TypeToken;
+import com.google.inject.Module;
/**
* Implementation of {@link ApiMetadata} for Rackspace Cloud Files API
*
- * @author Dan Lo Bianco
+ * @author Adrian Cole
*/
-public class CloudFilesApiMetadata extends BaseApiMetadata {
-
- public CloudFilesApiMetadata() {
- this(builder()
- .id("cloudfiles")
- .type(ApiType.BLOBSTORE)
- .name("Rackspace Cloud Files API")
- .identityName("Username")
- .credentialName("API Key")
- .documentation(URI.create("http://docs.rackspacecloud.com/files/api/v1/cfdevguide_d5/content/ch01.html")));
+public class CloudFilesApiMetadata extends BaseRestApiMetadata {
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 820062881469203616L;
+
+ public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() {
+ private static final long serialVersionUID = -5070937833892503232L;
+ };
+
+ private static Builder builder() {
+ return new Builder();
}
- // below are so that we can reuse builders, toString, hashCode, etc.
- // we have to set concrete classes here, as our base class cannot be
- // concrete due to serviceLoader
- protected CloudFilesApiMetadata(Builder> builder) {
+ @Override
+ public Builder toBuilder() {
+ return builder().fromApiMetadata(this);
+ }
+
+ public CloudFilesApiMetadata() {
+ this(builder());
+ }
+
+ protected CloudFilesApiMetadata(Builder builder) {
super(builder);
}
- private static class ConcreteBuilder extends Builder {
+ public static Properties defaultProperties() {
+ Properties properties = BaseRestApiMetadata.defaultProperties();
+ properties.setProperty(PROPERTY_REGIONS, "DEFAULT");
+ properties.setProperty(PROPERTY_USER_METADATA_PREFIX, "X-Object-Meta-");
+ return properties;
+ }
+
+ public static class Builder extends BaseRestApiMetadata.Builder {
+ protected Builder() {
+ super(CloudFilesClient.class, CloudFilesAsyncClient.class);
+ id("cloudfiles")
+ .name("Rackspace Cloud Files API")
+ .identityName("Username")
+ .credentialName("API Key")
+ .documentation(URI.create("http://docs.rackspacecloud.com/files/api/v1/cfdevguide_d5/content/ch01.html"))
+ .version(OpenStackAuthAsyncClient.VERSION)
+ .defaultProperties(CloudFilesApiMetadata.defaultProperties())
+ .wrapper(TypeToken.of(BlobStoreContext.class))
+ .defaultModules(ImmutableSet.>of(CloudFilesRestClientModule.class, CloudFilesBlobStoreContextModule.class));
+ }
@Override
public CloudFilesApiMetadata build() {
return new CloudFilesApiMetadata(this);
}
- }
- public static ConcreteBuilder builder() {
- return new ConcreteBuilder();
+ @Override
+ public Builder fromApiMetadata(ApiMetadata in) {
+ super.fromApiMetadata(in);
+ return this;
+ }
}
-
- @Override
- public ConcreteBuilder toBuilder() {
- return builder().fromApiMetadata(this);
- }
-
}
\ No newline at end of file
diff --git a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesContextBuilder.java b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesContextBuilder.java
deleted file mode 100644
index 05f95822f4..0000000000
--- a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/CloudFilesContextBuilder.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * 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.cloudfiles;
-
-import java.util.List;
-import java.util.Properties;
-
-import org.jclouds.blobstore.BlobStoreContextBuilder;
-import org.jclouds.cloudfiles.blobstore.config.CloudFilesBlobStoreContextModule;
-import org.jclouds.cloudfiles.config.CloudFilesRestClientModule;
-import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
-import org.jclouds.logging.jdk.config.JDKLoggingModule;
-
-import com.google.inject.Injector;
-import com.google.inject.Module;
-
-/**
- * Creates {@link CloudFilesBlobStoreContext} or {@link Injector} instances based on the most
- * commonly requested arguments.
- *
- * Note that Threadsafe objects will be bound as singletons to the Injector or Context provided.
- *
- *
- * If no Module
s are specified, the default {@link JDKLoggingModule logging} and
- * {@link JavaUrlHttpCommandExecutorServiceModule http transports} will be installed.
- *
- * @author Adrian Cole, Andrew Newdigate
- * @see CloudFilesBlobStoreContext
- */
-public class CloudFilesContextBuilder extends BlobStoreContextBuilder {
-
- public CloudFilesContextBuilder(Properties props) {
- super(CloudFilesClient.class, CloudFilesAsyncClient.class, props);
- }
-
- @Override
- protected void addContextModule(List modules) {
- modules.add(new CloudFilesBlobStoreContextModule());
- }
-
- @Override
- protected void addClientModule(List modules) {
- modules.add(new CloudFilesRestClientModule());
- }
-}
diff --git a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/config/CloudFilesRestClientModule.java b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/config/CloudFilesRestClientModule.java
index f665b01ad1..cdbc74dea9 100644
--- a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/config/CloudFilesRestClientModule.java
+++ b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/config/CloudFilesRestClientModule.java
@@ -28,7 +28,6 @@ import org.jclouds.cloudfiles.CDNManagement;
import org.jclouds.cloudfiles.CloudFilesAsyncClient;
import org.jclouds.cloudfiles.CloudFilesClient;
import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.RequiresHttp;
import org.jclouds.http.annotation.ClientError;
import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError;
@@ -53,7 +52,6 @@ import com.google.inject.Provides;
* @author Adrian Cole
*/
@ConfiguresRestClient
-@RequiresHttp
public class CloudFilesRestClientModule extends RestClientModule {
public CloudFilesRestClientModule() {
diff --git a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/CloudFilesApiMetadataTest.java b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/CloudFilesApiMetadataTest.java
index 2672d7e980..ba6a4d55c9 100644
--- a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/CloudFilesApiMetadataTest.java
+++ b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/CloudFilesApiMetadataTest.java
@@ -18,8 +18,7 @@
*/
package org.jclouds.cloudfiles;
-import org.jclouds.apis.ApiType;
-import org.jclouds.apis.BaseApiMetadataTest;
+import org.jclouds.blobstore.internal.BaseBlobStoreApiMetadataTest;
import org.testng.annotations.Test;
/**
@@ -27,9 +26,9 @@ import org.testng.annotations.Test;
* @author Adrian Cole
*/
@Test(groups = "unit", testName = "CloudFilesApiMetadataTest")
-public class CloudFilesApiMetadataTest extends BaseApiMetadataTest {
+public class CloudFilesApiMetadataTest extends BaseBlobStoreApiMetadataTest {
public CloudFilesApiMetadataTest() {
- super(new CloudFilesApiMetadata(), ApiType.BLOBSTORE);
+ super(new CloudFilesApiMetadata());
}
}
diff --git a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/CloudFilesClientLiveTest.java b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/CloudFilesClientLiveTest.java
index 7c5706a761..e7b382059f 100644
--- a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/CloudFilesClientLiveTest.java
+++ b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/CloudFilesClientLiveTest.java
@@ -41,9 +41,13 @@ import com.google.common.collect.Iterables;
@Test(groups = "live")
public class CloudFilesClientLiveTest extends CommonSwiftClientLiveTest {
+ public CloudFilesClientLiveTest(){
+ provider = "cloudfiles";
+ }
+
@Override
public CloudFilesClient getApi() {
- return (CloudFilesClient) context.getProviderSpecificContext().getApi();
+ return context.unwrap(CloudFilesApiMetadata.CONTEXT_TOKEN).getApi();
}
@Override
diff --git a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesBlobIntegrationLiveTest.java b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesBlobIntegrationLiveTest.java
index 5dc7f166eb..ce04b4f47e 100644
--- a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesBlobIntegrationLiveTest.java
+++ b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesBlobIntegrationLiveTest.java
@@ -28,6 +28,10 @@ import org.testng.annotations.Test;
*/
@Test(groups = "live")
public class CloudFilesBlobIntegrationLiveTest extends SwiftBlobIntegrationLiveTest {
+ public CloudFilesBlobIntegrationLiveTest(){
+ provider = "cloudfiles";
+ }
+
@Override
protected void checkContentDisposition(Blob blob, String contentDisposition) {
assert blob.getPayload().getContentMetadata().getContentDisposition().startsWith(contentDisposition) : blob
diff --git a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesBlobLiveTest.java b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesBlobLiveTest.java
index cb66f7c794..edae3c1abf 100644
--- a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesBlobLiveTest.java
+++ b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesBlobLiveTest.java
@@ -27,5 +27,7 @@ import org.testng.annotations.Test;
*/
@Test(groups = { "live" })
public class CloudFilesBlobLiveTest extends SwiftBlobLiveTest {
-
+ public CloudFilesBlobLiveTest(){
+ provider = "cloudfiles";
+ }
}
diff --git a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesBlobMapIntegrationLiveTest.java b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesBlobMapIntegrationLiveTest.java
index ff7a240fee..e091cc1642 100644
--- a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesBlobMapIntegrationLiveTest.java
+++ b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesBlobMapIntegrationLiveTest.java
@@ -26,5 +26,7 @@ import org.testng.annotations.Test;
*/
@Test(groups = "live")
public class CloudFilesBlobMapIntegrationLiveTest extends SwiftBlobMapIntegrationLiveTest {
-
+ public CloudFilesBlobMapIntegrationLiveTest(){
+ provider = "cloudfiles";
+ }
}
diff --git a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesBlobSignerLiveTest.java b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesBlobSignerLiveTest.java
index 1437aa506e..7add9a211d 100644
--- a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesBlobSignerLiveTest.java
+++ b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesBlobSignerLiveTest.java
@@ -27,5 +27,7 @@ import org.testng.annotations.Test;
*/
@Test(groups = { "live" })
public class CloudFilesBlobSignerLiveTest extends SwiftBlobSignerLiveTest {
-
+ public CloudFilesBlobSignerLiveTest(){
+ provider = "cloudfiles";
+ }
}
diff --git a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesContainerIntegrationLiveTest.java b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesContainerIntegrationLiveTest.java
index f55abb8f77..c9dc3f6cf0 100644
--- a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesContainerIntegrationLiveTest.java
+++ b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesContainerIntegrationLiveTest.java
@@ -26,5 +26,7 @@ import org.testng.annotations.Test;
*/
@Test(groups = "live")
public class CloudFilesContainerIntegrationLiveTest extends SwiftContainerIntegrationLiveTest {
-
+ public CloudFilesContainerIntegrationLiveTest(){
+ provider = "cloudfiles";
+ }
}
diff --git a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesContainerLiveTest.java b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesContainerLiveTest.java
index 86b7a471e5..11217a5c10 100644
--- a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesContainerLiveTest.java
+++ b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesContainerLiveTest.java
@@ -26,5 +26,7 @@ import org.testng.annotations.Test;
*/
@Test(groups = { "live" })
public class CloudFilesContainerLiveTest extends BaseContainerLiveTest {
-
+ public CloudFilesContainerLiveTest(){
+ provider = "cloudfiles";
+ }
}
diff --git a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesInputStreamMapIntegrationLiveTest.java b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesInputStreamMapIntegrationLiveTest.java
index c4f99d274e..1fd19dc1cc 100644
--- a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesInputStreamMapIntegrationLiveTest.java
+++ b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesInputStreamMapIntegrationLiveTest.java
@@ -26,5 +26,7 @@ import org.testng.annotations.Test;
*/
@Test(groups = "live")
public class CloudFilesInputStreamMapIntegrationLiveTest extends SwiftInputStreamMapIntegrationLiveTest {
-
+ public CloudFilesInputStreamMapIntegrationLiveTest(){
+ provider = "cloudfiles";
+ }
}
diff --git a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesServiceIntegrationLiveTest.java b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesServiceIntegrationLiveTest.java
index 1265764550..c89574c8e6 100644
--- a/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesServiceIntegrationLiveTest.java
+++ b/apis/cloudfiles/src/test/java/org/jclouds/cloudfiles/blobstore/integration/CloudFilesServiceIntegrationLiveTest.java
@@ -26,5 +26,7 @@ import org.testng.annotations.Test;
*/
@Test(groups = "live")
public class CloudFilesServiceIntegrationLiveTest extends SwiftServiceIntegrationLiveTest {
-
+ public CloudFilesServiceIntegrationLiveTest(){
+ provider = "cloudfiles";
+ }
}
diff --git a/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/CloudLoadBalancersApiMetadata.java b/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/CloudLoadBalancersApiMetadata.java
index 4885acb21d..b897f6f17d 100644
--- a/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/CloudLoadBalancersApiMetadata.java
+++ b/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/CloudLoadBalancersApiMetadata.java
@@ -19,50 +19,80 @@
package org.jclouds.cloudloadbalancers;
import java.net.URI;
+import java.util.Properties;
import org.jclouds.apis.ApiMetadata;
-import org.jclouds.apis.ApiType;
-import org.jclouds.apis.BaseApiMetadata;
+import org.jclouds.cloudloadbalancers.config.CloudLoadBalancersRestClientModule;
+import org.jclouds.cloudloadbalancers.loadbalancer.config.CloudLoadBalancersLoadBalancerContextModule;
+import org.jclouds.loadbalancer.LoadBalancerServiceContext;
+import org.jclouds.openstack.OpenStackAuthAsyncClient;
+import org.jclouds.rest.RestContext;
+import org.jclouds.rest.internal.BaseRestApiMetadata;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.reflect.TypeToken;
+import com.google.inject.Module;
/**
- * Implementation of {@link ApiMetadata} for Rackspace Cloud Load Balancers API
+ * Implementation of {@link ApiMetadata} for CloudLoadBalancers 1.0 API
*
- * @author Dan Lo Bianco
+ * @author Adrian Cole
*/
-public class CloudLoadBalancersApiMetadata extends BaseApiMetadata {
+public class CloudLoadBalancersApiMetadata extends BaseRestApiMetadata {
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 6725672099385580694L;
- public CloudLoadBalancersApiMetadata() {
- this(builder()
- .id("cloudloadbalancers")
- .type(ApiType.LOADBALANCER)
- .name("Rackspace Cloud Load Balancers API")
- .identityName("Username")
- .credentialName("API Key")
- .documentation(URI.create("http://docs.rackspacecloud.com/loadbalancers/api/v1.0/clb-devguide/content/ch01.html")));
+ public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() {
+ private static final long serialVersionUID = -5070937833892503232L;
+ };
+
+
+ @Override
+ public Builder toBuilder() {
+ return new Builder().fromApiMetadata(this);
}
- // below are so that we can reuse builders, toString, hashCode, etc.
- // we have to set concrete classes here, as our base class cannot be
- // concrete due to serviceLoader
- protected CloudLoadBalancersApiMetadata(Builder> builder) {
+ public CloudLoadBalancersApiMetadata() {
+ this(new Builder());
+ }
+
+ protected CloudLoadBalancersApiMetadata(Builder builder) {
super(builder);
}
- private static class ConcreteBuilder extends Builder {
+ public static Properties defaultProperties() {
+ Properties properties = BaseRestApiMetadata.defaultProperties();
+ return properties;
+ }
+
+ public static class Builder extends BaseRestApiMetadata.Builder {
+
+ protected Builder() {
+ super(CloudLoadBalancersClient.class, CloudLoadBalancersAsyncClient.class);
+ id("cloudloadbalancers")
+ .name("Rackspace Cloud Load Balancers API")
+ .identityName("Username")
+ .credentialName("API Key")
+ .documentation(URI.create("http://docs.rackspacecloud.com/loadbalancers/api/v1.0/clb-devguide/content/ch01.html"))
+ .version(OpenStackAuthAsyncClient.VERSION)
+ .defaultEndpoint("https://auth.api.rackspacecloud.com")
+ .defaultProperties(CloudLoadBalancersApiMetadata.defaultProperties())
+ .wrapper(TypeToken.of(LoadBalancerServiceContext.class))
+ .defaultModules(ImmutableSet.>of(CloudLoadBalancersRestClientModule.class, CloudLoadBalancersLoadBalancerContextModule.class));
+ }
@Override
public CloudLoadBalancersApiMetadata build() {
return new CloudLoadBalancersApiMetadata(this);
}
- }
- public static ConcreteBuilder builder() {
- return new ConcreteBuilder();
- }
+ @Override
+ public Builder fromApiMetadata(ApiMetadata in) {
+ super.fromApiMetadata(in);
+ return this;
+ }
- @Override
- public ConcreteBuilder toBuilder() {
- return builder().fromApiMetadata(this);
}
}
\ No newline at end of file
diff --git a/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/CloudLoadBalancersContextBuilder.java b/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/CloudLoadBalancersContextBuilder.java
deleted file mode 100644
index 93b51fc864..0000000000
--- a/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/CloudLoadBalancersContextBuilder.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.cloudloadbalancers;
-
-import java.util.List;
-import java.util.Properties;
-
-import org.jclouds.cloudloadbalancers.config.CloudLoadBalancersRestClientModule;
-import org.jclouds.cloudloadbalancers.loadbalancer.config.CloudLoadBalancersLoadBalancerContextModule;
-import org.jclouds.loadbalancer.LoadBalancerServiceContextBuilder;
-
-import com.google.inject.Module;
-
-/**
- *
- * @author Adrian Cole
- */
-public class CloudLoadBalancersContextBuilder extends
- LoadBalancerServiceContextBuilder {
-
- public CloudLoadBalancersContextBuilder(Properties props) {
- super(CloudLoadBalancersClient.class, CloudLoadBalancersAsyncClient.class, props);
- }
-
- @Override
- protected void addContextModule(List modules) {
- modules.add(new CloudLoadBalancersLoadBalancerContextModule());
- }
-
- protected void addClientModule(List modules) {
- modules.add(new CloudLoadBalancersRestClientModule());
- }
-
-}
diff --git a/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/CloudLoadBalancersPropertiesBuilder.java b/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/CloudLoadBalancersPropertiesBuilder.java
deleted file mode 100644
index fe8c881636..0000000000
--- a/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/CloudLoadBalancersPropertiesBuilder.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.cloudloadbalancers;
-
-import static org.jclouds.Constants.PROPERTY_API_VERSION;
-
-import java.util.Properties;
-
-import org.jclouds.PropertiesBuilder;
-
-/**
- * Builds properties used inRackspace Cloud Load Balancers Clients
- *
- * @author Dan Lo Bianco
- */
-public class CloudLoadBalancersPropertiesBuilder extends PropertiesBuilder {
- @Override
- protected Properties defaultProperties() {
- Properties properties = super.defaultProperties();
- properties.setProperty(PROPERTY_API_VERSION, "1.0");
- return properties;
- }
-
- public CloudLoadBalancersPropertiesBuilder(Properties properties) {
- super(properties);
- }
-
- }
diff --git a/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/config/CloudLoadBalancersRestClientModule.java b/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/config/CloudLoadBalancersRestClientModule.java
index 58b1681999..bd9e8ce2b2 100644
--- a/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/config/CloudLoadBalancersRestClientModule.java
+++ b/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/config/CloudLoadBalancersRestClientModule.java
@@ -37,7 +37,6 @@ import org.jclouds.cloudloadbalancers.handlers.ParseCloudLoadBalancersErrorFromH
import org.jclouds.cloudloadbalancers.location.RegionUrisFromPropertiesAndAccountIDPathSuffix;
import org.jclouds.cloudloadbalancers.reference.RackspaceConstants;
import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.RequiresHttp;
import org.jclouds.http.annotation.ClientError;
import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError;
@@ -64,7 +63,6 @@ import com.google.inject.assistedinject.FactoryModuleBuilder;
*
* @author Adrian Cole
*/
-@RequiresHttp
@ConfiguresRestClient
public class CloudLoadBalancersRestClientModule extends
RestClientModule {
diff --git a/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/functions/LB.java b/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/functions/LB.java
index 213eea8d48..658a2134e5 100644
--- a/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/functions/LB.java
+++ b/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/functions/LB.java
@@ -22,9 +22,9 @@ import java.util.Date;
import java.util.Map;
import java.util.Set;
-import org.jclouds.cloudloadbalancers.domain.LoadBalancer.Status;
import org.jclouds.cloudloadbalancers.domain.Node;
import org.jclouds.cloudloadbalancers.domain.VirtualIP;
+import org.jclouds.cloudloadbalancers.domain.LoadBalancer.Status;
import org.jclouds.cloudloadbalancers.domain.internal.BaseLoadBalancer;
import com.google.common.collect.Maps;
diff --git a/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/CloudLoadBalancersApiMetadataTest.java b/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/CloudLoadBalancersApiMetadataTest.java
index 77aa57b660..a31007e3d9 100644
--- a/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/CloudLoadBalancersApiMetadataTest.java
+++ b/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/CloudLoadBalancersApiMetadataTest.java
@@ -18,8 +18,7 @@
*/
package org.jclouds.cloudloadbalancers;
-import org.jclouds.apis.ApiType;
-import org.jclouds.apis.BaseApiMetadataTest;
+import org.jclouds.loadbalancer.internal.BaseLoadBalancerServiceApiMetadataTest;
import org.testng.annotations.Test;
/**
@@ -27,9 +26,9 @@ import org.testng.annotations.Test;
* @author Adrian Cole
*/
@Test(groups = "unit", testName = "CloudLoadBalancersApiMetadataTest")
-public class CloudLoadBalancersApiMetadataTest extends BaseApiMetadataTest {
+public class CloudLoadBalancersApiMetadataTest extends BaseLoadBalancerServiceApiMetadataTest {
public CloudLoadBalancersApiMetadataTest() {
- super(new CloudLoadBalancersApiMetadata(), ApiType.LOADBALANCER);
+ super(new CloudLoadBalancersApiMetadata());
}
}
diff --git a/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/features/LoadBalancerAsyncClientTest.java b/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/features/LoadBalancerAsyncClientTest.java
index bacd9bb7f5..23c35038fd 100644
--- a/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/features/LoadBalancerAsyncClientTest.java
+++ b/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/features/LoadBalancerAsyncClientTest.java
@@ -22,8 +22,8 @@ import java.io.IOException;
import java.lang.reflect.Method;
import org.jclouds.cloudloadbalancers.domain.LoadBalancerAttributes;
-import org.jclouds.cloudloadbalancers.domain.LoadBalancerAttributes.Builder;
import org.jclouds.cloudloadbalancers.domain.LoadBalancerRequest;
+import org.jclouds.cloudloadbalancers.domain.LoadBalancerAttributes.Builder;
import org.jclouds.cloudloadbalancers.domain.VirtualIP.Type;
import org.jclouds.cloudloadbalancers.functions.UnwrapLoadBalancer;
import org.jclouds.cloudloadbalancers.functions.UnwrapLoadBalancers;
diff --git a/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/features/LoadBalancerClientLiveTest.java b/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/features/LoadBalancerClientLiveTest.java
index e11bda0e72..2b672161cb 100644
--- a/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/features/LoadBalancerClientLiveTest.java
+++ b/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/features/LoadBalancerClientLiveTest.java
@@ -46,19 +46,19 @@ public class LoadBalancerClientLiveTest extends BaseCloudLoadBalancersClientLive
private Set lbs = Sets.newLinkedHashSet();
@Override
- public void setupClient() {
- super.setupClient();
+ public void setupContext() {
+ super.setupContext();
assertEquals(client.getConfiguredRegions(), Arrays.asList(regions));
Logger.getAnonymousLogger().info("running against regions " + client.getConfiguredRegions());
}
@Override
- protected void tearDown() {
+ protected void tearDownContext() {
for (LoadBalancer lb : lbs) {
client.getLoadBalancerClient(lb.getRegion()).removeLoadBalancer(lb.getId());
assert loadBalancerDeleted.apply(lb) : lb;
}
- super.tearDown();
+ super.tearDownContext();
}
public void testCreateLoadBalancer() throws Exception {
diff --git a/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/features/NodeAsyncClientTest.java b/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/features/NodeAsyncClientTest.java
index b0702d5d7e..fb09722a1b 100644
--- a/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/features/NodeAsyncClientTest.java
+++ b/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/features/NodeAsyncClientTest.java
@@ -24,8 +24,8 @@ import java.util.Collections;
import java.util.Set;
import org.jclouds.cloudloadbalancers.domain.NodeAttributes;
-import org.jclouds.cloudloadbalancers.domain.NodeAttributes.Builder;
import org.jclouds.cloudloadbalancers.domain.NodeRequest;
+import org.jclouds.cloudloadbalancers.domain.NodeAttributes.Builder;
import org.jclouds.cloudloadbalancers.domain.internal.BaseNode.Condition;
import org.jclouds.cloudloadbalancers.internal.BaseCloudLoadBalancersAsyncClientTest;
import org.jclouds.http.HttpRequest;
diff --git a/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/features/NodeClientLiveTest.java b/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/features/NodeClientLiveTest.java
index e722442f85..64bfa9611e 100644
--- a/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/features/NodeClientLiveTest.java
+++ b/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/features/NodeClientLiveTest.java
@@ -26,16 +26,16 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.Set;
+import java.util.Map.Entry;
import java.util.logging.Logger;
import org.jclouds.cloudloadbalancers.domain.LoadBalancer;
-import org.jclouds.cloudloadbalancers.domain.LoadBalancer.Status;
import org.jclouds.cloudloadbalancers.domain.LoadBalancerRequest;
import org.jclouds.cloudloadbalancers.domain.Node;
import org.jclouds.cloudloadbalancers.domain.NodeAttributes;
import org.jclouds.cloudloadbalancers.domain.NodeRequest;
+import org.jclouds.cloudloadbalancers.domain.LoadBalancer.Status;
import org.jclouds.cloudloadbalancers.domain.VirtualIP.Type;
import org.jclouds.cloudloadbalancers.internal.BaseCloudLoadBalancersClientLiveTest;
import org.testng.annotations.AfterGroups;
@@ -137,7 +137,7 @@ public class NodeClientLiveTest extends BaseCloudLoadBalancersClientLiveTest {
@Override
@AfterGroups(groups = "live")
- protected void tearDown() {
+ protected void tearDownContext() {
for (Entry> entry : nodes.entrySet()) {
LoadBalancer lb = entry.getKey();
LoadBalancerClient lbClient = client.getLoadBalancerClient(lb.getRegion());
@@ -147,6 +147,6 @@ public class NodeClientLiveTest extends BaseCloudLoadBalancersClientLiveTest {
}
assert loadBalancerDeleted.apply(lb) : lb;
}
- super.tearDown();
+ super.tearDownContext();
}
}
diff --git a/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/functions/UnwrapLoadBalancerTest.java b/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/functions/UnwrapLoadBalancerTest.java
index 0fc4fb0bff..521aa3a0ef 100644
--- a/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/functions/UnwrapLoadBalancerTest.java
+++ b/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/functions/UnwrapLoadBalancerTest.java
@@ -19,9 +19,9 @@
package org.jclouds.cloudloadbalancers.functions;
import org.jclouds.cloudloadbalancers.domain.LoadBalancer;
-import org.jclouds.cloudloadbalancers.domain.LoadBalancer.Status;
import org.jclouds.cloudloadbalancers.domain.Node;
import org.jclouds.cloudloadbalancers.domain.VirtualIP;
+import org.jclouds.cloudloadbalancers.domain.LoadBalancer.Status;
import org.jclouds.cloudloadbalancers.domain.VirtualIP.IPVersion;
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.http.HttpResponse;
diff --git a/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/functions/UnwrapLoadBalancersTest.java b/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/functions/UnwrapLoadBalancersTest.java
index b6fc178223..95b1e0d848 100644
--- a/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/functions/UnwrapLoadBalancersTest.java
+++ b/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/functions/UnwrapLoadBalancersTest.java
@@ -21,8 +21,8 @@ package org.jclouds.cloudloadbalancers.functions;
import java.util.Set;
import org.jclouds.cloudloadbalancers.domain.LoadBalancer;
-import org.jclouds.cloudloadbalancers.domain.LoadBalancer.Status;
import org.jclouds.cloudloadbalancers.domain.VirtualIP;
+import org.jclouds.cloudloadbalancers.domain.LoadBalancer.Status;
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.http.HttpResponse;
import org.jclouds.json.BaseSetParserTest;
diff --git a/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/internal/BaseCloudLoadBalancersAsyncClientTest.java b/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/internal/BaseCloudLoadBalancersAsyncClientTest.java
index eb8aa9132a..d0ed3c0283 100644
--- a/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/internal/BaseCloudLoadBalancersAsyncClientTest.java
+++ b/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/internal/BaseCloudLoadBalancersAsyncClientTest.java
@@ -31,16 +31,13 @@ import java.util.Properties;
import javax.inject.Singleton;
+import org.jclouds.apis.ApiMetadata;
+import org.jclouds.cloudloadbalancers.CloudLoadBalancersApiMetadata;
import org.jclouds.cloudloadbalancers.CloudLoadBalancersAsyncClient;
-import org.jclouds.cloudloadbalancers.CloudLoadBalancersContextBuilder;
-import org.jclouds.cloudloadbalancers.CloudLoadBalancersPropertiesBuilder;
import org.jclouds.cloudloadbalancers.config.CloudLoadBalancersRestClientModule;
-import org.jclouds.cloudloadbalancers.features.LoadBalancerAsyncClient;
-import org.jclouds.cloudloadbalancers.features.LoadBalancerClient;
import org.jclouds.cloudloadbalancers.reference.Region;
import org.jclouds.domain.Credentials;
import org.jclouds.http.HttpRequest;
-import org.jclouds.http.RequiresHttp;
import org.jclouds.internal.ClassMethodArgs;
import org.jclouds.location.config.LocationModule;
import org.jclouds.openstack.filters.AuthenticateRequest;
@@ -48,13 +45,10 @@ import org.jclouds.openstack.keystone.v1_1.config.AuthenticationServiceModule.Ge
import org.jclouds.openstack.keystone.v1_1.domain.Auth;
import org.jclouds.openstack.keystone.v1_1.parse.ParseAuthTest;
import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.RestClientTest;
-import org.jclouds.rest.RestContextFactory;
-import org.jclouds.rest.RestContextSpec;
+import org.jclouds.rest.internal.BaseAsyncClientTest;
import org.testng.annotations.BeforeClass;
import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableSet;
import com.google.inject.AbstractModule;
import com.google.inject.Module;
import com.google.inject.Provides;
@@ -62,7 +56,7 @@ import com.google.inject.Provides;
/**
* @author Adrian Cole
*/
-public abstract class BaseCloudLoadBalancersAsyncClientTest extends RestClientTest {
+public abstract class BaseCloudLoadBalancersAsyncClientTest extends BaseAsyncClientTest {
protected String provider;
@@ -76,7 +70,6 @@ public abstract class BaseCloudLoadBalancersAsyncClientTest extends RestClien
}
@ConfiguresRestClient
- @RequiresHttp
protected static class TestCloudLoadBalancersRestClientModule extends CloudLoadBalancersRestClientModule {
@Override
protected void installLocations() {
@@ -131,15 +124,9 @@ public abstract class BaseCloudLoadBalancersAsyncClientTest extends RestClien
return overrides;
}
- /**
- * this is only here as "cloudloadbalancers" is not in rest.properties
- */
- @SuppressWarnings( { "unchecked", "rawtypes" })
@Override
- public RestContextSpec, ?> createContextSpec() {
- return RestContextFactory. contextSpec(provider, "https://auth",
- "1.0", "", "", "identity", "credential", LoadBalancerClient.class, LoadBalancerAsyncClient.class,
- (Class) CloudLoadBalancersPropertiesBuilder.class, (Class) CloudLoadBalancersContextBuilder.class,
- ImmutableSet. of());
+ protected ApiMetadata createApiMetadata() {
+ return new CloudLoadBalancersApiMetadata();
}
+
}
\ No newline at end of file
diff --git a/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/internal/BaseCloudLoadBalancersClientLiveTest.java b/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/internal/BaseCloudLoadBalancersClientLiveTest.java
index b8a1fdd898..201a5b363a 100644
--- a/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/internal/BaseCloudLoadBalancersClientLiveTest.java
+++ b/apis/cloudloadbalancers/src/test/java/org/jclouds/cloudloadbalancers/internal/BaseCloudLoadBalancersClientLiveTest.java
@@ -18,40 +18,38 @@
*/
package org.jclouds.cloudloadbalancers.internal;
-import java.util.Properties;
import java.util.concurrent.TimeUnit;
+import org.jclouds.apis.BaseContextLiveTest;
import org.jclouds.cloudloadbalancers.CloudLoadBalancersAsyncClient;
import org.jclouds.cloudloadbalancers.CloudLoadBalancersClient;
import org.jclouds.cloudloadbalancers.domain.LoadBalancer;
import org.jclouds.cloudloadbalancers.predicates.LoadBalancerActive;
import org.jclouds.cloudloadbalancers.predicates.LoadBalancerDeleted;
-import org.jclouds.loadbalancer.LoadBalancerServiceContextFactory;
+import org.jclouds.loadbalancer.LoadBalancerServiceContext;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.net.IPSocket;
import org.jclouds.predicates.RetryablePredicate;
-import org.jclouds.rest.BaseRestClientLiveTest;
import org.jclouds.rest.RestContext;
-import org.testng.annotations.AfterGroups;
import org.testng.annotations.BeforeGroups;
import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableSet;
+import com.google.common.reflect.TypeToken;
import com.google.inject.Guice;
import com.google.inject.Injector;
-import com.google.inject.Module;
/**
*
* @author Adrian Cole
*/
-public class BaseCloudLoadBalancersClientLiveTest extends BaseRestClientLiveTest {
+public class BaseCloudLoadBalancersClientLiveTest extends BaseContextLiveTest {
+
public BaseCloudLoadBalancersClientLiveTest() {
provider = "cloudloadbalancers";
}
protected CloudLoadBalancersClient client;
- protected RestContext context;
+ protected RestContext lbContext;
protected String[] regions = {};
protected Predicate socketTester;
protected RetryablePredicate loadBalancerActive;
@@ -59,15 +57,13 @@ public class BaseCloudLoadBalancersClientLiveTest extends BaseRestClientLiveTest
protected Injector injector;
+ @BeforeGroups(groups = { "integration", "live" })
+ @Override
+ public void setupContext() {
+ super.setupContext();
+ lbContext = context.unwrap();
- @BeforeGroups(groups = "live")
- public void setupClient() {
- setupCredentials();
- Properties overrides = setupProperties();
- context = new LoadBalancerServiceContextFactory().createContext(provider, ImmutableSet. of(new Log4JLoggingModule()),
- overrides).getProviderSpecificContext();
-
- client = context.getApi();
+ client = lbContext.getApi();
injector = Guice.createInjector(new Log4JLoggingModule());
loadBalancerActive = new RetryablePredicate(new LoadBalancerActive(client), 300, 1, 1,
@@ -78,10 +74,9 @@ public class BaseCloudLoadBalancersClientLiveTest extends BaseRestClientLiveTest
injector.injectMembers(loadBalancerDeleted);
}
- @AfterGroups(groups = "live")
- protected void tearDown() {
- if (context != null)
- context.close();
+ @Override
+ protected TypeToken contextType() {
+ return TypeToken.of(LoadBalancerServiceContext.class);
}
}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersApiMetadata.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersApiMetadata.java
index c41c0a1aba..208fb51b30 100644
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersApiMetadata.java
+++ b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersApiMetadata.java
@@ -19,50 +19,79 @@
package org.jclouds.cloudservers;
import java.net.URI;
+import java.util.Properties;
import org.jclouds.apis.ApiMetadata;
-import org.jclouds.apis.ApiType;
-import org.jclouds.apis.BaseApiMetadata;
+import org.jclouds.cloudservers.compute.config.CloudServersComputeServiceContextModule;
+import org.jclouds.cloudservers.config.CloudServersRestClientModule;
+import org.jclouds.compute.ComputeServiceContext;
+import org.jclouds.openstack.OpenStackAuthAsyncClient;
+import org.jclouds.rest.RestContext;
+import org.jclouds.rest.internal.BaseRestApiMetadata;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.reflect.TypeToken;
+import com.google.inject.Module;
/**
- * Implementation of {@link ApiMetadata} for Rackspace Cloud Servers API
+ * Implementation of {@link ApiMetadata} for CloudServers 1.0 API
*
* @author Adrian Cole
*/
-public class CloudServersApiMetadata extends BaseApiMetadata {
+public class CloudServersApiMetadata extends BaseRestApiMetadata {
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 6725672099385580694L;
- public CloudServersApiMetadata() {
- this(builder()
- .id("cloudservers")
- .type(ApiType.COMPUTE)
- .name("Rackspace Cloud Servers API")
- .identityName("Username")
- .credentialName("API Key")
- .documentation(URI.create("http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide/content/ch01.html")));
+ public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() {
+ private static final long serialVersionUID = -5070937833892503232L;
+ };
+
+ @Override
+ public Builder toBuilder() {
+ return new Builder().fromApiMetadata(this);
}
- // below are so that we can reuse builders, toString, hashCode, etc.
- // we have to set concrete classes here, as our base class cannot be
- // concrete due to serviceLoader
- protected CloudServersApiMetadata(Builder> builder) {
+ public CloudServersApiMetadata() {
+ this(new Builder());
+ }
+
+ protected CloudServersApiMetadata(Builder builder) {
super(builder);
}
- private static class ConcreteBuilder extends Builder {
+ public static Properties defaultProperties() {
+ Properties properties = BaseRestApiMetadata.defaultProperties();
+ return properties;
+ }
+
+ public static class Builder extends BaseRestApiMetadata.Builder {
+
+ protected Builder() {
+ super(CloudServersClient.class, CloudServersAsyncClient.class);
+ id("cloudservers")
+ .name("Rackspace Cloud Servers API")
+ .identityName("Username")
+ .credentialName("API Key")
+ .documentation(URI.create("http://docs.rackspacecloud.com/servers/api/v1.0/cs-devguide/content/ch01.html"))
+ .version(OpenStackAuthAsyncClient.VERSION)
+ .defaultEndpoint("https://auth.api.rackspacecloud.com")
+ .defaultProperties(CloudServersApiMetadata.defaultProperties())
+ .wrapper(TypeToken.of(ComputeServiceContext.class))
+ .defaultModules(ImmutableSet.>of(CloudServersRestClientModule.class, CloudServersComputeServiceContextModule.class));
+ }
@Override
public CloudServersApiMetadata build() {
return new CloudServersApiMetadata(this);
}
- }
- public static ConcreteBuilder builder() {
- return new ConcreteBuilder();
- }
+ @Override
+ public Builder fromApiMetadata(ApiMetadata in) {
+ super.fromApiMetadata(in);
+ return this;
+ }
- @Override
- public ConcreteBuilder toBuilder() {
- return builder().fromApiMetadata(this);
}
}
\ No newline at end of file
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersContextBuilder.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersContextBuilder.java
deleted file mode 100644
index 9c322927d5..0000000000
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/CloudServersContextBuilder.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * 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.cloudservers;
-
-import java.util.List;
-import java.util.Properties;
-
-import org.jclouds.cloudservers.compute.config.CloudServersComputeServiceContextModule;
-import org.jclouds.cloudservers.config.CloudServersRestClientModule;
-import org.jclouds.compute.ComputeServiceContextBuilder;
-import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
-import org.jclouds.logging.jdk.config.JDKLoggingModule;
-
-import com.google.inject.Injector;
-import com.google.inject.Module;
-
-/**
- * Creates {@link CloudServersComputeServiceContext} or {@link Injector} instances based on the most
- * commonly requested arguments.
- *
- * Note that Threadsafe objects will be bound as singletons to the Injector or Context provided.
- *
- *
- * If no Module
s are specified, the default {@link JDKLoggingModule logging} and
- * {@link JavaUrlHttpCommandExecutorServiceModule http transports} will be installed.
- *
- * @author Adrian Cole
- * @see CloudServersComputeServiceContext
- */
-public class CloudServersContextBuilder extends
- ComputeServiceContextBuilder {
-
- public CloudServersContextBuilder(Properties props) {
- super(CloudServersClient.class, CloudServersAsyncClient.class, props);
- }
-
- @Override
- protected void addContextModule(List modules) {
- modules.add(new CloudServersComputeServiceContextModule());
- }
-
- @Override
- protected void addClientModule(List modules) {
- modules.add(new CloudServersRestClientModule());
- }
-
-}
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/config/CloudServersComputeServiceContextModule.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/config/CloudServersComputeServiceContextModule.java
index d7065b96dc..9747eca77f 100644
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/config/CloudServersComputeServiceContextModule.java
+++ b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/compute/config/CloudServersComputeServiceContextModule.java
@@ -22,8 +22,6 @@ import java.util.Map;
import javax.inject.Singleton;
-import org.jclouds.cloudservers.CloudServersAsyncClient;
-import org.jclouds.cloudservers.CloudServersClient;
import org.jclouds.cloudservers.compute.functions.CloudServersImageToImage;
import org.jclouds.cloudservers.compute.functions.CloudServersImageToOperatingSystem;
import org.jclouds.cloudservers.compute.functions.FlavorToHardware;
@@ -55,12 +53,8 @@ import com.google.inject.TypeLiteral;
*
* @author Adrian Cole
*/
-public class CloudServersComputeServiceContextModule
- extends
- ComputeServiceAdapterContextModule {
- public CloudServersComputeServiceContextModule() {
- super(CloudServersClient.class, CloudServersAsyncClient.class);
- }
+public class CloudServersComputeServiceContextModule extends
+ ComputeServiceAdapterContextModule {
@SuppressWarnings("unchecked")
@Override
diff --git a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/config/CloudServersRestClientModule.java b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/config/CloudServersRestClientModule.java
index dcc000ec92..13f267c7c5 100644
--- a/apis/cloudservers/src/main/java/org/jclouds/cloudservers/config/CloudServersRestClientModule.java
+++ b/apis/cloudservers/src/main/java/org/jclouds/cloudservers/config/CloudServersRestClientModule.java
@@ -32,7 +32,6 @@ import org.jclouds.cloudservers.CloudServersClient;
import org.jclouds.cloudservers.handlers.ParseCloudServersErrorFromHttpResponse;
import org.jclouds.date.TimeStamp;
import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.RequiresHttp;
import org.jclouds.http.annotation.ClientError;
import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError;
@@ -53,7 +52,6 @@ import com.google.inject.Provides;
* @author Adrian Cole
*/
@ConfiguresRestClient
-@RequiresHttp
public class CloudServersRestClientModule extends RestClientModule {
public CloudServersRestClientModule() {
diff --git a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersApiMetadataTest.java b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersApiMetadataTest.java
index f4d822af98..6587b5ab3c 100644
--- a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersApiMetadataTest.java
+++ b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersApiMetadataTest.java
@@ -18,8 +18,7 @@
*/
package org.jclouds.cloudservers;
-import org.jclouds.apis.ApiType;
-import org.jclouds.apis.BaseApiMetadataTest;
+import org.jclouds.compute.internal.BaseComputeServiceApiMetadataTest;
import org.testng.annotations.Test;
/**
@@ -27,9 +26,9 @@ import org.testng.annotations.Test;
* @author Adrian Cole
*/
@Test(groups = "unit", testName = "CloudServersApiMetadataTest")
-public class CloudServersApiMetadataTest extends BaseApiMetadataTest {
+public class CloudServersApiMetadataTest extends BaseComputeServiceApiMetadataTest {
public CloudServersApiMetadataTest() {
- super(new CloudServersApiMetadata(), ApiType.COMPUTE);
+ super(new CloudServersApiMetadata());
}
}
diff --git a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersAsyncClientTest.java b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersAsyncClientTest.java
index 50713095c9..e630ff6ed6 100644
--- a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersAsyncClientTest.java
+++ b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersAsyncClientTest.java
@@ -38,6 +38,7 @@ import java.util.Properties;
import javax.inject.Singleton;
import javax.ws.rs.core.MediaType;
+import org.jclouds.apis.ApiMetadata;
import org.jclouds.cloudservers.config.CloudServersRestClientModule;
import org.jclouds.cloudservers.domain.BackupSchedule;
import org.jclouds.cloudservers.domain.DailyBackup;
@@ -49,7 +50,6 @@ import org.jclouds.cloudservers.options.ListOptions;
import org.jclouds.cloudservers.options.RebuildServerOptions;
import org.jclouds.domain.Credentials;
import org.jclouds.http.HttpRequest;
-import org.jclouds.http.RequiresHttp;
import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.http.functions.ReturnFalseOn404;
import org.jclouds.http.functions.ReturnTrueIf2xx;
@@ -60,14 +60,12 @@ import org.jclouds.openstack.keystone.v1_1.config.AuthenticationServiceModule.Ge
import org.jclouds.openstack.keystone.v1_1.domain.Auth;
import org.jclouds.openstack.keystone.v1_1.parse.ParseAuthTest;
import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.RestClientTest;
-import org.jclouds.rest.RestContextFactory;
-import org.jclouds.rest.RestContextSpec;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnFalseOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
+import org.jclouds.rest.internal.BaseAsyncClientTest;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test;
@@ -84,7 +82,7 @@ import com.google.inject.TypeLiteral;
// NOTE:without testName, this will not call @Before* and fail w/NPE during
// surefire
@Test(groups = "unit", singleThreaded = true, testName = "CloudServersAsyncClientTest")
-public class CloudServersAsyncClientTest extends RestClientTest {
+public class CloudServersAsyncClientTest extends BaseAsyncClientTest {
private static final Class extends ListOptions[]> listOptionsVarargsClass = new ListOptions[] {}.getClass();
private static final Class extends CreateServerOptions[]> createServerOptionsVarargsClass = new CreateServerOptions[] {}
.getClass();
@@ -891,8 +889,7 @@ public class CloudServersAsyncClientTest extends RestClientTest createContextSpec() {
- return new RestContextFactory(setupRestProperties()).createContextSpec(provider, "user", "password", setupProperties());
+ protected ApiMetadata createApiMetadata() {
+ return new CloudServersApiMetadata();
}
@Override
diff --git a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersClientLiveTest.java b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersClientLiveTest.java
index 7835e6beee..d1f0cc47e9 100644
--- a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersClientLiveTest.java
+++ b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/CloudServersClientLiveTest.java
@@ -29,7 +29,6 @@ import java.io.IOException;
import java.lang.reflect.UndeclaredThrowableException;
import java.security.SecureRandom;
import java.util.Map;
-import java.util.Properties;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@@ -45,19 +44,16 @@ import org.jclouds.cloudservers.domain.ServerStatus;
import org.jclouds.cloudservers.domain.SharedIpGroup;
import org.jclouds.cloudservers.domain.WeeklyBackup;
import org.jclouds.cloudservers.options.RebuildServerOptions;
-import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.domain.ExecResponse;
+import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
import org.jclouds.domain.LoginCredentials;
import org.jclouds.http.HttpResponseException;
import org.jclouds.io.Payload;
-import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.net.IPSocket;
import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.predicates.SocketOpen;
-import org.jclouds.rest.RestContextFactory;
import org.jclouds.ssh.SshClient;
import org.jclouds.ssh.SshException;
-import org.jclouds.sshj.config.SshjSshClientModule;
import org.jclouds.util.Strings2;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeGroups;
@@ -66,10 +62,8 @@ import org.testng.annotations.Test;
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.inject.Injector;
-import com.google.inject.Module;
/**
* Tests behavior of {@code CloudServersClient}
@@ -77,7 +71,8 @@ import com.google.inject.Module;
* @author Adrian Cole
*/
@Test(groups = "live", singleThreaded = true, testName = "CloudServersClientLiveTest")
-public class CloudServersClientLiveTest extends BaseVersionedServiceLiveTest {
+public class CloudServersClientLiveTest extends BaseComputeServiceContextLiveTest {
+
public CloudServersClientLiveTest() {
provider = "cloudservers";
}
@@ -86,15 +81,11 @@ public class CloudServersClientLiveTest extends BaseVersionedServiceLiveTest {
protected SshClient.Factory sshFactory;
protected Predicate socketTester;
- @BeforeGroups(groups = { "live" })
- public void setupClient() {
- setupCredentials();
- Properties overrides = setupProperties();
-
- Injector injector = new RestContextFactory().createContextBuilder(provider,
- ImmutableSet. of(new Log4JLoggingModule(), new SshjSshClientModule()), overrides)
- .buildInjector();
-
+ @BeforeGroups(groups = { "integration", "live" })
+ @Override
+ public void setupContext() {
+ super.setupContext();
+ Injector injector = context.utils().injector();
client = injector.getInstance(CloudServersClient.class);
sshFactory = injector.getInstance(SshClient.Factory.class);
SocketOpen socketOpen = injector.getInstance(SocketOpen.class);
diff --git a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/compute/CloudServersComputeServiceLiveTest.java b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/compute/CloudServersComputeServiceLiveTest.java
index c725549435..9aa6c7671d 100644
--- a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/compute/CloudServersComputeServiceLiveTest.java
+++ b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/compute/CloudServersComputeServiceLiveTest.java
@@ -22,13 +22,9 @@ import static org.testng.Assert.assertEquals;
import java.io.IOException;
-import org.jclouds.cloudservers.CloudServersAsyncClient;
-import org.jclouds.cloudservers.CloudServersClient;
-import org.jclouds.compute.BaseComputeServiceLiveTest;
-import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.internal.BaseComputeServiceLiveTest;
import org.jclouds.domain.LocationScope;
-import org.jclouds.rest.RestContext;
import org.jclouds.sshj.config.SshjSshClientModule;
import org.testng.annotations.Test;
@@ -42,6 +38,7 @@ import com.google.inject.Module;
*/
@Test(groups = "live", enabled = true, singleThreaded = true, testName = "CloudServersComputeServiceLiveTest")
public class CloudServersComputeServiceLiveTest extends BaseComputeServiceLiveTest {
+
public CloudServersComputeServiceLiveTest() {
provider = "cloudservers";
}
@@ -51,12 +48,6 @@ public class CloudServersComputeServiceLiveTest extends BaseComputeServiceLiveTe
return new SshjSshClientModule();
}
- public void testAssignability() throws Exception {
- @SuppressWarnings("unused")
- RestContext tmContext = new ComputeServiceContextFactory()
- .createContext(provider, identity, credential).getProviderSpecificContext();
- }
-
@Override
protected void checkNodes(Iterable extends NodeMetadata> nodes, String group, String task) throws IOException {
super.checkNodes(nodes, group, task);
diff --git a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/internal/BaseCloudServersRestClientExpectTest.java b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/internal/BaseCloudServersRestClientExpectTest.java
index fd1e37bd06..f6018a9707 100644
--- a/apis/cloudservers/src/test/java/org/jclouds/cloudservers/internal/BaseCloudServersRestClientExpectTest.java
+++ b/apis/cloudservers/src/test/java/org/jclouds/cloudservers/internal/BaseCloudServersRestClientExpectTest.java
@@ -23,12 +23,11 @@ import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS;
import java.util.Date;
import java.util.Properties;
+import org.jclouds.apis.ApiMetadata;
+import org.jclouds.cloudservers.CloudServersApiMetadata;
import org.jclouds.cloudservers.CloudServersClient;
-import org.jclouds.cloudservers.CloudServersContextBuilder;
-import org.jclouds.cloudservers.CloudServersPropertiesBuilder;
import org.jclouds.cloudservers.config.CloudServersRestClientModule;
import org.jclouds.date.internal.SimpleDateFormatDateService;
-import org.jclouds.http.RequiresHttp;
import org.jclouds.openstack.filters.AddTimestampQuery;
import org.jclouds.openstack.keystone.v1_1.config.AuthenticationServiceModule;
import org.jclouds.openstack.keystone.v1_1.internal.BaseKeystoneRestClientExpectTest;
@@ -47,14 +46,18 @@ public class BaseCloudServersRestClientExpectTest extends BaseKeystoneRestClient
public BaseCloudServersRestClientExpectTest() {
provider = "cloudservers";
}
+
+ @Override
+ protected ApiMetadata createApiMetadata() {
+ return new CloudServersApiMetadata();
+ }
+
@Override
- protected Properties setupRestProperties() {
+ protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(PROPERTY_REGIONS, "US");
overrides.setProperty(provider + ".endpoint", endpoint);
- overrides.setProperty(provider + ".contextbuilder", CloudServersContextBuilder.class.getName());
- overrides.setProperty(provider + ".propertiesbuilder", CloudServersPropertiesBuilder.class.getName());
return overrides;
}
@@ -77,8 +80,7 @@ public class BaseCloudServersRestClientExpectTest extends BaseKeystoneRestClient
}
@ConfiguresRestClient
- @RequiresHttp
- protected static class TestCloudServersRestClientModule extends CloudServersRestClientModule {
+ protected static class TestCloudServersRestClientModule extends CloudServersRestClientModule {
@Override
public Supplier provideCacheBusterDate() {
diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaApiMetadata.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaApiMetadata.java
index 7d9a7f992e..28be12c28c 100644
--- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaApiMetadata.java
+++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaApiMetadata.java
@@ -18,51 +18,85 @@
*/
package org.jclouds.cloudsigma;
+import static org.jclouds.cloudsigma.reference.CloudSigmaConstants.PROPERTY_VNC_PASSWORD;
+
import java.net.URI;
+import java.util.Properties;
import org.jclouds.apis.ApiMetadata;
-import org.jclouds.apis.ApiType;
-import org.jclouds.apis.BaseApiMetadata;
+import org.jclouds.cloudsigma.compute.config.CloudSigmaComputeServiceContextModule;
+import org.jclouds.cloudsigma.config.CloudSigmaRestClientModule;
+import org.jclouds.compute.ComputeServiceContext;
+import org.jclouds.rest.RestContext;
+import org.jclouds.rest.internal.BaseRestApiMetadata;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.reflect.TypeToken;
+import com.google.inject.Module;
/**
* Implementation of {@link ApiMetadata} for the Cloud Sigma API
*
* @author Adrian Cole
*/
-public class CloudSigmaApiMetadata extends BaseApiMetadata {
+public class CloudSigmaApiMetadata extends BaseRestApiMetadata {
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 6725672099385580694L;
- public CloudSigmaApiMetadata() {
- this(builder()
- .id("cloudsigma")
- .type(ApiType.COMPUTE)
- .name("CloudSigma API")
- .identityName("Email")
- .credentialName("Password")
- .documentation(URI.create("http://cloudsigma.com/en/platform-details/the-api")));
+ public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() {
+ private static final long serialVersionUID = -5070937833892503232L;
+ };
+
+ @Override
+ public Builder toBuilder() {
+ return new Builder().fromApiMetadata(this);
}
- // below are so that we can reuse builders, toString, hashCode, etc.
- // we have to set concrete classes here, as our base class cannot be
- // concrete due to serviceLoader
- protected CloudSigmaApiMetadata(Builder> builder) {
+ public CloudSigmaApiMetadata() {
+ this(new Builder());
+ }
+
+ protected CloudSigmaApiMetadata(Builder builder) {
super(builder);
}
- private static class ConcreteBuilder extends Builder {
+ public static Properties defaultProperties() {
+ Properties properties = BaseRestApiMetadata.defaultProperties();
+ properties.setProperty(PROPERTY_VNC_PASSWORD, "IL9vs34d");
+ // passwords are set post-boot, so auth failures are possible
+ // from a race condition applying the password set script
+ properties.setProperty("jclouds.ssh.max-retries", "7");
+ properties.setProperty("jclouds.ssh.retry-auth", "true");
+ return properties;
+ }
+
+ public static class Builder extends BaseRestApiMetadata.Builder {
+
+ protected Builder() {
+ super(CloudSigmaClient.class, CloudSigmaAsyncClient.class);
+ id("cloudsigma")
+ .name("CloudSigma API")
+ .identityName("Email")
+ .credentialName("Password")
+ .documentation(URI.create("http://cloudsigma.com/en/platform-details/the-api"))
+ .version("1.0")
+ .defaultEndpoint("https://api.cloudsigma.com")
+ .defaultProperties(CloudSigmaApiMetadata.defaultProperties())
+ .wrapper(TypeToken.of(ComputeServiceContext.class))
+ .defaultModules(ImmutableSet.>of(CloudSigmaRestClientModule.class, CloudSigmaComputeServiceContextModule.class));
+ }
@Override
public CloudSigmaApiMetadata build() {
return new CloudSigmaApiMetadata(this);
}
- }
- public static ConcreteBuilder builder() {
- return new ConcreteBuilder();
- }
+ @Override
+ public Builder fromApiMetadata(ApiMetadata in) {
+ super.fromApiMetadata(in);
+ return this;
+ }
- @Override
- public ConcreteBuilder toBuilder() {
- return builder().fromApiMetadata(this);
}
}
\ No newline at end of file
diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaContextBuilder.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaContextBuilder.java
deleted file mode 100644
index c777e0e408..0000000000
--- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaContextBuilder.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.cloudsigma;
-
-import java.util.List;
-import java.util.Properties;
-
-import org.jclouds.cloudsigma.compute.config.CloudSigmaComputeServiceContextModule;
-import org.jclouds.cloudsigma.config.CloudSigmaRestClientModule;
-import org.jclouds.compute.ComputeServiceContextBuilder;
-
-import com.google.inject.Module;
-
-/**
- *
- * @author Adrian Cole
- */
-public class CloudSigmaContextBuilder extends ComputeServiceContextBuilder {
-
- public CloudSigmaContextBuilder(Properties props) {
- super(CloudSigmaClient.class, CloudSigmaAsyncClient.class, props);
- }
-
- @Override
- protected void addContextModule(List modules) {
- modules.add(new CloudSigmaComputeServiceContextModule());
- }
-
- protected void addClientModule(List modules) {
- modules.add(new CloudSigmaRestClientModule());
- }
-
-}
diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaPropertiesBuilder.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaPropertiesBuilder.java
deleted file mode 100644
index bf13f88b68..0000000000
--- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/CloudSigmaPropertiesBuilder.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.cloudsigma;
-
-import static org.jclouds.Constants.PROPERTY_API_VERSION;
-import static org.jclouds.cloudsigma.reference.CloudSigmaConstants.PROPERTY_VNC_PASSWORD;
-
-import java.util.Properties;
-
-import org.jclouds.PropertiesBuilder;
-
-/**
- * Builds properties used in CloudSigma Clients
- *
- * @author Adrian Cole
- */
-public class CloudSigmaPropertiesBuilder extends PropertiesBuilder {
- @Override
- protected Properties defaultProperties() {
- Properties properties = super.defaultProperties();
- properties.setProperty(PROPERTY_API_VERSION, "1.0");
- properties.setProperty(PROPERTY_VNC_PASSWORD, "IL9vs34d");
- // passwords are set post-boot, so auth failures are possible
- // from a race condition applying the password set script
- properties.setProperty("jclouds.ssh.max-retries", "7");
- properties.setProperty("jclouds.ssh.retry-auth", "true");
- return properties;
- }
-
- public CloudSigmaPropertiesBuilder(Properties properties) {
- super(properties);
- }
-
-}
diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/CloudSigmaComputeServiceAdapter.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/CloudSigmaComputeServiceAdapter.java
index 1652168653..52ade29acf 100644
--- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/CloudSigmaComputeServiceAdapter.java
+++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/CloudSigmaComputeServiceAdapter.java
@@ -140,7 +140,7 @@ public class CloudSigmaComputeServiceAdapter implements
@Override
public Iterable listHardwareProfiles() {
- Builder hardware = ImmutableSet. builder();
+ Builder hardware = ImmutableSet.builder();
for (double cpu : new double[] { 1000, 5000, 10000, 20000 })
for (int ram : new int[] { 512, 1024, 4 * 1024, 16 * 1024, 32 * 1024 }) {
final float size = (float) cpu / 100;
diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/config/CloudSigmaComputeServiceContextModule.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/config/CloudSigmaComputeServiceContextModule.java
index 6d596eaffd..51afbb8c76 100644
--- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/config/CloudSigmaComputeServiceContextModule.java
+++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/config/CloudSigmaComputeServiceContextModule.java
@@ -23,7 +23,6 @@ import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import javax.inject.Singleton;
-import org.jclouds.cloudsigma.CloudSigmaAsyncClient;
import org.jclouds.cloudsigma.CloudSigmaClient;
import org.jclouds.cloudsigma.compute.CloudSigmaComputeServiceAdapter;
import org.jclouds.cloudsigma.compute.CloudSigmaTemplateBuilderImpl;
@@ -68,13 +67,8 @@ import com.google.inject.TypeLiteral;
*
* @author Adrian Cole
*/
-public class CloudSigmaComputeServiceContextModule
- extends
- ComputeServiceAdapterContextModule {
-
- public CloudSigmaComputeServiceContextModule() {
- super(CloudSigmaClient.class, CloudSigmaAsyncClient.class);
- }
+public class CloudSigmaComputeServiceContextModule extends
+ ComputeServiceAdapterContextModule {
@Override
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/functions/PreinstalledDiskToImage.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/functions/PreinstalledDiskToImage.java
index 5439b5d0ad..356fc1bec9 100644
--- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/functions/PreinstalledDiskToImage.java
+++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/functions/PreinstalledDiskToImage.java
@@ -25,8 +25,8 @@ import org.jclouds.cloudsigma.domain.DriveInfo;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.ImageBuilder;
import org.jclouds.compute.domain.OperatingSystem;
-import org.jclouds.compute.domain.OperatingSystem.Builder;
import org.jclouds.compute.domain.OsFamilyVersion64Bit;
+import org.jclouds.compute.domain.OperatingSystem.Builder;
import org.jclouds.domain.Location;
import com.google.common.base.Function;
diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/config/CloudSigmaRestClientModule.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/config/CloudSigmaRestClientModule.java
index b933c221e3..ce17878825 100644
--- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/config/CloudSigmaRestClientModule.java
+++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/config/CloudSigmaRestClientModule.java
@@ -33,14 +33,13 @@ import org.jclouds.cloudsigma.domain.ServerMetrics;
import org.jclouds.cloudsigma.functions.BaseDriveToMap;
import org.jclouds.cloudsigma.functions.DriveDataToMap;
import org.jclouds.cloudsigma.functions.MapToDevices;
-import org.jclouds.cloudsigma.functions.MapToDevices.DeviceToId;
import org.jclouds.cloudsigma.functions.MapToDriveMetrics;
import org.jclouds.cloudsigma.functions.MapToNICs;
import org.jclouds.cloudsigma.functions.MapToServerMetrics;
import org.jclouds.cloudsigma.functions.ServerToMap;
+import org.jclouds.cloudsigma.functions.MapToDevices.DeviceToId;
import org.jclouds.cloudsigma.handlers.CloudSigmaErrorHandler;
import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.RequiresHttp;
import org.jclouds.http.annotation.ClientError;
import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError;
@@ -55,7 +54,6 @@ import com.google.inject.TypeLiteral;
*
* @author Adrian Cole
*/
-@RequiresHttp
@ConfiguresRestClient
public class CloudSigmaRestClientModule extends RestClientModule {
diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/functions/MapToDevices.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/functions/MapToDevices.java
index 709786f360..a0a6b11fef 100644
--- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/functions/MapToDevices.java
+++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/functions/MapToDevices.java
@@ -31,8 +31,8 @@ import org.jclouds.cloudsigma.domain.SCSIDevice;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.ImmutableSet.Builder;
import com.google.common.collect.Maps;
+import com.google.common.collect.ImmutableSet.Builder;
/**
*
diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/functions/MapToDriveMetrics.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/functions/MapToDriveMetrics.java
index 345321567f..8aff9137e4 100644
--- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/functions/MapToDriveMetrics.java
+++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/functions/MapToDriveMetrics.java
@@ -36,7 +36,7 @@ import com.google.common.collect.ImmutableMap.Builder;
public class MapToDriveMetrics implements Function