maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcconn...@apache.org
Subject svn commit: r673828 - in /maven/sandbox/trunk/mercury: ./ src/main/java/org/apache/maven/mercury/spi/http/client/deploy/ src/test/java/org/apache/maven/mercury/spi/http/client/ src/test/java/org/apache/maven/mercury/spi/http/server/ src/test/resources/...
Date Thu, 03 Jul 2008 21:47:08 GMT
Author: jmcconnell
Date: Thu Jul  3 14:47:07 2008
New Revision: 673828

URL: http://svn.apache.org/viewvc?rev=673828&view=rev
Log:
enable webdav support, enable ssl support, add test put server and associated test deployer,
which dependency on jetty-client to 7.0-SNAPSHOT

Added:
    maven/sandbox/trunk/mercury/src/test/java/org/apache/maven/mercury/spi/http/client/SecureJettyDeployerTest.java
    maven/sandbox/trunk/mercury/src/test/java/org/apache/maven/mercury/spi/http/server/SecurePutServer.java
    maven/sandbox/trunk/mercury/src/test/resources/secureServer/
    maven/sandbox/trunk/mercury/src/test/resources/secureServer/keystore   (with props)
    maven/sandbox/trunk/mercury/src/test/resources/secureServer/realm.properties
Modified:
    maven/sandbox/trunk/mercury/pom.xml
    maven/sandbox/trunk/mercury/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DefaultDeployer.java
    maven/sandbox/trunk/mercury/src/test/java/org/apache/maven/mercury/spi/http/client/JettyDeployerTest.java
    maven/sandbox/trunk/mercury/src/test/java/org/apache/maven/mercury/spi/http/server/SimplePutServer.java

Modified: maven/sandbox/trunk/mercury/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mercury/pom.xml?rev=673828&r1=673827&r2=673828&view=diff
==============================================================================
--- maven/sandbox/trunk/mercury/pom.xml (original)
+++ maven/sandbox/trunk/mercury/pom.xml Thu Jul  3 14:47:07 2008
@@ -103,12 +103,12 @@
     <dependency>
       <groupId>org.mortbay.jetty</groupId>
       <artifactId>jetty-client</artifactId>
-      <version>7.0.0pre0</version>
+      <version>7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.mortbay.jetty</groupId>
       <artifactId>jetty-servlet</artifactId>
-      <version>7.0.0pre0</version>
+      <version>7.0.0pre2</version>
     </dependency>
     <dependency>
       <groupId>org.codehaus.plexus</groupId>

Modified: maven/sandbox/trunk/mercury/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DefaultDeployer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mercury/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DefaultDeployer.java?rev=673828&r1=673827&r2=673828&view=diff
==============================================================================
--- maven/sandbox/trunk/mercury/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DefaultDeployer.java
(original)
+++ maven/sandbox/trunk/mercury/src/main/java/org/apache/maven/mercury/spi/http/client/deploy/DefaultDeployer.java
Thu Jul  3 14:47:07 2008
@@ -51,6 +51,7 @@
         _idGenerator = new RandomBatchIdGenerator();
         _httpClient = new HttpClient();
         _httpClient.setConnectorType( HttpClient.CONNECTOR_SELECT_CHANNEL );
