diff --git a/aws/s3/perftest/pom.xml b/aws/s3/perftest/pom.xml index 6432049434..037a1045e2 100644 --- a/aws/s3/perftest/pom.xml +++ b/aws/s3/perftest/pom.xml @@ -72,6 +72,44 @@ jclouds-httpnio ${project.version} + + ${project.groupId} + jclouds-gae + ${project.version} + + + + com.google.appengine + appengine-api-stubs + 1.2.1 + test + + + com.google.appengine + appengine-local-runtime + 1.2.1 + test + + + ${project.groupId} + jclouds-core + ${project.version} + test-jar + test + + + org.mortbay.jetty + jetty + + + + + org.apache.geronimo.specs + geronimo-servlet_2.5_spec + 1.2 + test + + net.java.dev.jets3t jets3t 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 new file mode 100644 index 0000000000..e5322b4df2 --- /dev/null +++ b/aws/s3/perftest/src/test/java/org/jclouds/aws/s3/JCloudsGaePerformanceLiveTest.java @@ -0,0 +1,122 @@ +/** + * + * Copyright (C) 2009 Global Cloud Specialists, Inc. + * + * ==================================================================== + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF 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 org.jclouds.gae.config.URLFetchServiceClientModule; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import com.google.appengine.tools.development.ApiProxyLocalImpl; +import com.google.apphosting.api.ApiProxy; +import com.google.inject.Module; + +@Test(sequential = true, testName = "s3.JCloudsGaePerformanceLiveTest", groups = { "live" }) +public class JCloudsGaePerformanceLiveTest extends BaseJCloudsPerformance { + + @Override + protected boolean putByteArray(String bucket, String key, byte[] data, String contentType) + throws Exception { + setupApiProxy(); + return super.putByteArray(bucket, key, data, contentType); + } + + @Override + protected boolean putFile(String bucket, String key, File data, String contentType) + throws Exception { + setupApiProxy(); + return super.putFile(bucket, key, data, contentType); + } + + @Override + protected boolean putInputStream(String bucket, String key, InputStream data, String contentType) + throws Exception { + setupApiProxy(); + return super.putInputStream(bucket, key, data, contentType); + } + + @Override + protected boolean putString(String bucket, String key, String data, String contentType) + throws Exception { + setupApiProxy(); + return super.putString(bucket, key, data, contentType); + } + + @Override + protected void deleteEverything() throws Exception { + setupApiProxy(); + super.deleteEverything(); + } + + @BeforeMethod + void setupApiProxy() { + ApiProxy.setEnvironmentForCurrentThread(new TestEnvironment()); + ApiProxy.setDelegate(new ApiProxyLocalImpl(new File(".")) { + }); + } + + class TestEnvironment implements ApiProxy.Environment { + public String getAppId() { + return "Unit Tests"; + } + + public String getVersionId() { + return "1.0"; + } + + public void setDefaultNamespace(String s) { + } + + public String getRequestNamespace() { + return null; + } + + public String getDefaultNamespace() { + return null; + } + + public String getAuthDomain() { + return null; + } + + public boolean isLoggedIn() { + return false; + } + + public String getEmail() { + return null; + } + + public boolean isAdmin() { + return false; + } + } + + @Override + protected Module createHttpModule() { + return new URLFetchServiceClientModule(); + } +} \ No newline at end of file