From fe46d0d02a1c77e1fc405f4f25b02cab23a114c2 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Mon, 27 Dec 2010 22:54:49 +0100 Subject: [PATCH] revised test properties in perftest --- aws/perftest/pom.xml | 18 ++++++++-------- .../aws/s3/AmazonPerformanceLiveTest.java | 14 +++++-------- .../aws/s3/BasePerformanceLiveTest.java | 2 +- .../aws/s3/JCloudsPerformanceLiveTest.java | 4 ++-- .../aws/s3/Jets3tPerformanceLiveTest.java | 21 +++++++------------ 5 files changed, 25 insertions(+), 34 deletions(-) diff --git a/aws/perftest/pom.xml b/aws/perftest/pom.xml index b674287383..6413f0c65e 100644 --- a/aws/perftest/pom.xml +++ b/aws/perftest/pom.xml @@ -34,9 +34,9 @@ extraction of appengine-java-sdk --> YOUR_APPENGINE_HOME - 100 - ${test.aws.identity} - ${test.aws.credential} + 100 + ${test.aws.identity} + ${test.aws.credential} org.jclouds.aws.s3.blobstore.integration.S3TestInitializer @@ -143,20 +143,20 @@ 1 - jclouds.test.identity - ${jclouds.test.identity} + test.s3.identity + ${test.s3.identity} - jclouds.test.credential - ${jclouds.test.credential} + test.s3.credential + ${test.s3.credential} test.initializer ${test.initializer} - jclouds.test.loopcount - ${jclouds.test.loopcount} + test.s3.loopcount + ${test.s3.loopcount} diff --git a/aws/perftest/src/test/java/org/jclouds/aws/s3/AmazonPerformanceLiveTest.java b/aws/perftest/src/test/java/org/jclouds/aws/s3/AmazonPerformanceLiveTest.java index df7fcfd7bc..a60a85d361 100755 --- a/aws/perftest/src/test/java/org/jclouds/aws/s3/AmazonPerformanceLiveTest.java +++ b/aws/perftest/src/test/java/org/jclouds/aws/s3/AmazonPerformanceLiveTest.java @@ -27,7 +27,6 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.Executors; import java.util.concurrent.Future; -import org.jets3t.service.S3ServiceException; import org.testng.ITestContext; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -47,15 +46,12 @@ import com.amazonaws.services.s3.model.PutObjectRequest; public class AmazonPerformanceLiveTest extends BasePerformanceLiveTest { private AmazonS3 s3; - @BeforeClass(groups = { "live" }, dependsOnMethods = "setUpResourcesOnThisThread") - protected void createLiveS3Context(ITestContext testContext) throws S3ServiceException { + @BeforeClass(groups = { "integration", "live" }) + public void setUpResourcesOnThisThread(ITestContext testContext) throws Exception { + super.setUpResourcesOnThisThread(testContext); exec = Executors.newCachedThreadPool(); - if (testContext.getAttribute("jclouds.test.identity") != null) { - s3 = new AmazonS3Client(new BasicAWSCredentials((String) testContext.getAttribute("jclouds.test.identity"), - (String) testContext.getAttribute("jclouds.test.credential"))); - } else { - throw new RuntimeException("not configured properly"); - } + s3 = new AmazonS3Client(new BasicAWSCredentials(System.getProperty("test.s3.identity"), + System.getProperty("test.s3.credential"))); } @Override diff --git a/aws/perftest/src/test/java/org/jclouds/aws/s3/BasePerformanceLiveTest.java b/aws/perftest/src/test/java/org/jclouds/aws/s3/BasePerformanceLiveTest.java index 43117d7732..545028f7c4 100755 --- a/aws/perftest/src/test/java/org/jclouds/aws/s3/BasePerformanceLiveTest.java +++ b/aws/perftest/src/test/java/org/jclouds/aws/s3/BasePerformanceLiveTest.java @@ -51,7 +51,7 @@ public abstract class BasePerformanceLiveTest extends BaseBlobStoreIntegrationTe containerCount = 1; } protected int timeoutSeconds = 15; - protected int loopCount = Integer.parseInt(System.getProperty("jclouds.test.loopcount", "1000")); + protected int loopCount = Integer.parseInt(System.getProperty("test.s3.loopcount", "1000")); protected ExecutorService exec; protected Logger logger = Logger.NULL;; diff --git a/aws/perftest/src/test/java/org/jclouds/aws/s3/JCloudsPerformanceLiveTest.java b/aws/perftest/src/test/java/org/jclouds/aws/s3/JCloudsPerformanceLiveTest.java index 54f09ddb73..66f988f21d 100755 --- a/aws/perftest/src/test/java/org/jclouds/aws/s3/JCloudsPerformanceLiveTest.java +++ b/aws/perftest/src/test/java/org/jclouds/aws/s3/JCloudsPerformanceLiveTest.java @@ -49,8 +49,8 @@ public class JCloudsPerformanceLiveTest extends BaseJCloudsPerformanceLiveTest { @BeforeClass(groups = { "integration", "live" }) public void setUpResourcesOnThisThread(ITestContext testContext) throws Exception { exec = Executors.newCachedThreadPool(); - String accesskeyid = System.getProperty("jclouds.test.identity"); - String secretkey = System.getProperty("jclouds.test.credential"); + String accesskeyid = System.getProperty("test.s3.identity"); + String secretkey = System.getProperty("test.s3.credential"); Properties overrides = new Properties(); overrides.setProperty(PROPERTY_MAX_CONNECTIONS_PER_CONTEXT, 50 + ""); overrides.setProperty(PROPERTY_MAX_CONNECTIONS_PER_HOST, 30 + ""); diff --git a/aws/perftest/src/test/java/org/jclouds/aws/s3/Jets3tPerformanceLiveTest.java b/aws/perftest/src/test/java/org/jclouds/aws/s3/Jets3tPerformanceLiveTest.java index d29cf8fa64..e03314ecf7 100755 --- a/aws/perftest/src/test/java/org/jclouds/aws/s3/Jets3tPerformanceLiveTest.java +++ b/aws/perftest/src/test/java/org/jclouds/aws/s3/Jets3tPerformanceLiveTest.java @@ -24,10 +24,10 @@ import java.io.IOException; import java.io.InputStream; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executors; import java.util.concurrent.Future; import org.jets3t.service.S3Service; -import org.jets3t.service.S3ServiceException; import org.jets3t.service.impl.rest.httpclient.RestS3Service; import org.jets3t.service.security.AWSCredentials; import org.testng.ITestContext; @@ -45,16 +45,12 @@ import com.google.appengine.repackaged.com.google.common.base.Throwables; public class Jets3tPerformanceLiveTest extends BasePerformanceLiveTest { private S3Service jetClient; - @BeforeClass(groups = { "live" }, dependsOnMethods = "setUpResourcesOnThisThread") - protected void createLiveS3Context(ITestContext testContext) throws S3ServiceException { - if (testContext.getAttribute("jclouds.test.identity") != null) { - AWSCredentials credentials = new AWSCredentials((String) testContext - .getAttribute("jclouds.test.identity"), (String) testContext - .getAttribute("jclouds.test.credential")); - jetClient = new RestS3Service(credentials); - } else { - throw new RuntimeException("not configured properly"); - } + @BeforeClass(groups = { "integration", "live" }) + public void setUpResourcesOnThisThread(ITestContext testContext) throws Exception { + super.setUpResourcesOnThisThread(testContext); + exec = Executors.newCachedThreadPool(); + jetClient = new RestS3Service(new AWSCredentials(System.getProperty("test.s3.identity"), + System.getProperty("test.s3.credential"))); } @Override @@ -118,8 +114,7 @@ public class Jets3tPerformanceLiveTest extends BasePerformanceLiveTest { @SuppressWarnings("unchecked") @Override - protected Future putInputStream(final String bucket, String key, InputStream data, - String contentType) { + protected Future putInputStream(final String bucket, String key, InputStream data, String contentType) { final org.jets3t.service.model.S3Object object = new org.jets3t.service.model.S3Object(key); object.setContentType(contentType); object.setDataInputStream(data);