maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From micha...@apache.org
Subject [1/5] maven-wagon git commit: [WAGON-474] Upgrade and revise all tests for Jetty 8 [Forced Update!]
Date Thu, 29 Dec 2016 20:28:16 GMT
Repository: maven-wagon
Updated Branches:
  refs/heads/jetty-8 faee1f356 -> 307f8a6db (forced update)


[WAGON-474] Upgrade and revise all tests for Jetty 8

* Upgrade all test code to Jetty 8.1.22 and Servlet 3.0
* Unify variable names in redirect usecases to realServer and
  redirectServer
* RedirectHandler: redirect code is passed but completely ignored because
  sendRedirect() always sends 302
* Chronologically sort checkHandlerResult() calls
** Set redirect code (See Other (303)) as requested
** Update checkHandlerResult() for requested status codes rather sent
   chosen by server (mismatched previously)
* testPreemptiveAuthentication*(): properly check for OK for GET and
  CREATED for PUT instead of OK only for both
* WebDavWagonTest: replace status code literal for
  HttpServletResponse.SC_* for better readability
* testRedirect*(): add more checkHandlerResults
* Fix concurrency issues/race conditions in testSecuredGet() and
  testSecuredGetToStream() where Jetty workers weren't finished yet,
  but assert() has already been started. Waiting for 2000 ms avoids
  this in a cheap manner.
* Fix potential memory leaks from open sockets and Wagons


Project: http://git-wip-us.apache.org/repos/asf/maven-wagon/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-wagon/commit/d79e6639
Tree: http://git-wip-us.apache.org/repos/asf/maven-wagon/tree/d79e6639
Diff: http://git-wip-us.apache.org/repos/asf/maven-wagon/diff/d79e6639

Branch: refs/heads/jetty-8
Commit: d79e66393ff9032a0ba463523ce10f929f2231d7
Parents: b451e41
Author: Michael Osipov <michaelo@apache.org>
Authored: Mon Dec 26 00:55:09 2016 +0100
Committer: Michael Osipov <michaelo@apache.org>
Committed: Thu Dec 29 21:26:44 2016 +0100

----------------------------------------------------------------------
 pom.xml                                         |  14 +-
 wagon-provider-test/pom.xml                     |   8 +-
 .../maven/wagon/http/HttpWagonTestCase.java     | 299 +++++++++++--------
 .../wagon/providers/file/FileWagonTest.java     |  13 +-
 wagon-providers/wagon-http-lightweight/pom.xml  |   4 +-
 .../http/LightweightHttpsWagonTest.java         |   6 +-
 wagon-providers/wagon-http/pom.xml              |   8 +-
 .../http/AbstractHttpClientWagonTest.java       |   2 +
 .../http/HttpWagonHttpServerTestCase.java       |  14 +-
 .../http/HttpWagonReasonPhraseTest.java         |   2 +-
 .../providers/http/HttpWagonTimeoutTest.java    |   4 +-
 .../http/HttpsWagonPreemptiveTest.java          |   6 +-
 .../wagon/providers/http/HttpsWagonTest.java    |   6 +-
 .../providers/http/HugeFileDownloadTest.java    |  20 +-
 wagon-providers/wagon-ssh/pom.xml               |   8 +-
 .../ssh/jsch/ScpWagonWithProxyTest.java         |  23 +-
 wagon-providers/wagon-webdav-jackrabbit/pom.xml |   8 +-
 .../wagon/providers/webdav/WebDavWagonTest.java |  73 +++--
 .../providers/webdav/WebDavsWagonTest.java      |   6 +-
 wagon-tcks/wagon-tck-http/pom.xml               |  12 +-
 .../wagon/tck/http/fixture/ServerFixture.java   |  52 ++--
 21 files changed, 319 insertions(+), 269 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/d79e6639/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e127da4..a90a1ba 100644
--- a/pom.xml
+++ b/pom.xml
@@ -313,14 +313,14 @@ under the License.
       </dependency>
 
       <dependency>
-        <groupId>org.mortbay.jetty</groupId>
-        <artifactId>jetty</artifactId>
-        <version>6.1.26</version>
+        <groupId>org.eclipse.jetty.aggregate</groupId>
+        <artifactId>jetty-all</artifactId>
+        <version>8.1.22.v20160922</version>
       </dependency>
       <dependency>
-        <groupId>org.mortbay.jetty</groupId>
-        <artifactId>servlet-api</artifactId>
-        <version>2.5-20081211</version>
+        <groupId>javax.servlet</groupId>
+        <artifactId>javax.servlet-api</artifactId>
+        <version>3.0.1</version>
     </dependency>
     </dependencies>
   </dependencyManagement>
@@ -565,5 +565,5 @@ under the License.
       </reporting>
     </profile>
   </profiles>
-  
+
 </project>

http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/d79e6639/wagon-provider-test/pom.xml
----------------------------------------------------------------------
diff --git a/wagon-provider-test/pom.xml b/wagon-provider-test/pom.xml
index b19e7ac..9b0f4e5 100644
--- a/wagon-provider-test/pom.xml
+++ b/wagon-provider-test/pom.xml
@@ -51,12 +51,12 @@ under the License.
       <scope>compile</scope>
     </dependency>
     <dependency>
-      <groupId>org.mortbay.jetty</groupId>
-      <artifactId>jetty</artifactId>
+      <groupId>org.eclipse.jetty.aggregate</groupId>
+      <artifactId>jetty-all</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.mortbay.jetty</groupId>
-      <artifactId>servlet-api</artifactId>
+      <groupId>javax.servlet</groupId>
+      <artifactId>javax.servlet-api</artifactId>
     </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>

http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/d79e6639/wagon-provider-test/src/main/java/org/apache/maven/wagon/http/HttpWagonTestCase.java
----------------------------------------------------------------------
diff --git a/wagon-provider-test/src/main/java/org/apache/maven/wagon/http/HttpWagonTestCase.java b/wagon-provider-test/src/main/java/org/apache/maven/wagon/http/HttpWagonTestCase.java
index dfc499e..c19eaa3 100644
--- a/wagon-provider-test/src/main/java/org/apache/maven/wagon/http/HttpWagonTestCase.java
+++ b/wagon-provider-test/src/main/java/org/apache/maven/wagon/http/HttpWagonTestCase.java
@@ -34,20 +34,21 @@ import org.apache.maven.wagon.resource.Resource;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.StringUtils;
-import org.mortbay.jetty.Handler;
-import org.mortbay.jetty.HttpConnection;
-import org.mortbay.jetty.Request;
-import org.mortbay.jetty.Response;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.handler.AbstractHandler;
-import org.mortbay.jetty.handler.HandlerCollection;
-import org.mortbay.jetty.security.Constraint;
-import org.mortbay.jetty.security.ConstraintMapping;
-import org.mortbay.jetty.security.HashUserRealm;
-import org.mortbay.jetty.security.SecurityHandler;
-import org.mortbay.jetty.servlet.Context;
-import org.mortbay.jetty.servlet.DefaultServlet;
-import org.mortbay.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.security.ConstraintMapping;
+import org.eclipse.jetty.security.ConstraintSecurityHandler;
+import org.eclipse.jetty.security.HashLoginService;
+import org.eclipse.jetty.security.SecurityHandler;
+import org.eclipse.jetty.security.authentication.BasicAuthenticator;
+import org.eclipse.jetty.server.Request;
+import org.eclipse.jetty.server.Response;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.handler.AbstractHandler;
+import org.eclipse.jetty.server.handler.HandlerCollection;
+import org.eclipse.jetty.util.security.Constraint;
+import org.eclipse.jetty.util.security.Password;
+import org.eclipse.jetty.servlet.DefaultServlet;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
@@ -99,9 +100,12 @@ public abstract class HttpWagonTestCase
         server = new Server( 0 );
 
         PutHandler putHandler = new PutHandler( repositoryDirectory );
-        server.addHandler( putHandler );
 
-        createContext( server, repositoryDirectory );
+        ServletContextHandler context = createContext( server, repositoryDirectory );
+        HandlerCollection handlers = new HandlerCollection();
+        handlers.addHandler( putHandler );
+        handlers.addHandler( context );
+        server.setHandler( handlers );
 
         addConnectors( server );
 
@@ -120,13 +124,14 @@ public abstract class HttpWagonTestCase
         return server.getConnectors()[0].getLocalPort();
     }
 
