diff --git a/labs/cloudidentity/pom.xml b/labs/cloudidentity/pom.xml new file mode 100644 index 0000000000..ec218143c2 --- /dev/null +++ b/labs/cloudidentity/pom.xml @@ -0,0 +1,121 @@ + + + + 4.0.0 + + org.jclouds + jclouds-project + 1.5.0-SNAPSHOT + ../../project/pom.xml + + org.jclouds.labs + cloudidentity + jcloud cloudidentity api + jclouds components to access an implementation of Rackspace Cloud Identity + bundle + + + + https://identity.api.rackspacecloud.com + + 2.0 + + 413274:${test.rackspace-us.identity} + ${test.rackspace-us.credential} + RAX-KSKEY:apiKeyCredentials + + org.jclouds.cloudidentity.v2_0*;version="${project.version}" + + org.jclouds.rest.internal;version="${project.version}", + org.jclouds*;version="${project.version}", + * + + + + + + org.jclouds.api + openstack-keystone + ${project.version} + + + org.jclouds + jclouds-core + ${project.version} + test-jar + test + + + org.jclouds.api + openstack-keystone + ${project.version} + test-jar + test + + + org.jclouds.driver + jclouds-slf4j + ${project.version} + test + + + ch.qos.logback + logback-classic + 1.0.0 + test + + + + + + live + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration + integration-test + + test + + + + ${test.cloudidentity.endpoint} + ${test.cloudidentity.api-version} + ${test.cloudidentity.build-version} + ${test.cloudidentity.identity} + ${test.cloudidentity.credential} + ${test.jclouds.keystone.credential-type} + + + + + + + + + + + diff --git a/labs/cloudidentity/src/main/java/org/jclouds/cloudidentity/v2_0/CloudIdentityApiMetadata.java b/labs/cloudidentity/src/main/java/org/jclouds/cloudidentity/v2_0/CloudIdentityApiMetadata.java new file mode 100644 index 0000000000..4a22b27a55 --- /dev/null +++ b/labs/cloudidentity/src/main/java/org/jclouds/cloudidentity/v2_0/CloudIdentityApiMetadata.java @@ -0,0 +1,103 @@ +package org.jclouds.cloudidentity.v2_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. + */ + + +import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE; + +import java.net.URI; +import java.util.Properties; + +import org.jclouds.apis.ApiMetadata; +import org.jclouds.cloudidentity.v2_0.config.CloudIdentityCredentialTypes; +import org.jclouds.cloudidentity.v2_0.config.CloudIdentityRestClientModule; +import org.jclouds.openstack.keystone.v2_0.KeystoneApiMetadata; +import org.jclouds.openstack.keystone.v2_0.KeystoneAsyncClient; +import org.jclouds.openstack.keystone.v2_0.KeystoneClient; +import org.jclouds.rest.RestContext; + +import com.google.common.collect.ImmutableSet; +import com.google.common.reflect.TypeToken; +import com.google.inject.Module; + +/** + * Implementation of {@link ApiMetadata} for the Rackspace Cloud Identity Service + * + * @author Adrian Cole + */ +public class CloudIdentityApiMetadata extends KeystoneApiMetadata { + + /** The serialVersionUID */ + private static final long serialVersionUID = -1572520638079261710L; + + public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { + private static final long serialVersionUID = -5070937833892503232L; + }; + + private static Builder builder() { + return new Builder(); + } + + @Override + public Builder toBuilder() { + return builder().fromApiMetadata(this); + } + + public CloudIdentityApiMetadata() { + this(builder()); + } + + protected CloudIdentityApiMetadata(Builder builder) { + super(builder); + } + + public static Properties defaultProperties() { + Properties properties = KeystoneApiMetadata.defaultProperties(); + properties.setProperty(CREDENTIAL_TYPE, CloudIdentityCredentialTypes.API_KEY_CREDENTIALS); + + return properties; + } + + public static class Builder extends KeystoneApiMetadata.Builder { + protected Builder(){ + super(KeystoneClient.class, KeystoneAsyncClient.class); + id("cloudidentity") + .name("Rackspace Cloud Identity Service") + .defaultEndpoint("https://identity.api.rackspacecloud.com") + .identityName("username") + .credentialName("API Key") + .defaultProperties(CloudIdentityApiMetadata.defaultProperties()) + .context(CONTEXT_TOKEN) + .documentation(URI.create("http://docs.rackspace.com/auth/api/v2.0/auth-client-devguide/")) + .defaultModules(ImmutableSet.>of(CloudIdentityRestClientModule.class)); + } + + @Override + public CloudIdentityApiMetadata build() { + return new CloudIdentityApiMetadata(this); + } + + @Override + public Builder fromApiMetadata(ApiMetadata in) { + super.fromApiMetadata(in); + return this; + } + } + +} \ No newline at end of file diff --git a/labs/cloudidentity/src/main/java/org/jclouds/cloudidentity/v2_0/CloudIdentityAuthenticationAsyncClient.java b/labs/cloudidentity/src/main/java/org/jclouds/cloudidentity/v2_0/CloudIdentityAuthenticationAsyncClient.java new file mode 100644 index 0000000000..4215daa977 --- /dev/null +++ b/labs/cloudidentity/src/main/java/org/jclouds/cloudidentity/v2_0/CloudIdentityAuthenticationAsyncClient.java @@ -0,0 +1,71 @@ +/** + * 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.cloudidentity.v2_0; + +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.core.MediaType; + +import org.jclouds.cloudidentity.v2_0.domain.ApiKeyCredentials; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.openstack.keystone.v2_0.AuthenticationAsyncClient; +import org.jclouds.openstack.keystone.v2_0.binders.BindAuthToJsonPayload; +import org.jclouds.openstack.keystone.v2_0.domain.Access; +import org.jclouds.rest.annotations.MapBinder; +import org.jclouds.rest.annotations.PayloadParam; +import org.jclouds.rest.annotations.SelectJson; + +import com.google.common.util.concurrent.ListenableFuture; + +/** + * Provides asynchronous access to Service via their REST API. + *

+ * + * @see AuthenticationClient + * @see + * @author Adrian Cole + */ +@Path("/v2.0") +public interface CloudIdentityAuthenticationAsyncClient extends AuthenticationAsyncClient { + + /** + * @see CloudIdentityAuthenticationAsyncClient#authenticateWithTenantNameAndCredentials(String,ApiKeyCredentials) + */ + @POST + @SelectJson("access") + @Consumes(MediaType.APPLICATION_JSON) + @Path("/tokens") + @MapBinder(BindAuthToJsonPayload.class) + ListenableFuture authenticateWithTenantNameAndCredentials(@Nullable @PayloadParam("tenantName") String tenantName, + ApiKeyCredentials apiKeyCredentials); + + /** + * @see CloudIdentityAuthenticationAsyncClient#authenticateWithTenantIdAndCredentials(String,ApiKeyCredentials) + */ + @POST + @SelectJson("access") + @Consumes(MediaType.APPLICATION_JSON) + @Path("/tokens") + @MapBinder(BindAuthToJsonPayload.class) + ListenableFuture authenticateWithTenantIdAndCredentials(@Nullable @PayloadParam("tenantId") String tenantId, + ApiKeyCredentials apiKeyCredentials); + +} diff --git a/labs/cloudidentity/src/main/java/org/jclouds/cloudidentity/v2_0/CloudIdentityAuthenticationClient.java b/labs/cloudidentity/src/main/java/org/jclouds/cloudidentity/v2_0/CloudIdentityAuthenticationClient.java new file mode 100644 index 0000000000..c9533d86b8 --- /dev/null +++ b/labs/cloudidentity/src/main/java/org/jclouds/cloudidentity/v2_0/CloudIdentityAuthenticationClient.java @@ -0,0 +1,56 @@ +/** + * 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.cloudidentity.v2_0; + +import java.util.concurrent.TimeUnit; + +import org.jclouds.cloudidentity.v2_0.domain.ApiKeyCredentials; +import org.jclouds.concurrent.Timeout; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.openstack.keystone.v2_0.AuthenticationAsyncClient; +import org.jclouds.openstack.keystone.v2_0.AuthenticationClient; +import org.jclouds.openstack.keystone.v2_0.domain.Access; + +/** + * Provides synchronous access to the KeyStone Service API. + *

+ * + * @see AuthenticationAsyncClient + * @see + * @author Adrian Cole + */ +@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS) +public interface CloudIdentityAuthenticationClient extends AuthenticationClient { + + /** + * Authenticate to generate a token. + * + * @return access with token + */ + Access authenticateWithTenantNameAndCredentials(@Nullable String tenantId, ApiKeyCredentials apiKeyCredentials); + + /** + * Authenticate to generate a token. + * + * @return access with token + */ + Access authenticateWithTenantIdAndCredentials(@Nullable String tenantId, ApiKeyCredentials apiKeyCredentials); + +} \ No newline at end of file diff --git a/labs/cloudidentity/src/main/java/org/jclouds/cloudidentity/v2_0/config/CloudIdentityAuthenticationModule.java b/labs/cloudidentity/src/main/java/org/jclouds/cloudidentity/v2_0/config/CloudIdentityAuthenticationModule.java new file mode 100644 index 0000000000..a4fa64a0da --- /dev/null +++ b/labs/cloudidentity/src/main/java/org/jclouds/cloudidentity/v2_0/config/CloudIdentityAuthenticationModule.java @@ -0,0 +1,95 @@ +/** + * 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.cloudidentity.v2_0.config; + +import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient; + +import java.util.Map; + +import org.jclouds.cloudidentity.v2_0.CloudIdentityAuthenticationAsyncClient; +import org.jclouds.cloudidentity.v2_0.CloudIdentityAuthenticationClient; +import org.jclouds.cloudidentity.v2_0.functions.AuthenticateApiKeyCredentials; +import org.jclouds.domain.Credentials; +import org.jclouds.openstack.keystone.v2_0.AuthenticationAsyncClient; +import org.jclouds.openstack.keystone.v2_0.AuthenticationClient; +import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes; +import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule; +import org.jclouds.openstack.keystone.v2_0.domain.Access; +import org.jclouds.openstack.keystone.v2_0.functions.AuthenticatePasswordCredentials; + +import com.google.common.base.Function; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.ImmutableSet.Builder; +import com.google.inject.Injector; +import com.google.inject.Module; +import com.google.inject.Scopes; + +/** + * + * @author Adrian Cole + */ +public class CloudIdentityAuthenticationModule extends KeystoneAuthenticationModule { + + public CloudIdentityAuthenticationModule() { + this(new RegionModule()); + } + + protected CloudIdentityAuthenticationModule(Module locationModule) { + super(locationModule); + } + + public static class CloudIdentityAuthenticationModuleForRegions extends CloudIdentityAuthenticationModule { + public CloudIdentityAuthenticationModuleForRegions() { + super(new RegionModule()); + } + } + + public static Module forRegions() { + return new CloudIdentityAuthenticationModuleForRegions(); + } + + public static class CloudIdentityAuthenticationModuleForZones extends CloudIdentityAuthenticationModule { + public CloudIdentityAuthenticationModuleForZones() { + super(new ZoneModule()); + } + } + + public static Module forZones() { + return new CloudIdentityAuthenticationModuleForZones(); + } + + @Override + protected void bindAuthenticationClient() { + // AuthenticationClient is used directly for filters and retry handlers, so let's bind it + // explicitly + bindClientAndAsyncClient(binder(), CloudIdentityAuthenticationClient.class, + CloudIdentityAuthenticationAsyncClient.class); + bind(AuthenticationClient.class).to(CloudIdentityAuthenticationClient.class).in(Scopes.SINGLETON); + bind(AuthenticationAsyncClient.class).to(CloudIdentityAuthenticationAsyncClient.class).in(Scopes.SINGLETON); + } + + @Override + protected Map> authenticationMethods(Injector i) { + Builder> fns = ImmutableSet.> builder(); + fns.add(i.getInstance(AuthenticatePasswordCredentials.class)); + fns.add(i.getInstance(AuthenticateApiKeyCredentials.class)); + return CredentialTypes.indexByCredentialType(fns.build()); + } + +} \ No newline at end of file diff --git a/labs/cloudidentity/src/main/java/org/jclouds/cloudidentity/v2_0/config/CloudIdentityCredentialTypes.java b/labs/cloudidentity/src/main/java/org/jclouds/cloudidentity/v2_0/config/CloudIdentityCredentialTypes.java new file mode 100644 index 0000000000..84dcd7c49e --- /dev/null +++ b/labs/cloudidentity/src/main/java/org/jclouds/cloudidentity/v2_0/config/CloudIdentityCredentialTypes.java @@ -0,0 +1,32 @@ +/** + * 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.cloudidentity.v2_0.config; + +import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes; + + +/** + * + * @author Adrian Cole + */ +public class CloudIdentityCredentialTypes extends CredentialTypes { + + public static final String API_KEY_CREDENTIALS = "RAX-KSKEY:apiKeyCredentials"; + +} diff --git a/labs/cloudidentity/src/main/java/org/jclouds/cloudidentity/v2_0/config/CloudIdentityRestClientModule.java b/labs/cloudidentity/src/main/java/org/jclouds/cloudidentity/v2_0/config/CloudIdentityRestClientModule.java new file mode 100644 index 0000000000..7f2065f91a --- /dev/null +++ b/labs/cloudidentity/src/main/java/org/jclouds/cloudidentity/v2_0/config/CloudIdentityRestClientModule.java @@ -0,0 +1,25 @@ +package org.jclouds.cloudidentity.v2_0.config; + +import org.jclouds.location.config.LocationModule; +import org.jclouds.openstack.keystone.v2_0.KeystoneAsyncClient; +import org.jclouds.openstack.keystone.v2_0.KeystoneClient; +import org.jclouds.openstack.keystone.v2_0.config.KeystoneRestClientModule; +import org.jclouds.rest.ConfiguresRestClient; + +/** + * Configures the Keystone connection. + * + * @author Adam Lowe + */ +@ConfiguresRestClient +public class CloudIdentityRestClientModule extends KeystoneRestClientModule { + + @Override + protected void installLocations() { + // TODO: select this from KeystoneProperties.VERSION; note you select from + // a guice provided property, so it will have to come from somewhere else, maybe we move + // this to the the ContextBuilder + install(CloudIdentityAuthenticationModule.forRegions()); + install(new LocationModule()); + } +} diff --git a/labs/cloudidentity/src/main/java/org/jclouds/cloudidentity/v2_0/domain/ApiKeyCredentials.java b/labs/cloudidentity/src/main/java/org/jclouds/cloudidentity/v2_0/domain/ApiKeyCredentials.java new file mode 100644 index 0000000000..b44ae50538 --- /dev/null +++ b/labs/cloudidentity/src/main/java/org/jclouds/cloudidentity/v2_0/domain/ApiKeyCredentials.java @@ -0,0 +1,125 @@ +/** + * 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.cloudidentity.v2_0.domain; + +import static com.google.common.base.Objects.equal; +import static com.google.common.base.Objects.toStringHelper; +import static com.google.common.base.Preconditions.checkNotNull; + +import org.jclouds.cloudidentity.v2_0.config.CloudIdentityCredentialTypes; +import org.jclouds.openstack.keystone.v2_0.config.CredentialType; + +import com.google.common.base.Objects; + +/** + * ApiKey Credentials + * + * @see docs + + * @author Adrian Cole + */ +@CredentialType(CloudIdentityCredentialTypes.API_KEY_CREDENTIALS) +public class ApiKeyCredentials { + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + return builder().fromApiKeyCredentials(this); + } + + public static ApiKeyCredentials createWithUsernameAndApiKey(String username, String apiKey) { + return builder().apiKey(apiKey).username(username).build(); + } + + public static class Builder { + protected String username; + protected String apiKey; + + /** + * @see ApiKeyCredentials#getUsername() + */ + protected Builder apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * @see ApiKeyCredentials#getApiKey() + */ + public Builder username(String username) { + this.username = username; + return this; + } + + public ApiKeyCredentials build() { + return new ApiKeyCredentials(username, apiKey); + } + + public Builder fromApiKeyCredentials(ApiKeyCredentials from) { + return username(from.getUsername()).apiKey(from.getApiKey()); + } + } + + protected final String username; + protected final String apiKey; + + protected ApiKeyCredentials(String username, String apiKey) { + this.username = checkNotNull(username, "username"); + this.apiKey = checkNotNull(apiKey, "apiKey"); + } + + /** + * @return the username + */ + public String getUsername() { + return username; + } + + /** + * @return the apiKey + */ + public String getApiKey() { + return apiKey; + } + + @Override + public boolean equals(Object object) { + if (this == object) { + return true; + } + if (object instanceof ApiKeyCredentials) { + final ApiKeyCredentials other = ApiKeyCredentials.class.cast(object); + return equal(username, other.username) && equal(apiKey, other.apiKey); + } else { + return false; + } + } + + @Override + public int hashCode() { + return Objects.hashCode(username, apiKey); + } + + @Override + public String toString() { + return toStringHelper("").add("username", username).add("apiKey", apiKey).toString(); + } + +} diff --git a/labs/cloudidentity/src/main/java/org/jclouds/cloudidentity/v2_0/functions/AuthenticateApiKeyCredentials.java b/labs/cloudidentity/src/main/java/org/jclouds/cloudidentity/v2_0/functions/AuthenticateApiKeyCredentials.java new file mode 100644 index 0000000000..58d8ec8867 --- /dev/null +++ b/labs/cloudidentity/src/main/java/org/jclouds/cloudidentity/v2_0/functions/AuthenticateApiKeyCredentials.java @@ -0,0 +1,66 @@ +/** + * 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.cloudidentity.v2_0.functions; + +import javax.inject.Inject; +import javax.inject.Singleton; + +import org.jclouds.cloudidentity.v2_0.CloudIdentityAuthenticationClient; +import org.jclouds.cloudidentity.v2_0.config.CloudIdentityCredentialTypes; +import org.jclouds.cloudidentity.v2_0.domain.ApiKeyCredentials; +import org.jclouds.openstack.keystone.v2_0.config.CredentialType; +import org.jclouds.openstack.keystone.v2_0.domain.Access; +import org.jclouds.openstack.keystone.v2_0.functions.internal.BaseAuthenticator; + +/** + * + * @author Adrian Cole + * @see docs + */ +@CredentialType(CloudIdentityCredentialTypes.API_KEY_CREDENTIALS) +@Singleton +public class AuthenticateApiKeyCredentials extends BaseAuthenticator { + protected final CloudIdentityAuthenticationClient client; + + @Inject + public AuthenticateApiKeyCredentials(CloudIdentityAuthenticationClient client) { + this.client = client; + } + + @Override + protected Access authenticateWithTenantNameOrNull(String tenantId, ApiKeyCredentials apiKeyCredentials) { + return client.authenticateWithTenantNameAndCredentials(tenantId, apiKeyCredentials); + } + + @Override + protected Access authenticateWithTenantId(String tenantId, ApiKeyCredentials apiKeyCredentials) { + return client.authenticateWithTenantIdAndCredentials(tenantId, apiKeyCredentials); + } + + @Override + public ApiKeyCredentials createCredentials(String identity, String credential) { + return ApiKeyCredentials.createWithUsernameAndApiKey(identity, credential); + } + + @Override + public String toString() { + return "authenticateApiKeyCredentials()"; + } +} \ No newline at end of file diff --git a/labs/cloudidentity/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata b/labs/cloudidentity/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata new file mode 100644 index 0000000000..82996dbf10 --- /dev/null +++ b/labs/cloudidentity/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata @@ -0,0 +1 @@ +org.jclouds.cloudidentity.v2_0.CloudIdentityApiMetadata diff --git a/labs/cloudidentity/src/test/java/org/jclouds/cloudidentity/v2_0/CloudIdentityApiMetadataTest.java b/labs/cloudidentity/src/test/java/org/jclouds/cloudidentity/v2_0/CloudIdentityApiMetadataTest.java new file mode 100644 index 0000000000..b87885a2b3 --- /dev/null +++ b/labs/cloudidentity/src/test/java/org/jclouds/cloudidentity/v2_0/CloudIdentityApiMetadataTest.java @@ -0,0 +1,39 @@ +/** + * 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.cloudidentity.v2_0; + +import org.jclouds.View; +import org.jclouds.rest.internal.BaseRestApiMetadataTest; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; +import com.google.common.reflect.TypeToken; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "unit", testName = "CloudIdentityApiMetadataTest") +public class CloudIdentityApiMetadataTest extends BaseRestApiMetadataTest { + + // no identity abstraction, yet + public CloudIdentityApiMetadataTest() { + super(new CloudIdentityApiMetadata(), ImmutableSet.> of()); + } +} diff --git a/labs/cloudidentity/src/test/java/org/jclouds/cloudidentity/v2_0/CloudIdentityClientLiveTest.java b/labs/cloudidentity/src/test/java/org/jclouds/cloudidentity/v2_0/CloudIdentityClientLiveTest.java new file mode 100644 index 0000000000..7d4f69cd24 --- /dev/null +++ b/labs/cloudidentity/src/test/java/org/jclouds/cloudidentity/v2_0/CloudIdentityClientLiveTest.java @@ -0,0 +1,33 @@ +/** + * 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 1.1 (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-1.1 + * + * 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.cloudidentity.v2_0; + +import org.jclouds.openstack.keystone.v2_0.KeystoneClientLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", testName = "CloudIdentityClientLiveTest", singleThreaded = true) +public class CloudIdentityClientLiveTest extends KeystoneClientLiveTest { + public CloudIdentityClientLiveTest() { + provider = "cloudidentity"; + } +} \ No newline at end of file diff --git a/labs/cloudidentity/src/test/java/org/jclouds/cloudidentity/v2_0/features/CloudIdentityTenantClientLiveTest.java b/labs/cloudidentity/src/test/java/org/jclouds/cloudidentity/v2_0/features/CloudIdentityTenantClientLiveTest.java new file mode 100644 index 0000000000..394eff99a6 --- /dev/null +++ b/labs/cloudidentity/src/test/java/org/jclouds/cloudidentity/v2_0/features/CloudIdentityTenantClientLiveTest.java @@ -0,0 +1,33 @@ +/** + * 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 1.1 (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-1.1 + * + * 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.cloudidentity.v2_0.features; + +import org.jclouds.openstack.keystone.v2_0.features.TenantClientLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", testName = "CloudIdentityTenantClientLiveTest", singleThreaded = true) +public class CloudIdentityTenantClientLiveTest extends TenantClientLiveTest { + public CloudIdentityTenantClientLiveTest() { + provider = "cloudidentity"; + } +} \ No newline at end of file diff --git a/labs/cloudidentity/src/test/java/org/jclouds/cloudidentity/v2_0/features/CloudIdentityTokenClientLiveTest.java b/labs/cloudidentity/src/test/java/org/jclouds/cloudidentity/v2_0/features/CloudIdentityTokenClientLiveTest.java new file mode 100644 index 0000000000..d219ddfe49 --- /dev/null +++ b/labs/cloudidentity/src/test/java/org/jclouds/cloudidentity/v2_0/features/CloudIdentityTokenClientLiveTest.java @@ -0,0 +1,33 @@ +/** + * 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 1.1 (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-1.1 + * + * 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.cloudidentity.v2_0.features; + +import org.jclouds.openstack.keystone.v2_0.features.TokenClientLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", testName = "CloudIdentityTokenClientLiveTest", singleThreaded = true) +public class CloudIdentityTokenClientLiveTest extends TokenClientLiveTest { + public CloudIdentityTokenClientLiveTest() { + provider = "cloudidentity"; + } +} \ No newline at end of file diff --git a/labs/cloudidentity/src/test/java/org/jclouds/cloudidentity/v2_0/features/CloudIdentityUserClientLiveTest.java b/labs/cloudidentity/src/test/java/org/jclouds/cloudidentity/v2_0/features/CloudIdentityUserClientLiveTest.java new file mode 100644 index 0000000000..e2b477f12f --- /dev/null +++ b/labs/cloudidentity/src/test/java/org/jclouds/cloudidentity/v2_0/features/CloudIdentityUserClientLiveTest.java @@ -0,0 +1,33 @@ +/** + * 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 1.1 (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-1.1 + * + * 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.cloudidentity.v2_0.features; + +import org.jclouds.openstack.keystone.v2_0.features.UserClientLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", testName = "CloudIdentityUserClientLiveTest", singleThreaded = true) +public class CloudIdentityUserClientLiveTest extends UserClientLiveTest { + public CloudIdentityUserClientLiveTest() { + provider = "cloudidentity"; + } +} \ No newline at end of file diff --git a/labs/cloudservers-nova-us/pom.xml b/labs/cloudservers-nova-us/pom.xml new file mode 100644 index 0000000000..bc872a211e --- /dev/null +++ b/labs/cloudservers-nova-us/pom.xml @@ -0,0 +1,150 @@ + + + + 4.0.0 + + org.jclouds + jclouds-project + 1.5.0-SNAPSHOT + ../../project/pom.xml + + org.jclouds.labs + cloudservers-nova-us + jclouds Rackspace Next Generation Cloud Servers provider + OpenStack Nova implementation targeted to Rackspace Next Generation Cloud Servers + bundle + + + https://identity.api.rackspacecloud.com + 2 + + ${test.rackspace-us.identity} + ${test.rackspace-us.credential} + + + + + org.jclouds.cloudservers_nova.us*;version="${project.version}" + + org.jclouds.compute.internal;version="${project.version}", + org.jclouds.rest.internal;version="${project.version}", + org.jclouds*;version="${project.version}", + * + + + + + + org.jclouds.labs + cloudidentity + ${project.version} + + + org.jclouds.api + openstack-nova + ${project.version} + + + org.jclouds + jclouds-core + ${project.version} + test-jar + test + + + org.jclouds + jclouds-compute + ${project.version} + test-jar + test + + + org.jclouds.labs + cloudidentity + ${project.version} + test-jar + test + + + org.jclouds.api + openstack-nova + ${project.version} + test-jar + test + + + org.jclouds.driver + jclouds-slf4j + ${project.version} + test + + + org.jclouds.driver + jclouds-sshj + ${project.version} + test + + + ch.qos.logback + logback-classic + 1.0.0 + test + + + + + + live + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration + integration-test + + test + + + 1 + + ${test.cloudservers-nova-us.endpoint} + ${test.cloudservers-nova-us.api-version} + ${test.cloudservers-nova-us.build-version} + ${test.cloudservers-nova-us.identity} + ${test.cloudservers-nova-us.credential} + ${test.cloudservers-nova-us.image-id} + ${test.cloudservers-nova-us.image.login-user} + ${test.cloudservers-nova-us.image.authenticate-sudo} + + + + + + + + + + + diff --git a/labs/cloudservers-nova-us/src/main/java/org/jclouds/cloudservers_nova/us/CloudServersUSProviderMetadata.java b/labs/cloudservers-nova-us/src/main/java/org/jclouds/cloudservers_nova/us/CloudServersUSProviderMetadata.java new file mode 100644 index 0000000000..a704cf79dd --- /dev/null +++ b/labs/cloudservers-nova-us/src/main/java/org/jclouds/cloudservers_nova/us/CloudServersUSProviderMetadata.java @@ -0,0 +1,109 @@ +/** + * 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_nova.us; + +import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_TERMINATED; +import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE; +import static org.jclouds.openstack.nova.v1_1.config.NovaProperties.AUTO_ALLOCATE_FLOATING_IPS; +import static org.jclouds.openstack.nova.v1_1.config.NovaProperties.AUTO_GENERATE_KEYPAIRS; + +import java.net.URI; +import java.util.Properties; + +import org.jclouds.cloudidentity.v2_0.config.CloudIdentityCredentialTypes; +import org.jclouds.cloudidentity.v2_0.config.CloudIdentityAuthenticationModule.CloudIdentityAuthenticationModuleForZones; +import org.jclouds.openstack.nova.v1_1.NovaApiMetadata; +import org.jclouds.openstack.nova.v1_1.compute.config.NovaComputeServiceContextModule; +import org.jclouds.openstack.nova.v1_1.config.NovaRestClientModule; +import org.jclouds.providers.ProviderMetadata; +import org.jclouds.providers.internal.BaseProviderMetadata; + +import com.google.common.collect.ImmutableSet; +import com.google.inject.Module; + +/** + * Implementation of {@link org.jclouds.types.ProviderMetadata} for Rackspace Next Generation Cloud Servers. + * + * @author Adrian Cole + */ +public class CloudServersUSProviderMetadata extends BaseProviderMetadata { + + /** The serialVersionUID */ + private static final long serialVersionUID = -300987074165012648L; + + public static Builder builder() { + return new Builder(); + } + + @Override + public Builder toBuilder() { + return builder().fromProviderMetadata(this); + } + + public CloudServersUSProviderMetadata() { + super(builder()); + } + + public CloudServersUSProviderMetadata(Builder builder) { + super(builder); + } + + public static Properties defaultProperties() { + Properties properties = new Properties(); + properties.setProperty(CREDENTIAL_TYPE, CloudIdentityCredentialTypes.API_KEY_CREDENTIALS); + + // deallocating ip addresses can take a while + properties.setProperty(TIMEOUT_NODE_TERMINATED, 60 * 1000 + ""); + properties.setProperty(AUTO_ALLOCATE_FLOATING_IPS, "true"); + properties.setProperty(AUTO_GENERATE_KEYPAIRS, "true"); + return properties; + } + + public static class Builder extends BaseProviderMetadata.Builder { + + protected Builder(){ + id("cloudservers-nova-us") + .name("Rackspace Next Generation Cloud Servers") + .apiMetadata(new NovaApiMetadata().toBuilder() + .identityName("username") + .credentialName("API Key") + .version("2") + .documentation(URI.create("http://docs.rackspace.com/servers/api/v2/cs-devguide/content/ch_preface.html#webhelp-currentid")) + .defaultModules(ImmutableSet.>of(CloudIdentityAuthenticationModuleForZones.class, NovaRestClientModule.class, NovaComputeServiceContextModule.class)) + .build()) + .homepage(URI.create("http://www.rackspace.com/cloud/nextgen")) + .console(URI.create("https://mycloud.rackspace.com")) + .linkedServices("cloudservers-nova-us", "cloudfiles-swift-us") + .iso3166Codes("US-IL", "US-TX") + .endpoint("https://identity.api.rackspacecloud.com") + .defaultProperties(CloudServersUSProviderMetadata.defaultProperties()); + } + + @Override + public CloudServersUSProviderMetadata build() { + return new CloudServersUSProviderMetadata(this); + } + + @Override + public Builder fromProviderMetadata(ProviderMetadata in) { + super.fromProviderMetadata(in); + return this; + } + } +} diff --git a/labs/cloudservers-nova-us/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata b/labs/cloudservers-nova-us/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata new file mode 100644 index 0000000000..720076428f --- /dev/null +++ b/labs/cloudservers-nova-us/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata @@ -0,0 +1 @@ +org.jclouds.cloudservers_nova.us.CloudServersUSProviderMetadata diff --git a/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/CloudServersUSProviderTest.java b/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/CloudServersUSProviderTest.java new file mode 100644 index 0000000000..be17d28fee --- /dev/null +++ b/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/CloudServersUSProviderTest.java @@ -0,0 +1,52 @@ +/** + * 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 computee 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. + */ +/** + * + * + * ==================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not computee 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_nova.us; + +import org.jclouds.openstack.nova.v1_1.NovaApiMetadata; +import org.jclouds.providers.internal.BaseProviderMetadataTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "unit", testName = "CloudServersUSProviderTest") +public class CloudServersUSProviderTest extends BaseProviderMetadataTest { + + public CloudServersUSProviderTest() { + super(new CloudServersUSProviderMetadata(), new NovaApiMetadata()); + } +} diff --git a/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/compute/CloudServersUSComputeServiceLiveTest.java b/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/compute/CloudServersUSComputeServiceLiveTest.java new file mode 100644 index 0000000000..18506ec2c9 --- /dev/null +++ b/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/compute/CloudServersUSComputeServiceLiveTest.java @@ -0,0 +1,34 @@ +/** + * 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 computee 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_nova.us.compute; + +import org.jclouds.openstack.nova.v1_1.compute.NovaComputeServiceLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", singleThreaded = true, testName = "CloudServersUSComputeServiceLiveTest") +public class CloudServersUSComputeServiceLiveTest extends NovaComputeServiceLiveTest { + + public CloudServersUSComputeServiceLiveTest() { + provider = "cloudservers-nova-us"; + } +} diff --git a/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/compute/CloudServersUSTemplateBuilderLiveTest.java b/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/compute/CloudServersUSTemplateBuilderLiveTest.java new file mode 100644 index 0000000000..c77f62f2ba --- /dev/null +++ b/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/compute/CloudServersUSTemplateBuilderLiveTest.java @@ -0,0 +1,89 @@ +/** + * 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 computee 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_nova.us.compute; + +import static org.jclouds.compute.util.ComputeServiceUtils.getCores; +import static org.testng.Assert.assertEquals; + +import java.util.Set; + +import org.jclouds.compute.domain.OsFamily; +import org.jclouds.compute.domain.OsFamilyVersion64Bit; +import org.jclouds.compute.domain.Template; +import org.jclouds.compute.internal.BaseTemplateBuilderLiveTest; +import org.jclouds.openstack.nova.v1_1.compute.options.NovaTemplateOptions; +import org.testng.annotations.Test; + +import com.google.common.base.Predicate; +import com.google.common.base.Predicates; +import com.google.common.collect.ImmutableSet; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", singleThreaded = true, testName = "CloudServersUSTemplateBuilderLiveTest") +public class CloudServersUSTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest { + + public CloudServersUSTemplateBuilderLiveTest() { + provider = "cloudservers-nova-us"; + } + + @Override + protected Predicate defineUnsupportedOperatingSystems() { + return Predicates.not(new Predicate() { + + @Override + public boolean apply(OsFamilyVersion64Bit input) { + switch (input.family) { + case UBUNTU: + return (input.version.equals("") || input.version.equals("12.04") || input.version.matches("^1[01].*")) && input.is64Bit; + case DEBIAN: + return input.is64Bit && !input.version.equals("5.0"); + case CENTOS: + return (input.version.equals("") || input.version.equals("5.6") || input.version.equals("6.0")) + && input.is64Bit; + default: + return false; + } + } + + }); + } + + @Test + public void testTemplateBuilder() { + Template defaultTemplate = this.view.getComputeService().templateBuilder().build(); + assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true); + assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "12.04"); + assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); + assertEquals(defaultTemplate.getImage().getName(), "Ubuntu Precise 12.04 LTS Server 64-bit 20120424"); + assertEquals(defaultTemplate.getImage().getDefaultCredentials().getUser(), "ubuntu"); + assertEquals(defaultTemplate.getLocation().getId(), "az-2.region-a.geo-1"); + assertEquals(defaultTemplate.getImage().getLocation().getId(), "az-2.region-a.geo-1"); + assertEquals(defaultTemplate.getHardware().getLocation().getId(), "az-2.region-a.geo-1"); + assertEquals(defaultTemplate.getOptions().as(NovaTemplateOptions.class).shouldAutoAssignFloatingIp(), true); + assertEquals(getCores(defaultTemplate.getHardware()), 1.0d); + } + + @Override + protected Set getIso3166Codes() { + return ImmutableSet. of("US-NV"); + } +} diff --git a/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/compute/extensions/CloudServersUSImageExtensionLivetest.java b/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/compute/extensions/CloudServersUSImageExtensionLivetest.java new file mode 100644 index 0000000000..0c4d3af76b --- /dev/null +++ b/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/compute/extensions/CloudServersUSImageExtensionLivetest.java @@ -0,0 +1,44 @@ +/** + * 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_nova.us.compute.extensions; + +import org.jclouds.compute.extensions.internal.BaseImageExtensionLiveTest; +import org.jclouds.sshj.config.SshjSshClientModule; +import org.testng.annotations.Test; + +import com.google.inject.Module; + +/** + * + * @author Adrian Cole + * + */ +@Test(groups = "live", singleThreaded = true, testName = "CloudServersUSImageExtensionLivetest") +public class CloudServersUSImageExtensionLivetest extends BaseImageExtensionLiveTest { + + public CloudServersUSImageExtensionLivetest() { + provider = "cloudservers-nova-us"; + } + + @Override + protected Module getSshModule() { + return new SshjSshClientModule(); + } +} diff --git a/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/features/CloudServersUSFlavorClientLiveTest.java b/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/features/CloudServersUSFlavorClientLiveTest.java new file mode 100644 index 0000000000..068211c21e --- /dev/null +++ b/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/features/CloudServersUSFlavorClientLiveTest.java @@ -0,0 +1,34 @@ +/** + * 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_nova.us.features; + +import org.jclouds.openstack.nova.v1_1.features.FlavorClientLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", testName = "CloudServersUSFlavorClientLiveTest") +public class CloudServersUSFlavorClientLiveTest extends FlavorClientLiveTest { + public CloudServersUSFlavorClientLiveTest() { + provider = "cloudservers-nova-us"; + } + +} diff --git a/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/features/CloudServersUSFloatingIPClientLiveTest.java b/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/features/CloudServersUSFloatingIPClientLiveTest.java new file mode 100644 index 0000000000..3ff3d1b18e --- /dev/null +++ b/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/features/CloudServersUSFloatingIPClientLiveTest.java @@ -0,0 +1,34 @@ +/** + * 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_nova.us.features; + +import org.jclouds.openstack.nova.v1_1.extensions.FloatingIPClientLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", testName = "CloudServersUSFloatingIPClientLiveTest") +public class CloudServersUSFloatingIPClientLiveTest extends FloatingIPClientLiveTest { + public CloudServersUSFloatingIPClientLiveTest() { + provider = "cloudservers-nova-us"; + } + +} diff --git a/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/features/CloudServersUSImageClientLiveTest.java b/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/features/CloudServersUSImageClientLiveTest.java new file mode 100644 index 0000000000..b6643d2153 --- /dev/null +++ b/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/features/CloudServersUSImageClientLiveTest.java @@ -0,0 +1,33 @@ +/** + * 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_nova.us.features; + +import org.jclouds.openstack.nova.v1_1.features.ImageClientLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", testName = "CloudServersUSImageClientLiveTest") +public class CloudServersUSImageClientLiveTest extends ImageClientLiveTest { + public CloudServersUSImageClientLiveTest() { + provider = "cloudservers-nova-us"; + } +} diff --git a/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/features/CloudServersUSKeyPairClientLiveTest.java b/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/features/CloudServersUSKeyPairClientLiveTest.java new file mode 100644 index 0000000000..6c56ca73a1 --- /dev/null +++ b/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/features/CloudServersUSKeyPairClientLiveTest.java @@ -0,0 +1,34 @@ +/** + * 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_nova.us.features; + +import org.jclouds.openstack.nova.v1_1.extensions.KeyPairClientLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", testName = "CloudServersUSKeyPairClientLiveTest") +public class CloudServersUSKeyPairClientLiveTest extends KeyPairClientLiveTest { + public CloudServersUSKeyPairClientLiveTest() { + provider = "cloudservers-nova-us"; + } + +} diff --git a/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/features/CloudServersUSSecurityGroupClientLiveTest.java b/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/features/CloudServersUSSecurityGroupClientLiveTest.java new file mode 100644 index 0000000000..c9fbe4b626 --- /dev/null +++ b/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/features/CloudServersUSSecurityGroupClientLiveTest.java @@ -0,0 +1,33 @@ +/** + * 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_nova.us.features; + +import org.jclouds.openstack.nova.v1_1.extensions.SecurityGroupClientLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", testName = "CloudServersUSSecurityGroupClientLiveTest") +public class CloudServersUSSecurityGroupClientLiveTest extends SecurityGroupClientLiveTest { + public CloudServersUSSecurityGroupClientLiveTest() { + provider = "cloudservers-nova-us"; + } +} diff --git a/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/features/CloudServersUSServerClientLiveTest.java b/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/features/CloudServersUSServerClientLiveTest.java new file mode 100644 index 0000000000..73168b44f7 --- /dev/null +++ b/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/features/CloudServersUSServerClientLiveTest.java @@ -0,0 +1,34 @@ +/** + * 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_nova.us.features; + +import org.jclouds.openstack.nova.v1_1.features.ServerClientLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", testName = "CloudServersUSServerClientLiveTest") +public class CloudServersUSServerClientLiveTest extends ServerClientLiveTest { + public CloudServersUSServerClientLiveTest() { + provider = "cloudservers-nova-us"; + } + +} diff --git a/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/features/CloudServersUSVolumeClientLiveTest.java b/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/features/CloudServersUSVolumeClientLiveTest.java new file mode 100644 index 0000000000..90c89c686a --- /dev/null +++ b/labs/cloudservers-nova-us/src/test/java/org/jclouds/cloudservers_nova/us/features/CloudServersUSVolumeClientLiveTest.java @@ -0,0 +1,34 @@ +/** + * 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_nova.us.features; + +import org.jclouds.openstack.nova.v1_1.extensions.VolumeClientLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", testName = "CloudServersUSVolumeClientLiveTest") +public class CloudServersUSVolumeClientLiveTest extends VolumeClientLiveTest { + public CloudServersUSVolumeClientLiveTest() { + provider = "cloudservers-nova-us"; + } + +} diff --git a/labs/pom.xml b/labs/pom.xml index bde7affc9e..fae08004c5 100644 --- a/labs/pom.xml +++ b/labs/pom.xml @@ -47,5 +47,7 @@ openstack-glance joyent-sdc openstack-quantum + cloudidentity + cloudservers-nova-us