Issue 527:update to official build of jetty

This commit is contained in:
Adrian Cole 2011-04-09 03:18:42 -07:00
parent 35412b828c
commit 95310ba680
12 changed files with 42 additions and 48 deletions

View File

@ -1,6 +1,6 @@
/** /**
* *
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com> * Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
* *
* ==================================================================== * ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -16,7 +16,6 @@
* limitations under the License. * limitations under the License.
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.compute; package org.jclouds.compute;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;

View File

@ -98,8 +98,8 @@
<version>1.0</version> <version>1.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mortbay.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-ssl</artifactId> <artifactId>jetty-security</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -1,6 +1,6 @@
/** /**
* *
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com> * Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
* *
* ==================================================================== * ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -16,7 +16,6 @@
* limitations under the License. * limitations under the License.
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.http; package org.jclouds.http;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
@ -29,9 +28,9 @@ import java.util.concurrent.ExecutionException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.server.Request;
import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule; import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
import org.jclouds.http.handlers.BackoffLimitedRetryHandler; import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
import org.mortbay.jetty.Request;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.inject.Module; import com.google.inject.Module;

View File

@ -1,6 +1,6 @@
/** /**
* *
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com> * Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
* *
* ==================================================================== * ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -16,7 +16,6 @@
* limitations under the License. * limitations under the License.
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.http; package org.jclouds.http;
import static com.google.common.base.Throwables.propagate; import static com.google.common.base.Throwables.propagate;
@ -46,6 +45,12 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.HttpHeaders;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.server.ssl.SslSocketConnector;
import org.jclouds.Constants; import org.jclouds.Constants;
import org.jclouds.crypto.CryptoStreams; import org.jclouds.crypto.CryptoStreams;
import org.jclouds.io.InputSuppliers; import org.jclouds.io.InputSuppliers;
@ -53,12 +58,6 @@ import org.jclouds.rest.RestContext;
import org.jclouds.rest.RestContextBuilder; import org.jclouds.rest.RestContextBuilder;
import org.jclouds.rest.RestContextSpec; import org.jclouds.rest.RestContextSpec;
import org.jclouds.util.Strings2; import org.jclouds.util.Strings2;
import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Handler;
import org.mortbay.jetty.Request;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.handler.AbstractHandler;
import org.mortbay.jetty.ssl.SslSocketConnector;
import org.testng.annotations.AfterTest; import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest; import org.testng.annotations.BeforeTest;
import org.testng.annotations.Optional; import org.testng.annotations.Optional;
@ -87,7 +86,7 @@ public abstract class BaseJettyTest {
static final Pattern actionPattern = Pattern.compile("/objects/(.*)/action/([a-z]*);?(.*)"); static final Pattern actionPattern = Pattern.compile("/objects/(.*)/action/([a-z]*);?(.*)");
@BeforeTest @BeforeTest
@Parameters( { "test-jetty-port" }) @Parameters({ "test-jetty-port" })
public void setUpJetty(@Optional("8123") final int testPort) throws Exception { public void setUpJetty(@Optional("8123") final int testPort) throws Exception {
this.testPort = testPort; this.testPort = testPort;
@ -96,8 +95,8 @@ public abstract class BaseJettyTest {
md5 = CryptoStreams.md5Base64(oneHundredOneConstitutions); md5 = CryptoStreams.md5Base64(oneHundredOneConstitutions);
Handler server1Handler = new AbstractHandler() { Handler server1Handler = new AbstractHandler() {
public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException { throws IOException, ServletException {
if (failIfNoContentLength(request, response)) { if (failIfNoContentLength(request, response)) {
return; return;
} else if (target.indexOf("sleep") > 0) { } else if (target.indexOf("sleep") > 0) {
@ -187,7 +186,7 @@ public abstract class BaseJettyTest {
} }
} else { } else {
for (String header : new String[] { "Content-Disposition", HttpHeaders.CONTENT_LANGUAGE, for (String header : new String[] { "Content-Disposition", HttpHeaders.CONTENT_LANGUAGE,
HttpHeaders.CONTENT_ENCODING }) HttpHeaders.CONTENT_ENCODING })
if (request.getHeader(header) != null) { if (request.getHeader(header) != null) {
response.addHeader("x-" + header, request.getHeader(header)); response.addHeader("x-" + header, request.getHeader(header));
} }
@ -207,8 +206,8 @@ public abstract class BaseJettyTest {
protected void setupAndStartSSLServer(final int testPort) throws Exception { protected void setupAndStartSSLServer(final int testPort) throws Exception {
Handler server2Handler = new AbstractHandler() { Handler server2Handler = new AbstractHandler() {
public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException { throws IOException, ServletException {
if (request.getMethod().equals("PUT")) { if (request.getMethod().equals("PUT")) {
if (request.getContentLength() > 0) { if (request.getContentLength() > 0) {
response.setStatus(HttpServletResponse.SC_OK); response.setStatus(HttpServletResponse.SC_OK);
@ -262,12 +261,12 @@ public abstract class BaseJettyTest {
} }
public static RestContextBuilder<IntegrationTestClient, IntegrationTestAsyncClient> newBuilder(int testPort, public static RestContextBuilder<IntegrationTestClient, IntegrationTestAsyncClient> newBuilder(int testPort,
Properties properties, Module... connectionModules) { Properties properties, Module... connectionModules) {
properties.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true"); properties.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
properties.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true"); properties.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
RestContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec = contextSpec("test", RestContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec = contextSpec("test",
"http://localhost:" + testPort, "1", "", "identity", null, IntegrationTestClient.class, "http://localhost:" + testPort, "1", "", "identity", null, IntegrationTestClient.class,
IntegrationTestAsyncClient.class, ImmutableSet.<Module> copyOf(connectionModules)); IntegrationTestAsyncClient.class, ImmutableSet.<Module> copyOf(connectionModules));
return createContextBuilder(contextSpec, properties); return createContextBuilder(contextSpec, properties);
} }
@ -293,7 +292,7 @@ public abstract class BaseJettyTest {
*/ */
protected boolean failEveryTenRequests(HttpServletRequest request, HttpServletResponse response) throws IOException { protected boolean failEveryTenRequests(HttpServletRequest request, HttpServletResponse response) throws IOException {
if (cycle.incrementAndGet() % 10 == 0) { if (cycle.incrementAndGet() % 10 == 0) {
response.sendError(500); response.sendError(500, "unlucky 10");
((Request) request).setHandled(true); ((Request) request).setHandled(true);
return true; return true;
} }
@ -301,7 +300,7 @@ public abstract class BaseJettyTest {
} }
protected boolean redirectEveryTwentyRequests(HttpServletRequest request, HttpServletResponse response) protected boolean redirectEveryTwentyRequests(HttpServletRequest request, HttpServletResponse response)
throws IOException { throws IOException {
if (cycle.incrementAndGet() % 20 == 0) { if (cycle.incrementAndGet() % 20 == 0) {
response.sendRedirect("http://localhost:" + (testPort + 1) + "/"); response.sendRedirect("http://localhost:" + (testPort + 1) + "/");
((Request) request).setHandled(true); ((Request) request).setHandled(true);
@ -325,7 +324,7 @@ public abstract class BaseJettyTest {
if (realHeaders.get(CONTENT_LENGTH) == null) { if (realHeaders.get(CONTENT_LENGTH) == null) {
response.getWriter().println("no content length!"); response.getWriter().println("no content length!");
response.getWriter().println(realHeaders.toString()); response.getWriter().println(realHeaders.toString());
response.sendError(500); response.sendError(500, "no content length!");
((Request) request).setHandled(true); ((Request) request).setHandled(true);
return true; return true;
} }

View File

@ -1,6 +1,6 @@
/** /**
* *
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com> * Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
* *
* ==================================================================== * ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -16,7 +16,6 @@
* limitations under the License. * limitations under the License.
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.http.functions; package org.jclouds.http.functions;
import static org.easymock.EasyMock.expect; import static org.easymock.EasyMock.expect;
@ -33,11 +32,11 @@ import java.util.concurrent.TimeoutException;
import javax.inject.Provider; import javax.inject.Provider;
import javax.ws.rs.core.UriBuilder; import javax.ws.rs.core.UriBuilder;
import org.eclipse.jetty.http.HttpHeaders;
import org.jclouds.http.HttpResponse; import org.jclouds.http.HttpResponse;
import org.jclouds.io.Payload; import org.jclouds.io.Payload;
import org.jclouds.rest.internal.GeneratedHttpRequest; import org.jclouds.rest.internal.GeneratedHttpRequest;
import org.jclouds.util.Strings2; import org.jclouds.util.Strings2;
import org.mortbay.jetty.HttpHeaders;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.base.Function; import com.google.common.base.Function;

View File

@ -1,6 +1,6 @@
/** /**
* *
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com> * Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
* *
* ==================================================================== * ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -16,13 +16,12 @@
* limitations under the License. * limitations under the License.
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.rest; package org.jclouds.rest;
import static com.google.common.base.Throwables.propagate; import static com.google.common.base.Throwables.propagate;
import static org.easymock.classextension.EasyMock.createMock; import static org.easymock.classextension.EasyMock.createMock;
import static org.jclouds.http.HttpUtils.sortAndConcatHeadersIntoString; import static org.jclouds.http.HttpUtils.sortAndConcatHeadersIntoString;
import static org.mortbay.jetty.HttpHeaders.TRANSFER_ENCODING; import static org.eclipse.jetty.http.HttpHeaders.TRANSFER_ENCODING;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull; import static org.testng.Assert.assertNull;

View File

@ -1,6 +1,6 @@
/** /**
* *
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com> * Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
* *
* ==================================================================== * ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -16,7 +16,6 @@
* limitations under the License. * limitations under the License.
* ==================================================================== * ====================================================================
*/ */
package org.jclouds.rest.internal; package org.jclouds.rest.internal;
import static com.google.common.base.Charsets.UTF_8; import static com.google.common.base.Charsets.UTF_8;
@ -77,6 +76,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder; import javax.ws.rs.core.UriBuilder;
import org.easymock.IArgumentMatcher; import org.easymock.IArgumentMatcher;
import org.eclipse.jetty.http.HttpHeaders;
import org.jclouds.concurrent.Timeout; import org.jclouds.concurrent.Timeout;
import org.jclouds.crypto.Crypto; import org.jclouds.crypto.Crypto;
import org.jclouds.date.DateService; import org.jclouds.date.DateService;
@ -138,7 +138,6 @@ import org.jclouds.rest.binders.BindToJsonPayload;
import org.jclouds.rest.binders.BindToStringPayload; import org.jclouds.rest.binders.BindToStringPayload;
import org.jclouds.rest.config.RestClientModule; import org.jclouds.rest.config.RestClientModule;
import org.jclouds.util.Strings2; import org.jclouds.util.Strings2;
import org.mortbay.jetty.HttpHeaders;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider; import org.testng.annotations.DataProvider;
import org.testng.annotations.Test; import org.testng.annotations.Test;

View File

@ -66,8 +66,8 @@
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mortbay.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-ssl</artifactId> <artifactId>jetty-security</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -74,8 +74,8 @@
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mortbay.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-ssl</artifactId> <artifactId>jetty-security</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -66,8 +66,8 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mortbay.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-ssl</artifactId> <artifactId>jetty-security</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -193,9 +193,9 @@
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.mortbay.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-ssl</artifactId> <artifactId>jetty-security</artifactId>
<version>7.0.0.pre5</version> <version>7.4.0.RC0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.jcraft</groupId> <groupId>com.jcraft</groupId>
@ -208,7 +208,7 @@
<dependency> <dependency>
<groupId>org.testng</groupId> <groupId>org.testng</groupId>
<artifactId>testng</artifactId> <artifactId>testng</artifactId>
<version>5.14.10</version> <version>6.0.1</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -64,8 +64,8 @@
<version>1.6.3</version> <version>1.6.3</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mortbay.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-ssl</artifactId> <artifactId>jetty-security</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>