Author: shv
Date: Tue Jun  5 07:49:47 2012
New Revision: 1346272

URL: http://svn.apache.org/viewvc?rev=1346272&view=rev
Log:
HADOOP-8383. Disable TestKerberosAuthenticator. Contributed by Benoy Antony.

Modified:
    hadoop/common/branches/branch-0.22/common/CHANGES.txt
    
hadoop/common/branches/branch-0.22/common/src/test/core/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java
    
hadoop/common/branches/branch-0.22/common/src/test/core/org/apache/hadoop/security/authentication/client/TestKerberosAuthenticator.java
    
hadoop/common/branches/branch-0.22/common/src/test/core/org/apache/hadoop/security/authentication/client/TestPseudoAuthenticator.java
    
hadoop/common/branches/branch-0.22/common/src/test/core/org/apache/hadoop/security/authentication/server/TestKerberosAuthenticationHandler.java

Modified: hadoop/common/branches/branch-0.22/common/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/common/CHANGES.txt?rev=1346272&r1=1346271&r2=1346272&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.22/common/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.22/common/CHANGES.txt Tue Jun  5 07:49:47 
2012
@@ -47,6 +47,8 @@ Release 0.22.1 - Unreleased
     HADOOP-7115. Add a cache for getpwuid_r and getpwgid_r calls.
     (Devaraj Das and Benoy Antony via shv)
 
+    HADOOP-8383. Disable TestKerberosAuthenticator. (Benoy Antony via shv)
+
 Release 0.22.0 - 2011-11-29
 
   INCOMPATIBLE CHANGES

Modified: 
hadoop/common/branches/branch-0.22/common/src/test/core/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java
URL: 
http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/common/src/test/core/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java?rev=1346272&r1=1346271&r2=1346272&view=diff
==============================================================================
--- 
hadoop/common/branches/branch-0.22/common/src/test/core/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java
 (original)
+++ 
hadoop/common/branches/branch-0.22/common/src/test/core/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java
 Tue Jun  5 07:49:47 2012
@@ -13,18 +13,9 @@
  */
 package org.apache.hadoop.security.authentication.client;
 
-import org.apache.hadoop.security.authentication.server.AuthenticationFilter;
-import junit.framework.TestCase;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.servlet.Context;
-import org.mortbay.jetty.servlet.FilterHolder;
-import org.mortbay.jetty.servlet.ServletHolder;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
 
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
@@ -37,7 +28,19 @@ import java.net.ServerSocket;
 import java.net.URL;
 import java.util.Properties;
 
-public abstract class AuthenticatorTestCase extends TestCase {
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.hadoop.security.authentication.server.AuthenticationFilter;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.servlet.Context;
+import org.mortbay.jetty.servlet.FilterHolder;
+import org.mortbay.jetty.servlet.ServletHolder;
+
+public abstract class AuthenticatorTestCase  {
   private Server server;
   private String host = null;
   private int port = -1;

Modified: 
hadoop/common/branches/branch-0.22/common/src/test/core/org/apache/hadoop/security/authentication/client/TestKerberosAuthenticator.java
URL: 
http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/common/src/test/core/org/apache/hadoop/security/authentication/client/TestKerberosAuthenticator.java?rev=1346272&r1=1346271&r2=1346272&view=diff
==============================================================================
--- 
hadoop/common/branches/branch-0.22/common/src/test/core/org/apache/hadoop/security/authentication/client/TestKerberosAuthenticator.java
 (original)
+++ 
hadoop/common/branches/branch-0.22/common/src/test/core/org/apache/hadoop/security/authentication/client/TestKerberosAuthenticator.java
 Tue Jun  5 07:49:47 2012
@@ -13,17 +13,21 @@
  */
 package org.apache.hadoop.security.authentication.client;
 
-import org.apache.hadoop.security.authentication.KerberosTestUtils;
-import org.apache.hadoop.security.authentication.server.AuthenticationFilter;
-import 
org.apache.hadoop.security.authentication.server.PseudoAuthenticationHandler;
-import 
org.apache.hadoop.security.authentication.server.KerberosAuthenticationHandler;
-import org.junit.Ignore;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.util.Properties;
 import java.util.concurrent.Callable;
 
+import org.apache.hadoop.security.authentication.KerberosTestUtils;
+import org.apache.hadoop.security.authentication.server.AuthenticationFilter;
+import 
org.apache.hadoop.security.authentication.server.KerberosAuthenticationHandler;
+import 
org.apache.hadoop.security.authentication.server.PseudoAuthenticationHandler;
+import org.junit.Ignore;
+import org.junit.Test;
+
 //Disabled because kerberos setup and valid keytabs are required.
 @Ignore("requires kerberos setup")
 public class TestKerberosAuthenticator extends AuthenticatorTestCase {
@@ -37,7 +41,8 @@ public class TestKerberosAuthenticator e
                       "RULE:[1:$1@$0](.*@" + 
KerberosTestUtils.getRealm()+")s/@.*//\n");
     return props;
   }
-
+  
+  @Test
   public void testFallbacktoPseudoAuthenticator() throws Exception {
     Properties props = new Properties();
     props.setProperty(AuthenticationFilter.AUTH_TYPE, "simple");
@@ -45,7 +50,8 @@ public class TestKerberosAuthenticator e
     setAuthenticationHandlerConfig(props);
     _testAuthentication(new KerberosAuthenticator(), false);
   }
-
+  
+  @Test
   public void testNotAuthenticated() throws Exception {
     setAuthenticationHandlerConfig(getAuthenticationHandlerConfiguration());
     start();
@@ -59,8 +65,8 @@ public class TestKerberosAuthenticator e
       stop();
     }
   }
