Issue 1113:Move perftest to new jclouds-perftest-s3 repository

This commit is contained in:
Adrian Cole 2012-10-21 16:14:51 -07:00
parent e43df10f39
commit 546e027db0
12 changed files with 0 additions and 1217 deletions

View File

@ -1,57 +0,0 @@
====
Licensed to jclouds, Inc. (jclouds) under one or more
contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. jclouds licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
====
This sample uses the Google App Engine for Java SDK located at http://googleappengine.googlecode.com/files/appengine-java-sdk-1.3.5.zip
Please unzip the above file and modify your maven settings.xml like below before attempting to run 'mvn -Plive install'
<profile>
<id>appengine</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<appengine.home>/path/to/appengine-java-sdk-1.3.5</appengine.home>
</properties>
</profile>
<profile>
<id>aws</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<jclouds.aws.accesskeyid>YOUR_ACCESS_KEY_ID</jclouds.aws.accesskeyid>
<jclouds.aws.secretaccesskey>YOUR_SECRET_KEY</jclouds.aws.secretaccesskey>
</properties>
</profile>
<repositories>
<repository>
<id>jclouds</id>
<url>http://jclouds.googlecode.com/svn/trunk/repo</url>
</repository>
<repository>
<id>jclouds-rimu-snapshots-nexus</id>
<url>http://jclouds.rimuhosting.com:8081/nexus/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

View File

