From 221e491f5dae9d207b34a968dcdd1d6968135b14 Mon Sep 17 00:00:00 2001 From: Alejandro Abdelnur Date: Wed, 8 Aug 2012 15:43:26 +0000 Subject: [PATCH] Merge -r 1370811:1370812 from trunk to branch. FIXES: HADOOP-8660 git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1370815 13f79535-47bb-0310-9956-ffa450edef68 --- .../client/AuthenticatorTestCase.java | 18 +++++++++++++++--- .../hadoop-common/CHANGES.txt | 2 ++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java b/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java index c2fa86f0a77..a8641e69e65 100644 --- a/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java +++ b/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java @@ -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 AuthenticatorTestCase extends TestCase { 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 AuthenticatorTestCase extends TestCase { 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.any()); + Assert.assertTrue(connConf.invoked); String tokenStr = token.toString(); if (doPost) { conn.setRequestMethod("POST"); diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index a238d08eb7a..3d1296295f3 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -208,6 +208,8 @@ Release 2.0.1-alpha - UNRELEASED 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