diff --git a/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseContainerLiveTest.java b/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseContainerLiveTest.java index f058b271b4..d53c42804a 100644 --- a/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseContainerLiveTest.java +++ b/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseContainerLiveTest.java @@ -16,8 +16,11 @@ */ package org.jclouds.blobstore.integration.internal; +import static java.util.concurrent.TimeUnit.SECONDS; import static org.jclouds.blobstore.options.CreateContainerOptions.Builder.publicRead; +import static org.jclouds.util.Predicates2.retry; import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; import java.io.IOException; import java.net.MalformedURLException; @@ -25,11 +28,13 @@ import java.util.Collections; import java.util.List; import java.util.logging.Logger; +import com.google.common.net.HostAndPort; import org.jclouds.blobstore.BlobStore; import org.jclouds.blobstore.domain.BlobMetadata; import org.jclouds.blobstore.domain.StorageMetadata; import org.jclouds.domain.Location; import org.jclouds.javax.annotation.Nullable; +import org.jclouds.predicates.SocketOpen; import org.jclouds.util.Strings2; import org.testng.SkipException; import org.testng.annotations.Test; @@ -70,7 +75,11 @@ public class BaseContainerLiveTest extends BaseBlobStoreIntegrationTest { BlobMetadata metadata = view.getBlobStore().blobMetadata(containerName, "hello"); - assert metadata.getPublicUri() != null : metadata; + assertTrue(metadata.getPublicUri() != null, metadata.toString()); + + SocketOpen socketOpen = context.utils().injector().getInstance(SocketOpen.class); + Predicate socketTester = retry(socketOpen, 1200, 10, SECONDS); + assertTrue(socketTester.apply(HostAndPort.fromParts(metadata.getPublicUri().getHost(),80)), metadata.getPublicUri().toString()); assertEquals(Strings2.toStringAndClose(view.utils().http().get(metadata.getPublicUri())), TEST_STRING); diff --git a/providers/hpcloud-objectstorage/pom.xml b/providers/hpcloud-objectstorage/pom.xml index c8f1aa79e7..0029e2c039 100644 --- a/providers/hpcloud-objectstorage/pom.xml +++ b/providers/hpcloud-objectstorage/pom.xml @@ -36,9 +36,7 @@ 1.0 FIXME_IDENTITY FIXME_CREDENTIAL diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApiMetadata.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApiMetadata.java index 68ad6a6bb0..d7d87571a4 100644 --- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApiMetadata.java +++ b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApiMetadata.java @@ -16,32 +16,32 @@ */ package org.jclouds.hpcloud.objectstorage; -import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.SERVICE_TYPE; -import static org.jclouds.rest.config.BinderUtils.bindSyncToAsyncHttpApi; - -import java.net.URI; -import java.util.Properties; - -import javax.inject.Named; - +import com.google.common.collect.ImmutableSet; +import com.google.common.reflect.TypeToken; +import com.google.inject.Module; +import com.google.inject.name.Named; import org.jclouds.blobstore.BlobRequestSigner; import org.jclouds.hpcloud.objectstorage.blobstore.HPCloudObjectStorageBlobRequestSigner; import org.jclouds.hpcloud.objectstorage.blobstore.config.HPCloudObjectStorageBlobStoreContextModule; import org.jclouds.hpcloud.objectstorage.config.HPCloudObjectStorageRestClientModule; import org.jclouds.location.suppliers.RegionIdToURISupplier; -import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.RegionModule; +import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes; import org.jclouds.openstack.keystone.v2_0.config.MappedAuthenticationApiModule; import org.jclouds.openstack.keystone.v2_0.suppliers.RegionIdToAdminURISupplier; import org.jclouds.openstack.swift.SwiftKeystoneApiMetadata; import org.jclouds.openstack.swift.blobstore.config.TemporaryUrlExtensionModule; -import org.jclouds.openstack.swift.config.SwiftRestClientModule.KeystoneStorageEndpointModule; import org.jclouds.openstack.swift.extensions.KeystoneTemporaryUrlKeyAsyncApi; import org.jclouds.openstack.swift.extensions.TemporaryUrlKeyApi; import org.jclouds.rest.annotations.ApiVersion; -import com.google.common.collect.ImmutableSet; -import com.google.common.reflect.TypeToken; -import com.google.inject.Module; +import java.net.URI; +import java.util.Properties; + +import static org.jclouds.hpcloud.objectstorage.config.HPCloudObjectStorageRestClientModule.HPCloudObjectStorageEndpointModule; +import static org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.RegionModule; +import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE; +import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.SERVICE_TYPE; +import static org.jclouds.rest.config.BinderUtils.bindSyncToAsyncHttpApi; /** * Implementation of {@link org.jclouds.providers.ProviderMetadata} for HP Cloud Services Object Storage * @@ -73,6 +73,7 @@ public class HPCloudObjectStorageApiMetadata extends SwiftKeystoneApiMetadata { public static Properties defaultProperties() { Properties properties = SwiftKeystoneApiMetadata.defaultProperties(); + properties.setProperty(CREDENTIAL_TYPE, CredentialTypes.API_ACCESS_KEY_CREDENTIALS); return properties; } @@ -89,7 +90,7 @@ public class HPCloudObjectStorageApiMetadata extends SwiftKeystoneApiMetadata { .context(CONTEXT_TOKEN) .defaultModules(ImmutableSet.>builder() .add(MappedAuthenticationApiModule.class) - .add(KeystoneStorageEndpointModule.class) + .add(HPCloudObjectStorageEndpointModule.class) .add(IgnoreRegionVersionsModule.class) .add(HPCloudObjectStorageRestClientModule.class) .add(HPCloudObjectStorageBlobStoreContextModule.class) diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageProviderMetadata.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageProviderMetadata.java index 687d8f043f..415214e644 100644 --- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageProviderMetadata.java +++ b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageProviderMetadata.java @@ -17,17 +17,17 @@ package org.jclouds.hpcloud.objectstorage; import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.REQUIRES_TENANT; +import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE; import java.net.URI; import java.util.Properties; +import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes; import org.jclouds.providers.ProviderMetadata; import org.jclouds.providers.internal.BaseProviderMetadata; /** - * Implementation of {@link org.jclouds.types.ProviderMetadata} for StratoGen VMware hosting - * - * @author Adrian Cole + * Implementation of {@link org.jclouds.types.ProviderMetadata} for HP Cloud */ public class HPCloudObjectStorageProviderMetadata extends BaseProviderMetadata { @@ -51,6 +51,8 @@ public class HPCloudObjectStorageProviderMetadata extends BaseProviderMetadata { public static Properties defaultProperties() { Properties properties = new Properties(); properties.setProperty(REQUIRES_TENANT, "true"); + properties.setProperty(CREDENTIAL_TYPE, CredentialTypes.API_ACCESS_KEY_CREDENTIALS); + return properties; } @@ -63,7 +65,7 @@ public class HPCloudObjectStorageProviderMetadata extends BaseProviderMetadata { .homepage(URI.create("http://hpcloud.com")) .console(URI.create("https://manage.hpcloud.com/objects/us-west")) .linkedServices("hpcloud-compute", "hpcloud-objectstorage") - .iso3166Codes("US-NV") + .iso3166Codes("US-NV", "US-VA") .endpoint("https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/") .defaultProperties(HPCloudObjectStorageProviderMetadata.defaultProperties()); } diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageProviderMetadata.java.orig b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageProviderMetadata.java.orig new file mode 100644 index 0000000000..56d8badd0d --- /dev/null +++ b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageProviderMetadata.java.orig @@ -0,0 +1,90 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.hpcloud.objectstorage; + +import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.REQUIRES_TENANT; +import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE; + +import java.net.URI; +import java.util.Properties; + +import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes; +import org.jclouds.providers.ProviderMetadata; +import org.jclouds.providers.internal.BaseProviderMetadata; + +/** +<<<<<<< HEAD + * Implementation of {@link org.jclouds.types.ProviderMetadata} for StratoGen VMware hosting + * + * @author Adrian Cole +======= + * Implementation of {@link org.jclouds.types.ProviderMetadata} for HP Cloud +>>>>>>> 7d89840... JCLOUDS-584: HP Cloud Object Storage Fixes for 13.5 + */ +public class HPCloudObjectStorageProviderMetadata extends BaseProviderMetadata { + + public static Builder builder() { + return new Builder(); + } + + @Override + public Builder toBuilder() { + return builder().fromProviderMetadata(this); + } + + public HPCloudObjectStorageProviderMetadata() { + super(builder()); + } + + public HPCloudObjectStorageProviderMetadata(Builder builder) { + super(builder); + } + + public static Properties defaultProperties() { + Properties properties = new Properties(); + properties.setProperty(REQUIRES_TENANT, "true"); + properties.setProperty(CREDENTIAL_TYPE, CredentialTypes.API_ACCESS_KEY_CREDENTIALS); + + return properties; + } + + public static class Builder extends BaseProviderMetadata.Builder { + + protected Builder() { + id("hpcloud-objectstorage") + .name("HP Cloud Services Object Storage") + .apiMetadata(new HPCloudObjectStorageApiMetadata()) + .homepage(URI.create("http://hpcloud.com")) + .console(URI.create("https://manage.hpcloud.com/objects/us-west")) + .linkedServices("hpcloud-compute", "hpcloud-objectstorage") + .iso3166Codes("US-NV", "US-VA") + .endpoint("https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/") + .defaultProperties(HPCloudObjectStorageProviderMetadata.defaultProperties()); + } + + @Override + public HPCloudObjectStorageProviderMetadata build() { + return new HPCloudObjectStorageProviderMetadata(this); + } + + @Override + public Builder fromProviderMetadata(ProviderMetadata in) { + super.fromProviderMetadata(in); + return this; + } + } +} diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageAsyncBlobStore.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageAsyncBlobStore.java index a4ec392e35..dac6c91fa9 100644 --- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageAsyncBlobStore.java +++ b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageAsyncBlobStore.java @@ -16,8 +16,10 @@ */ package org.jclouds.hpcloud.objectstorage.blobstore; +import static com.google.common.util.concurrent.Futures.immediateFuture; import static com.google.common.util.concurrent.Futures.transform; +import java.net.URI; import java.util.Set; import javax.inject.Inject; @@ -80,20 +82,14 @@ public class HPCloudObjectStorageAsyncBlobStore extends SwiftAsyncBlobStore { @Override public ListenableFuture createContainerInLocation(Location location, final String container, CreateContainerOptions options) { - - ListenableFuture returnVal = createContainerInLocation(location, container); - if (options.isPublicRead()) - return transform(createContainerInLocation(location, container), new Function() { - - @Override - public Boolean apply(Boolean input) { - if (Boolean.TRUE.equals(input)) { - return enableAndCache.apply(container) != null; - } - return false; + if (options.isPublicRead()) { + return transform(immediateFuture(enableAndCache.apply(container)), new Function() { + public Boolean apply(URI from) { + return from != null; } - }, userExecutor); - return returnVal; + } + + return createContainerInLocation(location, container); } } diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobStore.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobStore.java index d616d0609e..943b39b00c 100644 --- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobStore.java +++ b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobStore.java @@ -49,7 +49,7 @@ import com.google.common.base.Supplier; @Singleton public class HPCloudObjectStorageBlobStore extends SwiftBlobStore { - private EnableCDNAndCache enableAndCache; + private EnableCDNAndCache enableCDNAndCache; @Inject protected HPCloudObjectStorageBlobStore(BlobStoreContext context, BlobUtils blobUtils, @@ -58,23 +58,19 @@ public class HPCloudObjectStorageBlobStore extends SwiftBlobStore { BlobStoreListContainerOptionsToListContainerOptions container2ContainerListOptions, ContainerToResourceList container2ResourceList, ObjectToBlob object2Blob, BlobToObject blob2Object, ObjectToBlobMetadata object2BlobMd, BlobToHttpGetOptions blob2ObjectGetOptions, - Provider fetchBlobMetadataProvider, EnableCDNAndCache enableAndCache, + Provider fetchBlobMetadataProvider, EnableCDNAndCache enableCDNAndCache, Provider multipartUploadStrategy) { super(context, blobUtils, defaultLocation, locations, sync, container2ResourceMd, container2ContainerListOptions, container2ResourceList, object2Blob, blob2Object, object2BlobMd, blob2ObjectGetOptions, fetchBlobMetadataProvider, multipartUploadStrategy); - this.enableAndCache = enableAndCache; + this.enableCDNAndCache = enableCDNAndCache; } @Override public boolean createContainerInLocation(Location location, String container, CreateContainerOptions options) { - try { - return createContainerInLocation(location, container); - } finally { - if (options.isPublicRead()) - enableAndCache.apply(container); - } + // Enabling CDN will create the container if it does not exist + return options.isPublicRead() ? enableCDNAndCache.apply(container) != null : createContainerInLocation(location, container); } } diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/config/HPCloudObjectStorageRestClientModule.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/config/HPCloudObjectStorageRestClientModule.java index f15f049f22..3c7219723d 100644 --- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/config/HPCloudObjectStorageRestClientModule.java +++ b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/config/HPCloudObjectStorageRestClientModule.java @@ -17,10 +17,12 @@ package org.jclouds.hpcloud.objectstorage.config; import static org.jclouds.reflect.Reflection2.typeToken; import static org.jclouds.util.Suppliers2.getLastValueInMap; +import static org.jclouds.util.Suppliers2.getValueInMapOrNull; import java.net.URI; import java.util.Map; +import javax.inject.Named; import javax.inject.Singleton; import org.jclouds.hpcloud.objectstorage.HPCloudObjectStorageApi; @@ -29,9 +31,14 @@ import org.jclouds.hpcloud.objectstorage.extensions.CDNContainerApi; import org.jclouds.hpcloud.objectstorage.extensions.CDNContainerAsyncApi; import org.jclouds.hpcloud.services.HPExtensionCDN; import org.jclouds.hpcloud.services.HPExtensionServiceType; +import org.jclouds.javax.annotation.Nullable; +import org.jclouds.location.reference.LocationConstants; import org.jclouds.location.suppliers.RegionIdToURISupplier; +import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule; +import org.jclouds.openstack.services.ServiceType; import org.jclouds.openstack.swift.CommonSwiftAsyncClient; import org.jclouds.openstack.swift.CommonSwiftClient; +import org.jclouds.openstack.swift.Storage; import org.jclouds.openstack.swift.config.SwiftRestClientModule; import org.jclouds.rest.ConfiguresRestClient; import org.jclouds.rest.annotations.ApiVersion; @@ -61,10 +68,40 @@ public class HPCloudObjectStorageRestClientModule extends bind(CommonSwiftAsyncClient.class).to(HPCloudObjectStorageAsyncApi.class).in(Scopes.SINGLETON); } + private static Supplier getUriSupplier(String serviceType, String apiVersion, RegionIdToURISupplier.Factory factory, String region) { + Supplier>> endpointsSupplier = factory.createForApiTypeAndVersion(serviceType, apiVersion); + + if (region.isEmpty()) { + return getLastValueInMap(endpointsSupplier); + } else { + return getValueInMapOrNull(endpointsSupplier, region); + } + } + @Provides @Singleton @HPExtensionCDN - protected Supplier provideCDNUrl(RegionIdToURISupplier.Factory factory, @ApiVersion String apiVersion) { - return getLastValueInMap(factory.createForApiTypeAndVersion(HPExtensionServiceType.CDN, apiVersion)); + @Nullable + protected Supplier provideCDNUrl(RegionIdToURISupplier.Factory factory, + @ApiVersion String apiVersion, + @Named(LocationConstants.PROPERTY_REGION) String region) { + + return getUriSupplier(HPExtensionServiceType.CDN, apiVersion, factory, region); } + + // Ignores requested apiVersion to work around versionId issue in HP endpoints + public static class HPCloudObjectStorageEndpointModule extends KeystoneAuthenticationModule { + @Provides + @Singleton + @Storage + @Nullable + protected Supplier provideStorageUrl(RegionIdToURISupplier.Factory factory, + @ApiVersion String apiVersion, + @Named(LocationConstants.PROPERTY_REGION) String region) { + + return getUriSupplier(ServiceType.OBJECT_STORE, null, factory, region); + + } + } + } diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/domain/CDNContainer.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/domain/CDNContainer.java index c301ce2130..e674b27d22 100644 --- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/domain/CDNContainer.java +++ b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/domain/CDNContainer.java @@ -130,8 +130,8 @@ public class CDNContainer implements Comparable { private final String referrerAcl; private final String useragentAcl; - @ConstructorProperties({ "name", "cdnEnabled", "ttl", "cdnUri", "cdnSslUri", "referrerAcl", "useragentAcl", - "logRetention" }) + @ConstructorProperties({ "name", "cdn_enabled", "ttl", "x-cdn-uri", "x-cdn-ssl-uri", "referrerAcl", "useragentAcl", + "log_retention" }) protected CDNContainer(@Nullable String name, boolean cdnEnabled, long ttl, @Nullable URI CDNUri, @Nullable URI CDNSslUri, @Nullable String referrerAcl, @Nullable String useragentAcl, boolean logRetention) { diff --git a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobSignerExpectTest.java b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobSignerExpectTest.java index f95d10b6bc..824d9a8932 100644 --- a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobSignerExpectTest.java +++ b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobSignerExpectTest.java @@ -46,37 +46,37 @@ import com.google.inject.Module; public class HPCloudObjectStorageBlobSignerExpectTest extends BaseBlobSignerExpectTest { public HPCloudObjectStorageBlobSignerExpectTest() { - identity = "12346637803162:identity"; + identity = "myTenantName:apiaccesskey"; } @Override protected HttpRequest getBlob() { return HttpRequest.builder().method("GET") - .endpoint("https://objects.jclouds.org/v1.0/40806637803162/container/name") - .addHeader("X-Auth-Token", "Auth_4f173437e4b013bee56d1007").build(); + .endpoint("https://region-a.geo-1.objects.hpcloudsvc.com/v1/myTenantId/container/name") + .addHeader("X-Auth-Token", "myToken").build(); } @Override protected HttpRequest getBlobWithTime() { return HttpRequest.builder().method("GET") - .endpoint("https://objects.jclouds.org/v1.0/40806637803162/container/name?temp_url_sig=40806637803162%3Aidentity%3Ada88bc31122f0d0806b1c7bf71cd3af5c5d5b94c&temp_url_expires=123456792") + .endpoint("https://region-a.geo-1.objects.hpcloudsvc.com/v1/myTenantId/container/name?temp_url_sig=myTenantId%3Aapiaccesskey%3A5620ad176e6dd08f25e7ae34f72e5fd98d1b89b1&temp_url_expires=123456792") .build(); } @Override protected HttpRequest getBlobWithOptions() { return HttpRequest.builder().method("GET") - .endpoint("https://objects.jclouds.org/v1.0/40806637803162/container/name") - .addHeader("X-Auth-Token", "Auth_4f173437e4b013bee56d1007").addHeader("Range", "bytes=0-1").build(); + .endpoint("https://region-a.geo-1.objects.hpcloudsvc.com/v1/myTenantId/container/name") + .addHeader("X-Auth-Token", "myToken").addHeader("Range", "bytes=0-1").build(); } @Override protected HttpRequest putBlob() { return HttpRequest.builder().method("PUT") - .endpoint("https://objects.jclouds.org/v1.0/40806637803162/container/name") + .endpoint("https://region-a.geo-1.objects.hpcloudsvc.com/v1/myTenantId/container/name") .addHeader("ETag", "00020408") .addHeader("Expect", "100-continue") - .addHeader("X-Auth-Token", "Auth_4f173437e4b013bee56d1007") + .addHeader("X-Auth-Token", "myToken") .addHeader("X-Delete-At", "1") .build(); } @@ -84,7 +84,7 @@ public class HPCloudObjectStorageBlobSignerExpectTest extends BaseBlobSignerExpe @Override protected HttpRequest putBlobWithTime() { return HttpRequest.builder().method("PUT") - .endpoint("https://objects.jclouds.org/v1.0/40806637803162/container/name?temp_url_sig=40806637803162%3Aidentity%3Ac90269245ab0a316d5ea5e654d4c2a975fb4bf77&temp_url_expires=123456792") + .endpoint("https://region-a.geo-1.objects.hpcloudsvc.com/v1/myTenantId/container/name?temp_url_sig=myTenantId%3Aapiaccesskey%3A04dc6071fbbf8e1696eaceb61a3fe49874abb71d&temp_url_expires=123456792") .addHeader("Expect", "100-continue") .build(); } @@ -92,8 +92,8 @@ public class HPCloudObjectStorageBlobSignerExpectTest extends BaseBlobSignerExpe @Override protected HttpRequest removeBlob() { return HttpRequest.builder().method("DELETE") - .endpoint("https://objects.jclouds.org/v1.0/40806637803162/container/name") - .addHeader("X-Auth-Token", "Auth_4f173437e4b013bee56d1007").build(); + .endpoint("https://region-a.geo-1.objects.hpcloudsvc.com/v1/myTenantId/container/name") + .addHeader("X-Auth-Token", "myToken").build(); } /** @@ -109,7 +109,7 @@ public class HPCloudObjectStorageBlobSignerExpectTest extends BaseBlobSignerExpe .addHeader("Accept", "application/json") .payload( payloadFromStringWithContentType( - "{\"auth\":{\"passwordCredentials\":{\"username\":\"identity\",\"password\":\"credential\"},\"tenantName\":\"12346637803162\"}}", + "{\"auth\":{\"apiAccessKeyCredentials\":{\"accessKey\":\"apiaccesskey\",\"secretKey\":\"credential\"},\"tenantName\":\"myTenantName\"}}", "application/json")).build(); HttpResponse authenticationResponse = HttpResponse.builder().statusCode(200) @@ -120,7 +120,7 @@ public class HPCloudObjectStorageBlobSignerExpectTest extends BaseBlobSignerExpe .builder() .method("HEAD") .endpoint("https://objects.jclouds.org/v1.0/40806637803162/") - .addHeader("X-Auth-Token", "Auth_4f173437e4b013bee56d1007").build(); + .addHeader("X-Auth-Token", "myToken").build(); HttpResponse temporaryKeyResponse = HttpResponse.builder().statusCode(200) .addHeader(ACCOUNT_TEMPORARY_URL_KEY, "TEMPORARY_KEY").build(); diff --git a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobStoreExpectTest.java b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobStoreExpectTest.java index 59d82ca77d..7a3894513f 100644 --- a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobStoreExpectTest.java +++ b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobStoreExpectTest.java @@ -37,7 +37,7 @@ public class HPCloudObjectStorageBlobStoreExpectTest extends BaseHPCloudObjectSt public void testListObjectsWhenResponseIs2xx() throws Exception { Map requestResponseMap = ImmutableMap. builder().put( - keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess).build(); + keystoneAuthWithAccessKeyAndSecretKey, responseWithKeystoneAccess).build(); BlobStore clientWhenLocationsExist = requestsSendResponses(requestResponseMap); diff --git a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/integration/HPCloudObjectStorageBlobIntegrationLiveTest.java b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/integration/HPCloudObjectStorageBlobIntegrationLiveTest.java index 3c13926500..1a01cdf2f1 100644 --- a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/integration/HPCloudObjectStorageBlobIntegrationLiveTest.java +++ b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/integration/HPCloudObjectStorageBlobIntegrationLiveTest.java @@ -18,6 +18,7 @@ package org.jclouds.hpcloud.objectstorage.blobstore.integration; import org.jclouds.blobstore.domain.Blob; import org.jclouds.openstack.swift.blobstore.integration.SwiftBlobIntegrationLiveTest; +import org.testng.annotations.DataProvider; import org.testng.annotations.Test; /** @@ -29,6 +30,20 @@ public class HPCloudObjectStorageBlobIntegrationLiveTest extends SwiftBlobIntegr provider = "hpcloud-objectstorage"; } + /** + * HP Cloud Object Storage container naming rules have more restrictions than defaults + * @see + */ + @DataProvider(name = "delete") + public Object[][] createData() { + if (System.getProperty("os.name").toLowerCase().contains("windows")) { + return new Object[][] { { "normal" }, { "sp ace" } }; + } else { + return new Object[][] { { "normal" }, { "sp ace" }, { "qu?stion" }, { "unic₪de" }, { "path/foo" }, { "colon:" }, + { "asteri*k" }, { "p|pe" } }; + } + } + @Override protected void checkContentDisposition(Blob blob, String contentDisposition) { assert blob.getPayload().getContentMetadata().getContentDisposition().startsWith(contentDisposition) : blob diff --git a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/integration/HPCloudObjectStorageContainerLiveTest.java b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/integration/HPCloudObjectStorageContainerLiveTest.java index 43f3189f5f..57aa3539cb 100644 --- a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/integration/HPCloudObjectStorageContainerLiveTest.java +++ b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/integration/HPCloudObjectStorageContainerLiveTest.java @@ -17,6 +17,7 @@ package org.jclouds.hpcloud.objectstorage.blobstore.integration; import org.jclouds.blobstore.integration.internal.BaseContainerLiveTest; +import org.testng.SkipException; import org.testng.annotations.Test; /** @@ -27,4 +28,13 @@ public class HPCloudObjectStorageContainerLiveTest extends BaseContainerLiveTest public HPCloudObjectStorageContainerLiveTest() { provider = "hpcloud-objectstorage"; } + + @Override + @Test + public void testPublicAccessInNonDefaultLocation() { throw new SkipException("Locations are ignored"); } + + @Override + @Test + public void testPublicAccessInNonDefaultLocationWithBigBlob() { throw new SkipException("Locations are ignored"); } + } diff --git a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/integration/HPCloudObjectStorageServiceIntegrationLiveTest.java b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/integration/HPCloudObjectStorageServiceIntegrationLiveTest.java index 308c31a579..5b2e31ba75 100644 --- a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/integration/HPCloudObjectStorageServiceIntegrationLiveTest.java +++ b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/blobstore/integration/HPCloudObjectStorageServiceIntegrationLiveTest.java @@ -19,6 +19,7 @@ package org.jclouds.hpcloud.objectstorage.blobstore.integration; import java.util.Set; import org.jclouds.openstack.swift.blobstore.integration.SwiftServiceIntegrationLiveTest; +import org.testng.SkipException; import org.testng.annotations.Test; import com.google.common.collect.ImmutableSet; @@ -34,7 +35,11 @@ public class HPCloudObjectStorageServiceIntegrationLiveTest extends SwiftService @Override protected Set getIso3166Codes() { - return ImmutableSet. of("US-NV"); + return ImmutableSet. of("US-NV", "US-VA"); } + @Override + @Test + public void testAllLocations() { throw new SkipException("Locations are ignored"); } + } diff --git a/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/config/HPCloudObjectStorageEndpointModuleTest.java b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/config/HPCloudObjectStorageEndpointModuleTest.java new file mode 100644 index 0000000000..119ea782d9 --- /dev/null +++ b/providers/hpcloud-objectstorage/src/test/java/org/jclouds/hpcloud/objectstorage/config/HPCloudObjectStorageEndpointModuleTest.java @@ -0,0 +1,131 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.hpcloud.objectstorage.config; + +import com.google.common.base.Supplier; +import com.google.common.base.Suppliers; +import com.google.common.collect.Maps; +import org.jclouds.hpcloud.services.HPExtensionServiceType; +import org.jclouds.location.suppliers.RegionIdToURISupplier; +import org.jclouds.openstack.services.ServiceType; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Map; + +import static org.easymock.EasyMock.createStrictMock; +import static org.easymock.EasyMock.expect; +import static org.easymock.EasyMock.replay; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertNull; +import static org.testng.Assert.fail; + +@Test(groups = "unit") +public class HPCloudObjectStorageEndpointModuleTest { + + private final String apiVersion = "1.0"; + private final RegionIdToURISupplier.Factory mockFactory = createStrictMock(RegionIdToURISupplier.Factory.class); + private final RegionIdToURISupplier.Factory mockCDNFactory = createStrictMock(RegionIdToURISupplier.Factory.class); + private final RegionIdToURISupplier mockSupplier = createStrictMock(RegionIdToURISupplier.class); + + /** + * Setup the expectations for our mock factory to return 3 region urls keyed + * by test region names + */ + @BeforeTest + public void setup() { + Map> endpoints = Maps.newHashMap(); + + try { + endpoints.put("region1", Suppliers.ofInstance(new URI("http://region1.example.org/"))); + endpoints.put("region2", Suppliers.ofInstance(new URI("http://region2.example.org/"))); + endpoints.put("region3", Suppliers.ofInstance(new URI("http://region3.example.org/"))); + } catch (URISyntaxException ex) { + fail("static test Strings do not parse to URI: " + ex.getMessage()); + } + + expect(mockSupplier.get()) + .andReturn(endpoints) + .anyTimes(); + expect(mockFactory.createForApiTypeAndVersion(ServiceType.OBJECT_STORE, null)) + .andReturn(mockSupplier) + .anyTimes(); + expect(mockCDNFactory.createForApiTypeAndVersion(HPExtensionServiceType.CDN, apiVersion)) + .andReturn(mockSupplier) + .anyTimes(); + + replay(mockSupplier); + replay(mockFactory); + replay(mockCDNFactory); + } + + @Test + public void testObjectStorageRegion() { + final HPCloudObjectStorageRestClientModule.HPCloudObjectStorageEndpointModule moduleToTest = new HPCloudObjectStorageRestClientModule.HPCloudObjectStorageEndpointModule(); + + for (int i = 1; i <= 3; i++) { + Supplier resultingSupplier = moduleToTest.provideStorageUrl(mockFactory, apiVersion, String.format("region%1$s", i)); + assertNotNull(resultingSupplier); + URI resultingUri = resultingSupplier.get(); + assertNotNull(resultingUri); + + assertEquals(resultingUri.toString(), + String.format("http://region%1$s.example.org/", i)); + } + } + + @Test + public void testCDNRegion() { + final HPCloudObjectStorageRestClientModule moduleToTest = new HPCloudObjectStorageRestClientModule(); + + for (int i = 1; i <= 3; i++) { + Supplier resultingSupplier = moduleToTest.provideCDNUrl(mockCDNFactory, apiVersion, String.format("region%1$s", i)); + assertNotNull(resultingSupplier); + URI resultingUri = resultingSupplier.get(); + assertNotNull(resultingUri); + + assertEquals(resultingUri.toString(), + String.format("http://region%1$s.example.org/", i)); + } + } + + /** + * Test that specifying an undefined region will return null + */ + @Test + public void testObjectStorageUndefinedRegion() { + final HPCloudObjectStorageRestClientModule.HPCloudObjectStorageEndpointModule moduleToTest = new HPCloudObjectStorageRestClientModule.HPCloudObjectStorageEndpointModule(); + + Supplier resultingSupplier = moduleToTest.provideStorageUrl(mockFactory, apiVersion, "region-that-dne"); + assertNotNull(resultingSupplier); + URI resultingUri = resultingSupplier.get(); + assertNull(resultingUri); + } + + @Test + public void testCDNUndefinedRegion() { + final HPCloudObjectStorageRestClientModule moduleToTest = new HPCloudObjectStorageRestClientModule(); + + Supplier resultingSupplier = moduleToTest.provideCDNUrl(mockCDNFactory, apiVersion, "region-that-dne"); + assertNotNull(resultingSupplier); + URI resultingUri = resultingSupplier.get(); + assertNull(resultingUri); + } +} diff --git a/providers/hpcloud-objectstorage/src/test/resources/keystoneAuthResponseNoCDN.json b/providers/hpcloud-objectstorage/src/test/resources/keystoneAuthResponseNoCDN.json index 4d872152f8..31db938897 100644 --- a/providers/hpcloud-objectstorage/src/test/resources/keystoneAuthResponseNoCDN.json +++ b/providers/hpcloud-objectstorage/src/test/resources/keystoneAuthResponseNoCDN.json @@ -1,104 +1,299 @@ -{ - "access": { - "token": { - "expires": "2012-01-18T21:35:59.050Z", - "id": "Auth_4f173437e4b013bee56d1007", - "tenant": { - "id": "40806637803162", - "name": "user@jclouds.org-default-tenant" - } +{"access": { + "token": { + "expires": "2014-04-24T08:52:18.113Z", + "id": "myToken", + "tenant": { + "id": "myTenantId", + "name": "myTenantName" + } + }, + "user": { + "id": "myUserId", + "name": "myUsername", + "otherAttributes": { + "domainStatus": "enabled", + "domainStatusCode": "00" }, - "user": { - "id": "36980896575174", - "name": "user@jclouds.org", - "roles": [ + "roles": [ + { + "id": "00000000004004", + "serviceId": "100", + "name": "domainuser" + }, + { + "id": "00000000004016", + "serviceId": "120", + "name": "netadmin", + "tenantId": "myTenantId" + }, + { + "id": "00000000004014", + "serviceId": "150", + "name": "cdn-admin", + "tenantId": "myTenantId" + }, + { + "id": "00000000004022", + "serviceId": "110", + "name": "Admin", + "tenantId": "myTenantId" + }, + { + "id": "00000000004024", + "serviceId": "140", + "name": "user", + "tenantId": "myTenantId" + }, + { + "id": "00000000004013", + "serviceId": "130", + "name": "block-admin", + "tenantId": "myTenantId" + }, + { + "id": "00000000004025", + "serviceId": "120", + "name": "sysadmin", + "tenantId": "myTenantId" + }, + { + "id": "91643347410087", + "serviceId": "240", + "name": "dns-admin", + "tenantId": "myTenantId" + }, + { + "id": "00000000004003", + "serviceId": "100", + "name": "domainadmin" + }, + { + "id": "10419409370304", + "serviceId": "170", + "name": "net-admin", + "tenantId": "myTenantId" + } + ] + }, + "serviceCatalog": [ + { + "name": "Usage Reporting", + "type": "metering", + "endpoints": [ { - "id": "00000000004022", - "serviceId": "110", - "name": "Admin", - "tenantName": "40806637803162" + "publicURL": "", + "region": "region-a.geo-1", + "versionId": "2", + "versionInfo": "https:\/\/region-a.geo-1.usage-reporting-internal.hpcloudsvc.com:8777", + "versionList": "https:\/\/region-a.geo-1.usage-reporting-internal.hpcloudsvc.com:8777" }, { - "id": "00000000004024", - "serviceId": "140", - "name": "user", - "tenantName": "40806637803162" - }, - { - "id": "00000000004004", - "serviceId": "100", - "name": "domainuser" - }, - { - "id": "00000000004016", - "serviceId": "120", - "name": "netadmin", - "tenantName": "40806637803162" + "publicURL": "", + "region": "region-b.geo-1", + "versionId": "2", + "versionInfo": "https:\/\/region-b.geo-1.usage-reporting-internal.hpcloudsvc.com:8777", + "versionList": "https:\/\/region-b.geo-1.usage-reporting-internal.hpcloudsvc.com:8777" } ] }, - "serviceCatalog": [ - { - "name": "Object Storage", - "type": "object-store", - "endpoints": [ - { - "tenantName": "40806637803162", - "adminURL": "https://objects.jclouds.org/v1.0/", - "publicURL": "https://objects.jclouds.org/v1.0/40806637803162", - "region": "region-a.geo-1", - "id": "1.0" - } - ] - }, - { - "name": "Identity", - "type": "identity", - "endpoints": [ - { - "publicURL": "https://csnode.jclouds.org/v2.0/", - "region": "region-a.geo-1", - "id": "2.0", - "list": "https://csnode.jclouds.org/extension" - } - ] - }, - { - "name": "Image Management", - "type": "image", - "endpoints": [ - { - "tenantName": "40806637803162", - "publicURL": "https://glance.jclouds.org:9292/v1.0", - "region": "az-1.region-a.geo-1", - "id": "1.0" - } - ] - }, - { - "name":"Cloud Servers", - "type":"compute", - "endpoints":[{ - "tenantId":"1", - "publicURL":"https://compute.north.host/v1/1234", - "internalURL":"https://compute.north.host/v1/1234", - "region":"az-1.region-a.geo-1", - "versionId":"1.0", - "versionInfo":"https://compute.north.host/v1.0/", - "versionList":"https://compute.north.host/" - }, - { - "tenantId":"2", - "publicURL":"https://compute.north.host/v1.1/3456", - "internalURL":"https://compute.north.host/v1.1/3456", - "region":"az-1.region-a.geo-1", - "versionId":"1.1", - "versionInfo":"https://compute.north.host/v1.1/", - "versionList":"https://compute.north.host/" - } - ], - "endpoints_links":[] - } - ] - } -} \ No newline at end of file + { + "name": "Networking", + "type": "network", + "endpoints": [ + { + "tenantId": "myTenantId", + "publicURL": "", + "publicURL2": "", + "region": "az-1.region-a.geo-1", + "versionId": "", + "versionInfo": "", + "versionList": "" + }, + { + "tenantId": "myTenantId", + "publicURL": "https:\/\/region-a.geo-1.network.hpcloudsvc.com", + "publicURL2": "", + "region": "region-a.geo-1", + "versionId": "2.0", + "versionInfo": "https:\/\/region-a.geo-1.network.hpcloudsvc.com", + "versionList": "https:\/\/region-a.geo-1.network.hpcloudsvc.com" + }, + { + "tenantId": "myTenantId", + "publicURL": "https:\/\/region-b.geo-1.network.hpcloudsvc.com", + "publicURL2": "", + "region": "region-b.geo-1", + "versionId": "2.0", + "versionInfo": "https:\/\/region-b.geo-1.network.hpcloudsvc.com", + "versionList": "https:\/\/region-b.geo-1.network.hpcloudsvc.com" + } + ] + }, + { + "name": "Object Storage", + "type": "object-store", + "endpoints": [ + { + "tenantId": "myTenantId", + "publicURL": "https:\/\/region-a.geo-1.objects.hpcloudsvc.com\/v1\/myTenantId", + "region": "region-a.geo-1", + "versionId": "1.0", + "versionInfo": "https:\/\/region-a.geo-1.objects.hpcloudsvc.com\/v1.0\/", + "versionList": "https:\/\/region-a.geo-1.objects.hpcloudsvc.com" + }, + { + "tenantId": "myTenantId", + "publicURL": "https:\/\/region-b.geo-1.objects.hpcloudsvc.com:443\/v1\/myTenantId", + "region": "region-b.geo-1", + "versionId": "1", + "versionInfo": "https:\/\/region-b.geo-1.objects.hpcloudsvc.com:443\/v1\/", + "versionList": "https:\/\/region-b.geo-1.objects.hpcloudsvc.com:443" + } + ] + }, + { + "name": "Identity", + "type": "identity", + "endpoints": [ + { + "publicURL": "https:\/\/region-a.geo-1.identity.hpcloudsvc.com:35357\/v2.0\/", + "region": "region-a.geo-1", + "versionId": "2.0", + "versionInfo": "https:\/\/region-a.geo-1.identity.hpcloudsvc.com:35357\/v2.0\/", + "versionList": "https:\/\/region-a.geo-1.identity.hpcloudsvc.com:35357" + }, + { + "publicURL": "https:\/\/region-a.geo-1.identity.hpcloudsvc.com:35357\/v3\/", + "region": "region-a.geo-1", + "versionId": "3.0", + "versionInfo": "https:\/\/region-a.geo-1.identity.hpcloudsvc.com:35357\/v3\/", + "versionList": "https:\/\/region-a.geo-1.identity.hpcloudsvc.com:35357" + }, + { + "publicURL": "https:\/\/region-b.geo-1.identity.hpcloudsvc.com:35357\/v2.0\/", + "region": "region-b.geo-1", + "versionId": "2.0", + "versionInfo": "https:\/\/region-b.geo-1.identity.hpcloudsvc.com:35357\/v2.0\/", + "versionList": "https:\/\/region-b.geo-1.identity.hpcloudsvc.com:35357" + }, + { + "publicURL": "https:\/\/region-b.geo-1.identity.hpcloudsvc.com:35357\/v3\/", + "region": "region-b.geo-1", + "versionId": "3.0", + "versionInfo": "https:\/\/region-b.geo-1.identity.hpcloudsvc.com:35357\/v3\/", + "versionList": "https:\/\/region-b.geo-1.identity.hpcloudsvc.com:35357" + } + ] + }, + { + "name": "Image Management", + "type": "image", + "endpoints": [ + { + "tenantId": "myTenantId", + "publicURL": "https:\/\/glance1.uswest.hpcloud.net:9292\/v1.0", + "publicURL2": "", + "region": "az-1.region-a.geo-1", + "versionId": "1.0", + "versionInfo": "https:\/\/glance1.uswest.hpcloud.net:9292\/v1.0\/", + "versionList": "https:\/\/glance1.uswest.hpcloud.net:9292" + }, + { + "tenantId": "myTenantId", + "publicURL": "https:\/\/region-a.geo-1.images.hpcloudsvc.com:443\/v1.0", + "publicURL2": "", + "region": "region-a.geo-1", + "versionId": "1.0", + "versionInfo": "https:\/\/region-a.geo-1.images.hpcloudsvc.com:443\/v1.0", + "versionList": "https:\/\/region-a.geo-1.images.hpcloudsvc.com:443" + }, + { + "tenantId": "myTenantId", + "publicURL": "https:\/\/region-b.geo-1.images.hpcloudsvc.com:443\/v1.0", + "publicURL2": "", + "region": "region-b.geo-1", + "versionId": "1.0", + "versionInfo": "https:\/\/region-b.geo-1.images.hpcloudsvc.com:443\/v1.0", + "versionList": "https:\/\/region-b.geo-1.images.hpcloudsvc.com:443" + } + ] + }, + { + "name": "DNS", + "type": "hpext:dns", + "endpoints": [{ + "tenantId": "myTenantId", + "publicURL": "https:\/\/region-a.geo-1.dns.hpcloudsvc.com\/v1\/", + "publicURL2": "", + "region": "region-a.geo-1", + "versionId": "1", + "versionInfo": "https:\/\/region-a.geo-1.dns.hpcloudsvc.com\/v1\/", + "versionList": "https:\/\/region-a.geo-1.dns.hpcloudsvc.com\/" + }] + }, + { + "name": "Block Storage", + "type": "volume", + "endpoints": [ + { + "tenantId": "myTenantId", + "publicURL": "https:\/\/az-1.region-a.geo-1.compute.hpcloudsvc.com\/v1.1\/myTenantId", + "publicURL2": "", + "region": "az-1.region-a.geo-1", + "versionId": "1.1", + "versionInfo": "https:\/\/az-1.region-a.geo-1.compute.hpcloudsvc.com\/v1.1\/", + "versionList": "https:\/\/az-1.region-a.geo-1.compute.hpcloudsvc.com" + }, + { + "tenantId": "myTenantId", + "publicURL": "https:\/\/region-a.geo-1.block.hpcloudsvc.com\/v1\/myTenantId", + "publicURL2": "", + "region": "region-a.geo-1", + "versionId": "1.0", + "versionInfo": "https:\/\/region-a.geo-1.block.hpcloudsvc.com\/v1", + "versionList": "https:\/\/region-a.geo-1.block.hpcloudsvc.com" + }, + { + "tenantId": "myTenantId", + "publicURL": "https:\/\/region-b.geo-1.block.hpcloudsvc.com\/v1\/myTenantId", + "publicURL2": "", + "region": "region-b.geo-1", + "versionId": "1.0", + "versionInfo": "https:\/\/region-b.geo-1.block.hpcloudsvc.com\/v1", + "versionList": "https:\/\/region-b.geo-1.block.hpcloudsvc.com" + } + ] + }, + { + "name": "Compute", + "type": "compute", + "endpoints": [ + { + "tenantId": "myTenantId", + "publicURL": "https:\/\/az-1.region-a.geo-1.compute.hpcloudsvc.com\/v1.1\/myTenantId", + "publicURL2": "https:\/\/az-1.region-a.geo-1.ec2-compute.hpcloudsvc.com\/services\/Cloud", + "region": "az-1.region-a.geo-1", + "versionId": "1.1", + "versionInfo": "https:\/\/az-1.region-a.geo-1.compute.hpcloudsvc.com\/v1.1\/", + "versionList": "https:\/\/az-1.region-a.geo-1.compute.hpcloudsvc.com" + }, + { + "tenantId": "myTenantId", + "publicURL": "https:\/\/region-a.geo-1.compute.hpcloudsvc.com\/v2\/myTenantId", + "region": "region-a.geo-1", + "versionId": "2", + "versionInfo": "https:\/\/region-a.geo-1.compute.hpcloudsvc.com\/v2\/", + "versionList": "https:\/\/region-a.geo-1.compute.hpcloudsvc.com" + }, + { + "tenantId": "myTenantId", + "publicURL": "https:\/\/region-b.geo-1.compute.hpcloudsvc.com\/v2\/myTenantId", + "region": "region-b.geo-1", + "versionId": "2", + "versionInfo": "https:\/\/region-b.geo-1.compute.hpcloudsvc.com\/v2\/", + "versionList": "https:\/\/region-b.geo-1.compute.hpcloudsvc.com" + } + ] + } + ] +}} \ No newline at end of file diff --git a/providers/hpcloud-objectstorage/src/test/resources/keystoneAuthResponseWithCDN.json b/providers/hpcloud-objectstorage/src/test/resources/keystoneAuthResponseWithCDN.json index 832baf0ddb..11d41116e5 100644 --- a/providers/hpcloud-objectstorage/src/test/resources/keystoneAuthResponseWithCDN.json +++ b/providers/hpcloud-objectstorage/src/test/resources/keystoneAuthResponseWithCDN.json @@ -1,116 +1,321 @@ -{ - "access": { - "token": { - "expires": "2012-01-18T21:35:59.050Z", - "id": "Auth_4f173437e4b013bee56d1007", - "tenant": { - "id": "40806637803162", - "name": "user@jclouds.org-default-tenant" - } +{"access": { + "token": { + "expires": "2014-04-24T08:52:18.113Z", + "id": "myToken", + "tenant": { + "id": "myTenantId", + "name": "myTenantName" + } + }, + "user": { + "id": "myUserId", + "name": "myUsername", + "otherAttributes": { + "domainStatus": "enabled", + "domainStatusCode": "00" }, - "user": { - "id": "36980896575174", - "name": "user@jclouds.org", - "roles": [ + "roles": [ + { + "id": "00000000004004", + "serviceId": "100", + "name": "domainuser" + }, + { + "id": "00000000004016", + "serviceId": "120", + "name": "netadmin", + "tenantId": "myTenantId" + }, + { + "id": "00000000004014", + "serviceId": "150", + "name": "cdn-admin", + "tenantId": "myTenantId" + }, + { + "id": "00000000004022", + "serviceId": "110", + "name": "Admin", + "tenantId": "myTenantId" + }, + { + "id": "00000000004024", + "serviceId": "140", + "name": "user", + "tenantId": "myTenantId" + }, + { + "id": "00000000004013", + "serviceId": "130", + "name": "block-admin", + "tenantId": "myTenantId" + }, + { + "id": "00000000004025", + "serviceId": "120", + "name": "sysadmin", + "tenantId": "myTenantId" + }, + { + "id": "91643347410087", + "serviceId": "240", + "name": "dns-admin", + "tenantId": "myTenantId" + }, + { + "id": "00000000004003", + "serviceId": "100", + "name": "domainadmin" + }, + { + "id": "10419409370304", + "serviceId": "170", + "name": "net-admin", + "tenantId": "myTenantId" + } + ] + }, + "serviceCatalog": [ + { + "name": "Usage Reporting", + "type": "metering", + "endpoints": [ { - "id": "00000000004022", - "serviceId": "110", - "name": "Admin", - "tenantName": "40806637803162" + "publicURL": "", + "region": "region-a.geo-1", + "versionId": "2", + "versionInfo": "https://region-a.geo-1.usage-reporting-internal.hpcloudsvc.com:8777", + "versionList": "https://region-a.geo-1.usage-reporting-internal.hpcloudsvc.com:8777" }, { - "id": "00000000004024", - "serviceId": "140", - "name": "user", - "tenantName": "40806637803162" - }, - { - "id": "00000000004004", - "serviceId": "100", - "name": "domainuser" - }, - { - "id": "00000000004016", - "serviceId": "120", - "name": "netadmin", - "tenantName": "40806637803162" + "publicURL": "", + "region": "region-b.geo-1", + "versionId": "2", + "versionInfo": "https://region-b.geo-1.usage-reporting-internal.hpcloudsvc.com:8777", + "versionList": "https://region-b.geo-1.usage-reporting-internal.hpcloudsvc.com:8777" } ] }, - "serviceCatalog": [ - { - "name": "CDN", - "type": "hpext:cdn", - "endpoints": [{ - "tenantId": "1", - "publicURL": "https://cdnmgmt.jclouds.org/v1.0/40806637803162", + { + "name": "Networking", + "type": "network", + "endpoints": [ + { + "tenantId": "myTenantId", + "publicURL": "", + "publicURL2": "", + "region": "az-1.region-a.geo-1", + "versionId": "", + "versionInfo": "", + "versionList": "" + }, + { + "tenantId": "myTenantId", + "publicURL": "https://region-a.geo-1.network.hpcloudsvc.com", + "publicURL2": "", + "region": "region-a.geo-1", + "versionId": "2.0", + "versionInfo": "https://region-a.geo-1.network.hpcloudsvc.com", + "versionList": "https://region-a.geo-1.network.hpcloudsvc.com" + }, + { + "tenantId": "myTenantId", + "publicURL": "https://region-b.geo-1.network.hpcloudsvc.com", + "publicURL2": "", + "region": "region-b.geo-1", + "versionId": "2.0", + "versionInfo": "https://region-b.geo-1.network.hpcloudsvc.com", + "versionList": "https://region-b.geo-1.network.hpcloudsvc.com" + } + ] + }, + { + "name": "CDN", + "type": "hpext:cdn", + "endpoints": [ + { + "tenantId": "myTenantId", + "publicURL": "https://region-a.geo-1.cdnmgmt.hpcloudsvc.com/v1.0/myTenantId", "region": "region-a.geo-1", "versionId": "1.0", - "versionInfo":"https://cdnmgmt.jclouds.org/v1.0/", - "versionList":"https://cdnmgmt.jclouds.org" - }] - }, - { - "name": "Object Storage", - "type": "object-store", - "endpoints": [ - { - "tenantName": "40806637803162", - "adminURL": "https://objects.jclouds.org/v1.0/", - "publicURL": "https://objects.jclouds.org/v1.0/40806637803162", - "region": "region-a.geo-1", - "id": "1.0" - } - ] - }, - { - "name": "Identity", - "type": "identity", - "endpoints": [ - { - "publicURL": "https://csnode.jclouds.org/v2.0/", - "region": "region-a.geo-1", - "id": "2.0", - "list": "https://csnode.jclouds.org/extension" - } - ] - }, - { - "name": "Image Management", - "type": "image", - "endpoints": [ - { - "tenantName": "40806637803162", - "publicURL": "https://glance.jclouds.org:9292/v1.0", - "region": "az-1.region-a.geo-1", - "id": "1.0" - } - ] - }, - { - "name":"Cloud Servers", - "type":"compute", - "endpoints":[{ - "tenantId":"1", - "publicURL":"https://compute.north.host/v1/1234", - "internalURL":"https://compute.north.host/v1/1234", - "region":"az-1.region-a.geo-1", - "versionId":"1.0", - "versionInfo":"https://compute.north.host/v1.0/", - "versionList":"https://compute.north.host/" - }, - { - "tenantId":"2", - "publicURL":"https://compute.north.host/v1.1/3456", - "internalURL":"https://compute.north.host/v1.1/3456", - "region":"az-1.region-a.geo-1", - "versionId":"1.1", - "versionInfo":"https://compute.north.host/v1.1/", - "versionList":"https://compute.north.host/" - } - ], - "endpoints_links":[] - } - ] - } -} \ No newline at end of file + "versionInfo": "https://region-a.geo-1.cdnmgmt.hpcloudsvc.com/v1.0/", + "versionList": "https://region-a.geo-1.cdnmgmt.hpcloudsvc.com/" + }, + { + "tenantId": "myTenantId", + "publicURL": "https://region-b.geo-1.cdnmgmt.hpcloudsvc.com/v1.0/myTenantId", + "region": "region-b.geo-1", + "versionId": "1.0", + "versionInfo": "https://region-b.geo-1.cdnmgmt.hpcloudsvc.com/v1.0/", + "versionList": "https://region-b.geo-1.cdnmgmt.hpcloudsvc.com/" + } + ] + }, + { + "name": "Object Storage", + "type": "object-store", + "endpoints": [ + { + "tenantId": "myTenantId", + "publicURL": "https://region-a.geo-1.objects.hpcloudsvc.com/v1/myTenantId", + "region": "region-a.geo-1", + "versionId": "1.0", + "versionInfo": "https://region-a.geo-1.objects.hpcloudsvc.com/v1.0/", + "versionList": "https://region-a.geo-1.objects.hpcloudsvc.com" + }, + { + "tenantId": "myTenantId", + "publicURL": "https://region-b.geo-1.objects.hpcloudsvc.com:443/v1/myTenantId", + "region": "region-b.geo-1", + "versionId": "1", + "versionInfo": "https://region-b.geo-1.objects.hpcloudsvc.com:443/v1/", + "versionList": "https://region-b.geo-1.objects.hpcloudsvc.com:443" + } + ] + }, + { + "name": "Identity", + "type": "identity", + "endpoints": [ + { + "publicURL": "https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/", + "region": "region-a.geo-1", + "versionId": "2.0", + "versionInfo": "https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/", + "versionList": "https://region-a.geo-1.identity.hpcloudsvc.com:35357" + }, + { + "publicURL": "https://region-a.geo-1.identity.hpcloudsvc.com:35357/v3/", + "region": "region-a.geo-1", + "versionId": "3.0", + "versionInfo": "https://region-a.geo-1.identity.hpcloudsvc.com:35357/v3/", + "versionList": "https://region-a.geo-1.identity.hpcloudsvc.com:35357" + }, + { + "publicURL": "https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/", + "region": "region-b.geo-1", + "versionId": "2.0", + "versionInfo": "https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0/", + "versionList": "https://region-b.geo-1.identity.hpcloudsvc.com:35357" + }, + { + "publicURL": "https://region-b.geo-1.identity.hpcloudsvc.com:35357/v3/", + "region": "region-b.geo-1", + "versionId": "3.0", + "versionInfo": "https://region-b.geo-1.identity.hpcloudsvc.com:35357/v3/", + "versionList": "https://region-b.geo-1.identity.hpcloudsvc.com:35357" + } + ] + }, + { + "name": "Image Management", + "type": "image", + "endpoints": [ + { + "tenantId": "myTenantId", + "publicURL": "https://glance1.uswest.hpcloud.net:9292/v1.0", + "publicURL2": "", + "region": "az-1.region-a.geo-1", + "versionId": "1.0", + "versionInfo": "https://glance1.uswest.hpcloud.net:9292/v1.0/", + "versionList": "https://glance1.uswest.hpcloud.net:9292" + }, + { + "tenantId": "myTenantId", + "publicURL": "https://region-a.geo-1.images.hpcloudsvc.com:443/v1.0", + "publicURL2": "", + "region": "region-a.geo-1", + "versionId": "1.0", + "versionInfo": "https://region-a.geo-1.images.hpcloudsvc.com:443/v1.0", + "versionList": "https://region-a.geo-1.images.hpcloudsvc.com:443" + }, + { + "tenantId": "myTenantId", + "publicURL": "https://region-b.geo-1.images.hpcloudsvc.com:443/v1.0", + "publicURL2": "", + "region": "region-b.geo-1", + "versionId": "1.0", + "versionInfo": "https://region-b.geo-1.images.hpcloudsvc.com:443/v1.0", + "versionList": "https://region-b.geo-1.images.hpcloudsvc.com:443" + } + ] + }, + { + "name": "DNS", + "type": "hpext:dns", + "endpoints": [{ + "tenantId": "myTenantId", + "publicURL": "https://region-a.geo-1.dns.hpcloudsvc.com/v1/", + "publicURL2": "", + "region": "region-a.geo-1", + "versionId": "1", + "versionInfo": "https://region-a.geo-1.dns.hpcloudsvc.com/v1/", + "versionList": "https://region-a.geo-1.dns.hpcloudsvc.com/" + }] + }, + { + "name": "Block Storage", + "type": "volume", + "endpoints": [ + { + "tenantId": "myTenantId", + "publicURL": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/myTenantId", + "publicURL2": "", + "region": "az-1.region-a.geo-1", + "versionId": "1.1", + "versionInfo": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/", + "versionList": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com" + }, + { + "tenantId": "myTenantId", + "publicURL": "https://region-a.geo-1.block.hpcloudsvc.com/v1/myTenantId", + "publicURL2": "", + "region": "region-a.geo-1", + "versionId": "1.0", + "versionInfo": "https://region-a.geo-1.block.hpcloudsvc.com/v1", + "versionList": "https://region-a.geo-1.block.hpcloudsvc.com" + }, + { + "tenantId": "myTenantId", + "publicURL": "https://region-b.geo-1.block.hpcloudsvc.com/v1/myTenantId", + "publicURL2": "", + "region": "region-b.geo-1", + "versionId": "1.0", + "versionInfo": "https://region-b.geo-1.block.hpcloudsvc.com/v1", + "versionList": "https://region-b.geo-1.block.hpcloudsvc.com" + } + ] + }, + { + "name": "Compute", + "type": "compute", + "endpoints": [ + { + "tenantId": "myTenantId", + "publicURL": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/myTenantId", + "publicURL2": "https://az-1.region-a.geo-1.ec2-compute.hpcloudsvc.com/services/Cloud", + "region": "az-1.region-a.geo-1", + "versionId": "1.1", + "versionInfo": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/", + "versionList": "https://az-1.region-a.geo-1.compute.hpcloudsvc.com" + }, + { + "tenantId": "myTenantId", + "publicURL": "https://region-a.geo-1.compute.hpcloudsvc.com/v2/myTenantId", + "region": "region-a.geo-1", + "versionId": "2", + "versionInfo": "https://region-a.geo-1.compute.hpcloudsvc.com/v2/", + "versionList": "https://region-a.geo-1.compute.hpcloudsvc.com" + }, + { + "tenantId": "myTenantId", + "publicURL": "https://region-b.geo-1.compute.hpcloudsvc.com/v2/myTenantId", + "region": "region-b.geo-1", + "versionId": "2", + "versionInfo": "https://region-b.geo-1.compute.hpcloudsvc.com/v2/", + "versionList": "https://region-b.geo-1.compute.hpcloudsvc.com" + } + ] + } + ] +}} \ No newline at end of file diff --git a/providers/hpcloud-objectstorage/src/test/resources/test_list_cdn.json b/providers/hpcloud-objectstorage/src/test/resources/test_list_cdn.json index ca09e600f9..6cc438fbc1 100644 --- a/providers/hpcloud-objectstorage/src/test/resources/test_list_cdn.json +++ b/providers/hpcloud-objectstorage/src/test/resources/test_list_cdn.json @@ -1,5 +1,5 @@ [ -{"name":"hpcloud-blobstore.testCDNOperationsContainerWithCDN","cdnEnabled":"false","ttl":3600,"cdnUri":"http://h10cdf69e2913a87afe9ce721ceb35ca5.cdn.hpcloudsvc.com","cdnSslUri":"https://a248.e.akamai.net/cdn.hpcloudsvc.com/h10cdf69e2913a87afe9ce721ceb35ca5/aw2","referrerAcl":"","useragentAcl":"", "logRetention":"false"}, -{"name":"hpcloud-blobstore5","cdnEnabled":"true","ttl":28800,"cdnUri":"http://h0bc2984e4ad8f8bec0ebf5b147c9fe55.cdn.hpcloudsvc.com","cdnSslUri":"https://a248.e.akamai.net/cdn.hpcloudsvc.com/h0bc2984e4ad8f8bec0ebf5b147c9fe55/aw2","referrerAcl":"","useragentAcl":"", "logRetention":"false"}, -{"name":"hpcloud-cfcdnint.testCDNOperationsContainerWithCDN","cdnEnabled":"false","ttl":3600,"cdnUri":"http://h82d1ae1ee2ada5151c60e33f097294c2.cdn.hpcloudsvc.com","cdnSslUri":"https://a248.e.akamai.net/cdn.hpcloudsvc.com/h82d1ae1ee2ada5151c60e33f097294c2/aw2","referrerAcl":"","useragentAcl":"", "logRetention":"false"} +{"name":"hpcloud-blobstore.testCDNOperationsContainerWithCDN","cdn_enabled":"false","ttl":3600,"x-cdn-uri":"http://h10cdf69e2913a87afe9ce721ceb35ca5.cdn.hpcloudsvc.com","x-cdn-ssl-uri":"https://a248.e.akamai.net/cdn.hpcloudsvc.com/h10cdf69e2913a87afe9ce721ceb35ca5/aw2","referrerAcl":"","useragentAcl":"", "log_retention":"false"}, +{"name":"hpcloud-blobstore5","cdn_enabled":"true","ttl":28800,"x-cdn-uri":"http://h0bc2984e4ad8f8bec0ebf5b147c9fe55.cdn.hpcloudsvc.com","x-cdn-ssl-uri":"https://a248.e.akamai.net/cdn.hpcloudsvc.com/h0bc2984e4ad8f8bec0ebf5b147c9fe55/aw2","referrerAcl":"","useragentAcl":"", "log_retention":"false"}, +{"name":"hpcloud-cfcdnint.testCDNOperationsContainerWithCDN","cdn_enabled":"false","ttl":3600,"x-cdn-uri":"http://h82d1ae1ee2ada5151c60e33f097294c2.cdn.hpcloudsvc.com","x-cdn-ssl-uri":"https://a248.e.akamai.net/cdn.hpcloudsvc.com/h82d1ae1ee2ada5151c60e33f097294c2/aw2","referrerAcl":"","useragentAcl":"", "log_retention":"false"} ] \ No newline at end of file