hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1173791 - in /hadoop/common/branches/branch-0.20-security: CHANGES.txt src/test/org/apache/hadoop/security/TestAuthenticationFilter.java
Date Wed, 21 Sep 2011 18:50:18 GMT
Author: atm
Date: Wed Sep 21 18:50:17 2011
New Revision: 1173791

URL: http://svn.apache.org/viewvc?rev=1173791&view=rev
Log:
HADOOP-7666. branch-0.20-security doesn't include o.a.h.security.TestAuthenticationFilter
(atm)

Added:
    hadoop/common/branches/branch-0.20-security/src/test/org/apache/hadoop/security/TestAuthenticationFilter.java
Modified:
    hadoop/common/branches/branch-0.20-security/CHANGES.txt

Modified: hadoop/common/branches/branch-0.20-security/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security/CHANGES.txt?rev=1173791&r1=1173790&r2=1173791&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.20-security/CHANGES.txt Wed Sep 21 18:50:17 2011
@@ -13,6 +13,9 @@ Release 0.20.206.0 - unreleased
     HADOOP-7665. branch-0.20-security doesn't include SPNEGO settings in
                  core-default.xml (atm)
 
+    HADOOP-7666. branch-0.20-security doesn't include
+                 o.a.h.security.TestAuthenticationFilter (atm)
+
   IMPROVEMENTS
 
     MAPREDUCE-2836. Provide option to fail jobs when submitted to

Added: hadoop/common/branches/branch-0.20-security/src/test/org/apache/hadoop/security/TestAuthenticationFilter.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security/src/test/org/apache/hadoop/security/TestAuthenticationFilter.java?rev=1173791&view=auto
==============================================================================
--- hadoop/common/branches/branch-0.20-security/src/test/org/apache/hadoop/security/TestAuthenticationFilter.java
(added)
+++ hadoop/common/branches/branch-0.20-security/src/test/org/apache/hadoop/security/TestAuthenticationFilter.java
Wed Sep 21 18:50:17 2011
@@ -0,0 +1,72 @@
+/**
+ * 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.security;
+
+
+import junit.framework.TestCase;
+import org.apache.hadoop.security.authentication.server.AuthenticationFilter;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.http.FilterContainer;
+import org.mockito.Mockito;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+
+import java.util.Map;
+
+public class TestAuthenticationFilter extends TestCase {
+
+  @SuppressWarnings("unchecked")
+  public void testConfiguration() {
+    Configuration conf = new Configuration();
+    conf.set("hadoop.http.authentication.foo", "bar");
+
+    FilterContainer container = Mockito.mock(FilterContainer.class);
+    Mockito.doAnswer(
+      new Answer() {
+        public Object answer(InvocationOnMock invocationOnMock)
+          throws Throwable {
+          Object[] args = invocationOnMock.getArguments();
+
+          assertEquals("authentication", args[0]);
+
+          assertEquals(AuthenticationFilter.class.getName(), args[1]);
+
+          Map<String, String> conf = (Map<String, String>) args[2];
+          assertEquals("/", conf.get("cookie.path"));
+
+          assertEquals("simple", conf.get("type"));
+          assertEquals("36000", conf.get("token.validity"));
+          assertEquals("hadoop", conf.get("signature.secret"));
+          assertNull(conf.get("cookie.domain"));
+          assertEquals("true", conf.get("simple.anonymous.allowed"));
+          assertEquals("HTTP/localhost@LOCALHOST",
+                       conf.get("kerberos.principal"));
+          assertEquals(System.getProperty("user.home") +
+                       "/hadoop.keytab", conf.get("kerberos.keytab"));
+          assertEquals("bar", conf.get("foo"));
+
+          return null;
+        }
+      }
+    ).when(container).addFilter(Mockito.<String>anyObject(),
+                                Mockito.<String>anyObject(),
+                                Mockito.<Map<String, String>>anyObject());
+
+    new AuthenticationFilterInitializer().initFilter(container, conf);
+  }
+
+}



Mime
View raw message