hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cdoug...@apache.org
Subject svn commit: r751995 - in /hadoop/core/branches/branch-0.20: ./ src/contrib/hdfsproxy/ src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/
Date Tue, 10 Mar 2009 06:31:28 GMT
Author: cdouglas
Date: Tue Mar 10 06:31:27 2009
New Revision: 751995

URL: http://svn.apache.org/viewvc?rev=751995&view=rev
Log:
HADOOP-5432. Disable ssl during unit tests in hdfsproxy, as it is unused and causes failures.

Modified:
    hadoop/core/branches/branch-0.20/CHANGES.txt
    hadoop/core/branches/branch-0.20/src/contrib/hdfsproxy/ivy.xml
    hadoop/core/branches/branch-0.20/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/HdfsProxy.java
    hadoop/core/branches/branch-0.20/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyHttpServer.java
    hadoop/core/branches/branch-0.20/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestHdfsProxy.java

Modified: hadoop/core/branches/branch-0.20/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.20/CHANGES.txt?rev=751995&r1=751994&r2=751995&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.20/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.20/CHANGES.txt Tue Mar 10 06:31:27 2009
@@ -684,6 +684,9 @@
     HADOOP-5298. Change TestServletFilter so that it allows a web page to be
     filtered more than once for a single access.  (szetszwo) 
 
+    HADOOP-5432. Disable ssl during unit tests in hdfsproxy, as it is unused
+    and causes failures. (cdouglas)
+
 Release 0.19.2 - Unreleased
 
   BUG FIXES

Modified: hadoop/core/branches/branch-0.20/src/contrib/hdfsproxy/ivy.xml
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.20/src/contrib/hdfsproxy/ivy.xml?rev=751995&r1=751994&r2=751995&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.20/src/contrib/hdfsproxy/ivy.xml (original)
+++ hadoop/core/branches/branch-0.20/src/contrib/hdfsproxy/ivy.xml Tue Mar 10 06:31:27 2009
@@ -22,6 +22,10 @@
     <artifact conf="master"/>
   </publications>
   <dependencies>
+    <dependency org="commons-httpclient"
+      name="commons-httpclient"
+      rev="${commons-httpclient.version}"
+      conf="common->master"/>
     <dependency org="commons-logging"
       name="commons-logging"
       rev="${commons-logging.version}"

Modified: hadoop/core/branches/branch-0.20/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/HdfsProxy.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.20/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/HdfsProxy.java?rev=751995&r1=751994&r2=751995&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.20/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/HdfsProxy.java
(original)
+++ hadoop/core/branches/branch-0.20/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/HdfsProxy.java
Tue Mar 10 06:31:27 2009
@@ -67,8 +67,12 @@
     Configuration sslConf = new Configuration(false);
     sslConf.addResource(conf.get("hdfsproxy.https.server.keystore.resource",
         "ssl-server.xml"));
+    // unit testing
+    sslConf.set("proxy.http.test.listener.addr",
+                conf.get("proxy.http.test.listener.addr"));
+
     this.server = new ProxyHttpServer(sslAddr, sslConf);
-    this.server.setAttribute("proxy.https.port", sslAddr.getPort());
+    this.server.setAttribute("proxy.https.port", server.getPort());
     this.server.setAttribute("name.node.address", nnAddr);
     this.server.setAttribute("name.conf", new Configuration());
     this.server.addGlobalFilter("ProxyFilter", ProxyFilter.class.getName(), null);
@@ -76,14 +80,7 @@
     this.server.addServlet("data", "/data/*", ProxyFileDataServlet.class);
     this.server.addServlet("streamFile", "/streamFile/*", ProxyStreamFile.class);
   }