@ -1,217 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to jclouds, Inc. (jclouds) under one or more
contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. jclouds licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-demos-project</artifactId>
<version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>jclouds-demo-perftest</artifactId>
<name>jclouds Performance test verses Amazon SDK implementation</name>
<description>Performance test verses Amazon SDK implementation</description>
<properties>
<test.aws-s3.loopcount>100</test.aws-s3.loopcount>
<test.aws-s3.identity>${test.aws.identity}</test.aws-s3.identity>
<test.aws-s3.credential>${test.aws.credential}</test.aws-s3.credential>
<jclouds.version>1.6.0-SNAPSHOT</jclouds.version>
<appengine.sdk.version>1.6.5</appengine.sdk.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jclouds.provider</groupId>
<artifactId>aws-s3</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.3.8</version>
</dependency>
<dependency>
<groupId>net.java.dev.jets3t</groupId>
<artifactId>jets3t</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>org.jclouds.driver</groupId>
<artifactId>jclouds-enterprise</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds.driver</groupId>
<artifactId>jclouds-netty</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds.driver</groupId>
<artifactId>jclouds-apachehc</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds.driver</groupId>
<artifactId>jclouds-gae</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-blobstore</artifactId>
<version>${jclouds.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.api</groupId>
<artifactId>s3</artifactId>
<version>${jclouds.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.provider</groupId>
<artifactId>aws-s3</artifactId>
<version>${jclouds.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<!-- start gae stuff -->
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>${appengine.sdk.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-stubs</artifactId>
<version>${appengine.sdk.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-testing</artifactId>
<version>${appengine.sdk.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<threadCount>1</threadCount>
<systemPropertyVariables>
<test.aws-s3.identity>${test.aws-s3.identity}</test.aws-s3.identity>
<test.aws-s3.credential>${test.aws-s3.credential}</test.aws-s3.credential>
<test.initializer>${test.initializer}</test.initializer>
<test.aws-s3.loopcount>${test.aws-s3.loopcount}</test.aws-s3.loopcount>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.ning.maven.plugins</groupId>
<artifactId>maven-duplicate-finder-plugin</artifactId>
<configuration>
<exceptions>
<exception>
<conflictingDependencies>
<!-- AWS SDK and GAE don't play nice -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.3.8</version>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>${appengine.sdk.version}</version>
</dependency>
</conflictingDependencies>
<resources>
<resource>META-INF/javamail.providers</resource>
</resources>
</exception>
<exception>
<!-- Google App Engine Deps, some google classes are duplicated between packages -->
<conflictingDependencies>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>${appengine.sdk.version}</version>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-testing</artifactId>
<version>${appengine.sdk.version}</version>
<scope>test</scope>
</dependency>
</conflictingDependencies>
<packages>
<package>com.google</package>
</packages>
</exception>
</exceptions>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>live</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<systemPropertyVariables>
<test.aws-s3.identity>${test.aws-s3.identity}</test.aws-s3.identity>
<test.aws-s3.credential>${test.aws-s3.credential}</test.aws-s3.credential>
<test.aws-s3.loopcount>${test.aws-s3.loopcount}</test.aws-s3.loopcount>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -1,118 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
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.jclouds.blobstore.BlobStoreContext;
import org.testng.annotations.Test;
import com.amazonaws.auth.BasicAWSCredentials;
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(singleThreaded = true, timeOut = 2 * 60 * 1000, groups = "live", testName = "AmazonPerformanceLiveTest")
public class AmazonPerformanceLiveTest extends BasePerformanceLiveTest {
public AmazonPerformanceLiveTest(){
exec = Executors.newCachedThreadPool();
}
private AmazonS3 s3;
@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")));
return super.createView(props, modules);
}
@Override
@Test(enabled = false)
public void testPutStringSerial() throws Exception {
throw new UnsupportedOperationException();
}
@Override
@Test(enabled = false)
public void testPutStringParallel() throws InterruptedException, ExecutionException {
throw new UnsupportedOperationException();
}
@Override
protected Future<?> putByteArray(final String bucket, final String key, final byte[] data, final String contentType) {
return exec.submit(new Callable<String>() {
@Override
public String call() throws Exception {
ObjectMetadata md = new ObjectMetadata();
md.setContentType(contentType);
md.setContentLength(data.length);
return s3.putObject(new PutObjectRequest(bucket, key, new ByteArrayInputStream(data), md)).getETag();
}
});
}
@Override
protected Future<?> putFile(final String bucket, final String key, final File data, String contentType) {
return exec.submit(new Callable<String>() {
@Override
public String call() throws Exception {
return s3.putObject(new PutObjectRequest(bucket, key, data)).getETag();
}
});
}
@Override
protected Future<?> putInputStream(final String bucket, final String key, final InputStream data,
final String contentType) {
return exec.submit(new Callable<String>() {
@Override
public String call() throws Exception {
ObjectMetadata md = new ObjectMetadata();
md.setContentType(contentType);
md.setContentLength(data.available());
return s3.putObject(new PutObjectRequest(bucket, key, data, md)).getETag();
}
});
}
@Override
protected Future<?> putString(String bucket, String key, String data, String contentType) {
throw new UnsupportedOperationException();
}
}

View File

@ -1,95 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.aws.s3;
import static org.jclouds.Constants.PROPERTY_IO_WORKER_THREADS;
import static org.jclouds.Constants.PROPERTY_MAX_CONNECTIONS_PER_CONTEXT;
import static org.jclouds.Constants.PROPERTY_MAX_CONNECTIONS_PER_HOST;
import static org.jclouds.Constants.PROPERTY_USER_THREADS;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.util.concurrent.Future;
import org.jclouds.s3.S3AsyncClient;
import org.jclouds.s3.domain.S3Object;
import com.google.common.base.Throwables;
/**
* // TODO: Adrian: Document this!
*
* @author Adrian Cole
*/
public abstract class BaseJCloudsPerformanceLiveTest extends BasePerformanceLiveTest {
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),
overrides.getProperty(PROPERTY_USER_THREADS));
}
@Override
protected Future<?> putByteArray(String bucket, String key, byte[] data, String contentType) {
S3Object object = newObject(key);
object.setPayload(data);
object.getPayload().getContentMetadata().setContentType(contentType);
return getApi().putObject(bucket, object);
}
public abstract S3AsyncClient getApi();
@Override
protected Future<?> putFile(String bucket, String key, File data, String contentType) {
S3Object object = newObject(key);
object.setPayload(data);
object.getPayload().getContentMetadata().setContentType(contentType);
return getApi().putObject(bucket, object);
}
private S3Object newObject(String key) {
S3Object object = getApi().newS3Object();
object.getMetadata().setKey(key);
return object;
}
@Override
protected Future<?> putInputStream(String bucket, String key, InputStream data, String contentType) {
S3Object object = newObject(key);
object.setPayload(data);
try {
object.getPayload().getContentMetadata().setContentLength(Long.valueOf(data.available()));
} catch (IOException e) {
Throwables.propagate(e);
}
object.getPayload().getContentMetadata().setContentType(contentType);
return getApi().putObject(bucket, object);
}
@Override
protected Future<?> putString(String bucket, String key, String data, String contentType) {
S3Object object = newObject(key);
object.setPayload(data);
object.getPayload().getContentMetadata().setContentType(contentType);
return getApi().putObject(bucket, object);
}
}

View File

@ -1,230 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.aws.s3;
import static org.jclouds.concurrent.FutureIterables.awaitCompletion;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStream;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicInteger;
import javax.inject.Provider;
import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest;
import org.jclouds.logging.Logger;
import org.testng.annotations.Test;
import com.google.common.collect.Maps;
import com.google.common.util.concurrent.JdkFutureAdapters;
import com.google.common.util.concurrent.ListenableFuture;
/**
* Tests relative performance of S3 functions.
*
* @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;
protected Logger logger = Logger.NULL;;
@Test(enabled = false)
public void testPutBytesSerial() throws Exception {
String bucketName = getContainerName();
try {
doSerial(new PutBytesFuture(bucketName), loopCount / 10);
} finally {
returnContainer(bucketName);
}
}
@Test
public void testPutBytesParallel() throws InterruptedException, ExecutionException, TimeoutException {
String bucketName = getContainerName();
try {
doParallel(new PutBytesFuture(bucketName), loopCount, bucketName);
} finally {
returnContainer(bucketName);
}
}
@Test(enabled = false)
public void testPutFileSerial() throws Exception {
String bucketName = getContainerName();
try {
doSerial(new PutFileFuture(bucketName), loopCount / 10);
} finally {
returnContainer(bucketName);
}
}
@Test
public void testPutFileParallel() throws InterruptedException, ExecutionException, TimeoutException {
String bucketName = getContainerName();
try {
doParallel(new PutFileFuture(bucketName), loopCount, bucketName);
} finally {
returnContainer(bucketName);
}
}
@Test(enabled = false)
public void testPutInputStreamSerial() throws Exception {
String bucketName = getContainerName();
try {
doSerial(new PutInputStreamFuture(bucketName), loopCount / 10);
} finally {
returnContainer(bucketName);
}
}
@Test
public void testPutInputStreamParallel() throws InterruptedException, ExecutionException, TimeoutException {
String bucketName = getContainerName();
try {
doParallel(new PutInputStreamFuture(bucketName), loopCount, bucketName);
} finally {
returnContainer(bucketName);
}
}
@Test(enabled = false)
public void testPutStringSerial() throws Exception {
String bucketName = getContainerName();
try {
doSerial(new PutStringFuture(bucketName), loopCount / 10);
} finally {
returnContainer(bucketName);
}
}
@Test
public void testPutStringParallel() throws InterruptedException, ExecutionException, TimeoutException {
String bucketName = getContainerName();
try {
doParallel(new PutStringFuture(bucketName), loopCount, bucketName);
} finally {
returnContainer(bucketName);
}
}
private void doSerial(Provider<ListenableFuture<?>> provider, int loopCount) throws Exception, ExecutionException {
for (int i = 0; i < loopCount; i++)
assert provider.get().get() != null;
}
private void doParallel(Provider<ListenableFuture<?>> provider, int loopCount, String containerName)
throws InterruptedException, ExecutionException, TimeoutException {
Map<Integer, ListenableFuture<?>> responses = Maps.newHashMap();
for (int i = 0; i < loopCount; i++)
responses.put(i, provider.get());
Map<Integer, Exception> exceptions = awaitCompletion(responses, exec, null, Logger.NULL, String.format(
"putting into containerName: %s", containerName));
assert exceptions.size() == 0 : exceptions;
}
class PutBytesFuture implements Provider<ListenableFuture<?>> {
final AtomicInteger key = new AtomicInteger(0);
protected byte[] test = new byte[1024 * 2];
private final String bucketName;
public PutBytesFuture(String bucketName) {
this.bucketName = bucketName;
}
public ListenableFuture<?> get() {
return JdkFutureAdapters.listenInPoolThread(putByteArray(bucketName, key.getAndIncrement() + "", test,
"application/octetstring"));
}
}
class PutFileFuture implements Provider<ListenableFuture<?>> {
final AtomicInteger key = new AtomicInteger(0);
protected File file = new File(getClass().getResource("/testimg.png").getFile());
private final String bucketName;
public PutFileFuture(String bucketName) {
this.bucketName = bucketName;
}
public ListenableFuture<?> get() {
return JdkFutureAdapters.listenInPoolThread(putFile(bucketName, key.getAndIncrement() + "", file, "text/xml"));
}
}
class PutInputStreamFuture extends PutBytesFuture {
final AtomicInteger key = new AtomicInteger(0);
private final String bucketName;
public PutInputStreamFuture(String bucketName) {
super(bucketName);
this.bucketName = bucketName;
}
@Override
public ListenableFuture<?> get() {
return JdkFutureAdapters.listenInPoolThread(putInputStream(bucketName, key.getAndIncrement() + "", new ByteArrayInputStream(
test), "application/octetstring"));
}
}
class PutStringFuture implements Provider<ListenableFuture<?>> {
final AtomicInteger key = new AtomicInteger(0);
protected String testString = "hello world!";
private final String bucketName;
public PutStringFuture(String bucketName) {
this.bucketName = bucketName;
}
public ListenableFuture<?> get() {
return JdkFutureAdapters.listenInPoolThread(putString(bucketName, key.getAndIncrement() + "", testString, "text/plain"));
}
}
protected abstract Future<?> putByteArray(String bucket, String key, byte[] data, String contentType);
protected abstract Future<?> putFile(String bucket, String key, File data, String contentType);
protected abstract Future<?> putInputStream(String bucket, String key, InputStream data, String contentType);
protected abstract Future<?> putString(String bucket, String key, String data, String contentType);
}

View File

@ -1,74 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.aws.s3;
import static org.jclouds.Constants.PROPERTY_CONNECTION_TIMEOUT;
import static org.jclouds.Constants.PROPERTY_IO_WORKER_THREADS;
import static org.jclouds.Constants.PROPERTY_MAX_CONNECTIONS_PER_CONTEXT;
import static org.jclouds.Constants.PROPERTY_MAX_CONNECTIONS_PER_HOST;
import static org.jclouds.Constants.PROPERTY_SO_TIMEOUT;
import static org.jclouds.Constants.PROPERTY_USER_THREADS;
import java.util.Properties;
import java.util.concurrent.Executors;
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.annotations.Test;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
@Test(singleThreaded = true, timeOut = 2 * 60 * 1000, groups = "live", testName = "JCloudsApacheHCPerformanceLiveTest")
public class JCloudsApacheHCPerformanceLiveTest extends BaseJCloudsPerformanceLiveTest {
public JCloudsApacheHCPerformanceLiveTest(){
exec = Executors.newCachedThreadPool();
}
@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 + "");
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 view.unwrap(AWSS3ApiMetadata.CONTEXT_TOKEN).getAsyncApi();
}
}

View File

@ -1,154 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.aws.s3;
import java.io.File;
import java.io.InputStream;
import java.util.Properties;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeoutException;
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.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;
/**
*
* This test is disabled due to timeout limitations in the google app engine sdk
*
* @author Adrian Cole
*/
@Test(enabled = false, singleThreaded = true, timeOut = 2 * 60 * 1000, groups = "live", testName = "JCloudsGaePerformanceLiveTest")
public class JCloudsGaePerformanceLiveTest extends BaseJCloudsPerformanceLiveTest {
@Override
@Test(enabled = false)
public void testPutBytesParallel() throws InterruptedException, ExecutionException, TimeoutException {
throw new UnsupportedOperationException();
}
@Override
@Test(enabled = false)
public void testPutBytesSerial() throws Exception {
throw new UnsupportedOperationException();
}
@Override
@Test(enabled = false)
public void testPutFileParallel() throws InterruptedException, ExecutionException, TimeoutException {
throw new UnsupportedOperationException();
}
@Override
@Test(enabled = false)
public void testPutFileSerial() throws Exception {
throw new UnsupportedOperationException();
}
@Override
@Test(enabled = false)
public void testPutInputStreamParallel() throws InterruptedException, ExecutionException, TimeoutException {
throw new UnsupportedOperationException();
}
@Override
@Test(enabled = false)
public void testPutInputStreamSerial() throws Exception {
throw new UnsupportedOperationException();
}
@Override
@Test(enabled = false)
public void testPutStringParallel() throws InterruptedException, ExecutionException, TimeoutException {
throw new UnsupportedOperationException();
}
@Override
@Test(enabled = false)
public void testPutStringSerial() throws Exception {
throw new UnsupportedOperationException();
}
public JCloudsGaePerformanceLiveTest() {
super();
// otherwise, we'll get timeout errors
// TODO sdk 1.2.3 should give the ability to set a higher timeout then 5
// seconds allowing this
// to be removed
loopCount = 5;
}
@Override
protected Future<?> putByteArray(String bucket, String key, byte[] data, String contentType) {
setupApiProxy();
return super.putByteArray(bucket, key, data, contentType);
}
@Override
protected Future<?> putFile(String bucket, String key, File data, String contentType) {
setupApiProxy();
return super.putFile(bucket, key, data, contentType);
}
@Override
protected Future<?> putInputStream(String bucket, String key, InputStream data, String contentType) {
setupApiProxy();
return super.putInputStream(bucket, key, data, contentType);
}
@Override
protected Future<?> putString(String bucket, String key, String data, String contentType) {
setupApiProxy();
return super.putString(bucket, key, data, contentType);
}
@BeforeMethod
void setupApiProxy() {
new LocalServiceTestHelper(new LocalURLFetchServiceTestConfig()).setUp();
}
@Override
protected Properties setupProperties() {
Properties overrides = super.setupProperties();
printPropertiesOfContext(overrides, "apachehc");
return overrides;
}
@Override
protected Iterable<Module> setupModules() {
return ImmutableSet.<Module>builder()
.add(new NullLoggingModule())
.add(new AsyncGoogleAppEngineConfigurationModule())
.add(new EnterpriseConfigurationModule()).build();
}
@Override
public S3AsyncClient getApi() {
return view.unwrap(AWSS3ApiMetadata.CONTEXT_TOKEN).getAsyncApi();
}
}

View File

@ -1,74 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.aws.s3;
import static org.jclouds.Constants.PROPERTY_IO_WORKER_THREADS;
import static org.jclouds.Constants.PROPERTY_MAX_CONNECTIONS_PER_CONTEXT;
import static org.jclouds.Constants.PROPERTY_MAX_CONNECTIONS_PER_HOST;
import static org.jclouds.Constants.PROPERTY_USER_THREADS;
import java.util.Properties;
import java.util.concurrent.Executors;
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.annotations.Test;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
/**
* Tests the default JClouds client.
*
* @author Adrian Cole
*
*/
@Test(singleThreaded = true, timeOut = 2 * 60 * 1000, groups = "live", testName = "JCloudsPerformanceLiveTest")
public class JCloudsPerformanceLiveTest extends BaseJCloudsPerformanceLiveTest {
public JCloudsPerformanceLiveTest(){
exec = Executors.newCachedThreadPool();
}
@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 + "");
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 view.unwrap(AWSS3ApiMetadata.CONTEXT_TOKEN).getAsyncApi();
}
}

