fixed syntax of perftest

This commit is contained in:
Adrian Cole 2012-05-07 16:54:29 -07:00
parent 015a89cdcd
commit 00e28b9910
2 changed files with 34 additions and 20 deletions

View File

@ -21,13 +21,13 @@ package org.jclouds.aws.s3;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStream;
import java.util.Properties;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import org.testng.ITestContext;
import org.testng.annotations.BeforeClass;
import org.jclouds.blobstore.BlobStoreContext;
import org.testng.annotations.Test;
import com.amazonaws.auth.BasicAWSCredentials;
@ -35,24 +35,29 @@ import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.ObjectMetadata;
import com.amazonaws.services.s3.model.PutObjectRequest;
import com.google.inject.Module;
/**
* Runs operations that amazon s3 sample code is capable of performing.
*
* @author Adrian Cole
*/
@Test(sequential = true, timeOut = 2 * 60 * 1000, groups = { "live" })
@Test(singleThreaded = true, timeOut = 2 * 60 * 1000, groups = "live", testName = "AmazonPerformanceLiveTest")
public class AmazonPerformanceLiveTest extends BasePerformanceLiveTest {
public AmazonPerformanceLiveTest(){
exec = Executors.newCachedThreadPool();
}
private AmazonS3 s3;
@BeforeClass(groups = { "integration", "live" })
public void setUpResourcesOnThisThread(ITestContext testContext) throws Exception {
super.setUpResourcesOnThisThread(testContext);
exec = Executors.newCachedThreadPool();
@Override
protected BlobStoreContext createView(Properties props, Iterable<Module> modules) {
s3 = new AmazonS3Client(new BasicAWSCredentials(System.getProperty("test.aws-s3.identity"),
System.getProperty("test.aws-s3.credential")));
System.getProperty("test.aws-s3.credential")));
return super.createView(props, modules);
}
@Override
@Test(enabled = false)
public void testPutStringSerial() throws Exception {

View File

@ -21,36 +21,46 @@ package org.jclouds.aws.s3;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import org.jclouds.blobstore.BlobStoreContext;
import org.jets3t.service.S3Service;
import org.jets3t.service.S3ServiceException;
import org.jets3t.service.impl.rest.httpclient.RestS3Service;
import org.jets3t.service.model.S3Object;
import org.jets3t.service.security.AWSCredentials;
import org.testng.ITestContext;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.google.appengine.repackaged.com.google.common.base.Throwables;
import com.google.inject.Module;
/**
* Runs operations that jets3t is capable of performing.
*
* @author Adrian Cole
*/
@Test(sequential = true, timeOut = 2 * 60 * 1000, groups = { "live" })
@Test(singleThreaded = true, timeOut = 2 * 60 * 1000, groups = "live", testName = "Jets3tPerformanceLiveTest")
public class Jets3tPerformanceLiveTest extends BasePerformanceLiveTest {
private S3Service jetClient;
@BeforeClass(groups = { "integration", "live" })
public void setUpResourcesOnThisThread(ITestContext testContext) throws Exception {
super.setUpResourcesOnThisThread(testContext);
public Jets3tPerformanceLiveTest(){
exec = Executors.newCachedThreadPool();
jetClient = new RestS3Service(new AWSCredentials(System.getProperty("test.aws-s3.identity"),
System.getProperty("test.aws-s3.credential")));
}
private S3Service jetClient;
@Override
protected BlobStoreContext createView(Properties props, Iterable<Module> modules) {
try {
jetClient = new RestS3Service(new AWSCredentials(System.getProperty("test.aws-s3.identity"),
System.getProperty("test.aws-s3.credential")));
} catch (S3ServiceException e) {
throw Throwables.propagate(e);
}
return super.createView(props, modules);
}
@Override
@ -93,7 +103,6 @@ public class Jets3tPerformanceLiveTest extends BasePerformanceLiveTest {
@Test(enabled = false)
protected Future<?> putByteArray(String bucket, String key, byte[] data, String contentType) {
throw new UnsupportedOperationException();
}
@Override