Add JcloudsS3ClientLiveTest

Uncovers several missing features:

Cache-Control header
conditional copies
public-read-write canned ACLs
XML ACLs

References #62.
pull/114/head
Andrew Gaul 2016-01-12 12:25:00 -08:00
rodzic ae95538647
commit 9c5499a05e
3 zmienionych plików z 143 dodań i 0 usunięć

Wyświetl plik

@ -74,6 +74,7 @@ Limitations
S3Proxy does not support:
* AWS signature V4, see [#24](https://github.com/andrewgaul/s3proxy/issues/24)
* conditional copy object, see [#113](https://github.com/andrewgaul/s3proxy/issues/113)
* POST uploads, see [#73](https://github.com/andrewgaul/s3proxy/issues/73)
* object server-side encryption
* object versioning, see [#74](https://github.com/andrewgaul/s3proxy/issues/74)

Wyświetl plik

@ -162,6 +162,13 @@ final class S3ProxyHandler extends AbstractHandler {
"x-amz-acl",
"x-amz-content-sha256",
"x-amz-copy-source",
// TODO: unsupported
/*
"x-amz-copy-source-if-match",
"x-amz-copy-source-if-modified-since",
"x-amz-copy-source-if-none-match",
"x-amz-copy-source-if-unmodified-since",
*/
"x-amz-copy-source-range",
"x-amz-date",
"x-amz-decoded-content-length",

Wyświetl plik

@ -0,0 +1,135 @@
/*
* Copyright 2014-2016 Andrew Gaul <andrew@gaul.org>
*
* Licensed 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.gaul.s3proxy;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.util.Properties;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import com.google.common.base.Throwables;
import com.google.common.util.concurrent.Uninterruptibles;
import org.jclouds.Constants;
import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.s3.S3ClientLiveTest;
import org.jclouds.s3.domain.S3Object;
import org.testng.SkipException;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
@Test(testName = "JcloudsS3ClientLiveTest")
public final class JcloudsS3ClientLiveTest extends S3ClientLiveTest {
protected static final int AWAIT_CONSISTENCY_TIMEOUT_SECONDS =
Integer.parseInt(
System.getProperty(
"test.blobstore.await-consistency-timeout-seconds",
"0"));
private S3Proxy s3Proxy;
private BlobStoreContext context;
@AfterClass
public void tearDown() throws Exception {
s3Proxy.stop();
context.close();
}
@Override
protected void awaitConsistency() {
Uninterruptibles.sleepUninterruptibly(
AWAIT_CONSISTENCY_TIMEOUT_SECONDS, TimeUnit.SECONDS);
}
@Override
protected Properties setupProperties() {
TestUtils.S3ProxyLaunchInfo info;
try {
info = TestUtils.startS3Proxy();
s3Proxy = info.getS3Proxy();
context = info.getBlobStore().getContext();
} catch (Exception e) {
throw Throwables.propagate(e);
}
Properties props = super.setupProperties();
props.setProperty(Constants.PROPERTY_IDENTITY, info.getS3Identity());
props.setProperty(Constants.PROPERTY_CREDENTIAL,
info.getS3Credential());
props.setProperty(Constants.PROPERTY_ENDPOINT,
info.getEndpoint().toString());
props.setProperty(Constants.PROPERTY_STRIP_EXPECT_HEADER, "true");
endpoint = info.getEndpoint().toString();
return props;
}
@Override
@Test
public void testPublicWriteOnObject() throws InterruptedException,
ExecutionException, TimeoutException, IOException {
throw new SkipException("public-read-write-acl not supported");
}
@Override
@Test
public void testUpdateObjectACL() throws InterruptedException,
ExecutionException, TimeoutException, IOException {
throw new SkipException("XML ACLs not supported");
}
@Override
@Test
public void testCopyIfModifiedSince() throws InterruptedException,
ExecutionException, TimeoutException, IOException {
throw new SkipException("conditional copies not supported");
}
@Override
@Test
public void testCopyIfUnmodifiedSince() throws InterruptedException,
ExecutionException, TimeoutException, IOException {
throw new SkipException("conditional copies not supported");
}
@Override
@Test
public void testCopyIfMatch() throws InterruptedException,
ExecutionException, TimeoutException, IOException {
throw new SkipException("conditional copies not supported");
}
@Override
@Test
public void testCopyIfNoneMatch() throws IOException,
InterruptedException, ExecutionException, TimeoutException {
throw new SkipException("conditional copies not supported");
}
// work around bucket-in-host and port 80 assumptions
@Override
protected URL getObjectURL(String containerName, String key)
throws Exception {
return new URL(String.format("%s/%s/%s", URI.create(endpoint),
containerName, key));
}
@Override
protected void assertCacheControl(S3Object newObject, String string) {
// Cache-Control not supported
}
}