attempts to clean up base integration test

git-svn-id: http://jclouds.googlecode.com/svn/trunk@1847 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
adrian.f.cole 2009-08-09 22:51:35 +00:00
parent 6dc3d789c1
commit 008979b027
1 changed files with 12 additions and 3 deletions

View File

@ -147,7 +147,7 @@ public class S3IntegrationTest {
@BeforeGroups(groups = { "integration", "live" }) @BeforeGroups(groups = { "integration", "live" })
@Parameters( { S3Constants.PROPERTY_AWS_ACCESSKEYID, S3Constants.PROPERTY_AWS_SECRETACCESSKEY }) @Parameters( { S3Constants.PROPERTY_AWS_ACCESSKEYID, S3Constants.PROPERTY_AWS_SECRETACCESSKEY })
protected void setUpCredentials(@Optional String AWSAccessKeyId, public void setUpCredentials(@Optional String AWSAccessKeyId,
@Optional String AWSSecretAccessKey, ITestContext testContext) throws Exception { @Optional String AWSSecretAccessKey, ITestContext testContext) throws Exception {
AWSAccessKeyId = AWSAccessKeyId != null ? AWSAccessKeyId : sysAWSAccessKeyId; AWSAccessKeyId = AWSAccessKeyId != null ? AWSAccessKeyId : sysAWSAccessKeyId;
AWSSecretAccessKey = AWSSecretAccessKey != null ? AWSSecretAccessKey : sysAWSSecretAccessKey; AWSSecretAccessKey = AWSSecretAccessKey != null ? AWSSecretAccessKey : sysAWSSecretAccessKey;
@ -158,7 +158,7 @@ public class S3IntegrationTest {
} }
@BeforeGroups(dependsOnMethods = { "setUpCredentials" }, groups = { "integration", "live" }) @BeforeGroups(dependsOnMethods = { "setUpCredentials" }, groups = { "integration", "live" })
protected void setUpClient(ITestContext testContext) throws Exception { public void setUpClient(ITestContext testContext) throws Exception {
if (testContext.getAttribute(S3Constants.PROPERTY_AWS_ACCESSKEYID) != null) { if (testContext.getAttribute(S3Constants.PROPERTY_AWS_ACCESSKEYID) != null) {
String AWSAccessKeyId = (String) testContext String AWSAccessKeyId = (String) testContext
.getAttribute(S3Constants.PROPERTY_AWS_ACCESSKEYID); .getAttribute(S3Constants.PROPERTY_AWS_ACCESSKEYID);
@ -329,11 +329,20 @@ public class S3IntegrationTest {
* @throws ExecutionException * @throws ExecutionException
* @throws TimeoutException * @throws TimeoutException
*/ */
protected void deleteBucket(String name) throws InterruptedException, ExecutionException, protected void deleteBucket(final String name) throws InterruptedException, ExecutionException,
TimeoutException { TimeoutException {
if (client.bucketExists(name)) { if (client.bucketExists(name)) {
emptyBucket(name); emptyBucket(name);
client.deleteBucketIfEmpty(name); client.deleteBucketIfEmpty(name);
assertEventually(new Runnable() {
public void run() {
try {
assert !client.bucketExists(name) : "bucket " + name + " still exists";
} catch (Exception e) {
Utils.<RuntimeException> rethrowIfRuntimeOrSameType(e);
}
}
});
} }
} }