git-svn-id: http://jclouds.googlecode.com/svn/trunk@822 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
adrian.f.cole 2009-05-21 16:08:31 +00:00
parent 834177f9fc
commit 950e56e327
8 changed files with 304 additions and 279 deletions

View File

@ -72,108 +72,4 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<!-- note that the groups/excluded groups don't work due to some problem
in surefire or testng. instead, we have to exclude via file path
<groups>integration</groups>
<excludedGroups>unit,performance,live</excludedGroups> -->
<excludes>
<exclude>**/*LiveTest.java</exclude>
</excludes>
<includes>
<include>**/*IntegrationTest.java</include>
</includes>
<systemProperties>
<property>
<name>jclouds.s3.httpstream.url</name>
<value>${jclouds.s3.httpstream.url}</value>
</property>
<property>
<name>jclouds.s3.httpstream.md5</name>
<value>${jclouds.s3.httpstream.md5}</value>
</property>
</systemProperties>
</configuration>
</execution>
</executions>
<configuration>
<!-- note that the groups/excluded groups don't work due to some problem
in surefire or testng. instead, we have to exclude via file path
<groups>unit,performance</groups>
<excludedGroups>integration,live</excludedGroups> -->
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
<exclude>**/*LiveTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>live</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<!-- note that the groups/excluded groups don't work due to some problem
in surefire or testng. instead, we have to exclude via file path
<groups>live,integration</groups>
<excludedGroups>unit,performance</excludedGroups> -->
<excludes>
<exclude>none</exclude>
</excludes>
<includes>
<include>**/*IntegrationTest.java</include>
<include>**/*LiveTest.java</include>
</includes>
<systemProperties>
<property>
<name>jclouds.aws.accesskeyid</name>
<value>${jclouds.aws.accesskeyid}</value>
</property>
<property>
<name>jclouds.aws.secretaccesskey</name>
<value>${jclouds.aws.secretaccesskey}</value>
</property>
<property>
<name>jclouds.s3.httpstream.url</name>
<value>${jclouds.s3.httpstream.url}</value>
</property>
<property>
<name>jclouds.s3.httpstream.md5</name>
<value>${jclouds.s3.httpstream.md5}</value>
</property>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project> </project>

View File

@ -43,4 +43,108 @@
<module>extensions</module> <module>extensions</module>
<module>samples</module> <module>samples</module>
</modules> </modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<!-- note that the groups/excluded groups don't work due to some problem
in surefire or testng. instead, we have to exclude via file path
<groups>integration</groups>
<excludedGroups>unit,performance,live</excludedGroups> -->
<excludes>
<exclude>**/*LiveTest.java</exclude>
</excludes>
<includes>
<include>**/*IntegrationTest.java</include>
</includes>
<systemProperties>
<property>
<name>jclouds.s3.httpstream.url</name>
<value>${jclouds.s3.httpstream.url}</value>
</property>
<property>
<name>jclouds.s3.httpstream.md5</name>
<value>${jclouds.s3.httpstream.md5}</value>
</property>
</systemProperties>
</configuration>
</execution>
</executions>
<configuration>
<!-- note that the groups/excluded groups don't work due to some problem
in surefire or testng. instead, we have to exclude via file path
<groups>unit,performance</groups>
<excludedGroups>integration,live</excludedGroups> -->
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
<exclude>**/*LiveTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>live</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<!-- note that the groups/excluded groups don't work due to some problem
in surefire or testng. instead, we have to exclude via file path
<groups>live,integration</groups>
<excludedGroups>unit,performance</excludedGroups> -->
<excludes>
<exclude>none</exclude>
</excludes>
<includes>
<include>**/*IntegrationTest.java</include>
<include>**/*LiveTest.java</include>
</includes>
<systemProperties>
<property>
<name>jclouds.aws.accesskeyid</name>
<value>${jclouds.aws.accesskeyid}</value>
</property>
<property>
<name>jclouds.aws.secretaccesskey</name>
<value>${jclouds.aws.secretaccesskey}</value>
</property>
<property>
<name>jclouds.s3.httpstream.url</name>
<value>${jclouds.s3.httpstream.url}</value>
</property>
<property>
<name>jclouds.s3.httpstream.md5</name>
<value>${jclouds.s3.httpstream.md5}</value>
</property>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project> </project>

View File

@ -41,11 +41,9 @@
<properties> <properties>
<!-- note you must set the property ${appengine.home} to a valid extraction of appengine-java-sdk --> <!-- note you must set the property ${appengine.home} to a valid extraction of appengine-java-sdk -->
<appengine.home>/Users/adriancole/Desktop/appengine-java-sdk-1.2.0</appengine.home> <appengine.home>/Users/adriancole/Desktop/appengine-java-sdk-1.2.1</appengine.home>
<devappserver.address>localhost</devappserver.address> <devappserver.address>localhost</devappserver.address>
<devappserver.port>8088</devappserver.port> <devappserver.port>8088</devappserver.port>
<jclouds.aws.accesskeyid></jclouds.aws.accesskeyid>
<jclouds.aws.secretaccesskey></jclouds.aws.secretaccesskey>
</properties> </properties>
<dependencies> <dependencies>
@ -95,7 +93,7 @@
<dependency> <dependency>
<groupId>com.google.appengine</groupId> <groupId>com.google.appengine</groupId>
<artifactId>appengine-tools-api</artifactId> <artifactId>appengine-tools-api</artifactId>
<version>1.2.0</version> <version>1.2.1</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${appengine.home}/lib/appengine-tools-api.jar</systemPath> <systemPath>${appengine.home}/lib/appengine-tools-api.jar</systemPath>
</dependency> </dependency>
@ -103,12 +101,10 @@
</dependencies> </dependencies>
<build> <build>
<finalName>${project.artifactId}</finalName> <finalName>${project.artifactId}</finalName>
<testSourceDirectory>src/it/java</testSourceDirectory>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<executions> <executions>
<execution> <execution>
<id>integration</id> <id>integration</id>
@ -117,16 +113,7 @@
<goal>test</goal> <goal>test</goal>
</goals> </goals>
<configuration> <configuration>
<testClassesDirectory>target/test-classes</testClassesDirectory>
<systemProperties> <systemProperties>
<property>
<name>jclouds.aws.accesskeyid</name>
<value>${jclouds.aws.accesskeyid}</value>
</property>
<property>
<name>jclouds.aws.secretaccesskey</name>
<value>${jclouds.aws.secretaccesskey}</value>
</property>
<property> <property>
<name>appengine.home</name> <name>appengine.home</name>
<value>${appengine.home}</value> <value>${appengine.home}</value>
@ -157,12 +144,58 @@
</configuration> </configuration>
</execution> </execution>
</executions> </executions>
<configuration>
<!-- fool default surefire execution in 'test' to not find any test classes -->
<testClassesDirectory>target/classes</testClassesDirectory>
</configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </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>
<systemProperties>
<property>
<name>jclouds.aws.accesskeyid</name>
<value>${jclouds.aws.accesskeyid}</value>
</property>
<property>
<name>jclouds.aws.secretaccesskey</name>
<value>${jclouds.aws.secretaccesskey}</value>
</property>
<property>
<name>appengine.home</name>
<value>${appengine.home}</value>
</property>
<property>
<name>devappserver.address</name>
<value>${devappserver.address}</value>
</property>
<property>
<name>devappserver.port</name>
<value>${devappserver.port}</value>
</property>
<property>
<name>warfile</name>
<value>${project.build.directory}/${project.artifactId}</value>
</property>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project> </project>

View File

@ -23,28 +23,26 @@
*/ */
package org.jclouds.samples.googleappengine; package org.jclouds.samples.googleappengine;
import java.io.IOException; import com.google.inject.Inject;
import java.io.Writer; import com.google.inject.Singleton;
import java.util.List; import org.jclouds.aws.s3.S3Context;
import java.util.concurrent.TimeUnit; import org.jclouds.aws.s3.S3ResponseException;
import org.jclouds.aws.s3.domain.S3Bucket;
import org.jclouds.logging.Logger;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import org.jclouds.aws.s3.S3Context; import java.io.Writer;
import org.jclouds.aws.s3.S3ResponseException; import java.util.List;
import org.jclouds.aws.s3.domain.S3Bucket; import java.util.concurrent.TimeUnit;
import org.jclouds.logging.Logger;
import com.google.inject.Inject;
import com.google.inject.Singleton;
/** /**
* Shows an example of how to use @{link S3Connection} injected with Guice. * Shows an example of how to use @{link S3Connection} injected with Guice.
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Singleton @Singleton
@ -59,32 +57,32 @@ public class JCloudsServlet extends HttpServlet {
@Override @Override
protected void doGet(HttpServletRequest httpServletRequest, protected void doGet(HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse) throws ServletException, HttpServletResponse httpServletResponse) throws ServletException,
IOException { IOException {
httpServletResponse.setContentType("text/plain"); httpServletResponse.setContentType("text/plain");
Writer writer = httpServletResponse.getWriter(); Writer writer = httpServletResponse.getWriter();
try { try {
List<S3Bucket.Metadata> myBuckets = context.getConnection() List<S3Bucket.Metadata> myBuckets = context.getConnection()
.listOwnedBuckets().get(10, TimeUnit.SECONDS); .listOwnedBuckets().get(10, TimeUnit.SECONDS);
writer.write("List:\n"); writer.write("List:\n");
for (S3Bucket.Metadata bucket : myBuckets) { for (S3Bucket.Metadata bucket : myBuckets) {
writer.write(String.format(" %1$s", bucket)); writer.write(String.format(" %1$s", bucket));
try { try {
writer.write(String.format(": %1$s entries%n", context writer.write(String.format(": %1$s entries%n", context
.createInputStreamMap(bucket.getName()).size())); .createInputStreamMap(bucket.getName()).size()));
} catch (S3ResponseException e) { } catch (S3ResponseException e) {
String message = String.format( String message = String.format(
": unable to list entries due to: %1$s%n", e ": unable to list entries due to: %1$s%n", e
.getError().getCode()); .getError().getCode());
writer.write(message); writer.write(message);
logger.warn(e, "message"); logger.warn(e, "message");
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new ServletException(e); throw new ServletException(e);
} }
writer.flush(); writer.flush();
writer.close(); writer.close();
} }
} }

View File

@ -23,12 +23,10 @@
*/ */
package org.jclouds.samples.googleappengine.config; package org.jclouds.samples.googleappengine.config;
import java.io.IOException; import com.google.inject.Inject;
import java.io.InputStream; import com.google.inject.Injector;
import java.util.Properties; import com.google.inject.servlet.GuiceServletContextListener;
import com.google.inject.servlet.ServletModule;
import javax.servlet.ServletContextEvent;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.jclouds.aws.s3.S3Context; import org.jclouds.aws.s3.S3Context;
import org.jclouds.aws.s3.S3ContextFactory; import org.jclouds.aws.s3.S3ContextFactory;
@ -36,17 +34,15 @@ import org.jclouds.aws.s3.reference.S3Constants;
import org.jclouds.gae.config.URLFetchServiceClientModule; import org.jclouds.gae.config.URLFetchServiceClientModule;
import org.jclouds.samples.googleappengine.JCloudsServlet; import org.jclouds.samples.googleappengine.JCloudsServlet;
import javax.servlet.ServletContextEvent;
import com.google.inject.Inject; import java.io.IOException;
import com.google.inject.Injector; import java.io.InputStream;
import com.google.inject.servlet.GuiceServletContextListener; import java.util.Properties;
import com.google.inject.servlet.ServletModule;
/** /**
* Setup Logging and create Injector for use in testing S3. * Setup Logging and create Injector for use in testing S3.
* *
* @author Adrian Cole * @author Adrian Cole
*
*/ */
public class GuiceServletConfig extends GuiceServletContextListener { public class GuiceServletConfig extends GuiceServletContextListener {
@Inject @Inject
@ -56,45 +52,45 @@ public class GuiceServletConfig extends GuiceServletContextListener {
@Override @Override
public void contextInitialized(ServletContextEvent servletContextEvent) { public void contextInitialized(ServletContextEvent servletContextEvent) {
Properties props = loadJCloudsProperties(servletContextEvent); Properties props = loadJCloudsProperties(servletContextEvent);
this.accessKeyId = props this.accessKeyId = props
.getProperty(S3Constants.PROPERTY_AWS_ACCESSKEYID); .getProperty(S3Constants.PROPERTY_AWS_ACCESSKEYID);
this.secretAccessKey = props this.secretAccessKey = props
.getProperty(S3Constants.PROPERTY_AWS_SECRETACCESSKEY); .getProperty(S3Constants.PROPERTY_AWS_SECRETACCESSKEY);
super.contextInitialized(servletContextEvent); super.contextInitialized(servletContextEvent);
} }
private Properties loadJCloudsProperties( private Properties loadJCloudsProperties(
ServletContextEvent servletContextEvent) { ServletContextEvent servletContextEvent) {
InputStream input = servletContextEvent.getServletContext() InputStream input = servletContextEvent.getServletContext()
.getResourceAsStream("/WEB-INF/jclouds.properties"); .getResourceAsStream("/WEB-INF/jclouds.properties");
Properties props = new Properties(); Properties props = new Properties();
try { try {
props.load(input); props.load(input);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} finally { } finally {
IOUtils.closeQuietly(input); IOUtils.closeQuietly(input);
} }
return props; return props;
} }
@Override @Override
protected Injector getInjector() { protected Injector getInjector() {
return S3ContextFactory.createInjector(accessKeyId, secretAccessKey, return S3ContextFactory.createInjector(accessKeyId, secretAccessKey,
false, new URLFetchServiceClientModule(), false, new URLFetchServiceClientModule(),
new ServletModule() { new ServletModule() {
@Override @Override
protected void configureServlets() { protected void configureServlets() {
serve("*.s3").with(JCloudsServlet.class); serve("*.s3").with(JCloudsServlet.class);
requestInjection(this); requestInjection(this);
} }
}); });
} }
@Override @Override
public void contextDestroyed(ServletContextEvent servletContextEvent) { public void contextDestroyed(ServletContextEvent servletContextEvent) {
context.close(); context.close();
super.contextDestroyed(servletContextEvent); super.contextDestroyed(servletContextEvent);
} }
} }

View File

@ -24,12 +24,6 @@
package org.jclouds.samples.googleappengine.functest; package org.jclouds.samples.googleappengine.functest;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Properties;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.jclouds.aws.s3.reference.S3Constants; import org.jclouds.aws.s3.reference.S3Constants;
import org.testng.annotations.BeforeTest; import org.testng.annotations.BeforeTest;
@ -37,65 +31,74 @@ import org.testng.annotations.Optional;
import org.testng.annotations.Parameters; import org.testng.annotations.Parameters;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Properties;
/** /**
* Starts up the Google App Engine for Java Development environment and deploys * Starts up the Google App Engine for Java Development environment and deploys
* an application which tests S3. * an application which tests S3.
* *
* @author Adrian Cole * @author Adrian Cole
*
*/ */
@Test(groups = "integration", enabled = true, sequential = true, testName = "functionalTests") @Test(groups = "live", sequential = true, testName = "functionalTests")
public class GoogleAppEngineTest extends BaseGoogleAppEngineTest { public class GoogleAppEngineLiveTest {
GoogleDevServer server;
private static final String sysAWSAccessKeyId = System private static final String sysAWSAccessKeyId = System
.getProperty(S3Constants.PROPERTY_AWS_ACCESSKEYID); .getProperty(S3Constants.PROPERTY_AWS_ACCESSKEYID);
private static final String sysAWSSecretAccessKey = System private static final String sysAWSSecretAccessKey = System
.getProperty(S3Constants.PROPERTY_AWS_SECRETACCESSKEY); .getProperty(S3Constants.PROPERTY_AWS_SECRETACCESSKEY);
private URL url;
@BeforeTest @BeforeTest
@Parameters( { "warfile", "devappserver.address", "devappserver.port", @Parameters({"warfile", "devappserver.address", "devappserver.port",
S3Constants.PROPERTY_AWS_ACCESSKEYID, S3Constants.PROPERTY_AWS_ACCESSKEYID,
S3Constants.PROPERTY_AWS_SECRETACCESSKEY }) S3Constants.PROPERTY_AWS_SECRETACCESSKEY})
public void startDevAppServer(final String warfile, final String address, public void startDevAppServer(final String warfile, final String address,
final String port, @Optional String AWSAccessKeyId, final String port, @Optional String AWSAccessKeyId,
@Optional String AWSSecretAccessKey) throws Exception { @Optional String AWSSecretAccessKey) throws Exception {
AWSAccessKeyId = AWSAccessKeyId != null ? AWSAccessKeyId url = new URL(String.format("http://%1$s:%2$s", address, port));
: sysAWSAccessKeyId;
AWSSecretAccessKey = AWSSecretAccessKey != null ? AWSSecretAccessKey
: sysAWSSecretAccessKey;
checkNotNull(AWSAccessKeyId, "AWSAccessKeyId"); AWSAccessKeyId = AWSAccessKeyId != null ? AWSAccessKeyId
checkNotNull(AWSSecretAccessKey, "AWSSecretAccessKey"); : sysAWSAccessKeyId;
AWSSecretAccessKey = AWSSecretAccessKey != null ? AWSSecretAccessKey
: sysAWSSecretAccessKey;
Properties props = new Properties(); checkNotNull(AWSAccessKeyId, "AWSAccessKeyId");
props.put(S3Constants.PROPERTY_AWS_ACCESSKEYID, AWSAccessKeyId); checkNotNull(AWSSecretAccessKey, "AWSSecretAccessKey");
props.put(S3Constants.PROPERTY_AWS_SECRETACCESSKEY, AWSSecretAccessKey);
writePropertiesAndStartServer(address, port, warfile, props); Properties props = new Properties();
props.put(S3Constants.PROPERTY_AWS_ACCESSKEYID, AWSAccessKeyId);
props.put(S3Constants.PROPERTY_AWS_SECRETACCESSKEY, AWSSecretAccessKey);
server = new GoogleDevServer();
server.writePropertiesAndStartServer(address, port, warfile, props);
} }
@Test @Test
public void shouldPass() throws InterruptedException, IOException { public void shouldPass() throws InterruptedException, IOException {
InputStream i = url.openStream(); InputStream i = url.openStream();
String string = IOUtils.toString(i); String string = IOUtils.toString(i);
assert string.indexOf("Hello World!") >= 0 : string; assert string.indexOf("Hello World!") >= 0 : string;
} }
@Test(invocationCount = 5, enabled = true) @Test(invocationCount = 5, enabled = true)
public void testGuiceJCloudsSerial() throws InterruptedException, public void testGuiceJCloudsSerial() throws InterruptedException,
IOException { IOException {
URL gurl = new URL(url, "/guice/listbuckets.s3"); URL gurl = new URL(url, "/guice/listbuckets.s3");
InputStream i = gurl.openStream(); InputStream i = gurl.openStream();
String string = IOUtils.toString(i); String string = IOUtils.toString(i);
assert string.indexOf("List") >= 0 : string; assert string.indexOf("List") >= 0 : string;
} }
@Test(invocationCount = 50, enabled = true, threadPoolSize = 10) @Test(invocationCount = 50, enabled = true, threadPoolSize = 10)
public void testGuiceJCloudsParallel() throws InterruptedException, public void testGuiceJCloudsParallel() throws InterruptedException,
IOException { IOException {
URL gurl = new URL(url, "/guice/listbuckets.s3"); URL gurl = new URL(url, "/guice/listbuckets.s3");
InputStream i = gurl.openStream(); InputStream i = gurl.openStream();
String string = IOUtils.toString(i); String string = IOUtils.toString(i);
assert string.indexOf("List") >= 0 : string; assert string.indexOf("List") >= 0 : string;
} }
} }

View File

@ -23,53 +23,48 @@
*/ */
package org.jclouds.samples.googleappengine.functest; package org.jclouds.samples.googleappengine.functest;
import java.io.FileNotFoundException; import com.google.appengine.tools.KickStart;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.io.File;
import java.util.Properties; import java.util.Properties;
import org.testng.annotations.AfterTest;
import com.google.appengine.tools.KickStart;
/** /**
* Basic functionality to start a local google app engine instance. * Basic functionality to start a local google app engine instance.
* *
* @author Adrian Cole * @author Adrian Cole
*
*/ */
public abstract class BaseGoogleAppEngineTest { public class GoogleDevServer {
Thread server; Thread server;
URL url;
protected void writePropertiesAndStartServer(final String address, public void writePropertiesAndStartServer(final String address,
final String port, final String warfile, Properties props) final String port, final String warfile, Properties props)
throws IOException, FileNotFoundException, InterruptedException { throws IOException, InterruptedException {
url = new URL(String.format("http://%1$s:%2$s", address, port)); 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});
props.store(new FileOutputStream(String.format( }
"%1$s/WEB-INF/jclouds.properties", warfile)), "test");
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 });
} });
server.start();
}); Thread.sleep(10 * 1000);
server.start();
Thread.sleep(7 * 1000);
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@AfterTest public void stop() throws Exception {
public void stopDevAppServer() throws Exception { server.stop();
server.stop();
} }
} }

View File

@ -50,18 +50,18 @@
<dependency> <dependency>
<groupId>com.google.appengine</groupId> <groupId>com.google.appengine</groupId>
<artifactId>appengine-api</artifactId> <artifactId>appengine-api</artifactId>
<version>1.2.0</version> <version>1.2.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.appengine</groupId> <groupId>com.google.appengine</groupId>
<artifactId>appengine-api-stubs</artifactId> <artifactId>appengine-api-stubs</artifactId>
<version>1.2.0</version> <version>1.2.1</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.appengine</groupId> <groupId>com.google.appengine</groupId>
<artifactId>appengine-local-runtime</artifactId> <artifactId>appengine-local-runtime</artifactId>
<version>1.2.0</version> <version>1.2.1</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>