From 73117e366235566847ccc086c9dc27dbe0d7cb7a Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Thu, 7 Jul 2011 22:35:09 -0400 Subject: [PATCH] Updated KickStart args and integration test setup --- demos/googleappengine/pom.xml | 83 +++++-------------- .../functest/GoogleAppEngineLiveTest.java | 2 +- .../functest/GoogleDevServer.java | 35 +++++--- 3 files changed, 45 insertions(+), 75 deletions(-) diff --git a/demos/googleappengine/pom.xml b/demos/googleappengine/pom.xml index beccf05e6b..e9e7453a6e 100644 --- a/demos/googleappengine/pom.xml +++ b/demos/googleappengine/pom.xml @@ -25,7 +25,7 @@ org.jclouds jclouds-demos-project - 1.0-SNAPSHOT + 1.1.0-SNAPSHOT jclouds-demo-googleappengine war @@ -34,9 +34,9 @@ jclouds-aws-demo + 1.4.2 localhost 8088 - @@ -54,11 +54,13 @@ org.jclouds.provider aws-s3 ${project.version} + runtime org.jclouds.provider aws-ec2 ${project.version} + runtime org.jclouds.driver @@ -74,6 +76,7 @@ displaytag displaytag 1.2 + runtime org.slf4j @@ -85,6 +88,7 @@ org.slf4j slf4j-jdk14 1.5.6 + runtime standard @@ -96,39 +100,31 @@ jstl javax.servlet 1.1.2 + runtime - org.apache.geronimo.specs - geronimo-el_1.0_spec - 1.0.1 - - - org.apache.geronimo.specs - geronimo-jsp_2.1_spec - 1.0.1 - provided - - - org.apache.geronimo.specs - geronimo-servlet_2.5_spec - 1.2 + javax.servlet + servlet-api + 2.5 provided + com.google.appengine appengine-tools-sdk - 1.4.3 - system - ${appengine.home}/lib/appengine-tools-api.jar + ${appengine.sdk.version} + test ${project.artifactId} - org.apache.maven.plugins maven-war-plugin + 2.1.1 + + WEB-INF/web.xml src/main/appengine @@ -138,44 +134,6 @@ - - org.apache.maven.plugins - maven-surefire-plugin - - - integration - integration-test - - test - - - - - devappserver.address - ${devappserver.address} - - - devappserver.port - ${devappserver.port} - - - warfile - ${project.build.directory}/${project.artifactId} - - - - ${env.APPENGINE_HOME}/lib/appengine-tools-api.jar - - - true - ${env.APPENGINE_HOME}/bin - ${env.APPENGINE_HOME}/lib - ${env.APPENGINE_HOME}/config/sdk - - - - - @@ -185,7 +143,6 @@ - org.apache.maven.plugins maven-surefire-plugin @@ -198,15 +155,17 @@ test.aws.identity - ${test.aws.identity} + + ${test.aws-s3.identity} test.aws.credential - ${test.aws.credential} + + ${test.aws-s3.credential} appengine.sdk.root - ${env.APPENGINE_HOME} + ${appengine.sdk.root} devappserver.address diff --git a/demos/googleappengine/src/test/java/org/jclouds/samples/googleappengine/functest/GoogleAppEngineLiveTest.java b/demos/googleappengine/src/test/java/org/jclouds/samples/googleappengine/functest/GoogleAppEngineLiveTest.java index e1007ef4fc..9b9f7e9b85 100644 --- a/demos/googleappengine/src/test/java/org/jclouds/samples/googleappengine/functest/GoogleAppEngineLiveTest.java +++ b/demos/googleappengine/src/test/java/org/jclouds/samples/googleappengine/functest/GoogleAppEngineLiveTest.java @@ -36,7 +36,7 @@ import org.testng.annotations.Test; * * @author Adrian Cole */ -@Test(groups = "live", sequential = true) +@Test(groups = "live", singleThreaded = true) public class GoogleAppEngineLiveTest { GoogleDevServer server; diff --git a/demos/googleappengine/src/test/java/org/jclouds/samples/googleappengine/functest/GoogleDevServer.java b/demos/googleappengine/src/test/java/org/jclouds/samples/googleappengine/functest/GoogleDevServer.java index b74d9d2e49..ad6c9e92c2 100644 --- a/demos/googleappengine/src/test/java/org/jclouds/samples/googleappengine/functest/GoogleDevServer.java +++ b/demos/googleappengine/src/test/java/org/jclouds/samples/googleappengine/functest/GoogleDevServer.java @@ -18,16 +18,21 @@ */ package org.jclouds.samples.googleappengine.functest; +import static com.google.common.base.Preconditions.checkNotNull; +import static java.lang.String.format; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.Properties; +import java.util.concurrent.TimeUnit; import com.google.appengine.tools.KickStart; +import com.google.appengine.tools.info.SdkInfo; /** * Basic functionality to start a local google app engine instance. - * + * * @author Adrian Cole */ public class GoogleDevServer { @@ -35,26 +40,27 @@ public class GoogleDevServer { Thread server; public void writePropertiesAndStartServer(final String address, - final String port, final String warfile, Properties props) + final String port, final String warfile, Properties props) throws IOException, InterruptedException { - String filename = String.format( - "%1$s/WEB-INF/jclouds.properties", warfile); + String filename = String.format("%1$s/WEB-INF/jclouds.properties", warfile); System.err.println("file: " + filename); props.store(new FileOutputStream(filename), "test"); assert new File(filename).exists(); this.server = new Thread(new Runnable() { public void run() { - KickStart - .main(new String[]{ - "com.google.appengine.tools.development.DevAppServerMain", - "--disable_update_check", "-a", address, "-p", - port, warfile}); - + String sdkRoot = checkNotNull(System.getProperty(SdkInfo.SDK_ROOT_PROPERTY), SdkInfo.SDK_ROOT_PROPERTY); + KickStart.main(new String[] { + KickStarter.systemProperty("java.util.logging.config.file", + format("%s/WEB-INF/logging.properties", warfile)), + KickStarter.systemProperty(SdkInfo.SDK_ROOT_PROPERTY, sdkRoot), + "com.google.appengine.tools.development.DevAppServerMain", + "--disable_update_check", + format("--sdk_root=%s", sdkRoot), + "-a", address, "-p", port, warfile }); } - }); server.start(); - Thread.sleep(30 * 1000); + TimeUnit.SECONDS.sleep(30); } public void stop() throws Exception { @@ -62,4 +68,9 @@ public class GoogleDevServer { server.interrupt(); } + private static class KickStarter { + private static String systemProperty(String key, String value) { + return format("--jvm_flag=-D%s=%s", key, value); + } + } } \ No newline at end of file