-    protected void createContext( Server server, File repositoryDirectory )
+    protected ServletContextHandler createContext( Server server, File repositoryDirectory )
         throws IOException
     {
-        Context root = new Context( server, "/", Context.SESSIONS );
+        ServletContextHandler root = new ServletContextHandler( ServletContextHandler.SESSIONS );
         root.setResourceBase( repositoryDirectory.getAbsolutePath() );
         ServletHolder servletHolder = new ServletHolder( new DefaultServlet() );
         root.addServlet( servletHolder, "/*" );
+        return root;
     }
 
     protected void tearDownWagonTestingFixtures()
@@ -216,7 +221,7 @@ public abstract class HttpWagonTestCase
         server.setHandler( handler );
         addConnectors( server );
         server.start();
-        wagon.connect( new Repository( "id", getProtocol() + "://localhost:" 
+        wagon.connect( new Repository( "id", getProtocol() + "://localhost:"
           + server.getConnectors()[0].getLocalPort() ) );
         wagon.getToStream( "resource", new ByteArrayOutputStream() );
         wagon.disconnect();
@@ -309,19 +314,19 @@ public abstract class HttpWagonTestCase
 
             AbstractHandler handler = new AbstractHandler()
             {
-                public void handle( String s, HttpServletRequest request, HttpServletResponse response, int i )
-                    throws IOException, ServletException
+                public void handle( String target, Request baseRequest, HttpServletRequest request,
+                    HttpServletResponse response ) throws IOException, ServletException
                 {
                     if ( called.get() )
                     {
                         response.setStatus( HttpServletResponse.SC_OK );
-                        ( (Request) request ).setHandled( true );
+                        baseRequest.setHandled( true );
                     }
                     else
                     {
                         called.set( true );
                         response.setStatus( SC_TOO_MANY_REQUESTS );
-                        ( (Request) request ).setHandled( true );
+                        baseRequest.setHandled( true );
 
                     }
                 }
@@ -456,19 +461,19 @@ public abstract class HttpWagonTestCase
 
             AbstractHandler handler = new AbstractHandler()
             {
-                public void handle( String s, HttpServletRequest request, HttpServletResponse response, int i )
-                    throws IOException, ServletException
+                public void handle( String target, Request baseRequest, HttpServletRequest request,
+                    HttpServletResponse response ) throws IOException, ServletException
                 {
                     if ( called.get() )
                     {
                         response.setStatus( HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
-                        ( (Request) request ).setHandled( true );
+                        baseRequest.setHandled( true );
                     }
                     else
                     {
                         called.set( true );
                         response.setStatus( SC_TOO_MANY_REQUESTS );
-                        ( (Request) request ).setHandled( true );
+                        baseRequest.setHandled( true );
                     }
                 }
             };
@@ -543,12 +548,13 @@ public abstract class HttpWagonTestCase
         Server server = new Server( getTestRepositoryPort() );
 
         String localRepositoryPath = FileTestUtils.getTestOutputDir().toString();
-        Context root = new Context( server, "/", Context.SESSIONS );
+        ServletContextHandler root = new ServletContextHandler( ServletContextHandler.SESSIONS );
         root.setResourceBase( localRepositoryPath );
         ServletHolder servletHolder = new ServletHolder( new DefaultServlet() );
         servletHolder.setInitParameter( "gzip", "true" );
         root.addServlet( servletHolder, "/*" );
         addConnectors( server );
+        server.setHandler( root );
         server.start();
 
         try
@@ -655,12 +661,12 @@ public abstract class HttpWagonTestCase
     {
         StreamingWagon wagon = (StreamingWagon) getWagon();
 
-        Server server = new Server( 0 );
+        Server realServer = new Server( 0 );
         TestHeaderHandler handler = new TestHeaderHandler();
 
-        server.setHandler( handler );
-        addConnectors( server );
-        server.start();
+        realServer.setHandler( handler );
+        addConnectors( realServer );
+        realServer.start();
 
         Server redirectServer = new Server( 0 );
 
@@ -679,10 +685,10 @@ public abstract class HttpWagonTestCase
             protocol = "https";
         }
 
-        String redirectUrl = protocol + "://localhost:" + server.getConnectors()[0].getLocalPort();
+        String redirectUrl = protocol + "://localhost:" + realServer.getConnectors()[0].getLocalPort();
 
         RedirectHandler redirectHandler =
-            new RedirectHandler( "Found", HttpServletResponse.SC_SEE_OTHER, redirectUrl, null );
+            new RedirectHandler( "See Other", HttpServletResponse.SC_SEE_OTHER, redirectUrl, null );
 
         redirectServer.setHandler( redirectHandler );
 
@@ -702,14 +708,15 @@ public abstract class HttpWagonTestCase
             String found = FileUtils.fileRead( tmpResult );
             assertEquals( "found:'" + found + "'", "Hello, World!", found );
 
+            checkHandlerResult( redirectHandler.handlerRequestResponses, HttpServletResponse.SC_SEE_OTHER );
             checkHandlerResult( handler.handlerRequestResponses, HttpServletResponse.SC_OK );
-            checkHandlerResult( redirectHandler.handlerRequestResponses, HttpServletResponse.SC_FOUND );
         }
         finally
         {
             wagon.disconnect();
 
-            server.stop();
+            redirectServer.stop();
+            realServer.stop();
 
             tmpResult.delete();
         }
@@ -720,12 +727,12 @@ public abstract class HttpWagonTestCase
     {
         StreamingWagon wagon = (StreamingWagon) getWagon();
 
-        Server server = new Server( 0 );
+        Server realServer = new Server( 0 );
         TestHeaderHandler handler = new TestHeaderHandler();
 
-        server.setHandler( handler );
-        addConnectors( server );
-        server.start();
+        realServer.setHandler( handler );
+        addConnectors( realServer );
+        realServer.start();
 
         Server redirectServer = new Server( 0 );
 
@@ -744,10 +751,10 @@ public abstract class HttpWagonTestCase
             protocol = "https";
         }
 
-        String redirectUrl = protocol + "://localhost:" + server.getConnectors()[0].getLocalPort();
+        String redirectUrl = protocol + "://localhost:" + realServer.getConnectors()[0].getLocalPort();
 
         RedirectHandler redirectHandler =
-            new RedirectHandler( "Found", HttpServletResponse.SC_SEE_OTHER, redirectUrl, null );
+            new RedirectHandler( "See Other", HttpServletResponse.SC_SEE_OTHER, redirectUrl, null );
 
         redirectServer.setHandler( redirectHandler );
 
@@ -763,14 +770,15 @@ public abstract class HttpWagonTestCase
             String found = FileUtils.fileRead( tmpResult );
             assertEquals( "found:'" + found + "'", "Hello, World!", found );
 
+            checkHandlerResult( redirectHandler.handlerRequestResponses, HttpServletResponse.SC_SEE_OTHER );
             checkHandlerResult( handler.handlerRequestResponses, HttpServletResponse.SC_OK );
-            checkHandlerResult( redirectHandler.handlerRequestResponses, HttpServletResponse.SC_FOUND );
         }
         finally
         {
             wagon.disconnect();
 
-            server.stop();
+            redirectServer.stop();
+            realServer.stop();
 
             tmpResult.delete();
         }
@@ -814,7 +822,7 @@ public abstract class HttpWagonTestCase
         String redirectUrl = protocol + "://localhost:" + realServer.getConnectors()[0].getLocalPort();
 
         RedirectHandler redirectHandler =
-            new RedirectHandler( "Found", HttpServletResponse.SC_SEE_OTHER, redirectUrl, repositoryDirectory );
+            new RedirectHandler( "See Other", HttpServletResponse.SC_SEE_OTHER, redirectUrl, repositoryDirectory );
 
         redirectServer.setHandler( redirectHandler );
 
@@ -839,17 +847,17 @@ public abstract class HttpWagonTestCase
             try
             {
                 wagon.putFromStream( fileInputStream, "test-secured-put-resource", content.length(), -1 );
+                assertEquals( content, FileUtils.fileRead( sourceFile.getAbsolutePath() ) );
+
+                checkRequestResponseForRedirectPutWithFullUrl( redirectHandler, putHandler );
             }
             finally
             {
+                wagon.disconnect();
                 fileInputStream.close();
                 tempFile.delete();
-
             }
 
-            assertEquals( content, FileUtils.fileRead( sourceFile.getAbsolutePath() ) );
-
-            checkRequestResponseForRedirectPutFromStreamWithFullUrl( putHandler, redirectHandler );
         }
         finally
         {
@@ -858,11 +866,11 @@ public abstract class HttpWagonTestCase
         }
     }
 
