mirror of https://github.com/apache/jclouds.git
made perftest compile and run again
This commit is contained in:
parent
05ab8b16df
commit
2698736301
|
@ -40,25 +40,8 @@ import com.google.common.base.Throwables;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
public abstract class BaseJCloudsPerformanceLiveTest extends BasePerformanceLiveTest {
|
||||
// boolean get
|
||||
// (
|
||||
// int id) throws Exception {
|
||||
// S3Bucket s3Bucket = new S3Bucket();
|
||||
// s3Bucket.setName(bucketPrefix + "-jclouds-puts");
|
||||
// S3Object object = new
|
||||
// S3Object();
|
||||
// object.setKey(id + "");
|
||||
// //object.setContentType("text/plain");
|
||||
// object.setContentType("application/octetstream");
|
||||
// //object.setPayload("this is a test");
|
||||
// object.setPayload(test);
|
||||
// return getApi()Provider.getObject(s3Bucket,
|
||||
// object.getKey()).get(120,TimeUnit.SECONDS) !=
|
||||
// S3Object.NOT_FOUND;
|
||||
|
||||
// }
|
||||
protected void overrideWithSysPropertiesAndPrint(Properties overrides, String contextName) {
|
||||
overrides.putAll(System.getProperties());
|
||||
protected void printPropertiesOfContext(Properties overrides, String contextName) {
|
||||
System.out.printf("%s: loopCount(%s), perContext(%s), perHost(%s), ioWorkers(%s), userThreads(%s)%n", contextName,
|
||||
loopCount, overrides.getProperty(PROPERTY_MAX_CONNECTIONS_PER_CONTEXT), overrides
|
||||
.getProperty(PROPERTY_MAX_CONNECTIONS_PER_HOST), overrides.getProperty(PROPERTY_IO_WORKER_THREADS),
|
||||
|
|
|
@ -46,9 +46,15 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
public abstract class BasePerformanceLiveTest extends BaseBlobStoreIntegrationTest {
|
||||
|
||||
public BasePerformanceLiveTest(){
|
||||
provider = "aws-s3";
|
||||
}
|
||||
|
||||
static {
|
||||
containerCount = 1;
|
||||
}
|
||||
|
||||
protected int timeoutSeconds = 15;
|
||||
protected int loopCount = Integer.parseInt(System.getProperty("test.aws-s3.loopcount", "1000"));
|
||||
protected ExecutorService exec;
|
||||
|
|
|
@ -28,42 +28,47 @@ import static org.jclouds.Constants.PROPERTY_USER_THREADS;
|
|||
import java.util.Properties;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import org.jclouds.blobstore.BlobStoreContextFactory;
|
||||
import org.jclouds.enterprise.config.EnterpriseConfigurationModule;
|
||||
import org.jclouds.http.apachehc.config.ApacheHCHttpCommandExecutorServiceModule;
|
||||
import org.jclouds.logging.config.NullLoggingModule;
|
||||
import org.jclouds.netty.config.NettyPayloadModule;
|
||||
import org.jclouds.s3.S3AsyncClient;
|
||||
import org.testng.ITestContext;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.inject.Module;
|
||||
|
||||
@Test(sequential = true, groups = { "live" })
|
||||
@Test(singleThreaded = true, timeOut = 2 * 60 * 1000, groups = "live", testName = "JCloudsApacheHCPerformanceLiveTest")
|
||||
public class JCloudsApacheHCPerformanceLiveTest extends BaseJCloudsPerformanceLiveTest {
|
||||
|
||||
@Override
|
||||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setUpResourcesOnThisThread(ITestContext testContext) throws Exception {
|
||||
public JCloudsApacheHCPerformanceLiveTest(){
|
||||
exec = Executors.newCachedThreadPool();
|
||||
String accesskeyid = System.getProperty("test.aws-s3.identity");
|
||||
String secretkey = System.getProperty("test.aws-s3.credential");
|
||||
Properties overrides = new Properties();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Properties setupProperties() {
|
||||
Properties overrides = super.setupProperties();
|
||||
overrides.setProperty(PROPERTY_SO_TIMEOUT, 5000 + "");
|
||||
overrides.setProperty(PROPERTY_CONNECTION_TIMEOUT, 5000 + "");
|
||||
overrides.setProperty(PROPERTY_MAX_CONNECTIONS_PER_CONTEXT, 20 + "");
|
||||
overrides.setProperty(PROPERTY_MAX_CONNECTIONS_PER_HOST, 0 + "");
|
||||
overrides.setProperty(PROPERTY_IO_WORKER_THREADS, 50 + "");
|
||||
overrides.setProperty(PROPERTY_USER_THREADS, 0 + "");
|
||||
String contextName = "enterprise";
|
||||
overrideWithSysPropertiesAndPrint(overrides, contextName);
|
||||
context = new BlobStoreContextFactory().createContext("aws-s3", accesskeyid, secretkey, ImmutableSet.of(
|
||||
new NullLoggingModule(), new ApacheHCHttpCommandExecutorServiceModule(),
|
||||
new EnterpriseConfigurationModule()), overrides);
|
||||
printPropertiesOfContext(overrides, "apachehc");
|
||||
return overrides;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Iterable<Module> setupModules() {
|
||||
return ImmutableSet.<Module>builder()
|
||||
.add(new NullLoggingModule())
|
||||
.add(new NettyPayloadModule())
|
||||
.add(new ApacheHCHttpCommandExecutorServiceModule())
|
||||
.add(new EnterpriseConfigurationModule()).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public S3AsyncClient getApi() {
|
||||
return (S3AsyncClient) context.getProviderSpecificContext().getAsyncApi();
|
||||
return view.unwrap(AWSS3ApiMetadata.CONTEXT_TOKEN).getAsyncApi();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,19 +25,17 @@ import java.util.concurrent.ExecutionException;
|
|||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.jclouds.blobstore.BlobStoreContext;
|
||||
import org.jclouds.blobstore.BlobStoreContextFactory;
|
||||
import org.jclouds.gae.config.GoogleAppEngineConfigurationModule;
|
||||
import org.jclouds.enterprise.config.EnterpriseConfigurationModule;
|
||||
import org.jclouds.gae.config.AsyncGoogleAppEngineConfigurationModule;
|
||||
import org.jclouds.logging.config.NullLoggingModule;
|
||||
import org.jclouds.s3.S3AsyncClient;
|
||||
import org.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
|
||||
import com.google.appengine.tools.development.testing.LocalURLFetchServiceTestConfig;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -45,7 +43,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(enabled = false, sequential = true, groups = { "disabled" })
|
||||
@Test(enabled = false, singleThreaded = true, timeOut = 2 * 60 * 1000, groups = "live", testName = "JCloudsGaePerformanceLiveTest")
|
||||
public class JCloudsGaePerformanceLiveTest extends BaseJCloudsPerformanceLiveTest {
|
||||
|
||||
@Override
|
||||
|
@ -134,27 +132,23 @@ public class JCloudsGaePerformanceLiveTest extends BaseJCloudsPerformanceLiveTes
|
|||
new LocalServiceTestHelper(new LocalURLFetchServiceTestConfig()).setUp();
|
||||
}
|
||||
|
||||
private BlobStoreContext perfContext;
|
||||
|
||||
@BeforeClass(groups = { "live" })
|
||||
void setup() {
|
||||
String accesskeyid = System.getProperty("jclouds.test.identity");
|
||||
String secretkey = System.getProperty("jclouds.test.credential");
|
||||
Properties overrides = new Properties();
|
||||
String contextName = "gae";
|
||||
overrideWithSysPropertiesAndPrint(overrides, contextName);
|
||||
context = new BlobStoreContextFactory().createContext("aws-s3", accesskeyid, secretkey, ImmutableSet.of(
|
||||
new NullLoggingModule(), new GoogleAppEngineConfigurationModule()), overrides);
|
||||
@Override
|
||||
protected Properties setupProperties() {
|
||||
Properties overrides = super.setupProperties();
|
||||
printPropertiesOfContext(overrides, "apachehc");
|
||||
return overrides;
|
||||
}
|
||||
|
||||
@AfterClass(groups = { "live" })
|
||||
void tearDown() {
|
||||
if (perfContext != null)
|
||||
perfContext.close();
|
||||
@Override
|
||||
protected Iterable<Module> setupModules() {
|
||||
return ImmutableSet.<Module>builder()
|
||||
.add(new NullLoggingModule())
|
||||
.add(new AsyncGoogleAppEngineConfigurationModule())
|
||||
.add(new EnterpriseConfigurationModule()).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public S3AsyncClient getApi() {
|
||||
return (S3AsyncClient) perfContext.getProviderSpecificContext().getAsyncApi();
|
||||
return view.unwrap(AWSS3ApiMetadata.CONTEXT_TOKEN).getAsyncApi();
|
||||
}
|
||||
}
|
|
@ -26,15 +26,14 @@ import static org.jclouds.Constants.PROPERTY_USER_THREADS;
|
|||
import java.util.Properties;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import org.jclouds.blobstore.BlobStoreContextFactory;
|
||||
import org.jclouds.enterprise.config.EnterpriseConfigurationModule;
|
||||
import org.jclouds.logging.config.NullLoggingModule;
|
||||
import org.jclouds.netty.config.NettyPayloadModule;
|
||||
import org.jclouds.s3.S3AsyncClient;
|
||||
import org.testng.ITestContext;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
* Tests the default JClouds client.
|
||||
|
@ -42,28 +41,34 @@ import com.google.common.collect.ImmutableSet;
|
|||
* @author Adrian Cole
|
||||
*
|
||||
*/
|
||||
@Test(sequential = true, timeOut = 2 * 60 * 1000, groups = { "live" })
|
||||
@Test(singleThreaded = true, timeOut = 2 * 60 * 1000, groups = "live", testName = "JCloudsPerformanceLiveTest")
|
||||
public class JCloudsPerformanceLiveTest extends BaseJCloudsPerformanceLiveTest {
|
||||
|
||||
@Override
|
||||
@BeforeClass(groups = { "integration", "live" })
|
||||
public void setUpResourcesOnThisThread(ITestContext testContext) throws Exception {
|
||||
public JCloudsPerformanceLiveTest(){
|
||||
exec = Executors.newCachedThreadPool();
|
||||
String accesskeyid = System.getProperty("test.aws-s3.identity");
|
||||
String secretkey = System.getProperty("test.aws-s3.credential");
|
||||
Properties overrides = new Properties();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Properties setupProperties() {
|
||||
Properties overrides = super.setupProperties();
|
||||
overrides.setProperty(PROPERTY_MAX_CONNECTIONS_PER_CONTEXT, 50 + "");
|
||||
overrides.setProperty(PROPERTY_MAX_CONNECTIONS_PER_HOST, 30 + "");
|
||||
overrides.setProperty(PROPERTY_IO_WORKER_THREADS, 50 + "");
|
||||
overrides.setProperty(PROPERTY_USER_THREADS, 0 + "");
|
||||
String contextName = "standard";
|
||||
overrideWithSysPropertiesAndPrint(overrides, contextName);
|
||||
context = new BlobStoreContextFactory().createContext("aws-s3", accesskeyid, secretkey, ImmutableSet.of(
|
||||
new NullLoggingModule(), new EnterpriseConfigurationModule()), overrides);
|
||||
printPropertiesOfContext(overrides, "default");
|
||||
return overrides;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Iterable<Module> setupModules() {
|
||||
return ImmutableSet.<Module>builder()
|
||||
.add(new NullLoggingModule())
|
||||
.add(new NettyPayloadModule())
|
||||
.add(new EnterpriseConfigurationModule()).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public S3AsyncClient getApi() {
|
||||
return (S3AsyncClient) context.getProviderSpecificContext().getAsyncApi();
|
||||
return view.unwrap(AWSS3ApiMetadata.CONTEXT_TOKEN).getAsyncApi();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue