mirror of https://github.com/apache/jclouds.git
integration tests for gae
git-svn-id: http://jclouds.googlecode.com/svn/trunk@394 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
31da8c19f2
commit
23b956f894
|
@ -49,8 +49,8 @@ import org.mortbay.jetty.Handler;
|
||||||
import org.mortbay.jetty.Request;
|
import org.mortbay.jetty.Request;
|
||||||
import org.mortbay.jetty.Server;
|
import org.mortbay.jetty.Server;
|
||||||
import org.mortbay.jetty.handler.AbstractHandler;
|
import org.mortbay.jetty.handler.AbstractHandler;
|
||||||
import org.testng.annotations.AfterClass;
|
import org.testng.annotations.AfterTest;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeTest;
|
||||||
import org.testng.annotations.Optional;
|
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;
|
||||||
|
@ -77,7 +77,7 @@ public abstract class BaseHttpFutureCommandClientTest {
|
||||||
protected Injector injector;
|
protected Injector injector;
|
||||||
private Closer closer;
|
private Closer closer;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeTest
|
||||||
@Parameters( { "test-jetty-port" })
|
@Parameters( { "test-jetty-port" })
|
||||||
public void setUpJetty(@Optional("8123") final int testPort)
|
public void setUpJetty(@Optional("8123") final int testPort)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
@ -152,14 +152,14 @@ public abstract class BaseHttpFutureCommandClientTest {
|
||||||
|
|
||||||
protected abstract Module createClientModule();
|
protected abstract Module createClientModule();
|
||||||
|
|
||||||
@AfterClass
|
@AfterTest
|
||||||
public void tearDownJetty() throws Exception {
|
public void tearDownJetty() throws Exception {
|
||||||
closer.close();
|
closer.close();
|
||||||
server.stop();
|
server.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(invocationCount = 500, timeOut = 1500)
|
@Test(invocationCount = 500, timeOut = 1500)
|
||||||
void testRequestFilter() throws MalformedURLException, ExecutionException,
|
public void testRequestFilter() throws MalformedURLException, ExecutionException,
|
||||||
InterruptedException, TimeoutException {
|
InterruptedException, TimeoutException {
|
||||||
GetString get = factory.createGetString("/");
|
GetString get = factory.createGetString("/");
|
||||||
get.getRequest().getHeaders().put("filterme", "filterme");
|
get.getRequest().getHeaders().put("filterme", "filterme");
|
||||||
|
@ -170,7 +170,7 @@ public abstract class BaseHttpFutureCommandClientTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(invocationCount = 500, timeOut = 1500)
|
@Test(invocationCount = 500, timeOut = 1500)
|
||||||
void testGetStringWithHeader() throws MalformedURLException,
|
public void testGetStringWithHeader() throws MalformedURLException,
|
||||||
ExecutionException, InterruptedException, TimeoutException {
|
ExecutionException, InterruptedException, TimeoutException {
|
||||||
GetString get = factory.createGetString("/");
|
GetString get = factory.createGetString("/");
|
||||||
get.getRequest().getHeaders().put("test", "test");
|
get.getRequest().getHeaders().put("test", "test");
|
||||||
|
@ -181,7 +181,7 @@ public abstract class BaseHttpFutureCommandClientTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(invocationCount = 500, timeOut = 1500)
|
@Test(invocationCount = 500, timeOut = 1500)
|
||||||
void testGetString() throws MalformedURLException, ExecutionException,
|
public void testGetString() throws MalformedURLException, ExecutionException,
|
||||||
InterruptedException, TimeoutException {
|
InterruptedException, TimeoutException {
|
||||||
GetString get = factory.createGetString("/");
|
GetString get = factory.createGetString("/");
|
||||||
assert get != null;
|
assert get != null;
|
||||||
|
@ -192,7 +192,7 @@ public abstract class BaseHttpFutureCommandClientTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(invocationCount = 500, timeOut = 1500)
|
@Test(invocationCount = 500, timeOut = 1500)
|
||||||
void testHead() throws MalformedURLException, ExecutionException,
|
public void testHead() throws MalformedURLException, ExecutionException,
|
||||||
InterruptedException, TimeoutException {
|
InterruptedException, TimeoutException {
|
||||||
Head head = factory.createHead("/");
|
Head head = factory.createHead("/");
|
||||||
assert head != null;
|
assert head != null;
|
||||||
|
@ -201,7 +201,7 @@ public abstract class BaseHttpFutureCommandClientTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(invocationCount = 500, timeOut = 1500)
|
@Test(invocationCount = 500, timeOut = 1500)
|
||||||
void testGetAndParseSax() throws MalformedURLException, ExecutionException,
|
public void testGetAndParseSax() throws MalformedURLException, ExecutionException,
|
||||||
InterruptedException, TimeoutException {
|
InterruptedException, TimeoutException {
|
||||||
GetAndParseSax<?> getAndParseSax = factory.createGetAndParseSax("/",
|
GetAndParseSax<?> getAndParseSax = factory.createGetAndParseSax("/",
|
||||||
new ParseSax.HandlerWithResult<String>() {
|
new ParseSax.HandlerWithResult<String>() {
|
||||||
|
|
27
gae/pom.xml
27
gae/pom.xml
|
@ -52,6 +52,18 @@
|
||||||
<artifactId>appengine-api</artifactId>
|
<artifactId>appengine-api</artifactId>
|
||||||
<version>1.2.0</version>
|
<version>1.2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.appengine</groupId>
|
||||||
|
<artifactId>appengine-api-stubs</artifactId>
|
||||||
|
<version>1.2.0</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.appengine</groupId>
|
||||||
|
<artifactId>appengine-local-runtime</artifactId>
|
||||||
|
<version>1.2.0</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>${project.groupId}</groupId>
|
<groupId>${project.groupId}</groupId>
|
||||||
<artifactId>jclouds-core</artifactId>
|
<artifactId>jclouds-core</artifactId>
|
||||||
|
@ -63,6 +75,21 @@
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<type>test-jar</type>
|
<type>test-jar</type>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.mortbay.jetty</groupId>
|
||||||
|
<artifactId>jetty</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.geronimo.specs</groupId>
|
||||||
|
<artifactId>geronimo-servlet_2.5_spec</artifactId>
|
||||||
|
<version>1.2</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -90,12 +90,24 @@ public class URLFetchServiceClient implements HttpFutureCommandClient {
|
||||||
for (HttpRequestFilter filter : getRequestFilters()) {
|
for (HttpRequestFilter filter : getRequestFilters()) {
|
||||||
filter.filter(request);
|
filter.filter(request);
|
||||||
}
|
}
|
||||||
|
HttpResponse response = null;
|
||||||
|
for (;;) {
|
||||||
logger.trace("%1s - converting request %2s", target, request);
|
logger.trace("%1s - converting request %2s", target, request);
|
||||||
HTTPRequest gaeRequest = convert(request);
|
HTTPRequest gaeRequest = convert(request);
|
||||||
logger.trace("%1s - submitting request %2s", target, gaeRequest);
|
logger
|
||||||
|
.trace("%1s - submitting request %2s", target,
|
||||||
|
gaeRequest);
|
||||||
gaeResponse = this.urlFetchService.fetch(gaeRequest);
|
gaeResponse = this.urlFetchService.fetch(gaeRequest);
|
||||||
logger.trace("%1s - received response %2s", target, gaeResponse);
|
logger
|
||||||
HttpResponse response = convert(gaeResponse);
|
.trace("%1s - received response %2s", target,
|
||||||
|
gaeResponse);
|
||||||
|
response = convert(gaeResponse);
|
||||||
|
if (response.getStatusCode() >= 500) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
operation.getResponseFuture().setResponse(response);
|
operation.getResponseFuture().setResponse(response);
|
||||||
operation.getResponseFuture().run();
|
operation.getResponseFuture().run();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<relativePath>../../project/pom.xml</relativePath>
|
<relativePath>../../project/pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>jclouds-samples-googleappengine</artifactId>
|
<artifactId>jclouds-gae-s3-example</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<name>JClouds Sample for Google App Engine</name>
|
<name>JClouds Sample for Google App Engine</name>
|
||||||
<description>JClouds Sample for Google App Engine</description>
|
<description>JClouds Sample for Google App Engine</description>
|
||||||
|
|
|
@ -25,6 +25,6 @@
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
|
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
|
||||||
<application>application-id</application>
|
<application>jclouds-s3-example</application>
|
||||||
<version>1</version>
|
<version>1</version>
|
||||||
</appengine-web-app>
|
</appengine-web-app>
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
"http://java.sun.com/dtd/web-app_2_3.dtd">
|
"http://java.sun.com/dtd/web-app_2_3.dtd">
|
||||||
|
|
||||||
<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">
|
<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">
|
||||||
<display-name>Archetype Created Web Application</display-name>
|
<display-name>jclouds-s3-example</display-name>
|
||||||
|
|
||||||
<!-- Servlets -->
|
<!-- Servlets -->
|
||||||
<filter>
|
<filter>
|
||||||
|
|
Loading…
Reference in New Issue