-    protected void checkRequestResponseForRedirectPutFromStreamWithFullUrl( PutHandler putHandler,
-                                                                            RedirectHandler redirectHandler )
+    protected void checkRequestResponseForRedirectPutWithFullUrl( RedirectHandler redirectHandler,
+                                                                  PutHandler putHandler )
     {
+        checkHandlerResult( redirectHandler.handlerRequestResponses, HttpServletResponse.SC_SEE_OTHER );
         checkHandlerResult( putHandler.handlerRequestResponses, HttpServletResponse.SC_CREATED );
-        checkHandlerResult( redirectHandler.handlerRequestResponses, HttpServletResponse.SC_FOUND );
     }
 
     public void testRedirectPutFromStreamRelativeUrl()
@@ -885,7 +893,7 @@ public abstract class HttpWagonTestCase
         addConnectors( redirectServer );
 
         RedirectHandler redirectHandler =
-            new RedirectHandler( "Found", HttpServletResponse.SC_SEE_OTHER, "/redirectRequest/foo",
+            new RedirectHandler( "See Other", HttpServletResponse.SC_SEE_OTHER, "/redirectRequest/foo",
                                  repositoryDirectory );
 
         redirectServer.setHandler( redirectHandler );
@@ -911,18 +919,17 @@ public abstract class HttpWagonTestCase
             try
             {
                 wagon.putFromStream( fileInputStream, "test-secured-put-resource", content.length(), -1 );
+                assertEquals( content, FileUtils.fileRead( sourceFile.getAbsolutePath() ) );
+
+                checkRequestResponseForRedirectPutWithRelativeUrl( redirectHandler, putHandler );
             }
             finally
             {
+                wagon.disconnect();
                 fileInputStream.close();
                 tempFile.delete();
-
             }
 
-            assertEquals( content, FileUtils.fileRead( sourceFile.getAbsolutePath() ) );
-
-            checkRequestResponseForRedirectPutFromStreamWithRelativeUrl( putHandler, redirectHandler );
-
         }
         finally
         {
@@ -931,12 +938,12 @@ public abstract class HttpWagonTestCase
         }
     }
 
-    protected void checkRequestResponseForRedirectPutFromStreamWithRelativeUrl( PutHandler putHandler,
-                                                                                RedirectHandler redirectHandler )
+    protected void checkRequestResponseForRedirectPutWithRelativeUrl( RedirectHandler redirectHandler,
+                                                                      PutHandler putHandler )
     {
-        checkHandlerResult( putHandler.handlerRequestResponses );
-        checkHandlerResult( redirectHandler.handlerRequestResponses, HttpServletResponse.SC_FOUND,
+        checkHandlerResult( redirectHandler.handlerRequestResponses, HttpServletResponse.SC_SEE_OTHER,
                             HttpServletResponse.SC_CREATED );
+        checkHandlerResult( putHandler.handlerRequestResponses );
     }
 
     protected void checkHandlerResult( List<HandlerRequestResponse> handlerRequestResponses,
@@ -994,7 +1001,7 @@ public abstract class HttpWagonTestCase
         String redirectUrl = protocol + "://localhost:" + realServer.getConnectors()[0].getLocalPort();
 
         RedirectHandler redirectHandler =
-            new RedirectHandler( "Found", HttpServletResponse.SC_SEE_OTHER, redirectUrl, repositoryDirectory );
+            new RedirectHandler( "See Other", HttpServletResponse.SC_SEE_OTHER, redirectUrl, repositoryDirectory );
 
         redirectServer.setHandler( redirectHandler );
 
@@ -1018,14 +1025,16 @@ public abstract class HttpWagonTestCase
             try
             {
                 wagon.put( tempFile, "test-secured-put-resource" );
+                assertEquals( content, FileUtils.fileRead( sourceFile.getAbsolutePath() ) );
+
+                checkRequestResponseForRedirectPutWithFullUrl( redirectHandler, putHandler );
             }
             finally
             {
+                wagon.disconnect();
                 tempFile.delete();
             }
 
-            assertEquals( content, FileUtils.fileRead( sourceFile.getAbsolutePath() ) );
-
         }
         finally
         {
@@ -1055,7 +1064,7 @@ public abstract class HttpWagonTestCase
         addConnectors( redirectServer );
 
         RedirectHandler redirectHandler =
-            new RedirectHandler( "Found", HttpServletResponse.SC_SEE_OTHER, "/redirectRequest/foo",
+            new RedirectHandler( "See Other", HttpServletResponse.SC_SEE_OTHER, "/redirectRequest/foo",
                                  repositoryDirectory );
 
         redirectServer.setHandler( redirectHandler );
@@ -1080,14 +1089,16 @@ public abstract class HttpWagonTestCase
             try
             {
                 wagon.put( tempFile, "test-secured-put-resource" );
+                assertEquals( content, FileUtils.fileRead( sourceFile.getAbsolutePath() ) );
+
+                checkRequestResponseForRedirectPutWithRelativeUrl( redirectHandler, putHandler );
             }
             finally
             {
+                wagon.disconnect();
                 tempFile.delete();
             }
 
-            assertEquals( content, FileUtils.fileRead( sourceFile.getAbsolutePath() ) );
-
         }
         finally
         {
@@ -1098,7 +1109,7 @@ public abstract class HttpWagonTestCase
 
 
     /**
-     * 
+     *
      */
     @SuppressWarnings( "checkstyle:visibilitymodifier" )
     public static class RedirectHandler
@@ -1122,23 +1133,28 @@ public abstract class HttpWagonTestCase
             this.repositoryDirectory = repositoryDirectory;
         }
 
-        public void handle( String s, HttpServletRequest req, HttpServletResponse resp, int i )
-            throws IOException, ServletException
+        public void handle( String target, Request baseRequest, HttpServletRequest request,
+            HttpServletResponse response ) throws IOException, ServletException
         {
-            if ( req.getRequestURI().contains( "redirectRequest" ) )
+            if ( request.getRequestURI().contains( "redirectRequest" ) )
             {
                 PutHandler putHandler = new PutHandler( this.repositoryDirectory );
-                putHandler.handle( s, req, resp, i );
+                putHandler.handle( target, baseRequest, request, response );
                 handlerRequestResponses.add(
-                    new HandlerRequestResponse( req.getMethod(), ( (Response) resp ).getStatus(),
-                                                req.getRequestURI() ) );
+                    new HandlerRequestResponse( request.getMethod(), ( (Response) response ).getStatus(),
+                                                request.getRequestURI() ) );
                 return;
             }
-            resp.setStatus( this.retCode );
-            resp.sendRedirect( this.redirectUrl + "/" + req.getRequestURI() );
+            response.setStatus( this.retCode );
+            response.setHeader( "Location", this.redirectUrl + request.getRequestURI() );
+            baseRequest.setHandled( true );
+
             handlerRequestResponses.add(
-                new HandlerRequestResponse( req.getMethod(), ( (Response) resp ).getStatus(), req.getRequestURI() ) );
+                new HandlerRequestResponse( request.getMethod(), ( (Response) response ).getStatus(),
+                                            request.getRequestURI() ) );
         }
+
+
     }
 
 
@@ -1342,7 +1358,17 @@ public abstract class HttpWagonTestCase
 
             assertEquals( "top secret", IOUtil.toString( in ) );
 
-            TestSecurityHandler securityHandler = (TestSecurityHandler) ( (Context) server.getHandler() ).getHandler();
+            /*
+             * We need to wait a bit for all Jetty workers/threads to complete their work. Otherwise
+             * we may suffer from race conditions where handlerRequestResponses list is not completely
+             * populated and its premature iteration in testPreemptiveAuthenticationGet will lead to
+             * a test failure.
+             */
+            // CHECKSTYLE_OFF: MagicNumber
+            Thread.sleep ( 2000L );
+            // CHECKSTYLE_ON: MagicNumber
+
+            TestSecurityHandler securityHandler = server.getChildHandlerByClass( TestSecurityHandler.class );
             testPreemptiveAuthenticationGet( securityHandler, supportPreemptiveAuthenticationGet() );
 
         }
@@ -1393,7 +1419,17 @@ public abstract class HttpWagonTestCase
 
             assertEquals( "top secret", out.toString( "US-ASCII" ) );
 
-            TestSecurityHandler securityHandler = (TestSecurityHandler) ( (Context) server.getHandler() ).getHandler();
+            /*
+             * We need to wait a bit for all Jetty workers/threads to complete their work. Otherwise
+             * we may suffer from race conditions where handlerRequestResponses list is not completely
+             * populated and its premature iteration in testPreemptiveAuthenticationGet will lead to
+             * a test failure.
+             */
+            // CHECKSTYLE_OFF: MagicNumber
+            Thread.sleep ( 2000L );
+            // CHECKSTYLE_ON: MagicNumber
+
+            TestSecurityHandler securityHandler = server.getChildHandlerByClass( TestSecurityHandler.class );
             testPreemptiveAuthenticationGet( securityHandler, supportPreemptiveAuthenticationGet() );
         }
         finally