View File

@ -1,146 +0,0 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
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.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(singleThreaded = true, timeOut = 2 * 60 * 1000, groups = "live", testName = "Jets3tPerformanceLiveTest")
public class Jets3tPerformanceLiveTest extends BasePerformanceLiveTest {
public Jets3tPerformanceLiveTest(){
exec = Executors.newCachedThreadPool();
}
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
@Test(enabled = false)
public void testPutStringSerial() throws Exception {
throw new UnsupportedOperationException();
}
@Override
@Test(enabled = false)
public void testPutBytesSerial() throws Exception {
throw new UnsupportedOperationException();
}
@Override
@Test(enabled = false)
public void testPutStringParallel() throws InterruptedException, ExecutionException {
throw new UnsupportedOperationException();
}
@Override
@Test(enabled = false)
public void testPutBytesParallel() throws InterruptedException, ExecutionException {
throw new UnsupportedOperationException();
}
@Override
@Test(enabled = false)
public void testPutInputStreamParallel() throws InterruptedException, ExecutionException {
throw new UnsupportedOperationException();
}
@Override
@Test(enabled = false)
public void testPutFileParallel() throws InterruptedException, ExecutionException {
throw new UnsupportedOperationException();
}
@Override
@Test(enabled = false)
protected Future<?> putByteArray(String bucket, String key, byte[] data, String contentType) {
throw new UnsupportedOperationException();
}
@Override
protected Future<?> putFile(final String bucket, String key, File data, String contentType) {
final org.jets3t.service.model.S3Object object = new org.jets3t.service.model.S3Object(key);
object.setContentType(contentType);
object.setDataInputFile(data);
object.setContentLength(data.length());
return exec.submit(new Callable<S3Object>() {
@Override
public S3Object call() throws Exception {
return jetClient.putObject(bucket, object);
}
});
}
@Override
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);
try {
object.setContentLength(data.available());
} catch (IOException e) {
Throwables.propagate(e);
}
return exec.submit(new Callable<S3Object>() {
@Override
public S3Object call() throws Exception {
return jetClient.putObject(bucket, object);
}
});
}
@Override
protected Future<?> putString(String bucket, String key, String data, String contentType) {
throw new UnsupportedOperationException();
}
}

View File

@ -1,51 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<!--
For more configuration infromation and examples see the Apache Log4j
website: http://logging.apache.org/log4j/
-->
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="false">
<!-- A time/date based rolling appender -->
<appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="target/test-data/jclouds.log" />
<param name="Append" value="true" />
<!-- Rollover at midnight each day -->
<param name="DatePattern" value="'.'yyyy-MM-dd" />
<param name="Threshold" value="WARN" />
<layout class="org.apache.log4j.PatternLayout">
<!-- The default pattern: Date Priority [Category] Message\n -->
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
<!--
The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
<param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x)
%m%n"/>
-->
</layout>
</appender>
<appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
<appender-ref ref="FILE" />
</appender>
<!-- ================ -->
<!-- Limit categories -->
<!-- ================ -->
<!-- ======================= -->
<!-- Setup the Root category -->
<!-- ======================= -->
<root>
<priority value="WARN" />
<appender-ref ref="ASYNC" />
</root>
</log4j:configuration>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

View File

@ -33,7 +33,6 @@
<modules>
<module>getpath</module>
<module>googleappengine</module>
<module>perftest</module>
<module>speedtest-azurequeue</module>
<module>speedtest-sqs</module>
<module>simpledb</module>