Author: tucu
Date: Wed Aug  8 15:32:06 2012
New Revision: 1370812

URL: http://svn.apache.org/viewvc?rev=1370812&view=rev
Log:
HADOOP-8660. TestPseudoAuthenticator failing with NPE. (tucu)

Modified:
    
hadoop/common/trunk/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java
    hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt

Modified: 
hadoop/common/trunk/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java
URL: 
http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java?rev=1370812&r1=1370811&r2=1370812&view=diff
==============================================================================
--- 
hadoop/common/trunk/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java
 (original)
+++ 
hadoop/common/trunk/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java
 Wed Aug  8 15:32:06 2012
@@ -13,6 +13,7 @@
  */
 package org.apache.hadoop.security.authentication.client;
 
+import junit.framework.Assert;
 import org.apache.hadoop.security.authentication.server.AuthenticationFilter;
 import junit.framework.TestCase;
 import org.mockito.Mockito;
@@ -114,6 +115,18 @@ public abstract class AuthenticatorTestC
     return "http://"; + host + ":" + port + "/foo/bar";
   }
 
+  private static class TestConnectionConfigurator
+      implements ConnectionConfigurator {
+    boolean invoked;
+
+    @Override
+    public HttpURLConnection configure(HttpURLConnection conn)
+        throws IOException {
+      invoked = true;
+      return conn;
+    }
+  }
+
   private String POST = "test";
 
   protected void _testAuthentication(Authenticator authenticator, boolean 
doPost) throws Exception {
@@ -121,11 +134,10 @@ public abstract class AuthenticatorTestC
     try {
       URL url = new URL(getBaseURL());
       AuthenticatedURL.Token token = new AuthenticatedURL.Token();
-      ConnectionConfigurator connConf =
-          Mockito.mock(ConnectionConfigurator.class);
+      TestConnectionConfigurator connConf = new TestConnectionConfigurator();
       AuthenticatedURL aUrl = new AuthenticatedURL(authenticator, connConf);
       HttpURLConnection conn = aUrl.openConnection(url, token);
-      Mockito.verify(connConf).configure(Mockito.<HttpURLConnection>any());
+      Assert.assertTrue(connConf.invoked);
       String tokenStr = token.toString();
       if (doPost) {
         conn.setRequestMethod("POST");

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1370812&r1=1370811&r2=1370812&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt 
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt Wed Aug 
 8 15:32:06 2012
@@ -411,6 +411,8 @@ Branch-2 ( Unreleased changes )
     
     HADOOP-8405. ZKFC tests leak ZK instances. (todd)
 
+    HADOOP-8660. TestPseudoAuthenticator failing with NPE. (tucu)
+
 Release 2.0.0-alpha - 05-23-2012
 
   INCOMPATIBLE CHANGES


Reply via email to