-  
-  /** add an http listener, only for testing purposes */
-  void setListener(InetSocketAddress addr) throws IOException {
-    this.server.setListener(addr);
-    LOG.warn("An HTTP listener is attached to the proxy server. " +
-    		"It should only be used for testing purposes.");
-  }
-  
+
   /** return the http port if any, only for testing purposes */
   int getPort() throws IOException {
     return server.getPort();

Modified: hadoop/core/branches/branch-0.20/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyHttpServer.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.20/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyHttpServer.java?rev=751995&r1=751994&r2=751995&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.20/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyHttpServer.java
(original)
+++ hadoop/core/branches/branch-0.20/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyHttpServer.java
Tue Mar 10 06:31:27 2009
@@ -28,6 +28,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.http.HttpServer;
+import org.apache.hadoop.net.NetUtils;
 
 import org.mortbay.jetty.Connector;
 import org.mortbay.jetty.nio.SelectChannelConnector;
@@ -47,34 +48,29 @@
   /** {@inheritDoc} */
   protected Connector createBaseListener(Configuration conf)
       throws IOException {
-    SslSocketConnector sslListener = new SslSocketConnector();
-    sslListener.setKeystore(conf.get("ssl.server.keystore.location"));
-    sslListener.setPassword(conf.get("ssl.server.keystore.password", ""));
-    sslListener.setKeyPassword(conf.get("ssl.server.keystore.keypassword", ""));
-    sslListener.setKeystoreType(conf.get("ssl.server.keystore.type", "jks"));
-    sslListener.setNeedClientAuth(true);
-    System.setProperty("javax.net.ssl.trustStore",
-        conf.get("ssl.server.truststore.location", ""));
-    System.setProperty("javax.net.ssl.trustStorePassword",
-        conf.get("ssl.server.truststore.password", ""));
-    System.setProperty("javax.net.ssl.trustStoreType",
-        conf.get("ssl.server.truststore.type", "jks"));
-    return sslListener;
-  }
-
-  /**
-   * Configure an http listener on the server. Intended solely for unit testing.
-   *
-   * @param addr address to listen on
-   */
-  void setListener(InetSocketAddress addr) throws IOException {
-    if (webServer.isStarted()) {
-      throw new IOException("Failed to add listener");
+    final String sAddr;
+    if (null == (sAddr = conf.get("proxy.http.test.listener.addr"))) {
+      SslSocketConnector sslListener = new SslSocketConnector();
+      sslListener.setKeystore(conf.get("ssl.server.keystore.location"));
+      sslListener.setPassword(conf.get("ssl.server.keystore.password", ""));
+      sslListener.setKeyPassword(conf.get("ssl.server.keystore.keypassword", ""));
+      sslListener.setKeystoreType(conf.get("ssl.server.keystore.type", "jks"));
+      sslListener.setNeedClientAuth(true);
+      System.setProperty("javax.net.ssl.trustStore",
+          conf.get("ssl.server.truststore.location", ""));
+      System.setProperty("javax.net.ssl.trustStorePassword",
+          conf.get("ssl.server.truststore.password", ""));
+      System.setProperty("javax.net.ssl.trustStoreType",
+          conf.get("ssl.server.truststore.type", "jks"));
+      return sslListener;
     }
+    // unit test
+    InetSocketAddress proxyAddr = NetUtils.createSocketAddr(sAddr);
     SelectChannelConnector testlistener = new SelectChannelConnector();
     testlistener.setUseDirectBuffers(false);
-    testlistener.setHost(addr.getHostName());
-    testlistener.setPort(addr.getPort());
-    webServer.setConnectors(new Connector[] { testlistener });
+    testlistener.setHost(proxyAddr.getHostName());
+    testlistener.setPort(proxyAddr.getPort());
+    return testlistener;
   }
+
 }

Modified: hadoop/core/branches/branch-0.20/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestHdfsProxy.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.20/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestHdfsProxy.java?rev=751995&r1=751994&r2=751995&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.20/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestHdfsProxy.java
(original)
+++ hadoop/core/branches/branch-0.20/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestHdfsProxy.java
Tue Mar 10 06:31:27 2009
@@ -215,7 +215,7 @@
       final Configuration proxyConf = new Configuration(false);
       proxyConf.set("hdfsproxy.dfs.namenode.address", hdfs.getUri().getHost() + ":"
           + hdfs.getUri().getPort());
-      proxyConf.set("hdfsproxy.https.address", "127.0.0.1:0");
+      proxyConf.set("hdfsproxy.https.address", "localhost:0");
       final String namenode = hdfs.getUri().toString();
       if (namenode.startsWith("hdfs://")) {
         MyFile[] files = createFiles(LOCAL_FS, TEST_ROOT_DIR + "/srcdat");
@@ -226,10 +226,10 @@
         assertTrue("Log directory does not exist.", hdfs.exists(new Path(
             namenode + "/logs")));
 
+        proxyConf.set("proxy.http.test.listener.addr", "localhost:0");
         proxy = new HdfsProxy(proxyConf);
-        InetSocketAddress proxyAddr = NetUtils.createSocketAddr("127.0.0.1:0");
-        proxy.setListener(proxyAddr);
         proxy.start();
+        InetSocketAddress proxyAddr = NetUtils.createSocketAddr("localhost:0");
         final String realProxyAddr = proxyAddr.getHostName() + ":"
             + proxy.getPort();
 



Mime
View raw message