From 2ccbbd8bd79ac75f3c8554eebec7245367a8ccdd Mon Sep 17 00:00:00 2001 From: "adrian.f.cole" Date: Sun, 7 Jun 2009 11:18:55 +0000 Subject: [PATCH] Issue 52 test google appengine in perftests git-svn-id: http://jclouds.googlecode.com/svn/trunk@1085 3d8758e0-26b5-11de-8745-db77d3ebf521 --- .../org/jclouds/aws/s3/BasePerformance.java | 21 ++++++++++--------- .../aws/s3/JCloudsGaePerformanceLiveTest.java | 2 ++ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/aws/s3/perftest/src/test/java/org/jclouds/aws/s3/BasePerformance.java b/aws/s3/perftest/src/test/java/org/jclouds/aws/s3/BasePerformance.java index af25a29a71..657abb913a 100644 --- a/aws/s3/perftest/src/test/java/org/jclouds/aws/s3/BasePerformance.java +++ b/aws/s3/perftest/src/test/java/org/jclouds/aws/s3/BasePerformance.java @@ -55,7 +55,8 @@ public abstract class BasePerformance extends S3IntegrationTest { return false; } - protected static int LOOP_COUNT = 100; + protected int timeoutSeconds = 10; + protected int loopCount = 100; protected ExecutorService exec; @@ -75,46 +76,46 @@ public abstract class BasePerformance extends S3IntegrationTest { @Test(enabled = true) public void testPutBytesSerial() throws Exception { - doSerial(new PutBytesCallable(this.bucketName), LOOP_COUNT / 10); + doSerial(new PutBytesCallable(this.bucketName), loopCount / 10); } @Test(enabled = true) public void testPutBytesParallel() throws InterruptedException, ExecutionException, TimeoutException { - doParallel(new PutBytesCallable(this.bucketName), LOOP_COUNT); + doParallel(new PutBytesCallable(this.bucketName), loopCount); } @Test(enabled = true) public void testPutFileSerial() throws Exception { - doSerial(new PutFileCallable(this.bucketName), LOOP_COUNT / 10); + doSerial(new PutFileCallable(this.bucketName), loopCount / 10); } @Test(enabled = true) public void testPutFileParallel() throws InterruptedException, ExecutionException, TimeoutException { - doParallel(new PutFileCallable(this.bucketName), LOOP_COUNT); + doParallel(new PutFileCallable(this.bucketName), loopCount); } @Test(enabled = true) public void testPutInputStreamSerial() throws Exception { - doSerial(new PutInputStreamCallable(this.bucketName), LOOP_COUNT / 10); + doSerial(new PutInputStreamCallable(this.bucketName), loopCount / 10); } @Test(enabled = true) public void testPutInputStreamParallel() throws InterruptedException, ExecutionException, TimeoutException { - doParallel(new PutInputStreamCallable(this.bucketName), LOOP_COUNT); + doParallel(new PutInputStreamCallable(this.bucketName), loopCount); } @Test(enabled = true) public void testPutStringSerial() throws Exception { - doSerial(new PutStringCallable(this.bucketName), LOOP_COUNT / 10); + doSerial(new PutStringCallable(this.bucketName), loopCount / 10); } @Test(enabled = true) public void testPutStringParallel() throws InterruptedException, ExecutionException, TimeoutException { - doParallel(new PutStringCallable(this.bucketName), LOOP_COUNT); + doParallel(new PutStringCallable(this.bucketName), loopCount); } private void doSerial(Provider> provider, int loopCount) throws Exception, @@ -128,7 +129,7 @@ public abstract class BasePerformance extends S3IntegrationTest { for (int i = 0; i < loopCount; i++) completer.submit(provider.get()); for (int i = 0; i < loopCount; i++) - assert completer.take().get(10, TimeUnit.SECONDS); + assert completer.take().get(timeoutSeconds, TimeUnit.SECONDS); } class PutBytesCallable implements Provider> { diff --git a/aws/s3/perftest/src/test/java/org/jclouds/aws/s3/JCloudsGaePerformanceLiveTest.java b/aws/s3/perftest/src/test/java/org/jclouds/aws/s3/JCloudsGaePerformanceLiveTest.java index e5322b4df2..c0ddc5df59 100644 --- a/aws/s3/perftest/src/test/java/org/jclouds/aws/s3/JCloudsGaePerformanceLiveTest.java +++ b/aws/s3/perftest/src/test/java/org/jclouds/aws/s3/JCloudsGaePerformanceLiveTest.java @@ -117,6 +117,8 @@ public class JCloudsGaePerformanceLiveTest extends BaseJCloudsPerformance { @Override protected Module createHttpModule() { + // otherwise, we'll get timeout errors + loopCount = 10; return new URLFetchServiceClientModule(); } } \ No newline at end of file