Author: cdouglas
Date: Tue Mar 10 06:31:08 2009
New Revision: 751994
URL: http://svn.apache.org/viewvc?rev=751994&view=rev
Log:
HADOOP-5432. Disable ssl during unit tests in hdfsproxy, as it is unused and
causes failures.
Modified:
hadoop/core/trunk/CHANGES.txt
hadoop/core/trunk/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/HdfsProxy.java
hadoop/core/trunk/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyHttpServer.java
hadoop/core/trunk/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestHdfsProxy.java
Modified: hadoop/core/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=751994&r1=751993&r2=751994&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Tue Mar 10 06:31:08 2009
@@ -949,6 +949,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/trunk/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/HdfsProxy.java
URL:
http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/HdfsProxy.java?rev=751994&r1=751993&r2=751994&view=diff
==============================================================================
---
hadoop/core/trunk/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/HdfsProxy.java
(original)
+++
hadoop/core/trunk/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/HdfsProxy.java
Tue Mar 10 06:31:08 2009
@@ -60,8 +60,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);
@@ -69,14 +73,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/trunk/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyHttpServer.java
URL:
http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyHttpServer.java?rev=751994&r1=751993&r2=751994&view=diff
==============================================================================
---
hadoop/core/trunk/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyHttpServer.java
(original)
+++
hadoop/core/trunk/src/contrib/hdfsproxy/src/java/org/apache/hadoop/hdfsproxy/ProxyHttpServer.java
Tue Mar 10 06:31:08 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/trunk/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestHdfsProxy.java
URL:
http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestHdfsProxy.java?rev=751994&r1=751993&r2=751994&view=diff
==============================================================================
---
hadoop/core/trunk/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestHdfsProxy.java
(original)
+++
hadoop/core/trunk/src/contrib/hdfsproxy/src/test/org/apache/hadoop/hdfsproxy/TestHdfsProxy.java
Tue Mar 10 06:31:08 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();