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
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public abstract class BaseJCloudsPerformanceLiveTest extends BasePerformanceLiveTest {
|
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 printPropertiesOfContext(Properties overrides, String contextName) {
|
||||||
protected void overrideWithSysPropertiesAndPrint(Properties overrides, String contextName) {
|
|
||||||
overrides.putAll(System.getProperties());
|
|
||||||
System.out.printf("%s: loopCount(%s), perContext(%s), perHost(%s), ioWorkers(%s), userThreads(%s)%n", 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
|
loopCount, overrides.getProperty(PROPERTY_MAX_CONNECTIONS_PER_CONTEXT), overrides
|
||||||
.getProperty(PROPERTY_MAX_CONNECTIONS_PER_HOST), overrides.getProperty(PROPERTY_IO_WORKER_THREADS),
|
.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
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public abstract class BasePerformanceLiveTest extends BaseBlobStoreIntegrationTest {
|
public abstract class BasePerformanceLiveTest extends BaseBlobStoreIntegrationTest {
|
||||||
|
|
||||||
|
public BasePerformanceLiveTest(){
|
||||||
|
provider = "aws-s3";
|
||||||
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
containerCount = 1;
|
containerCount = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int timeoutSeconds = 15;
|
protected int timeoutSeconds = 15;
|
||||||
protected int loopCount = Integer.parseInt(System.getProperty("test.aws-s3.loopcount", "1000"));
|
protected int loopCount = Integer.parseInt(System.getProperty("test.aws-s3.loopcount", "1000"));
|
||||||
protected ExecutorService exec;
|
protected ExecutorService exec;
|
||||||
|
|
|
@ -28,42 +28,47 @@ import static org.jclouds.Constants.PROPERTY_USER_THREADS;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
import org.jclouds.blobstore.BlobStoreContextFactory;
|
|
||||||
import org.jclouds.enterprise.config.EnterpriseConfigurationModule;
|
import org.jclouds.enterprise.config.EnterpriseConfigurationModule;
|
||||||
import org.jclouds.http.apachehc.config.ApacheHCHttpCommandExecutorServiceModule;
|
import org.jclouds.http.apachehc.config.ApacheHCHttpCommandExecutorServiceModule;
|
||||||
import org.jclouds.logging.config.NullLoggingModule;
|
import org.jclouds.logging.config.NullLoggingModule;
|
||||||
|
import org.jclouds.netty.config.NettyPayloadModule;
|
||||||
import org.jclouds.s3.S3AsyncClient;
|
import org.jclouds.s3.S3AsyncClient;
|
||||||
import org.testng.ITestContext;
|
|
||||||
import org.testng.annotations.BeforeClass;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
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 {
|
public class JCloudsApacheHCPerformanceLiveTest extends BaseJCloudsPerformanceLiveTest {
|
||||||
|
|
||||||
@Override
|
public JCloudsApacheHCPerformanceLiveTest(){
|
||||||
@BeforeClass(groups = { "integration", "live" })
|
|
||||||
public void setUpResourcesOnThisThread(ITestContext testContext) throws Exception {
|
|
||||||
exec = Executors.newCachedThreadPool();
|
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_SO_TIMEOUT, 5000 + "");
|
||||||
overrides.setProperty(PROPERTY_CONNECTION_TIMEOUT, 5000 + "");
|
overrides.setProperty(PROPERTY_CONNECTION_TIMEOUT, 5000 + "");
|
||||||
overrides.setProperty(PROPERTY_MAX_CONNECTIONS_PER_CONTEXT, 20 + "");
|
overrides.setProperty(PROPERTY_MAX_CONNECTIONS_PER_CONTEXT, 20 + "");
|
||||||
overrides.setProperty(PROPERTY_MAX_CONNECTIONS_PER_HOST, 0 + "");
|
overrides.setProperty(PROPERTY_MAX_CONNECTIONS_PER_HOST, 0 + "");
|
||||||
overrides.setProperty(PROPERTY_IO_WORKER_THREADS, 50 + "");
|
overrides.setProperty(PROPERTY_IO_WORKER_THREADS, 50 + "");
|
||||||
overrides.setProperty(PROPERTY_USER_THREADS, 0 + "");
|
overrides.setProperty(PROPERTY_USER_THREADS, 0 + "");
|
||||||
String contextName = "enterprise";
|
printPropertiesOfContext(overrides, "apachehc");
|
||||||
overrideWithSysPropertiesAndPrint(overrides, contextName);
|
return overrides;
|
||||||
context = new BlobStoreContextFactory().createContext("aws-s3", accesskeyid, secretkey, ImmutableSet.of(
|
|
||||||
new NullLoggingModule(), new ApacheHCHttpCommandExecutorServiceModule(),
|
|
||||||
new EnterpriseConfigurationModule()), overrides);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Iterable<Module> setupModules() {
|
||||||
|
return ImmutableSet.<Module>builder()
|
||||||
|
.add(new NullLoggingModule())
|
||||||
|
.add(new NettyPayloadModule())
|
||||||
|
.add(new ApacheHCHttpCommandExecutorServiceModule())
|
||||||
|
.add(new EnterpriseConfigurationModule()).build();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public S3AsyncClient getApi() {
|
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.Future;
|
||||||
import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.TimeoutException;
|
||||||
|
|
||||||
import org.jclouds.blobstore.BlobStoreContext;
|
import org.jclouds.enterprise.config.EnterpriseConfigurationModule;
|
||||||
import org.jclouds.blobstore.BlobStoreContextFactory;
|
import org.jclouds.gae.config.AsyncGoogleAppEngineConfigurationModule;
|
||||||
import org.jclouds.gae.config.GoogleAppEngineConfigurationModule;
|
|
||||||
import org.jclouds.logging.config.NullLoggingModule;
|
import org.jclouds.logging.config.NullLoggingModule;
|
||||||
import org.jclouds.s3.S3AsyncClient;
|
import org.jclouds.s3.S3AsyncClient;
|
||||||
import org.testng.annotations.AfterClass;
|
|
||||||
import org.testng.annotations.BeforeClass;
|
|
||||||
import org.testng.annotations.BeforeMethod;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
|
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
|
||||||
import com.google.appengine.tools.development.testing.LocalURLFetchServiceTestConfig;
|
import com.google.appengine.tools.development.testing.LocalURLFetchServiceTestConfig;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.inject.Module;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -45,7 +43,7 @@ import com.google.common.collect.ImmutableSet;
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @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 {
|
public class JCloudsGaePerformanceLiveTest extends BaseJCloudsPerformanceLiveTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -134,27 +132,23 @@ public class JCloudsGaePerformanceLiveTest extends BaseJCloudsPerformanceLiveTes
|
||||||
new LocalServiceTestHelper(new LocalURLFetchServiceTestConfig()).setUp();
|
new LocalServiceTestHelper(new LocalURLFetchServiceTestConfig()).setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlobStoreContext perfContext;
|
@Override
|
||||||
|
protected Properties setupProperties() {
|
||||||
@BeforeClass(groups = { "live" })
|
Properties overrides = super.setupProperties();
|
||||||
void setup() {
|
printPropertiesOfContext(overrides, "apachehc");
|
||||||
String accesskeyid = System.getProperty("jclouds.test.identity");
|
return overrides;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass(groups = { "live" })
|
@Override
|
||||||
void tearDown() {
|
protected Iterable<Module> setupModules() {
|
||||||
if (perfContext != null)
|
return ImmutableSet.<Module>builder()
|
||||||
perfContext.close();
|
.add(new NullLoggingModule())
|
||||||
|
.add(new AsyncGoogleAppEngineConfigurationModule())
|
||||||
|
.add(new EnterpriseConfigurationModule()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public S3AsyncClient getApi() {
|
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.Properties;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
import org.jclouds.blobstore.BlobStoreContextFactory;
|
|
||||||
import org.jclouds.enterprise.config.EnterpriseConfigurationModule;
|
import org.jclouds.enterprise.config.EnterpriseConfigurationModule;
|
||||||
import org.jclouds.logging.config.NullLoggingModule;
|
import org.jclouds.logging.config.NullLoggingModule;
|
||||||
|
import org.jclouds.netty.config.NettyPayloadModule;
|
||||||
import org.jclouds.s3.S3AsyncClient;
|
import org.jclouds.s3.S3AsyncClient;
|
||||||
import org.testng.ITestContext;
|
|
||||||
import org.testng.annotations.BeforeClass;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.inject.Module;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the default JClouds client.
|
* Tests the default JClouds client.
|
||||||
|
@ -42,28 +41,34 @@ import com.google.common.collect.ImmutableSet;
|
||||||
* @author Adrian Cole
|
* @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 {
|
public class JCloudsPerformanceLiveTest extends BaseJCloudsPerformanceLiveTest {
|
||||||
|
|
||||||
@Override
|
public JCloudsPerformanceLiveTest(){
|
||||||
@BeforeClass(groups = { "integration", "live" })
|
|
||||||
public void setUpResourcesOnThisThread(ITestContext testContext) throws Exception {
|
|
||||||
exec = Executors.newCachedThreadPool();
|
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_CONTEXT, 50 + "");
|
||||||
overrides.setProperty(PROPERTY_MAX_CONNECTIONS_PER_HOST, 30 + "");
|
overrides.setProperty(PROPERTY_MAX_CONNECTIONS_PER_HOST, 30 + "");
|
||||||
overrides.setProperty(PROPERTY_IO_WORKER_THREADS, 50 + "");
|
overrides.setProperty(PROPERTY_IO_WORKER_THREADS, 50 + "");
|
||||||
overrides.setProperty(PROPERTY_USER_THREADS, 0 + "");
|
overrides.setProperty(PROPERTY_USER_THREADS, 0 + "");
|
||||||
String contextName = "standard";
|
printPropertiesOfContext(overrides, "default");
|
||||||
overrideWithSysPropertiesAndPrint(overrides, contextName);
|
return overrides;
|
||||||
context = new BlobStoreContextFactory().createContext("aws-s3", accesskeyid, secretkey, ImmutableSet.of(
|
|
||||||
new NullLoggingModule(), new EnterpriseConfigurationModule()), overrides);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Iterable<Module> setupModules() {
|
||||||
|
return ImmutableSet.<Module>builder()
|
||||||
|
.add(new NullLoggingModule())
|
||||||
|
.add(new NettyPayloadModule())
|
||||||
|
.add(new EnterpriseConfigurationModule()).build();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public S3AsyncClient getApi() {
|
public S3AsyncClient getApi() {
|
||||||
return (S3AsyncClient) context.getProviderSpecificContext().getAsyncApi();
|
return view.unwrap(AWSS3ApiMetadata.CONTEXT_TOKEN).getAsyncApi();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue