diff --git a/labs/openstack-cinder/src/test/java/org/jclouds/openstack/cinder/v1/features/VolumeAndSnapshotApiLiveTest.java b/labs/openstack-cinder/src/test/java/org/jclouds/openstack/cinder/v1/features/VolumeAndSnapshotApiLiveTest.java index c203a87211..9db5c04bce 100644 --- a/labs/openstack-cinder/src/test/java/org/jclouds/openstack/cinder/v1/features/VolumeAndSnapshotApiLiveTest.java +++ b/labs/openstack-cinder/src/test/java/org/jclouds/openstack/cinder/v1/features/VolumeAndSnapshotApiLiveTest.java @@ -40,7 +40,7 @@ import com.google.common.collect.Iterables; /** * Tests behavior of VolumeApi - * + * * @author Everett Toews */ @Test(groups = "live", testName = "VolumeApiLiveTest", singleThreaded = true) @@ -74,7 +74,7 @@ public class VolumeAndSnapshotApiLiveTest extends BaseCinderApiLiveTest { public boolean apply(SnapshotApi snapshotApi) { return snapshotApi.get(testSnapshot.getId()) == null; } - }, 30 * 1000L).apply(snapshotApi)); + }, 300 * 1000L).apply(snapshotApi)); } if (testVolume != null) { @@ -84,7 +84,7 @@ public class VolumeAndSnapshotApiLiveTest extends BaseCinderApiLiveTest { public boolean apply(VolumeApi volumeApi) { return volumeApi.get(testVolume.getId()) == null; } - }, 30 * 1000L).apply(volumeApi)); + }, 300 * 1000L).apply(volumeApi)); } super.tearDownContext(); diff --git a/labs/pom.xml b/labs/pom.xml index 5140fc4c7f..d5759bace4 100644 --- a/labs/pom.xml +++ b/labs/pom.xml @@ -43,10 +43,8 @@ openstack-swift jenkins cdmi - openstack-glance joyent-cloudapi joyentcloud - openstack-quantum greenqloud-compute greenqloud-storage iam @@ -62,6 +60,10 @@ fgcp-de abiquo oauth + openstack-quantum + openstack-glance openstack-cinder + rackspace-cloudblockstorage-us + rackspace-cloudblockstorage-uk diff --git a/labs/rackspace-cloudblockstorage-uk/pom.xml b/labs/rackspace-cloudblockstorage-uk/pom.xml new file mode 100644 index 0000000000..fb372acf82 --- /dev/null +++ b/labs/rackspace-cloudblockstorage-uk/pom.xml @@ -0,0 +1,142 @@ + + + + 4.0.0 + + org.jclouds + jclouds-project + 1.6.0-SNAPSHOT + ../../project/pom.xml + + org.jclouds.labs + rackspace-cloudblockstorage-uk + jclouds Rackspace Next Generation Cloud Block Storage UK provider + OpenStack Cinder implementation targeted to Rackspace Next Generation Cloud Block Storage UK + bundle + + + https://lon.identity.api.rackspacecloud.com/v2.0/ + 1 + + ${test.rackspace-uk.identity} + ${test.rackspace-uk.credential} + + org.jclouds.rackspace.cloudblockstorage.uk*;version="${project.version}" + + org.jclouds.compute.internal;version="${project.version}", + org.jclouds.rest.internal;version="${project.version}", + org.jclouds*;version="${project.version}", + * + + + + + + org.jclouds + jclouds-core + ${project.version} + + + org.jclouds.labs + openstack-cinder + ${project.version} + + + org.jclouds.api + openstack-keystone + ${project.version} + + + org.jclouds.api + rackspace-cloudidentity + ${project.version} + + + org.jclouds + jclouds-core + ${project.version} + test-jar + test + + + org.jclouds.labs + openstack-cinder + ${project.version} + test-jar + test + + + org.jclouds.api + openstack-keystone + ${project.version} + test-jar + test + + + org.jclouds.api + rackspace-cloudidentity + ${project.version} + test-jar + test + + + ch.qos.logback + logback-classic + test + + + + + + live + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration + integration-test + + test + + + 1 + + ${test.rackspace-cloudblockstorage-uk.endpoint} + ${test.rackspace-cloudblockstorage-uk.api-version} + ${test.rackspace-cloudblockstorage-uk.build-version} + ${test.rackspace-cloudblockstorage-uk.identity} + ${test.rackspace-cloudblockstorage-uk.credential} + ${test.rackspace-cloudblockstorage-uk.template} + + + + + + + + + + + diff --git a/labs/rackspace-cloudblockstorage-uk/src/main/java/org/jclouds/rackspace/cloudblockstorage/uk/CloudBlockStorageUKProviderMetadata.java b/labs/rackspace-cloudblockstorage-uk/src/main/java/org/jclouds/rackspace/cloudblockstorage/uk/CloudBlockStorageUKProviderMetadata.java new file mode 100644 index 0000000000..62cc75035c --- /dev/null +++ b/labs/rackspace-cloudblockstorage-uk/src/main/java/org/jclouds/rackspace/cloudblockstorage/uk/CloudBlockStorageUKProviderMetadata.java @@ -0,0 +1,111 @@ +/** + * 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.rackspace.cloudblockstorage.uk; + +import static org.jclouds.location.reference.LocationConstants.ISO3166_CODES; +import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONE; +import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONES; +import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE; + +import java.net.URI; +import java.util.Properties; + +import org.jclouds.openstack.cinder.v1.CinderApiMetadata; +import org.jclouds.openstack.cinder.v1.config.CinderParserModule; +import org.jclouds.openstack.cinder.v1.config.CinderRestClientModule; +import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.ZoneModule; +import org.jclouds.providers.ProviderMetadata; +import org.jclouds.providers.internal.BaseProviderMetadata; +import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityAuthenticationModule; +import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityCredentialTypes; + +import com.google.common.collect.ImmutableSet; +import com.google.inject.Module; + +/** + * Implementation of {@link org.jclouds.types.ProviderMetadata} for Rackspace Next Generation Cloud Block Storage. + * + * @author Everett Toews + */ +public class CloudBlockStorageUKProviderMetadata extends BaseProviderMetadata { + private static final long serialVersionUID = -620987914134012695L; + + public static Builder builder() { + return new Builder(); + } + + @Override + public Builder toBuilder() { + return builder().fromProviderMetadata(this); + } + + public CloudBlockStorageUKProviderMetadata() { + super(builder()); + } + + public CloudBlockStorageUKProviderMetadata(Builder builder) { + super(builder); + } + + public static Properties defaultProperties() { + Properties properties = new Properties(); + properties.setProperty(CREDENTIAL_TYPE, CloudIdentityCredentialTypes.API_KEY_CREDENTIALS); + properties.setProperty(PROPERTY_ZONES, "LON"); + properties.setProperty(PROPERTY_ZONE + ".LON." + ISO3166_CODES, "GB-SLG"); + return properties; + } + + public static class Builder extends BaseProviderMetadata.Builder { + + protected Builder(){ + id("rackspace-cloudblockstorage-uk") + .name("Rackspace Next Generation Cloud Block Storage UK") + .apiMetadata(new CinderApiMetadata().toBuilder() + .identityName("${userName}") + .credentialName("${apiKey}") + .defaultEndpoint("https://lon.identity.api.rackspacecloud.com/v2.0/") + .endpointName("identity service url ending in /v2.0/") + .documentation(URI.create("http://docs.rackspace.com/cbs/api/v1.0/cbs-devguide/content/overview.html")) + .defaultModules(ImmutableSet.>builder() + .add(CloudIdentityAuthenticationModule.class) + .add(ZoneModule.class) + .add(CinderParserModule.class) + .add(CinderRestClientModule.class).build()) + .build()) + .homepage(URI.create("http://www.rackspace.co.uk/cloud-hosting/cloud-products/cloud-block-storage/")) + .console(URI.create("https://mycloud.rackspace.co.uk")) + .linkedServices("rackspace-cloudservers-uk", "cloudfiles-uk") + .iso3166Codes("GB-SLG") + .endpoint("https://lon.identity.api.rackspacecloud.com/v2.0/") + .defaultProperties(CloudBlockStorageUKProviderMetadata.defaultProperties()); + } + + @Override + public CloudBlockStorageUKProviderMetadata build() { + return new CloudBlockStorageUKProviderMetadata(this); + } + + @Override + public Builder fromProviderMetadata(ProviderMetadata in) { + super.fromProviderMetadata(in); + return this; + } + } + +} diff --git a/labs/rackspace-cloudblockstorage-uk/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata b/labs/rackspace-cloudblockstorage-uk/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata new file mode 100644 index 0000000000..97fe43d278 --- /dev/null +++ b/labs/rackspace-cloudblockstorage-uk/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata @@ -0,0 +1 @@ +org.jclouds.rackspace.cloudblockstorage.uk.CloudBlockStorageUKProviderMetadata diff --git a/labs/rackspace-cloudblockstorage-uk/src/test/java/org/jclouds/rackspace/cloudblockstorage/uk/CloudBlockStorageUKProviderMetadataExpectTest.java b/labs/rackspace-cloudblockstorage-uk/src/test/java/org/jclouds/rackspace/cloudblockstorage/uk/CloudBlockStorageUKProviderMetadataExpectTest.java new file mode 100644 index 0000000000..4c1328dac2 --- /dev/null +++ b/labs/rackspace-cloudblockstorage-uk/src/test/java/org/jclouds/rackspace/cloudblockstorage/uk/CloudBlockStorageUKProviderMetadataExpectTest.java @@ -0,0 +1,67 @@ +/** + * 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.rackspace.cloudblockstorage.uk; + +import static org.testng.Assert.assertEquals; + +import org.jclouds.http.HttpRequest; +import org.jclouds.http.HttpResponse; +import org.jclouds.openstack.cinder.v1.CinderApi; +import org.jclouds.openstack.cinder.v1.internal.BaseCinderApiExpectTest; +import org.jclouds.rackspace.cloudblockstorage.uk.CloudBlockStorageUKProviderMetadata; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +/** + * This test ensures that the wiring in {@link CloudBlockStorageUKProviderMetadata} is correct. + * + * @author Everett Toews + */ +@Test(groups = "unit", testName = "CloudBlockStorageUKProviderMetadataExpectTest") +public class CloudBlockStorageUKProviderMetadataExpectTest extends BaseCinderApiExpectTest { + + public CloudBlockStorageUKProviderMetadataExpectTest() { + this.provider = "rackspace-cloudblockstorage-uk"; + this.identity = "myUsername"; + this.credential = "myApiKey"; + } + + public void testCanGetConfiguredZones() { + + HttpRequest authenticate = HttpRequest.builder().method("POST") + .endpoint("https://lon.identity.api.rackspacecloud.com/v2.0/tokens") + .addHeader("Accept", "application/json") + .payload(payloadFromStringWithContentType( + "{\"auth\":{\"RAX-KSKEY:apiKeyCredentials\":{\"username\":\"myUsername\",\"apiKey\":\"myApiKey\"}}}" + , "application/json")).build(); + + + HttpResponse authenticationResponse = HttpResponse.builder() + .statusCode(200) + .payload(payloadFromResourceWithContentType("/access_rax_uk.json", "application/json")) + .build(); + + CinderApi whenNovaRegionExists = requestSendsResponse(authenticate, authenticationResponse); + + assertEquals(whenNovaRegionExists.getConfiguredZones(), ImmutableSet.of("LON")); + + } + +} diff --git a/labs/rackspace-cloudblockstorage-uk/src/test/java/org/jclouds/rackspace/cloudblockstorage/uk/CloudBlockStorageUKProviderTest.java b/labs/rackspace-cloudblockstorage-uk/src/test/java/org/jclouds/rackspace/cloudblockstorage/uk/CloudBlockStorageUKProviderTest.java new file mode 100644 index 0000000000..6dc8f27f24 --- /dev/null +++ b/labs/rackspace-cloudblockstorage-uk/src/test/java/org/jclouds/rackspace/cloudblockstorage/uk/CloudBlockStorageUKProviderTest.java @@ -0,0 +1,35 @@ +/** + * 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.rackspace.cloudblockstorage.uk; + +import org.jclouds.openstack.cinder.v1.CinderApiMetadata; +import org.jclouds.providers.internal.BaseProviderMetadataTest; +import org.jclouds.rackspace.cloudblockstorage.uk.CloudBlockStorageUKProviderMetadata; +import org.testng.annotations.Test; + +/** + * @author Everett Toews + */ +@Test(groups = "unit", testName = "CloudBlockStorageUKProviderTest") +public class CloudBlockStorageUKProviderTest extends BaseProviderMetadataTest { + + public CloudBlockStorageUKProviderTest() { + super(new CloudBlockStorageUKProviderMetadata(), new CinderApiMetadata()); + } +} diff --git a/labs/rackspace-cloudblockstorage-uk/src/test/java/org/jclouds/rackspace/cloudblockstorage/uk/features/CloudBlockStorageUKVolumeAndSnapshotApiLiveTest.java b/labs/rackspace-cloudblockstorage-uk/src/test/java/org/jclouds/rackspace/cloudblockstorage/uk/features/CloudBlockStorageUKVolumeAndSnapshotApiLiveTest.java new file mode 100644 index 0000000000..6bde1a366b --- /dev/null +++ b/labs/rackspace-cloudblockstorage-uk/src/test/java/org/jclouds/rackspace/cloudblockstorage/uk/features/CloudBlockStorageUKVolumeAndSnapshotApiLiveTest.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.rackspace.cloudblockstorage.uk.features; + +import org.jclouds.openstack.cinder.v1.features.VolumeAndSnapshotApiLiveTest; +import org.testng.annotations.Test; + +/** + * @author Everett Toews + */ +@Test(groups = "live", testName = "CloudBlockStorageUKVolumeAndSnapshotApiLiveTest") +public class CloudBlockStorageUKVolumeAndSnapshotApiLiveTest extends VolumeAndSnapshotApiLiveTest { + public CloudBlockStorageUKVolumeAndSnapshotApiLiveTest() { + provider = "rackspace-cloudblockstorage-uk"; + } +} diff --git a/labs/rackspace-cloudblockstorage-uk/src/test/java/org/jclouds/rackspace/cloudblockstorage/uk/features/CloudBlockStorageUKVolumeTypeApiLiveTest.java b/labs/rackspace-cloudblockstorage-uk/src/test/java/org/jclouds/rackspace/cloudblockstorage/uk/features/CloudBlockStorageUKVolumeTypeApiLiveTest.java new file mode 100644 index 0000000000..7a1efed23d --- /dev/null +++ b/labs/rackspace-cloudblockstorage-uk/src/test/java/org/jclouds/rackspace/cloudblockstorage/uk/features/CloudBlockStorageUKVolumeTypeApiLiveTest.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.rackspace.cloudblockstorage.uk.features; + +import org.jclouds.openstack.cinder.v1.features.VolumeTypeApiLiveTest; +import org.testng.annotations.Test; + +/** + * @author Everett Toews + */ +@Test(groups = "live", testName = "CloudBlockStorageUSVolumeTypeApiLiveTest") +public class CloudBlockStorageUKVolumeTypeApiLiveTest extends VolumeTypeApiLiveTest { + public CloudBlockStorageUKVolumeTypeApiLiveTest() { + provider = "rackspace-cloudblockstorage-uk"; + } +} diff --git a/labs/rackspace-cloudblockstorage-uk/src/test/resources/access_rax_uk.json b/labs/rackspace-cloudblockstorage-uk/src/test/resources/access_rax_uk.json new file mode 100644 index 0000000000..a818fefbb9 --- /dev/null +++ b/labs/rackspace-cloudblockstorage-uk/src/test/resources/access_rax_uk.json @@ -0,0 +1,129 @@ +{ + "access": { + "token": { + "id": "bdd18214-e266-4ad3-b985-d9bfb22c8da8", + "expires": "2012-10-01T02:11:16.000+01:00", + "tenant": { + "id": "10001786", + "name": "10001786" + } + }, + "serviceCatalog": [ + { + "endpoints": [ + { + "region": "LON", + "tenantId": "MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953", + "publicURL": "https://storage101.lon3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953", + "internalURL": "https://snet-storage101.lon3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953" + } + ], + "name": "cloudFiles", + "type": "object-store" + }, + { + "endpoints": [ + { + "region": "LON", + "tenantId": "MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953", + "publicURL": "https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953" + } + ], + "name": "cloudFilesCDN", + "type": "rax:object-cdn" + }, + { + "endpoints": [ + { + "tenantId": "10001786", + "publicURL": "https://lon.servers.api.rackspacecloud.com/v1.0/10001786", + "versionInfo": "https://lon.servers.api.rackspacecloud.com/v1.0", + "versionList": "https://lon.servers.api.rackspacecloud.com/", + "versionId": "1.0" + } + ], + "name": "cloudServers", + "type": "compute" + }, + { + "endpoints": [ + { + "tenantId": "10001786", + "publicURL": "https://lon.dns.api.rackspacecloud.com/v1.0/10001786" + } + ], + "name": "cloudDNS", + "type": "rax:dns" + }, + { + "endpoints": [ + { + "region": "LON", + "tenantId": "10001786", + "publicURL": "https://lon.loadbalancers.api.rackspacecloud.com/v1.0/10001786" + } + ], + "name": "cloudLoadBalancers", + "type": "rax:load-balancer" + }, + { + "endpoints": [ + { + "tenantId": "10001786", + "publicURL": "https://monitoring.api.rackspacecloud.com/v1.0/10001786" + } + ], + "name": "cloudMonitoring", + "type": "rax:monitor" + }, + { + "endpoints": [ + { + "region": "LON", + "tenantId": "10001786", + "publicURL": "https://lon.databases.api.rackspacecloud.com/v1.0/10001786" + } + ], + "name": "cloudDatabases", + "type": "rax:database" + }, + { + "endpoints": [ + { + "region": "LON", + "tenantId": "10001786", + "publicURL": "https://lon.servers.api.rackspacecloud.com/v2/10001786", + "versionInfo": "https://lon.servers.api.rackspacecloud.com/v2", + "versionList": "https://lon.servers.api.rackspacecloud.com/", + "versionId": "2" + } + ], + "name": "cloudServersOpenStack", + "type": "compute" + }, + { + "endpoints": [ + { + "publicURL": "https://lon.blockstorage.api.rackspacecloud.com/v1/10001786", + "tenantId": "10001786", + "region": "LON" + } + ], + "name": "cloudBlockStorage", + "type": "volume" + } + ], + "user": { + "id": "378", + "roles": [ + { + "id": "3", + "description": "User Admin Role.", + "name": "identity:user-admin" + } + ], + "name": "jclouds", + "RAX-AUTH:defaultRegion": "" + } + } +} \ No newline at end of file diff --git a/labs/rackspace-cloudblockstorage-us/pom.xml b/labs/rackspace-cloudblockstorage-us/pom.xml new file mode 100644 index 0000000000..511346b565 --- /dev/null +++ b/labs/rackspace-cloudblockstorage-us/pom.xml @@ -0,0 +1,142 @@ + + + + 4.0.0 + + org.jclouds + jclouds-project + 1.6.0-SNAPSHOT + ../../project/pom.xml + + org.jclouds.labs + rackspace-cloudblockstorage-us + jclouds Rackspace Next Generation Cloud Block Storage US provider + OpenStack Cinder implementation targeted to Rackspace Next Generation Cloud Block Storage US + bundle + + + https://identity.api.rackspacecloud.com/v2.0/ + 1 + + ${test.rackspace-us.identity} + ${test.rackspace-us.credential} + + org.jclouds.rackspace.cloudblockstorage.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 + jclouds-core + ${project.version} + + + org.jclouds.labs + openstack-cinder + ${project.version} + + + org.jclouds.api + openstack-keystone + ${project.version} + + + org.jclouds.api + rackspace-cloudidentity + ${project.version} + + + org.jclouds + jclouds-core + ${project.version} + test-jar + test + + + org.jclouds.labs + openstack-cinder + ${project.version} + test-jar + test + + + org.jclouds.api + openstack-keystone + ${project.version} + test-jar + test + + + org.jclouds.api + rackspace-cloudidentity + ${project.version} + test-jar + test + + + ch.qos.logback + logback-classic + test + + + + + + live + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration + integration-test + + test + + + 1 + + ${test.rackspace-cloudblockstorage-us.endpoint} + ${test.rackspace-cloudblockstorage-us.api-version} + ${test.rackspace-cloudblockstorage-us.build-version} + ${test.rackspace-cloudblockstorage-us.identity} + ${test.rackspace-cloudblockstorage-us.credential} + ${test.rackspace-cloudblockstorage-us.template} + + + + + + + + + + + diff --git a/labs/rackspace-cloudblockstorage-us/src/main/java/org/jclouds/rackspace/cloudblockstorage/us/CloudBlockStorageUSProviderMetadata.java b/labs/rackspace-cloudblockstorage-us/src/main/java/org/jclouds/rackspace/cloudblockstorage/us/CloudBlockStorageUSProviderMetadata.java new file mode 100644 index 0000000000..09f82e24d0 --- /dev/null +++ b/labs/rackspace-cloudblockstorage-us/src/main/java/org/jclouds/rackspace/cloudblockstorage/us/CloudBlockStorageUSProviderMetadata.java @@ -0,0 +1,112 @@ +/** + * 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.rackspace.cloudblockstorage.us; + +import static org.jclouds.location.reference.LocationConstants.ISO3166_CODES; +import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONE; +import static org.jclouds.location.reference.LocationConstants.PROPERTY_ZONES; +import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE; + +import java.net.URI; +import java.util.Properties; + +import org.jclouds.openstack.cinder.v1.CinderApiMetadata; +import org.jclouds.openstack.cinder.v1.config.CinderParserModule; +import org.jclouds.openstack.cinder.v1.config.CinderRestClientModule; +import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.ZoneModule; +import org.jclouds.providers.ProviderMetadata; +import org.jclouds.providers.internal.BaseProviderMetadata; +import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityAuthenticationModule; +import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityCredentialTypes; + +import com.google.common.collect.ImmutableSet; +import com.google.inject.Module; + +/** + * Implementation of {@link org.jclouds.types.ProviderMetadata} for Rackspace Next Generation Cloud Block Storage. + * + * @author Everett Toews + */ +public class CloudBlockStorageUSProviderMetadata extends BaseProviderMetadata { + private static final long serialVersionUID = -290987074134012652L; + + public static Builder builder() { + return new Builder(); + } + + @Override + public Builder toBuilder() { + return builder().fromProviderMetadata(this); + } + + public CloudBlockStorageUSProviderMetadata() { + super(builder()); + } + + public CloudBlockStorageUSProviderMetadata(Builder builder) { + super(builder); + } + + public static Properties defaultProperties() { + Properties properties = new Properties(); + properties.setProperty(CREDENTIAL_TYPE, CloudIdentityCredentialTypes.API_KEY_CREDENTIALS); + properties.setProperty(PROPERTY_ZONES, "ORD,DFW"); + properties.setProperty(PROPERTY_ZONE + ".ORD." + ISO3166_CODES, "US-IL"); + properties.setProperty(PROPERTY_ZONE + ".DFW." + ISO3166_CODES, "US-TX"); + return properties; + } + + public static class Builder extends BaseProviderMetadata.Builder { + + protected Builder(){ + id("rackspace-cloudblockstorage-us") + .name("Rackspace Next Generation Cloud Block Storage US") + .apiMetadata(new CinderApiMetadata().toBuilder() + .identityName("${userName}") + .credentialName("${apiKey}") + .defaultEndpoint("https://identity.api.rackspacecloud.com/v2.0/") + .endpointName("identity service url ending in /v2.0/") + .documentation(URI.create("http://docs.rackspace.com/cbs/api/v1.0/cbs-devguide/content/overview.html")) + .defaultModules(ImmutableSet.>builder() + .add(CloudIdentityAuthenticationModule.class) + .add(ZoneModule.class) + .add(CinderParserModule.class) + .add(CinderRestClientModule.class).build()) + .build()) + .homepage(URI.create("http://www.rackspace.com/cloud/public/blockstorage/")) + .console(URI.create("https://mycloud.rackspace.com")) + .linkedServices("rackspace-cloudservers-us", "cloudfiles-us") + .iso3166Codes("US-IL", "US-TX") + .endpoint("https://identity.api.rackspacecloud.com/v2.0/") + .defaultProperties(CloudBlockStorageUSProviderMetadata.defaultProperties()); + } + + @Override + public CloudBlockStorageUSProviderMetadata build() { + return new CloudBlockStorageUSProviderMetadata(this); + } + + @Override + public Builder fromProviderMetadata(ProviderMetadata in) { + super.fromProviderMetadata(in); + return this; + } + } + +} diff --git a/labs/rackspace-cloudblockstorage-us/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata b/labs/rackspace-cloudblockstorage-us/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata new file mode 100644 index 0000000000..84a96e253c --- /dev/null +++ b/labs/rackspace-cloudblockstorage-us/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata @@ -0,0 +1 @@ +org.jclouds.rackspace.cloudblockstorage.us.CloudBlockStorageUSProviderMetadata diff --git a/labs/rackspace-cloudblockstorage-us/src/test/java/org/jclouds/rackspace/cloudblockstorage/us/CloudBlockStorageUSProviderMetadataExpectTest.java b/labs/rackspace-cloudblockstorage-us/src/test/java/org/jclouds/rackspace/cloudblockstorage/us/CloudBlockStorageUSProviderMetadataExpectTest.java new file mode 100644 index 0000000000..18ee66539c --- /dev/null +++ b/labs/rackspace-cloudblockstorage-us/src/test/java/org/jclouds/rackspace/cloudblockstorage/us/CloudBlockStorageUSProviderMetadataExpectTest.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.rackspace.cloudblockstorage.us; + +import static org.testng.Assert.assertEquals; + +import org.jclouds.http.HttpRequest; +import org.jclouds.http.HttpResponse; +import org.jclouds.openstack.cinder.v1.CinderApi; +import org.jclouds.openstack.cinder.v1.internal.BaseCinderApiExpectTest; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +/** + * This test ensures that the wiring in {@link CloudBlockStorageUSProviderMetadata} is correct. + * + * @author Everett Toews + */ +@Test(groups = "unit", testName = "CloudBlockStorageUSProviderMetadataExpectTest") +public class CloudBlockStorageUSProviderMetadataExpectTest extends BaseCinderApiExpectTest { + + public CloudBlockStorageUSProviderMetadataExpectTest() { + this.provider = "rackspace-cloudblockstorage-us"; + this.identity = "myUsername"; + this.credential = "myApiKey"; + } + + public void testCanGetConfiguredZones() { + + HttpRequest authenticate = HttpRequest.builder().method("POST") + .endpoint("https://identity.api.rackspacecloud.com/v2.0/tokens") + .addHeader("Accept", "application/json") + .payload(payloadFromStringWithContentType( + "{\"auth\":{\"RAX-KSKEY:apiKeyCredentials\":{\"username\":\"myUsername\",\"apiKey\":\"myApiKey\"}}}" + , "application/json")).build(); + + + HttpResponse authenticationResponse = HttpResponse.builder() + .statusCode(200) + .payload(payloadFromResourceWithContentType("/access_rax_us.json", "application/json")) + .build(); + + CinderApi whenNovaRegionExists = requestSendsResponse(authenticate, authenticationResponse); + + assertEquals(whenNovaRegionExists.getConfiguredZones(), ImmutableSet.of("ORD", "DFW")); + + } + +} diff --git a/labs/rackspace-cloudblockstorage-us/src/test/java/org/jclouds/rackspace/cloudblockstorage/us/CloudBlockStorageUSProviderTest.java b/labs/rackspace-cloudblockstorage-us/src/test/java/org/jclouds/rackspace/cloudblockstorage/us/CloudBlockStorageUSProviderTest.java new file mode 100644 index 0000000000..7bbe0556ec --- /dev/null +++ b/labs/rackspace-cloudblockstorage-us/src/test/java/org/jclouds/rackspace/cloudblockstorage/us/CloudBlockStorageUSProviderTest.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.rackspace.cloudblockstorage.us; + +import org.jclouds.openstack.cinder.v1.CinderApiMetadata; +import org.jclouds.providers.internal.BaseProviderMetadataTest; +import org.testng.annotations.Test; + +/** + * @author Everett Toews + */ +@Test(groups = "unit", testName = "CloudBlockStorageUSProviderTest") +public class CloudBlockStorageUSProviderTest extends BaseProviderMetadataTest { + + public CloudBlockStorageUSProviderTest() { + super(new CloudBlockStorageUSProviderMetadata(), new CinderApiMetadata()); + } +} diff --git a/labs/rackspace-cloudblockstorage-us/src/test/java/org/jclouds/rackspace/cloudblockstorage/us/features/CloudBlockStorageUSVolumeAndSnapshotApiLiveTest.java b/labs/rackspace-cloudblockstorage-us/src/test/java/org/jclouds/rackspace/cloudblockstorage/us/features/CloudBlockStorageUSVolumeAndSnapshotApiLiveTest.java new file mode 100644 index 0000000000..7ed0edc483 --- /dev/null +++ b/labs/rackspace-cloudblockstorage-us/src/test/java/org/jclouds/rackspace/cloudblockstorage/us/features/CloudBlockStorageUSVolumeAndSnapshotApiLiveTest.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.rackspace.cloudblockstorage.us.features; + +import org.jclouds.openstack.cinder.v1.features.VolumeAndSnapshotApiLiveTest; +import org.testng.annotations.Test; + +/** + * @author Everett Toews + */ +@Test(groups = "live", testName = "CloudBlockStorageUSVolumeAndSnapshotApiLiveTest") +public class CloudBlockStorageUSVolumeAndSnapshotApiLiveTest extends VolumeAndSnapshotApiLiveTest { + public CloudBlockStorageUSVolumeAndSnapshotApiLiveTest() { + provider = "rackspace-cloudblockstorage-us"; + } +} diff --git a/labs/rackspace-cloudblockstorage-us/src/test/java/org/jclouds/rackspace/cloudblockstorage/us/features/CloudBlockStorageUSVolumeTypeApiLiveTest.java b/labs/rackspace-cloudblockstorage-us/src/test/java/org/jclouds/rackspace/cloudblockstorage/us/features/CloudBlockStorageUSVolumeTypeApiLiveTest.java new file mode 100644 index 0000000000..5761c603d8 --- /dev/null +++ b/labs/rackspace-cloudblockstorage-us/src/test/java/org/jclouds/rackspace/cloudblockstorage/us/features/CloudBlockStorageUSVolumeTypeApiLiveTest.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.rackspace.cloudblockstorage.us.features; + +import org.jclouds.openstack.cinder.v1.features.VolumeTypeApiLiveTest; +import org.testng.annotations.Test; + +/** + * @author Everett Toews + */ +@Test(groups = "live", testName = "CloudBlockStorageUSVolumeTypeApiLiveTest") +public class CloudBlockStorageUSVolumeTypeApiLiveTest extends VolumeTypeApiLiveTest { + public CloudBlockStorageUSVolumeTypeApiLiveTest() { + provider = "rackspace-cloudblockstorage-us"; + } +} diff --git a/labs/rackspace-cloudblockstorage-us/src/test/resources/access_rax_us.json b/labs/rackspace-cloudblockstorage-us/src/test/resources/access_rax_us.json new file mode 100644 index 0000000000..789ede78f4 --- /dev/null +++ b/labs/rackspace-cloudblockstorage-us/src/test/resources/access_rax_us.json @@ -0,0 +1,163 @@ +{ + "access": { + "token": { + "id": "myToken", + "expires": "2012-09-30T17:15:32.000-05:00", + "tenant": { + "id": "717071", + "name": "717071" + } + }, + "serviceCatalog": [ + { + "endpoints": [ + { + "tenantId": "717071", + "publicURL": "https://dns.api.rackspacecloud.com/v1.0/717071" + } + ], + "name": "cloudDNS", + "type": "rax:dns" + }, + { + "endpoints": [ + { + "tenantId": "717071", + "publicURL": "https://monitoring.api.rackspacecloud.com/v1.0/717071" + } + ], + "name": "cloudMonitoring", + "type": "rax:monitor" + }, + { + "endpoints": [ + { + "region": "DFW", + "tenantId": "717071", + "publicURL": "https://dfw.servers.api.rackspacecloud.com/v2/717071", + "versionInfo": "https://dfw.servers.api.rackspacecloud.com/v2", + "versionList": "https://dfw.servers.api.rackspacecloud.com/", + "versionId": "2" + }, + { + "region": "ORD", + "tenantId": "717071", + "publicURL": "https://ord.servers.api.rackspacecloud.com/v2/717071", + "versionInfo": "https://ord.servers.api.rackspacecloud.com/v2", + "versionList": "https://ord.servers.api.rackspacecloud.com/", + "versionId": "2" + } + ], + "name": "cloudServersOpenStack", + "type": "compute" + }, + { + "endpoints": [ + { + "region": "ORD", + "tenantId": "717071", + "publicURL": "https://ord.loadbalancers.api.rackspacecloud.com/v1.0/717071" + }, + { + "region": "DFW", + "tenantId": "717071", + "publicURL": "https://dfw.loadbalancers.api.rackspacecloud.com/v1.0/717071" + } + ], + "name": "cloudLoadBalancers", + "type": "rax:load-balancer" + }, + { + "endpoints": [ + { + "region": "DFW", + "tenantId": "717071", + "publicURL": "https://dfw.databases.api.rackspacecloud.com/v1.0/717071" + }, + { + "region": "ORD", + "tenantId": "717071", + "publicURL": "https://ord.databases.api.rackspacecloud.com/v1.0/717071" + } + ], + "name": "cloudDatabases", + "type": "rax:database" + }, + { + "endpoints": [ + { + "region": "DFW", + "tenantId": "MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9", + "publicURL": "https://storage101.dfw1.clouddrive.com/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9", + "internalURL": "https://snet-storage101.dfw1.clouddrive.com/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9" + }, + { + "region": "ORD", + "tenantId": "MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9", + "publicURL": "https://storage101.ord1.clouddrive.com/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9", + "internalURL": "https://snet-storage101.ord1.clouddrive.com/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9" + } + ], + "name": "cloudFiles", + "type": "object-store" + }, + { + "endpoints": [ + { + "region": "DFW", + "tenantId": "MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9", + "publicURL": "https://cdn1.clouddrive.com/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9" + }, + { + "region": "ORD", + "tenantId": "MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9", + "publicURL": "https://cdn2.clouddrive.com/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9" + } + ], + "name": "cloudFilesCDN", + "type": "rax:object-cdn" + }, + { + "endpoints": [ + { + "tenantId": "717071", + "publicURL": "https://servers.api.rackspacecloud.com/v1.0/717071", + "versionInfo": "https://servers.api.rackspacecloud.com/v1.0", + "versionList": "https://servers.api.rackspacecloud.com/", + "versionId": "1.0" + } + ], + "name": "cloudServers", + "type": "compute" + }, + { + "endpoints": [ + { + "publicURL": "https://ord.blockstorage.api.rackspacecloud.com/v1/717071", + "tenantId": "717071", + "region": "ORD" + }, + { + "region": "DFW", + "tenantId": "717071", + "publicURL": "https://dfw.blockstorage.api.rackspacecloud.com/v1/717071" + } + ], + "name": "cloudBlockStorage", + "type": "volume" + } + ], + "user": { + "id": "224085", + "roles": [ + { + "id": "3", + "description": "User Admin Role.", + "name": "identity:user-admin" + } + ], + "name": "myUsername", + "RAX-AUTH:defaultRegion": "DFW" + } + } +} \ No newline at end of file