@@ -1483,10 +1519,10 @@ public abstract class HttpWagonTestCase
 
         SecurityHandler sh = createSecurityHandler();
 
-        Context root = new Context( Context.SESSIONS );
-        root.setContextPath( "/" );
-        root.addHandler( sh );
+        ServletContextHandler root = new ServletContextHandler( ServletContextHandler.SESSIONS
+            | ServletContextHandler.SECURITY );
         root.setResourceBase( localRepositoryPath );
+        root.setSecurityHandler( sh );
         ServletHolder servletHolder = new ServletHolder( new DefaultServlet() );
         root.addServlet( servletHolder, "/*" );
 
@@ -1587,19 +1623,19 @@ public abstract class HttpWagonTestCase
 
             AbstractHandler handler = new AbstractHandler()
             {
-                public void handle( String s, HttpServletRequest request, HttpServletResponse response, int i )
-                    throws IOException, ServletException
+                public void handle( String target, Request baseRequest, HttpServletRequest request,
+                    HttpServletResponse response ) throws IOException, ServletException
                 {
                     if ( called.get() )
                     {
                         response.setStatus( HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
-                        ( (Request) request ).setHandled( true );
+                        baseRequest.setHandled( true );
                     }
                     else
                     {
                         called.set( true );
                         response.setStatus( SC_TOO_MANY_REQUESTS );
-                        ( (Request) request ).setHandled( true );
+                        baseRequest.setHandled( true );
                     }
                 }
             };
@@ -1725,10 +1761,8 @@ public abstract class HttpWagonTestCase
 
         PutHandler putHandler = new PutHandler( new File( localRepositoryPath ) );
 
-        HandlerCollection handlers = new HandlerCollection();
-        handlers.setHandlers( new Handler[]{ sh, putHandler } );
-
-        server.setHandler( handlers );
+        sh.setHandler( putHandler );
+        server.setHandler( sh );
         addConnectors( server );
         server.start();
 
@@ -1796,10 +1830,15 @@ public abstract class HttpWagonTestCase
 
         PutHandler putHandler = new PutHandler( new File( localRepositoryPath ) );
 
-        HandlerCollection handlers = new HandlerCollection();
-        handlers.setHandlers( addSecurityHandler ? new Handler[]{ sh, putHandler } : new Handler[]{ putHandler } );
-
-        server.setHandler( handlers );
+        if ( addSecurityHandler )
+        {
+            sh.setHandler( putHandler );
+            server.setHandler( sh );
+        }
+        else
+        {
+            server.setHandler( putHandler );
+        }
         addConnectors( server );
         server.start();
 
@@ -1871,29 +1910,29 @@ public abstract class HttpWagonTestCase
 
     protected void testPreemptiveAuthenticationGet( TestSecurityHandler sh, boolean preemptive )
     {
-        testPreemptiveAuthentication( sh, preemptive );
+        testPreemptiveAuthentication( sh, preemptive, HttpServletResponse.SC_OK );
     }
 
     protected void testPreemptiveAuthenticationPut( TestSecurityHandler sh, boolean preemptive )
     {
-        testPreemptiveAuthentication( sh, preemptive );
+        testPreemptiveAuthentication( sh, preemptive, HttpServletResponse.SC_CREATED );
     }
 
-    protected void testPreemptiveAuthentication( TestSecurityHandler sh, boolean preemptive )
+    protected void testPreemptiveAuthentication( TestSecurityHandler sh, boolean preemptive, int statusCode )
     {
 
         if ( preemptive )
         {
             assertEquals( "not 1 security handler use " + sh.handlerRequestResponses, 1,
                           sh.handlerRequestResponses.size() );
-            assertEquals( HttpServletResponse.SC_OK, sh.handlerRequestResponses.get( 0 ).responseCode );
+            assertEquals( statusCode, sh.handlerRequestResponses.get( 0 ).responseCode );
         }
         else
         {
             assertEquals( "not 2 security handler use " + sh.handlerRequestResponses, 2,
                           sh.handlerRequestResponses.size() );
             assertEquals( HttpServletResponse.SC_UNAUTHORIZED, sh.handlerRequestResponses.get( 0 ).responseCode );
-            assertEquals( HttpServletResponse.SC_OK, sh.handlerRequestResponses.get( 1 ).responseCode );
+            assertEquals( statusCode, sh.handlerRequestResponses.get( 1 ).responseCode );
 
         }
     }
@@ -1908,13 +1947,13 @@ public abstract class HttpWagonTestCase
             this.status = status;
         }
 
-        public void handle( String target, HttpServletRequest request, HttpServletResponse response, int dispatch )
-            throws IOException, ServletException
+        public void handle( String target, Request baseRequest, HttpServletRequest request,
+            HttpServletResponse response ) throws IOException, ServletException
         {
             if ( status != 0 )
             {
                 response.setStatus( status );
-                ( (Request) request ).setHandled( true );
+                baseRequest.setHandled( true );
             }
         }
     }
@@ -1949,7 +1988,7 @@ public abstract class HttpWagonTestCase
     }
 
     /**
-     * 
+     *
      */
     @SuppressWarnings( "checkstyle:visibilitymodifier" )
     public static class PutHandler
@@ -1968,12 +2007,9 @@ public abstract class HttpWagonTestCase
             this.resourceBase = repositoryDirectory;
         }
 
-        public void handle( String target, HttpServletRequest request, HttpServletResponse response, int dispatch )
-            throws IOException, ServletException
+        public void handle( String target, Request baseRequest, HttpServletRequest request,
+            HttpServletResponse response ) throws IOException, ServletException
         {
-            Request baseRequest =
-                request instanceof Request ? (Request) request : HttpConnection.getCurrentConnection().getRequest();
-
             if ( baseRequest.isHandled() || !"PUT".equals( baseRequest.getMethod() ) )
             {
                 return;
@@ -2023,8 +2059,8 @@ public abstract class HttpWagonTestCase
 
         List<HandlerRequestResponse> handlerRequestResponses = new ArrayList<HandlerRequestResponse>();
 
-        public void handle( String target, HttpServletRequest request, HttpServletResponse response, int dispatch )
-            throws IOException, ServletException
+        public void handle( String target, Request baseRequest, HttpServletRequest request,
+            HttpServletResponse response ) throws IOException, ServletException
         {
             System.out.println( " handle proxy request" );
             if ( request.getHeader( "Proxy-Authorization" ) == null )
@@ -2036,17 +2072,17 @@ public abstract class HttpWagonTestCase
                 response.setStatus( HttpServletResponse.SC_PROXY_AUTHENTICATION_REQUIRED );
                 response.addHeader( "Proxy-Authenticate", "Basic realm=\"Squid proxy-caching web server\"" );
 
-                ( (Request) request ).setHandled( true );
+                baseRequest.setHandled( true );
                 return;
             }
             handlerRequestResponses.add(
                 new HandlerRequestResponse( request.getMethod(), HttpServletResponse.SC_OK, request.getRequestURI() ) );
-            super.handle( target, request, response, dispatch );
+            super.handle( target, baseRequest, request, response );
         }
     }
 
     /**
-     * 
+     *
      */
     @SuppressWarnings( "checkstyle:visibilitymodifier" )
     private static class TestHeaderHandler
@@ -2060,14 +2096,14 @@ public abstract class HttpWagonTestCase
         {
         }
 
-        public void handle( String target, HttpServletRequest request, HttpServletResponse response, int dispatch )
-            throws IOException, ServletException
+        public void handle( String target, Request baseRrequest, HttpServletRequest request,
+            HttpServletResponse response ) throws IOException, ServletException
         {
             headers = new HashMap<String, String>();
-            for ( Enumeration<String> e = request.getHeaderNames(); e.hasMoreElements(); )
+            for ( Enumeration<String> e = baseRrequest.getHeaderNames(); e.hasMoreElements(); )
             {
                 String name = e.nextElement();
-                Enumeration headerValues = request.getHeaders( name );
+                Enumeration headerValues = baseRrequest.getHeaders( name );
                 // as per HTTP spec http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html
                 // multiple values for the same header key are concatenated separated by comma
                 // otherwise we wouldn't notice headers with same key added multiple times
@@ -2088,10 +2124,10 @@ public abstract class HttpWagonTestCase
             response.getWriter().print( "Hello, World!" );
 
             handlerRequestResponses.add(
-                new HandlerRequestResponse( request.getMethod(), ( (Response) response ).getStatus(),
-                                            request.getRequestURI() ) );
+                new HandlerRequestResponse( baseRrequest.getMethod(), ( (Response) response ).getStatus(),
+                                            baseRrequest.getRequestURI() ) );
 
-            ( (Request) request ).setHandled( true );
+            baseRrequest.setHandled( true );
         }
 
     }
@@ -2108,39 +2144,38 @@ public abstract class HttpWagonTestCase
         cm.setPathSpec( "/*" );
 
         TestSecurityHandler sh = new TestSecurityHandler();
-        HashUserRealm hashUserRealm = new HashUserRealm( "MyRealm" );
-        hashUserRealm.put( "user", "secret" );
-        hashUserRealm.addUserToRole( "user", "admin" );
-        sh.setUserRealm( hashUserRealm );
+        HashLoginService hashLoginService = new HashLoginService( "MyRealm" );
+        hashLoginService.putUser( "user", new Password( "secret" ), new String[] { "admin" } );
+        sh.setLoginService( hashLoginService );
         sh.setConstraintMappings( new ConstraintMapping[]{ cm } );
+        sh.setAuthenticator ( new BasicAuthenticator() );
         return sh;
     }
 
     /**
-     * 
+     *
      */
     @SuppressWarnings( "checkstyle:visibilitymodifier" )
     public static class TestSecurityHandler
-        extends SecurityHandler
+        extends ConstraintSecurityHandler
     {
 
         public List<HandlerRequestResponse> handlerRequestResponses = new ArrayList<HandlerRequestResponse>();
 
         @Override
-        public void handle( String target, HttpServletRequest request, HttpServletResponse response, int dispatch )
-            throws IOException, ServletException
+        public void handle( String target, Request baseRequest, HttpServletRequest request,
+            HttpServletResponse response ) throws IOException, ServletException
         {
             String method = request.getMethod();
-            super.handle( target, request, response, dispatch );
+            super.handle( target, baseRequest, request, response );
 
             handlerRequestResponses.add(
                 new HandlerRequestResponse( method, ( (Response) response ).getStatus(), request.getRequestURI() ) );
         }
-
     }
 
     /**
-     * 
+     *
      */
     @SuppressWarnings( "checkstyle:visibilitymodifier" )
     public static class HandlerRequestResponse

http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/d79e6639/wagon-providers/wagon-file/src/test/java/org/apache/maven/wagon/providers/file/FileWagonTest.java
----------------------------------------------------------------------
diff --git a/wagon-providers/wagon-file/src/test/java/org/apache/maven/wagon/providers/file/FileWagonTest.java b/wagon-providers/wagon-file/src/test/java/org/apache/maven/wagon/providers/file/FileWagonTest.java
index 6692988..41da7d4 100644
--- a/wagon-providers/wagon-file/src/test/java/org/apache/maven/wagon/providers/file/FileWagonTest.java
+++ b/wagon-providers/wagon-file/src/test/java/org/apache/maven/wagon/providers/file/FileWagonTest.java
@@ -59,7 +59,7 @@ public class FileWagonTest
     /**
      * This test is introduced to allow for null file wagons.
      * Which is used heavily in the maven component ITs.
-     * 
+     *
      * @throws ConnectionException
      * @throws AuthenticationException
      */
@@ -70,28 +70,29 @@ public class FileWagonTest
         resource.setContentLength( 100000 );
         Repository repository = new Repository();
         wagon.connect( repository );
+        wagon.disconnect();
     }
 
     protected long getExpectedLastModifiedOnGet( Repository repository, Resource resource )
     {
         return new File( repository.getBasedir(), resource.getName() ).lastModified();
     }
-    
+
     public void testResourceExists()
         throws Exception
     {
         String url = "file://" + getBasedir();
-        
+
         Wagon wagon = new FileWagon();
         Repository repository = new Repository( "someID", url );
         wagon.connect( repository );
-        
+
         assertTrue( wagon.resourceExists( "target" ) );
         assertTrue( wagon.resourceExists( "target/" ) );
         assertTrue( wagon.resourceExists( "pom.xml" ) );
-        
+
         assertFalse( wagon.resourceExists( "pom.xml/" ) );
-        
+
         wagon.disconnect();
     }
 }

http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/d79e6639/wagon-providers/wagon-http-lightweight/pom.xml
----------------------------------------------------------------------
diff --git a/wagon-providers/wagon-http-lightweight/pom.xml b/wagon-providers/wagon-http-lightweight/pom.xml
index f723004..dd79d17 100644
--- a/wagon-providers/wagon-http-lightweight/pom.xml
+++ b/wagon-providers/wagon-http-lightweight/pom.xml
@@ -60,8 +60,8 @@ under the License.
       <artifactId>junit</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.mortbay.jetty</groupId>
-      <artifactId>jetty</artifactId>
+      <groupId>org.eclipse.jetty.aggregate</groupId>
+      <artifactId>jetty-all</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/d79e6639/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpsWagonTest.java
----------------------------------------------------------------------
diff --git a/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpsWagonTest.java b/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpsWagonTest.java
index 3b532eb..fe30c83 100644
--- a/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpsWagonTest.java
+++ b/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpsWagonTest.java
@@ -19,9 +19,9 @@ package org.apache.maven.wagon.providers.http;
  * under the License.
  */
 
-import org.mortbay.jetty.Connector;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.security.SslSocketConnector;
+import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ssl.SslSocketConnector;
 
 public class LightweightHttpsWagonTest
     extends LightweightHttpWagonTest

http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/d79e6639/wagon-providers/wagon-http/pom.xml
----------------------------------------------------------------------
diff --git a/wagon-providers/wagon-http/pom.xml b/wagon-providers/wagon-http/pom.xml
index 794098d..e32cfcc 100644
--- a/wagon-providers/wagon-http/pom.xml
+++ b/wagon-providers/wagon-http/pom.xml
@@ -77,13 +77,13 @@ under the License.
       <artifactId>junit</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.mortbay.jetty</groupId>
-      <artifactId>jetty</artifactId>
+      <groupId>org.eclipse.jetty.aggregate</groupId>
+      <artifactId>jetty-all</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.mortbay.jetty</groupId>
-      <artifactId>servlet-api</artifactId>
+      <groupId>javax.servlet</groupId>
+      <artifactId>javax.servlet-api</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/d79e6639/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java
----------------------------------------------------------------------
diff --git a/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java b/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java
index c1814f4..15b1f6b 100644
--- a/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java
+++ b/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/AbstractHttpClientWagonTest.java
@@ -47,5 +47,7 @@ public class AbstractHttpClientWagonTest
         inputData.setResource( resource );
 
         wagon.fillInputData( inputData );
+
+        wagon.disconnect();
     }
 }

http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/d79e6639/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonHttpServerTestCase.java
----------------------------------------------------------------------
diff --git a/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonHttpServerTestCase.java b/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonHttpServerTestCase.java
index b5ef1e8..5e7e72b 100644
--- a/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonHttpServerTestCase.java
+++ b/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonHttpServerTestCase.java
@@ -21,9 +21,9 @@ package org.apache.maven.wagon.providers.http;
 
 import org.apache.maven.wagon.Wagon;
 import org.codehaus.plexus.PlexusTestCase;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.handler.ResourceHandler;
-import org.mortbay.jetty.servlet.Context;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.handler.ResourceHandler;
+import org.eclipse.jetty.servlet.ServletContextHandler;
 
 /**
  * User: jdumay Date: 24/01/2008 Time: 18:15:53
@@ -37,7 +37,7 @@ public abstract class HttpWagonHttpServerTestCase
 
     protected ResourceHandler resourceHandler;
 
-    protected Context context;
+    protected ServletContextHandler context;
 
     protected void setUp()
         throws Exception
@@ -45,10 +45,10 @@ public abstract class HttpWagonHttpServerTestCase
         super.setUp();
         server = new Server( httpServerPort );
 
-        context = new Context( server, "/", Context.SESSIONS );
-
+        context = new ServletContextHandler( ServletContextHandler.SESSIONS );
         resourceHandler = new ResourceHandler();
-        server.addHandler( resourceHandler );
+        context.setHandler( resourceHandler );
+        server.setHandler( context );
     }
 
     protected Wagon getWagon()

http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/d79e6639/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonReasonPhraseTest.java
----------------------------------------------------------------------
diff --git a/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonReasonPhraseTest.java b/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonReasonPhraseTest.java
index 32cbf32..484d638 100644
--- a/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonReasonPhraseTest.java
+++ b/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonReasonPhraseTest.java
@@ -24,7 +24,7 @@ import org.apache.maven.wagon.TransferFailedException;
 import org.apache.maven.wagon.Wagon;
 import org.apache.maven.wagon.authorization.AuthorizationException;
 import org.apache.maven.wagon.repository.Repository;
-import org.mortbay.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.servlet.ServletHolder;
 
 import java.io.File;
 

http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/d79e6639/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonTimeoutTest.java
----------------------------------------------------------------------
diff --git a/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonTimeoutTest.java b/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonTimeoutTest.java
index c223f23..5983b4f 100644
--- a/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonTimeoutTest.java
+++ b/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonTimeoutTest.java
@@ -23,7 +23,7 @@ import org.apache.maven.wagon.FileTestUtils;
 import org.apache.maven.wagon.TransferFailedException;
 import org.apache.maven.wagon.Wagon;
 import org.apache.maven.wagon.repository.Repository;
-import org.mortbay.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.servlet.ServletHolder;
 
 import java.io.File;
 import java.util.Random;
@@ -198,6 +198,8 @@ public class HttpWagonTimeoutTest
             wagon.getFileList( "/foobar" );
             long end = System.currentTimeMillis();
 
+            wagon.disconnect();
+
             // validate we have a default time out 60000
             assertTrue( (end - start) >= 500 && (end - start) < 1000 );
 

http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/d79e6639/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpsWagonPreemptiveTest.java
----------------------------------------------------------------------
diff --git a/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpsWagonPreemptiveTest.java b/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpsWagonPreemptiveTest.java
index 396823b..ace5b3c 100644
--- a/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpsWagonPreemptiveTest.java
+++ b/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpsWagonPreemptiveTest.java
@@ -20,9 +20,9 @@ package org.apache.maven.wagon.providers.http;
  */
 
 import org.apache.maven.wagon.Wagon;
-import org.mortbay.jetty.Connector;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.security.SslSocketConnector;
+import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ssl.SslSocketConnector;
 
 public class HttpsWagonPreemptiveTest
     extends HttpWagonTest

http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/d79e6639/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpsWagonTest.java
----------------------------------------------------------------------
diff --git a/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpsWagonTest.java b/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpsWagonTest.java
index c22b3ef..7d0de20 100644
--- a/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpsWagonTest.java
+++ b/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpsWagonTest.java
@@ -19,9 +19,9 @@ package org.apache.maven.wagon.providers.http;
  * under the License.
  */
 
-import org.mortbay.jetty.Connector;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.security.SslSocketConnector;
+import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ssl.SslSocketConnector;
 
 public class HttpsWagonTest
     extends HttpWagonTest

http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/d79e6639/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HugeFileDownloadTest.java
----------------------------------------------------------------------
diff --git a/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HugeFileDownloadTest.java b/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HugeFileDownloadTest.java
index 0b6566d..f460e0b 100644
--- a/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HugeFileDownloadTest.java
+++ b/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HugeFileDownloadTest.java
@@ -24,10 +24,10 @@ import org.apache.maven.wagon.Wagon;
 import org.apache.maven.wagon.observers.Debug;
 import org.apache.maven.wagon.repository.Repository;
 import org.codehaus.plexus.PlexusTestCase;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.servlet.Context;
-import org.mortbay.jetty.servlet.DefaultServlet;
-import org.mortbay.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.servlet.DefaultServlet;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
@@ -61,10 +61,11 @@ public class HugeFileDownloadTest
 
         server = new Server( 0 );
 
-        Context root = new Context( server, "/", Context.SESSIONS );
+        ServletContextHandler root = new ServletContextHandler( ServletContextHandler.SESSIONS );
         root.setResourceBase( new File( getBasedir(), "target" ).getAbsolutePath() );
         ServletHolder servletHolder = new ServletHolder( new DefaultServlet() );
         root.addServlet( servletHolder, "/*" );
+        server.setHandler( root );
 
         server.start();
 
@@ -84,7 +85,7 @@ public class HugeFileDownloadTest
         }
         finally
         {
-            server.start();
+            server.stop();
             dest.delete();
             hugeFile.delete();
         }
@@ -103,7 +104,7 @@ public class HugeFileDownloadTest
 
         server = new Server( 0 );
 
-        Context root = new Context( server, "/", Context.SESSIONS );
+        ServletContextHandler root = new ServletContextHandler( ServletContextHandler.SESSIONS );
         root.setResourceBase( new File( getBasedir(), "target" ).getAbsolutePath() );
         ServletHolder servletHolder = new ServletHolder( new HttpServlet()
         {
@@ -123,6 +124,7 @@ public class HugeFileDownloadTest
             }
         } );
         root.addServlet( servletHolder, "/*" );
+        server.setHandler( root );
 
         server.start();
 
@@ -142,7 +144,7 @@ public class HugeFileDownloadTest
         }
         finally
         {
-            server.start();
+            server.stop();
             dest.delete();
             hugeFile.delete();
         }
@@ -170,7 +172,7 @@ public class HugeFileDownloadTest
         ra.setLength( HUGE_FILE_SIZE + 1 );
         ra.seek( HUGE_FILE_SIZE );
         ra.write( 1 );
-
+        ra.close();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/d79e6639/wagon-providers/wagon-ssh/pom.xml
----------------------------------------------------------------------
diff --git a/wagon-providers/wagon-ssh/pom.xml b/wagon-providers/wagon-ssh/pom.xml
index 2052c6c..1c7a9b6 100644
--- a/wagon-providers/wagon-ssh/pom.xml
+++ b/wagon-providers/wagon-ssh/pom.xml
@@ -68,13 +68,13 @@ under the License.
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.mortbay.jetty</groupId>
-      <artifactId>jetty</artifactId>
+      <groupId>org.eclipse.jetty.aggregate</groupId>
+      <artifactId>jetty-all</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.mortbay.jetty</groupId>
-      <artifactId>servlet-api</artifactId>
+      <groupId>javax.servlet</groupId>
+      <artifactId>javax.servlet-api</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>

http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/d79e6639/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/ScpWagonWithProxyTest.java
----------------------------------------------------------------------
diff --git a/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/ScpWagonWithProxyTest.java b/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/ScpWagonWithProxyTest.java
index 9d5f985..f21a6f5 100644
--- a/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/ScpWagonWithProxyTest.java
+++ b/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/jsch/ScpWagonWithProxyTest.java
@@ -34,10 +34,10 @@ import org.apache.maven.wagon.authentication.AuthenticationException;
 import org.apache.maven.wagon.proxy.ProxyInfo;
 import org.apache.maven.wagon.repository.Repository;
 import org.codehaus.plexus.PlexusTestCase;
-import org.mortbay.jetty.Handler;
-import org.mortbay.jetty.Request;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.handler.AbstractHandler;
+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;
 
 public class ScpWagonWithProxyTest
     extends PlexusTestCase
@@ -50,13 +50,13 @@ public class ScpWagonWithProxyTest
         handled = false;
         Handler handler = new AbstractHandler()
         {
-            public void handle( String target, HttpServletRequest request, HttpServletResponse response, int dispatch )
-                throws IOException, ServletException
+            public void handle( String target, Request baseRequest, HttpServletRequest request,
+                HttpServletResponse response ) throws IOException, ServletException
             {
                 assertEquals( "CONNECT", request.getMethod() );
 
                 handled = true;
-                ( (Request) request ).setHandled( true );
+                baseRequest.setHandled( true );
             }
         };
 
@@ -83,10 +83,8 @@ public class ScpWagonWithProxyTest
         }
         finally
         {
-            if ( server != null )
-            {
-                server.stop();
-            }
+            wagon.disconnect();
+            server.stop();
         }
     }
 
@@ -120,6 +118,7 @@ public class ScpWagonWithProxyTest
         }
         finally
         {
+            wagon.disconnect();
             t.interrupt();
         }
     }
@@ -165,7 +164,7 @@ public class ScpWagonWithProxyTest
                         {
                             continue;
                         }
-                        
+
                         handled = true;
                     }
                     catch ( IOException e )

http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/d79e6639/wagon-providers/wagon-webdav-jackrabbit/pom.xml
----------------------------------------------------------------------
diff --git a/wagon-providers/wagon-webdav-jackrabbit/pom.xml b/wagon-providers/wagon-webdav-jackrabbit/pom.xml
index 016adcb..948fecb 100644
--- a/wagon-providers/wagon-webdav-jackrabbit/pom.xml
+++ b/wagon-providers/wagon-webdav-jackrabbit/pom.xml
@@ -105,8 +105,8 @@ under the License.
       <artifactId>junit</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.mortbay.jetty</groupId>
-      <artifactId>jetty</artifactId>
+      <groupId>org.eclipse.jetty.aggregate</groupId>
+      <artifactId>jetty-all</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -120,7 +120,7 @@ under the License.
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-simple</artifactId>
     </dependency>
- 
+
     <dependency>
       <groupId>biz.aQute</groupId>
       <artifactId>bnd</artifactId>
@@ -164,5 +164,5 @@ under the License.
         </executions>
       </plugin>
     </plugins>
-  </build>  
+  </build>
 </project>

http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/d79e6639/wagon-providers/wagon-webdav-jackrabbit/src/test/java/org/apache/maven/wagon/providers/webdav/WebDavWagonTest.java
----------------------------------------------------------------------
diff --git a/wagon-providers/wagon-webdav-jackrabbit/src/test/java/org/apache/maven/wagon/providers/webdav/WebDavWagonTest.java b/wagon-providers/wagon-webdav-jackrabbit/src/test/java/org/apache/maven/wagon/providers/webdav/WebDavWagonTest.java
index 1bab212..b5ca481 100644
--- a/wagon-providers/wagon-webdav-jackrabbit/src/test/java/org/apache/maven/wagon/providers/webdav/WebDavWagonTest.java
+++ b/wagon-providers/wagon-webdav-jackrabbit/src/test/java/org/apache/maven/wagon/providers/webdav/WebDavWagonTest.java
@@ -6,9 +6,9 @@ package org.apache.maven.wagon.providers.webdav;
  * 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
@@ -25,9 +25,9 @@ import org.apache.maven.wagon.Wagon;
 import org.apache.maven.wagon.http.HttpWagonTestCase;
 import org.apache.maven.wagon.repository.Repository;
 import org.apache.maven.wagon.resource.Resource;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.servlet.Context;
-import org.mortbay.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
 
 import java.io.File;
 import java.io.IOException;
@@ -35,11 +35,13 @@ import java.net.SocketTimeoutException;
 import java.util.List;
 import java.util.Properties;
 
+import javax.servlet.http.HttpServletResponse;
+
 /*
  * WebDAV Wagon Test
- * 
+ *
  * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * 
+ *
  * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
  */
 public class WebDavWagonTest
@@ -56,20 +58,21 @@ public class WebDavWagonTest
         return "dav";
     }
 
-    protected void createContext( Server server, File repositoryDirectory )
+    protected ServletContextHandler createContext( Server server, File repositoryDirectory )
         throws IOException
     {
-        Context dav = new Context( server, "/", Context.SESSIONS );
+        ServletContextHandler dav = new ServletContextHandler( ServletContextHandler.SESSIONS );
         ServletHolder davServletHolder = new ServletHolder( new DAVServlet() );
         davServletHolder.setInitParameter( "rootPath", repositoryDirectory.getAbsolutePath() );
         davServletHolder.setInitParameter( "xmlOnly", "false" );
         dav.addServlet( davServletHolder, "/*" );
+        return dav;
     }
 
     protected long getExpectedLastModifiedOnGet( Repository repository, Resource resource )
     {
         File file = new File( getDavRepository(), resource.getName() );
-        return ( file.lastModified() / 1000 ) * 1000;
+        return ( file.lastModified() / 1000L ) * 1000L;
     }
 
 
@@ -422,14 +425,14 @@ public class WebDavWagonTest
         {
             assertEquals( "testPreemptiveAuthenticationGet preemptive=true: expected 1 request, got "
                 + sh.handlerRequestResponses, 1, sh.handlerRequestResponses.size() );
-            assertEquals( 200, sh.handlerRequestResponses.get( 0 ).responseCode );
+            assertEquals( HttpServletResponse.SC_OK, sh.handlerRequestResponses.get( 0 ).responseCode );
         }
         else
         {
             assertEquals( "testPreemptiveAuthenticationGet preemptive=false: expected 2 requests (401,200), got "
                 + sh.handlerRequestResponses, 2, sh.handlerRequestResponses.size() );
-            assertEquals( 401, sh.handlerRequestResponses.get( 0 ).responseCode );
-            assertEquals( 200, sh.handlerRequestResponses.get( 1 ).responseCode );
+            assertEquals( HttpServletResponse.SC_UNAUTHORIZED, sh.handlerRequestResponses.get( 0 ).responseCode );
+            assertEquals( HttpServletResponse.SC_OK, sh.handlerRequestResponses.get( 1 ).responseCode );
         }
     }
 
