diff --git a/core/src/test/java/org/jclouds/http/BaseHttpFutureCommandClientTest.java b/core/src/test/java/org/jclouds/http/BaseHttpFutureCommandClientTest.java index c700bfabe0..4a79d0eaf7 100644 --- a/core/src/test/java/org/jclouds/http/BaseHttpFutureCommandClientTest.java +++ b/core/src/test/java/org/jclouds/http/BaseHttpFutureCommandClientTest.java @@ -111,7 +111,6 @@ public abstract class BaseHttpFutureCommandClientTest { injector = Guice.createInjector(new AbstractModule() { @Override protected void configure() { - Names.bindProperties(binder(), properties); } }, new HttpCommandsModule(), createClientModule(), diff --git a/s3/src/test/java/org/jclouds/aws/s3/S3IntegrationTest.java b/s3/src/test/java/org/jclouds/aws/s3/S3IntegrationTest.java index 42217b0d24..efcb3cf872 100644 --- a/s3/src/test/java/org/jclouds/aws/s3/S3IntegrationTest.java +++ b/s3/src/test/java/org/jclouds/aws/s3/S3IntegrationTest.java @@ -51,7 +51,7 @@ import org.testng.annotations.Test; import com.google.inject.Injector; import com.google.inject.Module; -@Test(sequential=true) +@Test(sequential = true) public class S3IntegrationTest { private static final Handler HANDLER = new ConsoleHandler() { @@ -78,90 +78,93 @@ public class S3IntegrationTest { guiceLogger.setLevel(Level.ALL); } - - protected String bucketPrefix = System.getProperty("user.name") - + "." + this.getClass().getName(); String badRequestWhenSourceIsDestBucketOnCopy400 = "InvalidRequestThe Source and Destination may not be the same when the MetadataDirective is Copy.54C77CAF4D42474BSJecknEUUUx88/65VAKbCdKSOCkpuVTeu7ZG9in9x9NTNglGnoxdbALCfS4k/DUZ"; String noSuchSourceKeyOrBucketOnCopy404 = "NoSuchKeyThe specified key does not exist.null9CCDF1DACA78B36F63cqk9YsTFBVfBfks840JVGsepPEdQM42mU+r7HN35sF4Nk5xAcWDEUPaQpK2eFU"; String noSuchDestinationBucketOnCopy404 = "NoSuchBucketThe specified bucket does not existcopydestination4F0CF319C5535975hdZyHOm7VK+JI2UCdye3d6TVkKhRBIoWflldXVDTKbgipYlamy8HgPBzHrUAVQNJ"; String successfulCopyObject200 = "2009-03-19T13:23:27.000Z\"92836a3ea45a6984d1b4d23a747d46bb\""; String badSign403 = "\n" - + "SignatureDoesNotMatchThe operation signature we calculated does not match the signature you provided. Check your key and signing method.47 45 54 0a 0a 0a 54 68 75 2c 20 31 39 20 4d 61 72 20 32 30 30 39 20 31 37 3a 34 38 3a 30 31 20 47 4d 54 0a 2f 61 64 72 69 61 6e 63 6f 6c 65 2e 73 33 2e 61 6d 61 7a 6f 6e 73 33 74 65 73 74 2e 66 69 6c 65 74 65 73 74 73 66 6f 72 61 64 72 69 61 6e 2f 66 69 6c 65514AA22EB75A6E42H5nqnZkGjuKvB+seutvx5hnp1P+WAuC9c3Y7MdQCcYDr1TGwNX/mt+FHstK0pVldQm6Wss7e5e/eNXV50AxChH+xkLI=GET\n" - + "\n" - + "\n" - + "Thu, 19 Mar 2009 17:48:01 GMT\n" - + "/adriancole.s3.amazons3test.filetestsforadrian/file0101100101001001"; + + "SignatureDoesNotMatchThe operation signature we calculated does not match the signature you provided. Check your key and signing method.47 45 54 0a 0a 0a 54 68 75 2c 20 31 39 20 4d 61 72 20 32 30 30 39 20 31 37 3a 34 38 3a 30 31 20 47 4d 54 0a 2f 61 64 72 69 61 6e 63 6f 6c 65 2e 73 33 2e 61 6d 61 7a 6f 6e 73 33 74 65 73 74 2e 66 69 6c 65 74 65 73 74 73 66 6f 72 61 64 72 69 61 6e 2f 66 69 6c 65514AA22EB75A6E42H5nqnZkGjuKvB+seutvx5hnp1P+WAuC9c3Y7MdQCcYDr1TGwNX/mt+FHstK0pVldQm6Wss7e5e/eNXV50AxChH+xkLI=GET\n" + + "\n" + + "\n" + + "Thu, 19 Mar 2009 17:48:01 GMT\n" + + "/adriancole.s3.amazons3test.filetestsforadrian/file0101100101001001"; String amazonHadAnError = "InternalErrorWe encountered an internal error. Please try again.EF6FA7A639CAFF15tBkX23mIeq2riHsNw2YShupMlZ9+iy3V/uN+lRhqCR4qHTE07ujFeyAUPTowvuH/"; protected S3Connection client; Injector i = null; + + protected String bucketPrefix = System.getProperty("user.name") + "." + + this.getClass().getName(); + private static final String sysAWSAccessKeyId = System - .getProperty("jclouds.aws.accesskeyid"); - - protected Injector createInject(String AWSAccessKeyId, String AWSSecretAccessKey) { - return S3ConnectionFactory.getInjector(buildS3Properties( - AWSAccessKeyId, AWSSecretAccessKey), createHttpModule()); - } - - protected Properties buildS3Properties(String AWSAccessKeyId, String AWSSecretAccessKey) { - Properties properties = new Properties( - S3ConnectionFactory.DEFAULT_PROPERTIES); - properties.setProperty("jclouds.aws.accesskeyid", checkNotNull( - AWSAccessKeyId, "AWSAccessKeyId")); - properties.setProperty("jclouds.aws.secretaccesskey", checkNotNull( - AWSSecretAccessKey, "AWSSecretAccessKey")); - properties.setProperty("jclouds.http.secure", "false"); - properties.setProperty("jclouds.http.port", "80"); - return properties; - } - - protected Module createHttpModule() { - return new JavaUrlHttpFutureCommandClientModule(); - } - + .getProperty("jclouds.aws.accesskeyid"); private static final String sysAWSSecretAccessKey = System - .getProperty("jclouds.aws.secretaccesskey"); + .getProperty("jclouds.aws.secretaccesskey"); @BeforeTest @Parameters( { "jclouds.aws.accesskeyid", "jclouds.aws.secretaccesskey" }) - protected void setUpClient(@Optional String AWSAccessKeyId, @Optional String AWSSecretAccessKey) throws Exception { - i = createInject(AWSAccessKeyId != null ? AWSAccessKeyId - : sysAWSAccessKeyId, - AWSSecretAccessKey != null ? AWSSecretAccessKey - : sysAWSSecretAccessKey); - client = i.getInstance(LiveS3Connection.class); - deleteEverything(); + protected void setUpClient(@Optional String AWSAccessKeyId, + @Optional String AWSSecretAccessKey) throws Exception { + i = createInject(AWSAccessKeyId != null ? AWSAccessKeyId + : sysAWSAccessKeyId, + AWSSecretAccessKey != null ? AWSSecretAccessKey + : sysAWSSecretAccessKey); + client = i.getInstance(LiveS3Connection.class); + deleteEverything(); + } + + protected Injector createInject(String AWSAccessKeyId, + String AWSSecretAccessKey) { + return S3ConnectionFactory.getInjector(buildS3Properties( + AWSAccessKeyId, AWSSecretAccessKey), createHttpModule()); + } + + protected Properties buildS3Properties(String AWSAccessKeyId, + String AWSSecretAccessKey) { + Properties properties = new Properties( + S3ConnectionFactory.DEFAULT_PROPERTIES); + properties.setProperty("jclouds.aws.accesskeyid", checkNotNull( + AWSAccessKeyId, "AWSAccessKeyId")); + properties.setProperty("jclouds.aws.secretaccesskey", checkNotNull( + AWSSecretAccessKey, "AWSSecretAccessKey")); + properties.setProperty("jclouds.http.secure", "false"); + properties.setProperty("jclouds.http.port", "80"); + return properties; + } + + protected Module createHttpModule() { + return new JavaUrlHttpFutureCommandClientModule(); } protected void deleteEverything() throws Exception { - try { - List buckets = client.getBuckets().get(); - List> results = new ArrayList>(); - for (S3Bucket bucket : buckets) { - if (bucket.getName().startsWith(bucketPrefix.toLowerCase())) { - bucket = client.getBucket(bucket).get(); - for (S3Object object : bucket.getContents()) { - results.add(client - .deleteObject(bucket, object.getKey())); - } - Iterator> iterator = results.iterator(); - while (iterator.hasNext()) { - iterator.next().get(); - iterator.remove(); - } - client.deleteBucket(bucket).get(); - } - - } - } catch (CancellationException e) { - throw e; - } + try { + List buckets = client.getBuckets().get(); + List> results = new ArrayList>(); + for (S3Bucket bucket : buckets) { + if (bucket.getName().startsWith(bucketPrefix.toLowerCase())) { + bucket = client.getBucket(bucket).get(); + for (S3Object object : bucket.getContents()) { + results.add(client + .deleteObject(bucket, object.getKey())); + } + Iterator> iterator = results.iterator(); + while (iterator.hasNext()) { + iterator.next().get(); + iterator.remove(); + } + client.deleteBucket(bucket).get(); + } + + } + } catch (CancellationException e) { + throw e; + } } @AfterTest protected void tearDownClient() throws Exception { - deleteEverything(); - client.close(); - i = null; + deleteEverything(); + client.close(); + i = null; } } \ No newline at end of file