hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1365988 [3/3] - in /hadoop/common/trunk/hadoop-hdfs-project: hadoop-hdfs-httpfs/ hadoop-hdfs-httpfs/dev-support/ hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/client/ hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/...
Date Thu, 26 Jul 2012 13:39:06 GMT
Added: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestJettyHelper.java.orig
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestJettyHelper.java.orig?rev=1365988&view=auto
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestJettyHelper.java.orig
(added)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/test/TestJettyHelper.java.orig
Thu Jul 26 13:39:05 2012
@@ -0,0 +1,118 @@
+/**
+ * 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.hadoop.test;
+
+import java.net.InetAddress;
+import java.net.MalformedURLException;
+import java.net.ServerSocket;
+import java.net.URL;
+
+import org.junit.Test;
+import org.junit.rules.MethodRule;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.Statement;
+import org.mortbay.jetty.Server;
+
+public class TestJettyHelper implements MethodRule {
+
+  @Test
+  public void dummy() {
+  }
+
+  private static ThreadLocal<Server> TEST_SERVLET_TL = new InheritableThreadLocal<Server>();
+
+  @Override
+  public Statement apply(final Statement statement, final FrameworkMethod frameworkMethod,
final Object o) {
+    return new Statement() {
+      @Override
+      public void evaluate() throws Throwable {
+        Server server = null;
+        TestJetty testJetty = frameworkMethod.getAnnotation(TestJetty.class);
+        if (testJetty != null) {
+          server = createJettyServer();
+        }
+        try {
+          TEST_SERVLET_TL.set(server);
+          statement.evaluate();
+        } finally {
+          TEST_SERVLET_TL.remove();
+          if (server != null && server.isRunning()) {
+            try {
+              server.stop();
+            } catch (Exception ex) {
+              throw new RuntimeException("Could not stop embedded servlet container, " +
ex.getMessage(), ex);
+            }
+          }
+        }
+      }
+    };
+  }
+
+  private Server createJettyServer() {
+    try {
+
+      String host = InetAddress.getLocalHost().getHostName();
+      ServerSocket ss = new ServerSocket(0);
+      int port = ss.getLocalPort();
+      ss.close();
+      Server server = new Server(0);
+      server.getConnectors()[0].setHost(host);
+      server.getConnectors()[0].setPort(port);
+      return server;
+    } catch (Exception ex) {
+      throw new RuntimeException("Could not stop embedded servlet container, " + ex.getMessage(),
ex);
+    }
+  }
+
+  /**
+   * Returns a Jetty server ready to be configured and the started. This server
+   * is only available when the test method has been annotated with
+   * {@link TestJetty}. Refer to {@link HTestCase} header for details.
+   * <p/>
+   * Once configured, the Jetty server should be started. The server will be
+   * automatically stopped when the test method ends.
+   *
+   * @return a Jetty server ready to be configured and the started.
+   */
+  public static Server getJettyServer() {
+    Server server = TEST_SERVLET_TL.get();
+    if (server == null) {
+      throw new IllegalStateException("This test does not use @TestJetty");
+    }
+    return server;
+  }
+
+  /**
+   * Returns the base URL (SCHEMA://HOST:PORT) of the test Jetty server
+   * (see {@link #getJettyServer()}) once started.
+   *
+   * @return the base URL (SCHEMA://HOST:PORT) of the test Jetty server.
+   */
+  public static URL getJettyURL() {
+    Server server = TEST_SERVLET_TL.get();
+    if (server == null) {
+      throw new IllegalStateException("This test does not use @TestJetty");
+    }
+    try {
+      return new URL("http://" + server.getConnectors()[0].getHost() + ":" + server.getConnectors()[0].getPort());
+    } catch (MalformedURLException ex) {
+      throw new RuntimeException("It should never happen, " + ex.getMessage(), ex);
+    }
+  }
+
+}

Added: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/resources/krb5.conf
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/resources/krb5.conf?rev=1365988&view=auto
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/resources/krb5.conf
(added)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/resources/krb5.conf
Thu Jul 26 13:39:05 2012
@@ -0,0 +1,28 @@
+#
+# 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.
+#
+[libdefaults]
+	default_realm = ${kerberos.realm}
+	udp_preference_limit = 1
+	extra_addresses = 127.0.0.1
+[realms]
+	${kerberos.realm} = {
+		admin_server = localhost:88
+		kdc = localhost:88
+	}
+[domain_realm]
+	localhost = ${kerberos.realm}

Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1365988&r1=1365987&r2=1365988&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Thu Jul 26 13:39:05 2012
@@ -199,6 +199,8 @@ Branch-2 ( Unreleased changes )
     HDFS-3518. Add a utility method HdfsUtils.isHealthy(uri) for checking if
     the given HDFS is healthy. (szetszwo)
 
+    HDFS-3113. httpfs does not support delegation tokens. (tucu)
+
   IMPROVEMENTS
 
     HDFS-3390. DFSAdmin should print full stack traces of errors when DEBUG



Mime
View raw message