-
-
+  
+  @Test
   public void testAuthentication() throws Exception {
     setAuthenticationHandlerConfig(getAuthenticationHandlerConfiguration());
     KerberosTestUtils.doAsClient(new Callable<Void>() {
@@ -71,7 +77,8 @@ public class TestKerberosAuthenticator e
       }
     });
   }
-
+  
+  @Test
   public void testAuthenticationPost() throws Exception {
     setAuthenticationHandlerConfig(getAuthenticationHandlerConfiguration());
     KerberosTestUtils.doAsClient(new Callable<Void>() {

Modified: 
hadoop/common/branches/branch-0.22/common/src/test/core/org/apache/hadoop/security/authentication/client/TestPseudoAuthenticator.java
URL: 
http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/common/src/test/core/org/apache/hadoop/security/authentication/client/TestPseudoAuthenticator.java?rev=1346272&r1=1346271&r2=1346272&view=diff
==============================================================================
--- 
hadoop/common/branches/branch-0.22/common/src/test/core/org/apache/hadoop/security/authentication/client/TestPseudoAuthenticator.java
 (original)
+++ 
hadoop/common/branches/branch-0.22/common/src/test/core/org/apache/hadoop/security/authentication/client/TestPseudoAuthenticator.java
 Tue Jun  5 07:49:47 2012
@@ -13,13 +13,16 @@
  */
 package org.apache.hadoop.security.authentication.client;
 
-import org.apache.hadoop.security.authentication.server.AuthenticationFilter;
-import 
org.apache.hadoop.security.authentication.server.PseudoAuthenticationHandler;
+import static org.junit.Assert.assertEquals;
 
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.util.Properties;
 
+import org.apache.hadoop.security.authentication.server.AuthenticationFilter;
+import 
org.apache.hadoop.security.authentication.server.PseudoAuthenticationHandler;
+import org.junit.Test;
+
 public class TestPseudoAuthenticator extends AuthenticatorTestCase {
 
   private Properties getAuthenticationHandlerConfiguration(boolean 
anonymousAllowed) {
@@ -28,12 +31,14 @@ public class TestPseudoAuthenticator ext
     props.setProperty(PseudoAuthenticationHandler.ANONYMOUS_ALLOWED, 
Boolean.toString(anonymousAllowed));
     return props;
   }
-
+  
+  @Test
   public void testGetUserName() throws Exception {
     PseudoAuthenticator authenticator = new PseudoAuthenticator();
     assertEquals(System.getProperty("user.name"), authenticator.getUserName());
   }
-
+  
+  @Test
   public void testAnonymousAllowed() throws Exception {
     
setAuthenticationHandlerConfig(getAuthenticationHandlerConfiguration(true));
     start();
@@ -46,7 +51,8 @@ public class TestPseudoAuthenticator ext
       stop();
     }
   }
-
+  
+  @Test
   public void testAnonymousDisallowed() throws Exception {
     
setAuthenticationHandlerConfig(getAuthenticationHandlerConfiguration(false));
     start();
@@ -59,22 +65,26 @@ public class TestPseudoAuthenticator ext
       stop();
     }
   }
-
+  
+  @Test
   public void testAuthenticationAnonymousAllowed() throws Exception {
     
setAuthenticationHandlerConfig(getAuthenticationHandlerConfiguration(true));
     _testAuthentication(new PseudoAuthenticator(), false);
   }
-
+  
+  @Test
   public void testAuthenticationAnonymousDisallowed() throws Exception {
     
setAuthenticationHandlerConfig(getAuthenticationHandlerConfiguration(false));
     _testAuthentication(new PseudoAuthenticator(), false);
   }
-
+  
+  @Test
   public void testAuthenticationAnonymousAllowedWithPost() throws Exception {
     
setAuthenticationHandlerConfig(getAuthenticationHandlerConfiguration(true));
     _testAuthentication(new PseudoAuthenticator(), true);
   }
-
+  
+  @Test
   public void testAuthenticationAnonymousDisallowedWithPost() throws Exception 
{
     
setAuthenticationHandlerConfig(getAuthenticationHandlerConfiguration(false));
     _testAuthentication(new PseudoAuthenticator(), true);

Modified: 
hadoop/common/branches/branch-0.22/common/src/test/core/org/apache/hadoop/security/authentication/server/TestKerberosAuthenticationHandler.java
URL: 
http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/common/src/test/core/org/apache/hadoop/security/authentication/server/TestKerberosAuthenticationHandler.java?rev=1346272&r1=1346271&r2=1346272&view=diff
==============================================================================
--- 
hadoop/common/branches/branch-0.22/common/src/test/core/org/apache/hadoop/security/authentication/server/TestKerberosAuthenticationHandler.java
 (original)
+++ 
hadoop/common/branches/branch-0.22/common/src/test/core/org/apache/hadoop/security/authentication/server/TestKerberosAuthenticationHandler.java
 Tue Jun  5 07:49:47 2012
@@ -13,32 +13,40 @@
  */
 package org.apache.hadoop.security.authentication.server;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.Properties;
+import java.util.concurrent.Callable;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.codec.binary.Base64;
 import org.apache.hadoop.security.authentication.KerberosTestUtils;
 import 
org.apache.hadoop.security.authentication.client.AuthenticationException;
 import org.apache.hadoop.security.authentication.client.KerberosAuthenticator;
-import junit.framework.TestCase;
-import org.apache.commons.codec.binary.Base64;
 import org.ietf.jgss.GSSContext;
 import org.ietf.jgss.GSSManager;
 import org.ietf.jgss.GSSName;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Ignore;
+import org.junit.Test;
 import org.mockito.Mockito;
-import sun.security.jgss.GSSUtil;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.Properties;
-import java.util.concurrent.Callable;
+import sun.security.jgss.GSSUtil;
 
 //Disabled because kerberos setup and valid keytabs are required.
 @Ignore("requires kerberos setup")
-public class TestKerberosAuthenticationHandler extends TestCase {
+public class TestKerberosAuthenticationHandler  {
 
   private KerberosAuthenticationHandler handler;
 
-  @Override
-  protected void setUp() throws Exception {
-    super.setUp();
+  @Before
+  public void setUp() throws Exception {
     handler = new KerberosAuthenticationHandler();
     Properties props = new Properties();
     props.setProperty(KerberosAuthenticationHandler.PRINCIPAL, 
KerberosTestUtils.getServerPrincipal());
@@ -53,25 +61,27 @@ public class TestKerberosAuthenticationH
     }
   }
 
-  @Override
-  protected void tearDown() throws Exception {
+  @After
+  public void tearDown() throws Exception {
     if (handler != null) {
       handler.destroy();
       handler = null;
     }
-    super.tearDown();
   }
-
+  
+  @Test
   public void testInit() throws Exception {
     assertEquals(KerberosTestUtils.getServerPrincipal(), 
handler.getPrincipal());
     assertEquals(KerberosTestUtils.getKeytabFile(), handler.getKeytab());
   }
-
+  
+  @Test
   public void testType() throws Exception {
     KerberosAuthenticationHandler handler = new 
KerberosAuthenticationHandler();
     assertEquals(KerberosAuthenticationHandler.TYPE, handler.getType());
   }
-
+  
+  @Test
   public void testRequestWithoutAuthorization() throws Exception {
     HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
     HttpServletResponse response = Mockito.mock(HttpServletResponse.class);
@@ -80,7 +90,8 @@ public class TestKerberosAuthenticationH
     Mockito.verify(response).setHeader(KerberosAuthenticator.WWW_AUTHENTICATE, 
KerberosAuthenticator.NEGOTIATE);
     Mockito.verify(response).setStatus(HttpServletResponse.SC_UNAUTHORIZED);
   }
-
+  
+  @Test
   public void testRequestWithInvalidAuthorization() throws Exception {
     HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
     HttpServletResponse response = Mockito.mock(HttpServletResponse.class);
@@ -90,7 +101,8 @@ public class TestKerberosAuthenticationH
     Mockito.verify(response).setHeader(KerberosAuthenticator.WWW_AUTHENTICATE, 
KerberosAuthenticator.NEGOTIATE);
     Mockito.verify(response).setStatus(HttpServletResponse.SC_UNAUTHORIZED);
   }
-
+  
+  @Test
   public void testRequestWithIncompleteAuthorization() throws Exception {
     HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
     HttpServletResponse response = Mockito.mock(HttpServletResponse.class);
@@ -107,7 +119,7 @@ public class TestKerberosAuthenticationH
     }
   }
 
-
+  @Test
   public void testRequestWithAuthorization() throws Exception {
     String token = KerberosTestUtils.doAsClient(new Callable<String>() {
       @Override
@@ -157,7 +169,8 @@ public class TestKerberosAuthenticationH
       Mockito.verify(response).setStatus(HttpServletResponse.SC_UNAUTHORIZED);
     }
   }
-
+  
+  @Test
   public void testRequestWithInvalidKerberosAuthorization() throws Exception {
 
     String token = new Base64(0).encodeToString(new byte[]{0, 1, 2});


Reply via email to