Use secure endpoint in tests

pull/185/head
Andrew Gaul 2017-02-15 18:11:33 -08:00
rodzic ab425bd7d2
commit acf125d8e9
3 zmienionych plików z 18 dodań i 3 usunięć

Wyświetl plik

@ -108,7 +108,7 @@ public final class S3AwsSdkTest {
info.getS3Credential());
context = info.getBlobStore().getContext();
s3Proxy = info.getS3Proxy();
s3Endpoint = info.getEndpoint();
s3Endpoint = info.getSecureEndpoint();
s3EndpointConfig = new EndpointConfiguration(
s3Endpoint.toString(), "us-east-1");
client = AmazonS3ClientBuilder.standard()

Wyświetl plik

@ -86,7 +86,7 @@ public final class S3ProxyTest {
context = info.getBlobStore().getContext();
blobStore = info.getBlobStore();
blobStoreType = context.unwrap().getProviderMetadata().getId();
s3Endpoint = info.getEndpoint();
s3Endpoint = info.getSecureEndpoint();
containerName = createRandomContainerName();
if (blobStoreType.equals("google-cloud-storage")) {
@ -139,7 +139,7 @@ public final class S3ProxyTest {
HttpClient httpClient = s3Context.utils().http();
URI uri = new URI(s3Endpoint.getScheme(), s3Endpoint.getUserInfo(),
s3Endpoint.getHost(), s3Proxy.getPort(),
s3Endpoint.getHost(), s3Proxy.getSecurePort(),
"/" + containerName + "/" + blobName,
/*query=*/ null, /*fragment=*/ null);
try (InputStream actual = httpClient.get(uri);

Wyświetl plik

@ -110,6 +110,7 @@ final class TestUtils {
private String s3Credential;
private BlobStore blobStore;
private URI endpoint;
private URI secureEndpoint;
S3Proxy getS3Proxy() {
return s3Proxy;
@ -134,6 +135,10 @@ final class TestUtils {
URI getEndpoint() {
return endpoint;
}
URI getSecureEndpoint() {
return secureEndpoint;
}
}
static S3ProxyLaunchInfo startS3Proxy() throws Exception {
@ -195,6 +200,7 @@ final class TestUtils {
.endpoint(info.getEndpoint());
if (secureEndpoint != null) {
s3ProxyBuilder.secureEndpoint(new URI(secureEndpoint));
info.secureEndpoint = new URI(secureEndpoint);
}
if (info.getS3Identity() != null || info.getS3Credential() != null) {
s3ProxyBuilder.awsAuthentication(s3ProxyAuthorization,
@ -219,6 +225,15 @@ final class TestUtils {
info.endpoint.getUserInfo(), info.endpoint.getHost(),
info.s3Proxy.getPort(), info.endpoint.getPath(),
info.endpoint.getQuery(), info.endpoint.getFragment());
if (info.secureEndpoint != null) {
info.secureEndpoint = new URI(info.secureEndpoint.getScheme(),
info.secureEndpoint.getUserInfo(),
info.secureEndpoint.getHost(),
info.s3Proxy.getSecurePort(),
info.secureEndpoint.getPath(),
info.secureEndpoint.getQuery(),
info.secureEndpoint.getFragment());
}
return info;
}