reorganized tests

git-svn-id: http://jclouds.googlecode.com/svn/trunk@1460 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
adrian.f.cole 2009-06-24 18:31:50 +00:00
parent 19989d8374
commit 256ec34af6
8 changed files with 26 additions and 27 deletions

View File

@ -38,22 +38,17 @@ import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
/**
* Tests connection by listing all the buckets and their size
* Tests connection by copying the contents of a url into the bucket.
*
* @author Adrian Cole
*/
@Test(testName = "s3.S3ConnectionIntegrationTest")
public class S3ConnectionIntegrationTest extends S3IntegrationTest {
@Test(groups = { "integration" })
void testListBuckets() throws Exception {
client.listOwnedBuckets().get(10, TimeUnit.SECONDS);
}
@Test(groups = { "live" }, testName = "s3.S3ConnectionLiveTest")
public class S3ConnectionLiveTest extends S3IntegrationTest {
private static final String sysHttpStreamUrl = System.getProperty("jclouds.s3.httpstream.url");
private static final String sysHttpStreamMd5 = System.getProperty("jclouds.s3.httpstream.md5");
@Test(groups = { "integration" })
@Test
@Parameters( { "jclouds.s3.httpstream.url", "jclouds.s3.httpstream.md5" })
public void testCopyUrl(@Optional String httpStreamUrl, @Optional String httpStreamMd5)
throws Exception {

View File

@ -50,6 +50,7 @@ import org.jclouds.aws.s3.domain.S3Bucket;
import org.jclouds.aws.s3.domain.S3Object;
import org.jclouds.aws.s3.domain.S3Bucket.Metadata;
import org.jclouds.aws.s3.domain.S3Bucket.Metadata.LocationConstraint;
import org.jclouds.aws.s3.internal.StubS3Connection;
import org.jclouds.aws.s3.reference.S3Constants;
import org.jclouds.aws.s3.util.S3Utils;
import org.jclouds.http.config.JavaUrlHttpFutureCommandClientModule;

View File

@ -26,12 +26,12 @@ package org.jclouds.aws.s3;
import org.testng.annotations.Test;
/**
* This performs the same test as {@link S3ConnectionIntegrationTest}, except using SSL.
* This performs the same test as {@link S3ConnectionLiveTest}, except using SSL.
*
* @author Adrian Cole
*/
@Test(groups = {"live"}, testName = "s3.SecureS3ConnectionIntegrationTest")
public class SecureS3ConnectionIntegrationTest extends S3ConnectionIntegrationTest {
@Test(groups = {"live"}, testName = "s3.SecureS3ConnectionLiveTest")
public class SecureS3ConnectionLiveTest extends S3ConnectionLiveTest {
@Override
protected S3ContextFactory buildS3ContextFactory(String AWSAccessKeyId,
String AWSSecretAccessKey) {

View File

@ -23,6 +23,8 @@
*/
package org.jclouds.aws.s3.commands;
import static org.jclouds.aws.s3.internal.StubS3Connection.TEST_ACL_EMAIL;
import static org.jclouds.aws.s3.internal.StubS3Connection.TEST_ACL_ID;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
@ -38,7 +40,6 @@ import org.jclouds.aws.s3.domain.AccessControlList.EmailAddressGrantee;
import org.jclouds.aws.s3.domain.AccessControlList.GroupGranteeURI;
import org.jclouds.aws.s3.domain.AccessControlList.Permission;
import org.testng.annotations.Test;
import static org.jclouds.aws.s3.StubS3Connection.*;
/**
* Tests integrated functionality of all commands that retrieve Access Control Lists (ACLs).

View File

@ -29,9 +29,9 @@ import org.jclouds.aws.s3.handlers.ParseAWSErrorFromXmlContent;
import org.jclouds.aws.s3.reference.S3Constants;
import org.jclouds.aws.s3.xml.config.S3ParserModule;
import org.jclouds.http.HttpErrorHandler;
import org.jclouds.http.HttpRetryHandler;
import org.jclouds.http.annotation.ClientError;
import org.jclouds.http.annotation.ServerError;
import org.jclouds.http.config.JavaUrlHttpFutureCommandClientModule;
import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
import org.testng.annotations.Test;
import com.google.inject.Guice;
@ -69,9 +69,9 @@ public class S3ContextModuleTest {
}, new JavaUrlHttpFutureCommandClientModule());
}
private static class ServerErrorHandlerTest {
@Inject
@ServerError
HttpErrorHandler errorHandler;
}
@ -81,16 +81,16 @@ public class S3ContextModuleTest {
assertEquals(error.errorHandler.getClass(), ParseAWSErrorFromXmlContent.class);
}
private static class RetryHandlerTest {
private static class ClientErrorHandlerTest {
@Inject
HttpRetryHandler retryHandler;
@ClientError
HttpErrorHandler errorHandler;
}
@Test
void testRetryHandler() {
RetryHandlerTest handler = createInjector().getInstance(RetryHandlerTest.class);
assertEquals(handler.retryHandler.getClass(), BackoffLimitedRetryHandler.class);
void testClientErrorHandler() {
ClientErrorHandlerTest handler = createInjector().getInstance(ClientErrorHandlerTest.class);
assertEquals(handler.errorHandler.getClass(), ParseAWSErrorFromXmlContent.class);
}
}

View File

@ -26,7 +26,7 @@ package org.jclouds.aws.s3.config;
import java.net.URI;
import org.jclouds.aws.s3.S3Connection;
import org.jclouds.aws.s3.StubS3Connection;
import org.jclouds.aws.s3.internal.StubS3Connection;
import com.google.inject.AbstractModule;

View File

@ -21,7 +21,7 @@
* under the License.
* ====================================================================
*/
package org.jclouds.aws.s3;
package org.jclouds.aws.s3.internal;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.easymock.classextension.EasyMock.createNiceMock;
@ -47,6 +47,7 @@ import java.util.concurrent.TimeoutException;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.output.ByteArrayOutputStream;
import org.jclouds.aws.s3.S3Connection;
import org.jclouds.aws.s3.commands.CopyObject;
import org.jclouds.aws.s3.commands.options.CopyObjectOptions;
import org.jclouds.aws.s3.commands.options.GetObjectOptions;
@ -79,6 +80,7 @@ import com.thoughtworks.xstream.XStream;
* Implementation of {@link S3Connection} which keeps all data in a local Map object.
*
* @author Adrian Cole
* @author James Murty
*/
public class StubS3Connection implements S3Connection {
public static final String TEST_ACL_ID = "1a405254c932b52e5b5caaa88186bc431a1bacb9ece631f835daddaf0c47677c";

View File

@ -23,20 +23,20 @@
*/
package org.jclouds.aws.s3.suncloud;
import org.jclouds.aws.s3.S3ConnectionIntegrationTest;
import org.jclouds.aws.s3.S3ConnectionLiveTest;
import org.jclouds.aws.s3.S3ContextFactory;
import org.jclouds.aws.s3.suncloud.config.SunCloudS3ConnectionModule;
import org.jclouds.aws.s3.suncloud.xml.config.SunCloudS3ParserModule;
import org.testng.annotations.Test;
/**
* This performs the same test as {@link S3ConnectionIntegrationTest}, except using Sun Cloud
* This performs the same test as {@link S3ConnectionLiveTest}, except using Sun Cloud
* Storage.
*
* @author Adrian Cole
*/
@Test(enabled = false, groups = { "live" }, testName = "s3.suncloud.SunCloudS3ConnectionLiveTest")
public class SunCloudS3ConnectionLiveTest extends S3ConnectionIntegrationTest {
public class SunCloudS3ConnectionLiveTest extends S3ConnectionLiveTest {
@Override
protected boolean debugEnabled() {