+        _httpClient.registerListener( "org.mortbay.jetty.client.webdav.WebdavListener");
         try
         {
             _httpClient.start();

Modified: maven/sandbox/trunk/mercury/src/test/java/org/apache/maven/mercury/spi/http/client/JettyDeployerTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mercury/src/test/java/org/apache/maven/mercury/spi/http/client/JettyDeployerTest.java?rev=673828&r1=673827&r2=673828&view=diff
==============================================================================
--- maven/sandbox/trunk/mercury/src/test/java/org/apache/maven/mercury/spi/http/client/JettyDeployerTest.java
(original)
+++ maven/sandbox/trunk/mercury/src/test/java/org/apache/maven/mercury/spi/http/client/JettyDeployerTest.java
Thu Jul  3 14:47:07 2008
@@ -26,8 +26,10 @@
 import org.apache.maven.mercury.spi.http.client.deploy.DefaultDeployer;
 import org.apache.maven.mercury.spi.http.client.deploy.DeployRequest;
 import org.apache.maven.mercury.spi.http.client.deploy.DeployResponse;
+import org.apache.maven.mercury.spi.http.server.SecurePutServer;
 import org.apache.maven.mercury.spi.http.server.SimplePutServer;
 import org.apache.maven.mercury.spi.http.validate.Validator;
+import org.mortbay.jetty.Server;
 import org.mortbay.util.IO;
 
 import java.io.File;
@@ -41,11 +43,11 @@
 
 public class JettyDeployerTest extends TestCase
 {
-    public static final String __HOST_FRAGMENT = "http://localhost:";
+    public String _HOST_FRAGMENT = "http://localhost:";
     public static final String __PATH_FRAGMENT = "/maven2/repo/";
-    private DefaultDeployer _deployer;
-    private SimplePutServer _putServer;
-    private String _port;
+    protected DefaultDeployer _deployer;
+    protected SimplePutServer _putServer;
+    protected String _port;
     File _baseDir;
     File _file0;
     File _file1;
@@ -137,19 +139,19 @@
         _file4 = new File(_baseDir, "file4.so");
         _file5 = new File(_baseDir, "file5.jpg");
         
-        _binding0.setRemoteUrl(__HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file0.txt");
+        _binding0.setRemoteUrl(_HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file0.txt");
         _binding0.setLocalFile(_file0);
         bindings.add(_binding0);
       
-        _binding3.setRemoteUrl(__HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file3.jar");
+        _binding3.setRemoteUrl(_HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file3.jar");
         _binding3.setLocalFile(_file3);
         bindings.add(_binding3);
         
-        _binding4.setRemoteUrl(__HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file4.so");
+        _binding4.setRemoteUrl(_HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file4.so");
         _binding4.setLocalFile(_file4);
         bindings.add(_binding4);
        
-        _binding5.setRemoteUrl(__HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file5.jpg");
+        _binding5.setRemoteUrl(_HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file5.jpg");
         _binding5.setLocalFile(_file5);
         bindings.add(_binding5);
           
@@ -194,24 +196,24 @@
         _file4 = new File(_baseDir, "file4.so");
         _file5 = new File(_baseDir, "file5.jpg");
         
-        _binding0.setRemoteUrl(__HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file0.txt");
+        _binding0.setRemoteUrl(_HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file0.txt");
         _binding0.setLocalFile(_file0);
         bindings.add(_binding0);
         
-        _binding1.setRemoteUrl(__HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file1.txt"); //has
no sha file
+        _binding1.setRemoteUrl(_HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file1.txt"); //has no
sha file
         _binding1.setLocalFile(_file1);
         _binding1.setLenientChecksum(true);
         bindings.add(_binding1);
       
-        _binding3.setRemoteUrl(__HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file3.jar");
+        _binding3.setRemoteUrl(_HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file3.jar");
         _binding3.setLocalFile(_file3);
         bindings.add(_binding3);
         
-        _binding4.setRemoteUrl(__HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file4.so");
+        _binding4.setRemoteUrl(_HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file4.so");
         _binding4.setLocalFile(_file4);
         bindings.add(_binding4);
        
-        _binding5.setRemoteUrl(__HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file5.jpg");
+        _binding5.setRemoteUrl(_HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file5.jpg");
         _binding5.setLocalFile(_file5);
         bindings.add(_binding5);
           
@@ -264,29 +266,29 @@
         File file6 = new File(_baseDir, "file6.txt");//doesn't exist
         File file7 = new File(_baseDir, "file7.txt");//doesn't exist
         
-        _binding0.setRemoteUrl(__HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file0.txt");
+        _binding0.setRemoteUrl(_HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file0.txt");
         _binding0.setLocalFile(_file0);
         bindings.add(_binding0);
 
-        _binding3.setRemoteUrl(__HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file3.jar");
+        _binding3.setRemoteUrl(_HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file3.jar");
         _binding3.setLocalFile(_file3);
         bindings.add(_binding3);
 
-        _binding4.setRemoteUrl(__HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file4.so");
+        _binding4.setRemoteUrl(_HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file4.so");
         _binding4.setLocalFile(_file4);
         bindings.add(_binding4);
 
-        _binding5.setRemoteUrl(__HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file5.jpg");
+        _binding5.setRemoteUrl(_HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file5.jpg");
         _binding5.setLocalFile(_file5);
         bindings.add(_binding5);
 
         Binding binding6 = new Binding();
-        binding6.setRemoteUrl(__HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file6.txt");
+        binding6.setRemoteUrl(_HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file6.txt");
         binding6.setLocalFile(file6);
         bindings.add(binding6);
         
         Binding binding7 = new Binding();
-        binding6.setRemoteUrl(__HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file7.txt");
+        binding6.setRemoteUrl(_HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file7.txt");
         binding6.setLocalFile(file7);
         bindings.add(binding7);
         
@@ -344,29 +346,29 @@
         File file6 = new File(_baseDir, "file6.txt");//doesn't exist
         File file7 = new File(_baseDir, "file7.txt");//doesn't exist
 
-        _binding0.setRemoteUrl(__HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file0.txt");
+        _binding0.setRemoteUrl(_HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file0.txt");
         _binding0.setLocalFile(_file0);
         bindings.add(_binding0);
 
-        _binding3.setRemoteUrl(__HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file3.jar");
+        _binding3.setRemoteUrl(_HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file3.jar");
         _binding3.setLocalFile(_file3);
         bindings.add(_binding3);
 
-        _binding4.setRemoteUrl(__HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file4.so");
+        _binding4.setRemoteUrl(_HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file4.so");
         _binding4.setLocalFile(_file4);
         bindings.add(_binding4);
 
-        _binding5.setRemoteUrl(__HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file5.jpg");
+        _binding5.setRemoteUrl(_HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file5.jpg");
         _binding5.setLocalFile(_file5);
         bindings.add(_binding5);
 
         Binding binding6 = new Binding();
-        binding6.setRemoteUrl(__HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file6.txt");
+        binding6.setRemoteUrl(_HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file6.txt");
         binding6.setLocalFile(file6);
         bindings.add(binding6);
         
         Binding binding7 = new Binding();
-        binding6.setRemoteUrl(__HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file7.txt");
+        binding6.setRemoteUrl(_HOST_FRAGMENT+_port+__PATH_FRAGMENT+"file7.txt");
         binding6.setLocalFile(file7);
         bindings.add(binding7);
 

Added: maven/sandbox/trunk/mercury/src/test/java/org/apache/maven/mercury/spi/http/client/SecureJettyDeployerTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mercury/src/test/java/org/apache/maven/mercury/spi/http/client/SecureJettyDeployerTest.java?rev=673828&view=auto
==============================================================================
--- maven/sandbox/trunk/mercury/src/test/java/org/apache/maven/mercury/spi/http/client/SecureJettyDeployerTest.java
(added)
+++ maven/sandbox/trunk/mercury/src/test/java/org/apache/maven/mercury/spi/http/client/SecureJettyDeployerTest.java
Thu Jul  3 14:47:07 2008
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding 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 the License.
+ */
+
+package org.apache.maven.mercury.spi.http.client;
+
+import org.apache.maven.mercury.spi.http.client.deploy.DefaultDeployer;
+import org.apache.maven.mercury.spi.http.server.SecurePutServer;
+
+public class SecureJettyDeployerTest extends JettyDeployerTest
+{
+    public SecureJettyDeployerTest() throws Exception
+    {
+        super();
+    }
+    
+    protected void setUp() throws Exception
+    {        
+        _HOST_FRAGMENT = "https://localhost:";
+        
+        _deployer = new DefaultDeployer();
+        _putServer = new SecurePutServer();
+        _putServer.start();
+        _port = String.valueOf(_putServer.getPort());
+        //super.setUp();
+    }
+
+   
+}

Added: maven/sandbox/trunk/mercury/src/test/java/org/apache/maven/mercury/spi/http/server/SecurePutServer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mercury/src/test/java/org/apache/maven/mercury/spi/http/server/SecurePutServer.java?rev=673828&view=auto
==============================================================================
--- maven/sandbox/trunk/mercury/src/test/java/org/apache/maven/mercury/spi/http/server/SecurePutServer.java
(added)
+++ maven/sandbox/trunk/mercury/src/test/java/org/apache/maven/mercury/spi/http/server/SecurePutServer.java
Thu Jul  3 14:47:07 2008
@@ -0,0 +1,94 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding 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 the License.
+ */
+
+package org.apache.maven.mercury.spi.http.server;
+
+import java.io.File;
+
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.Connector;
+import org.mortbay.jetty.handler.DefaultHandler;
+import org.mortbay.jetty.handler.HandlerCollection;
+import org.mortbay.jetty.security.SslSocketConnector;
+import org.mortbay.jetty.servlet.Context;
+import org.mortbay.jetty.servlet.DefaultServlet;
+import org.mortbay.jetty.servlet.FilterHolder;
+import org.mortbay.servlet.PutFilter;
+
+public class SecurePutServer extends SimplePutServer
+{
+    private File _base;
+    
+    public SecurePutServer() throws Exception
+    {       
+        SslSocketConnector connector = new SslSocketConnector();
+        String keystore = System.getProperty("user.dir") + File.separator + "src" + File.separator
+ "test" + File.separator + "resources" + File.separator
+        + "secureServer" + File.separator + "keystore";
+
+        connector.setPort(0);
+        connector.setKeystore(keystore);
+        connector.setPassword("storepwd");
+        connector.setKeyPassword("keypwd");
+
+        setConnectors(new Connector[] { connector });        
+        
+        HandlerCollection handlers = new HandlerCollection();
+        setHandler(handlers);
+        
+        Context context = new Context(handlers,"/maven2/repo");
+        handlers.addHandler(new DefaultHandler());
+
+        _base = File.createTempFile("securePutServer",null);
+        _base.delete();
+        _base.mkdir();
+        _base.deleteOnExit();
+        FilterHolder holder = context.addFilter(PutFilter.class, "/*", 0);
+        holder.setInitParameter("delAllowed","true");
+        context.addServlet(DefaultServlet.class,"/");
+        context.setResourceBase(_base.getCanonicalPath());
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.maven.mercury.spi.http.server.PutServer#getPutDir()
+     */
+    public File getPutDir ()
+    {
+        return _base;
+    }
+    
+    public void destroy ()
+    {
+        super.destroy();
+        File[] files = _base.listFiles();
+        for (int i=0;files!=null && i>0; i++)
+        {
+            files[i].delete();
+        }
+        _base.delete();
+    }
+    
+    public static void main(String[] args)
+    throws Exception
+    {
+        SecurePutServer server = new SecurePutServer();
+        server.start();
+        server.join();
+    }
+
+}

Modified: maven/sandbox/trunk/mercury/src/test/java/org/apache/maven/mercury/spi/http/server/SimplePutServer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mercury/src/test/java/org/apache/maven/mercury/spi/http/server/SimplePutServer.java?rev=673828&r1=673827&r2=673828&view=diff
==============================================================================
--- maven/sandbox/trunk/mercury/src/test/java/org/apache/maven/mercury/spi/http/server/SimplePutServer.java
(original)
+++ maven/sandbox/trunk/mercury/src/test/java/org/apache/maven/mercury/spi/http/server/SimplePutServer.java
Thu Jul  3 14:47:07 2008
@@ -65,11 +65,17 @@
         _base.delete();
     }
     
+    /* (non-Javadoc)
+     * @see org.apache.maven.mercury.spi.http.server.PutServer#getPutDir()
+     */
     public File getPutDir ()
     {
         return _base;
     }
 
+    /* (non-Javadoc)
+     * @see org.apache.maven.mercury.spi.http.server.PutServer#getPort()
+     */
     public int getPort()
     {
         return getConnectors()[0].getLocalPort();

Added: maven/sandbox/trunk/mercury/src/test/resources/secureServer/keystore
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mercury/src/test/resources/secureServer/keystore?rev=673828&view=auto
==============================================================================
Binary file - no diff available.

Propchange: maven/sandbox/trunk/mercury/src/test/resources/secureServer/keystore
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: maven/sandbox/trunk/mercury/src/test/resources/secureServer/realm.properties
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mercury/src/test/resources/secureServer/realm.properties?rev=673828&view=auto
==============================================================================
--- maven/sandbox/trunk/mercury/src/test/resources/secureServer/realm.properties (added)
+++ maven/sandbox/trunk/mercury/src/test/resources/secureServer/realm.properties Thu Jul 
3 14:47:07 2008
@@ -0,0 +1,22 @@
+#
+# This file defines users passwords and roles for a HashUserRealm
+#
+# The format is
+#  <username>: <password>[,<rolename> ...]
+#
+# Passwords may be clear text, obfuscated or checksummed.  The class 
+# org.mortbay.util.Password should be used to generate obfuscated
+# passwords or password checksums
+#
+# If DIGEST Authentication is used, the password must be in a recoverable
+# format, either plain text or OBF:.
+#
+# if using digest authentication, do not MD5-hash the password
+jetty: jetty,user
+admin: CRYPT:ad1ks..kc.1Ug,server-administrator,content-administrator,admin
+other: OBF:1xmk1w261u9r1w1c1xmq
+plain: plain
+user: password
+
+# This entry is for digest auth.  The credential is a MD5 hash of username:realmname:password
+digest: MD5:6e120743ad67abfbc385bc2bb754e297



Mime
View raw message