@@ -437,64 +440,70 @@ public class WebDavWagonTest
     {
         if ( preemptive )
         {
-            assertEquals( "testPreemptiveAuthenticationPut preemptive=true: expected 2 requests (200,.), got "
+            assertEquals( "testPreemptiveAuthenticationPut preemptive=true: expected 2 requests (200,201), got "
                 + sh.handlerRequestResponses, 2, sh.handlerRequestResponses.size() );
-            assertEquals( 200, sh.handlerRequestResponses.get( 0 ).responseCode );
+            assertEquals( HttpServletResponse.SC_OK, sh.handlerRequestResponses.get( 0 ).responseCode );
+            assertEquals( HttpServletResponse.SC_CREATED, sh.handlerRequestResponses.get( 1 ).responseCode );
         }
         else
         {
-            assertEquals( "testPreemptiveAuthenticationPut preemptive=false: expected 3 requests (401,200,.), got "
+            assertEquals( "testPreemptiveAuthenticationPut preemptive=false: expected 3 requests (401,200,201), got "
                 + sh.handlerRequestResponses, 3, sh.handlerRequestResponses.size() );
-            assertEquals( 401, sh.handlerRequestResponses.get( 0 ).responseCode );
-            assertEquals( 200, sh.handlerRequestResponses.get( 1 ).responseCode );
+            assertEquals( HttpServletResponse.SC_UNAUTHORIZED, sh.handlerRequestResponses.get( 0 ).responseCode );
+            assertEquals( HttpServletResponse.SC_OK, sh.handlerRequestResponses.get( 1 ).responseCode );
+            assertEquals( HttpServletResponse.SC_CREATED, sh.handlerRequestResponses.get( 2 ).responseCode );
         }
     }
 
 
-    @Override
+    /* This method cannot be reasonable used to represend GET and PUT for WebDAV, it would contain too much
+     * duplicate code. Leave as-is, but don't use it.
+     */
     protected void testPreemptiveAuthentication( TestSecurityHandler sh, boolean preemptive )
     {
         if ( preemptive )
         {
             assertEquals( "testPreemptiveAuthentication preemptive=false: expected 2 requests (200,.), got "
                 + sh.handlerRequestResponses, 2, sh.handlerRequestResponses.size() );
-            assertEquals( 200, sh.handlerRequestResponses.get( 0 ).responseCode );
+            assertEquals( HttpServletResponse.SC_OK, sh.handlerRequestResponses.get( 0 ).responseCode );
         }
         else
         {
             assertEquals( "testPreemptiveAuthentication preemptive=false: expected 3 requests (401,200,200), got "
                 + sh.handlerRequestResponses, 3, sh.handlerRequestResponses.size() );
-            assertEquals( 401, sh.handlerRequestResponses.get( 0 ).responseCode );
-            assertEquals( 200, sh.handlerRequestResponses.get( 1 ).responseCode );
-            assertEquals( 200, sh.handlerRequestResponses.get( 2 ).responseCode );
+            assertEquals( HttpServletResponse.SC_UNAUTHORIZED, sh.handlerRequestResponses.get( 0 ).responseCode );
+            assertEquals( HttpServletResponse.SC_OK, sh.handlerRequestResponses.get( 1 ).responseCode );
+            assertEquals( HttpServletResponse.SC_OK, sh.handlerRequestResponses.get( 2 ).responseCode );
 
         }
     }
 
-    protected void checkRequestResponseForRedirectPutFromStreamWithFullUrl( PutHandler putHandler,
-                                                                            RedirectHandler redirectHandler )
+    @Override
+    protected void checkRequestResponseForRedirectPutWithFullUrl( RedirectHandler redirectHandler,
+                                                                  PutHandler putHandler )
     {
         assertEquals( "found:" + putHandler.handlerRequestResponses, 1, putHandler.handlerRequestResponses.size() );
-        assertEquals( "found:" + putHandler.handlerRequestResponses, 201,
+        assertEquals( "found:" + putHandler.handlerRequestResponses, HttpServletResponse.SC_CREATED,
                       putHandler.handlerRequestResponses.get( 0 ).responseCode );
         assertEquals( "found:" + redirectHandler.handlerRequestResponses, 3,
                       redirectHandler.handlerRequestResponses.size() );
-        assertEquals( "found:" + redirectHandler.handlerRequestResponses, 302,
+        assertEquals( "found:" + redirectHandler.handlerRequestResponses, HttpServletResponse.SC_SEE_OTHER,
                       redirectHandler.handlerRequestResponses.get( 0 ).responseCode );
     }
 
-    protected void checkRequestResponseForRedirectPutFromStreamWithRelativeUrl( PutHandler putHandler,
-                                                                                RedirectHandler redirectHandler )
+    @Override
+    protected void checkRequestResponseForRedirectPutWithRelativeUrl( RedirectHandler redirectHandler,
+                                                                      PutHandler putHandler )
     {
         assertEquals( "found:" + putHandler.handlerRequestResponses, 0, putHandler.handlerRequestResponses.size() );
 
         assertEquals( "found:" + redirectHandler.handlerRequestResponses, 4,
                       redirectHandler.handlerRequestResponses.size() );
-        assertEquals( "found:" + redirectHandler.handlerRequestResponses, 302,
+        assertEquals( "found:" + redirectHandler.handlerRequestResponses, HttpServletResponse.SC_SEE_OTHER,
                       redirectHandler.handlerRequestResponses.get( 0 ).responseCode );
-        assertEquals( "found:" + redirectHandler.handlerRequestResponses, 302,
+        assertEquals( "found:" + redirectHandler.handlerRequestResponses, HttpServletResponse.SC_SEE_OTHER,
                       redirectHandler.handlerRequestResponses.get( 1 ).responseCode );
-        assertEquals( "found:" + redirectHandler.handlerRequestResponses, 201,
+        assertEquals( "found:" + redirectHandler.handlerRequestResponses, HttpServletResponse.SC_CREATED,
                       redirectHandler.handlerRequestResponses.get( 3 ).responseCode );
 
     }

http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/d79e6639/wagon-providers/wagon-webdav-jackrabbit/src/test/java/org/apache/maven/wagon/providers/webdav/WebDavsWagonTest.java
----------------------------------------------------------------------
diff --git a/wagon-providers/wagon-webdav-jackrabbit/src/test/java/org/apache/maven/wagon/providers/webdav/WebDavsWagonTest.java b/wagon-providers/wagon-webdav-jackrabbit/src/test/java/org/apache/maven/wagon/providers/webdav/WebDavsWagonTest.java
index ba18510..2ac44d6 100644
--- a/wagon-providers/wagon-webdav-jackrabbit/src/test/java/org/apache/maven/wagon/providers/webdav/WebDavsWagonTest.java
+++ b/wagon-providers/wagon-webdav-jackrabbit/src/test/java/org/apache/maven/wagon/providers/webdav/WebDavsWagonTest.java
@@ -1,8 +1,8 @@
 package org.apache.maven.wagon.providers.webdav;
 
-import org.mortbay.jetty.Connector;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.security.SslSocketConnector;
+import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ssl.SslSocketConnector;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one

http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/d79e6639/wagon-tcks/wagon-tck-http/pom.xml
----------------------------------------------------------------------
diff --git a/wagon-tcks/wagon-tck-http/pom.xml b/wagon-tcks/wagon-tck-http/pom.xml
index c874bbc..16d51e2 100644
--- a/wagon-tcks/wagon-tck-http/pom.xml
+++ b/wagon-tcks/wagon-tck-http/pom.xml
@@ -19,7 +19,7 @@ under the License.
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
-  
+
   <parent>
     <groupId>org.apache.maven.wagon</groupId>
     <artifactId>wagon-tcks</artifactId>
@@ -28,7 +28,7 @@ under the License.
   </parent>
 
   <artifactId>wagon-tck-http</artifactId>
-  
+
   <name>Apache Maven Wagon :: HTTP Test Compatibility Kit</name>
 
   <dependencies>
@@ -43,12 +43,12 @@ under the License.
       <version>2.2.2</version>
     </dependency>
     <dependency>
-      <groupId>org.mortbay.jetty</groupId>
-      <artifactId>jetty</artifactId>
+      <groupId>org.eclipse.jetty.aggregate</groupId>
+      <artifactId>jetty-all</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.mortbay.jetty</groupId>
-      <artifactId>servlet-api</artifactId>
+      <groupId>javax.servlet</groupId>
+      <artifactId>javax.servlet-api</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.maven.wagon</groupId>

http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/d79e6639/wagon-tcks/wagon-tck-http/src/main/java/org/apache/maven/wagon/tck/http/fixture/ServerFixture.java
----------------------------------------------------------------------
diff --git a/wagon-tcks/wagon-tck-http/src/main/java/org/apache/maven/wagon/tck/http/fixture/ServerFixture.java b/wagon-tcks/wagon-tck-http/src/main/java/org/apache/maven/wagon/tck/http/fixture/ServerFixture.java
index 9152e34..063f47b 100644
--- a/wagon-tcks/wagon-tck-http/src/main/java/org/apache/maven/wagon/tck/http/fixture/ServerFixture.java
+++ b/wagon-tcks/wagon-tck-http/src/main/java/org/apache/maven/wagon/tck/http/fixture/ServerFixture.java
@@ -19,23 +19,24 @@ package org.apache.maven.wagon.tck.http.fixture;
  * under the License.
  */
 
-import org.mortbay.jetty.Connector;
-import org.mortbay.jetty.Handler;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.handler.DefaultHandler;
-import org.mortbay.jetty.handler.HandlerCollection;
-import org.mortbay.jetty.nio.SelectChannelConnector;
-import org.mortbay.jetty.security.Constraint;
-import org.mortbay.jetty.security.ConstraintMapping;
-import org.mortbay.jetty.security.HashUserRealm;
-import org.mortbay.jetty.security.SecurityHandler;
-import org.mortbay.jetty.security.SslSocketConnector;
-import org.mortbay.jetty.servlet.AbstractSessionManager;
-import org.mortbay.jetty.servlet.FilterHolder;
-import org.mortbay.jetty.servlet.FilterMapping;
-import org.mortbay.jetty.servlet.ServletHolder;
-import org.mortbay.jetty.servlet.SessionHandler;
-import org.mortbay.jetty.webapp.WebAppContext;
+import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.server.Handler;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.handler.DefaultHandler;
+import org.eclipse.jetty.server.handler.HandlerCollection;
+import org.eclipse.jetty.server.nio.SelectChannelConnector;
+import org.eclipse.jetty.server.session.AbstractSessionManager;
+import org.eclipse.jetty.server.session.SessionHandler;
+import org.eclipse.jetty.security.ConstraintMapping;
+import org.eclipse.jetty.security.ConstraintSecurityHandler;
+import org.eclipse.jetty.security.HashLoginService;
+import org.eclipse.jetty.server.ssl.SslSocketConnector;
+import org.eclipse.jetty.servlet.FilterHolder;
+import org.eclipse.jetty.servlet.FilterMapping;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.util.security.Constraint;
+import org.eclipse.jetty.util.security.Password;
+import org.eclipse.jetty.webapp.WebAppContext;
 
 import javax.servlet.Filter;
 import javax.servlet.Servlet;
@@ -49,7 +50,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * 
+ *
  */
 public class ServerFixture
 {
@@ -69,9 +70,9 @@ public class ServerFixture
 
     private final WebAppContext webappContext;
 
-    private final HashUserRealm securityRealm;
+    private final HashLoginService loginService;
 
-    private final SecurityHandler securityHandler;
+    private final ConstraintSecurityHandler securityHandler;
 
     private int filterCount = 0;
 
@@ -116,11 +117,11 @@ public class ServerFixture
         cm.setConstraint( constraint );
         cm.setPathSpec( "/protected/*" );
 
-        securityHandler = new SecurityHandler();
+        securityHandler = new ConstraintSecurityHandler();
 
-        securityRealm = new HashUserRealm( "Test Server" );
+        loginService = new HashLoginService( "Test Server" );
 
-        securityHandler.setUserRealm( securityRealm );
+        securityHandler.setLoginService( loginService );
         securityHandler.setConstraintMappings( new ConstraintMapping[]{ cm } );
 
         webappContext = new WebAppContext();
@@ -129,7 +130,7 @@ public class ServerFixture
         File base = getResource( SERVER_ROOT_RESOURCE_PATH );
         logger.info( "docroot: " + base );
         webappContext.setWar( base.getAbsolutePath() );
-        webappContext.addHandler( securityHandler );
+        webappContext.setHandler( securityHandler );
 
         SessionHandler sessionHandler = webappContext.getSessionHandler();
         ( (AbstractSessionManager) sessionHandler.getSessionManager() ).setUsingCookies( false );
@@ -161,8 +162,7 @@ public class ServerFixture
 
     public void addUser( final String user, final String password )
     {
-        securityRealm.put( user, password );
-        securityRealm.addUserToRole( user, "allowed" );
+        loginService.putUser( user, new Password( password ), new String[] { "allowed" } );
     }
 
     public Server getServer()


Mime
View raw message