You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by xi...@apache.org on 2018/02/01 23:33:55 UTC
hadoop git commit: HADOOP-15197. Remove tomcat from the Hadoop-auth
test bundle.
Repository: hadoop
Updated Branches:
refs/heads/trunk dd50f5399 -> 09dd709d6
HADOOP-15197. Remove tomcat from the Hadoop-auth test bundle.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/09dd709d
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/09dd709d
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/09dd709d
Branch: refs/heads/trunk
Commit: 09dd709d6e4022cd68187c4da1483d98ffc7e15a
Parents: dd50f53
Author: Xiao Chen <xi...@apache.org>
Authored: Thu Feb 1 15:33:36 2018 -0800
Committer: Xiao Chen <xi...@apache.org>
Committed: Thu Feb 1 15:33:52 2018 -0800
----------------------------------------------------------------------
hadoop-common-project/hadoop-auth/pom.xml | 10 ----
.../client/AuthenticatorTestCase.java | 51 +-------------------
.../client/TestKerberosAuthenticator.java | 41 ++++++----------
hadoop-project/pom.xml | 10 ----
4 files changed, 16 insertions(+), 96 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/09dd709d/hadoop-common-project/hadoop-auth/pom.xml
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-auth/pom.xml b/hadoop-common-project/hadoop-auth/pom.xml
index 8cffeae..9308d0c 100644
--- a/hadoop-common-project/hadoop-auth/pom.xml
+++ b/hadoop-common-project/hadoop-auth/pom.xml
@@ -66,16 +66,6 @@
<artifactId>jetty-servlet</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-logging-juli</artifactId>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/09dd709d/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java
----------------------------------------------------------------------
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 8b9d45e..969cd7b 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,9 +13,6 @@
*/
package org.apache.hadoop.security.authentication.client;
-import org.apache.catalina.deploy.FilterDef;
-import org.apache.catalina.deploy.FilterMap;
-import org.apache.catalina.startup.Tomcat;
import org.apache.hadoop.security.authentication.server.AuthenticationFilter;
import org.apache.http.HttpResponse;
import org.apache.http.auth.AuthScope;
@@ -45,7 +42,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
-import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -65,18 +61,12 @@ public class AuthenticatorTestCase {
private Server server;
private String host = null;
private int port = -1;
- private boolean useTomcat = false;
- private Tomcat tomcat = null;
ServletContextHandler context;
private static Properties authenticatorConfig;
public AuthenticatorTestCase() {}
- public AuthenticatorTestCase(boolean useTomcat) {
- this.useTomcat = useTomcat;
- }
-
protected static void setAuthenticationHandlerConfig(Properties config) {
authenticatorConfig = config;
}
@@ -120,8 +110,7 @@ public class AuthenticatorTestCase {
}
protected void start() throws Exception {
- if (useTomcat) startTomcat();
- else startJetty();
+ startJetty();
}
protected void startJetty() throws Exception {
@@ -142,32 +131,8 @@ public class AuthenticatorTestCase {
System.out.println("Running embedded servlet container at: http://" + host + ":" + port);
}
- protected void startTomcat() throws Exception {
- tomcat = new Tomcat();
- File base = new File(System.getProperty("java.io.tmpdir"));
- org.apache.catalina.Context ctx =
- tomcat.addContext("/foo",base.getAbsolutePath());
- FilterDef fd = new FilterDef();
- fd.setFilterClass(TestFilter.class.getName());
- fd.setFilterName("TestFilter");
- FilterMap fm = new FilterMap();
- fm.setFilterName("TestFilter");
- fm.addURLPattern("/*");
- fm.addServletName("/bar");
- ctx.addFilterDef(fd);
- ctx.addFilterMap(fm);
- tomcat.addServlet(ctx, "/bar", TestServlet.class.getName());
- ctx.addServletMapping("/bar", "/bar");
- host = "localhost";
- port = getLocalPort();
- tomcat.setHostname(host);
- tomcat.setPort(port);
- tomcat.start();
- }
-
protected void stop() throws Exception {
- if (useTomcat) stopTomcat();
- else stopJetty();
+ stopJetty();
}
protected void stopJetty() throws Exception {
@@ -182,18 +147,6 @@ public class AuthenticatorTestCase {
}
}
- protected void stopTomcat() throws Exception {
- try {
- tomcat.stop();
- } catch (Exception e) {
- }
-
- try {
- tomcat.destroy();
- } catch (Exception e) {
- }
- }
-
protected String getBaseURL() {
return "http://" + host + ":" + port + "/foo/bar";
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/09dd709d/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/TestKerberosAuthenticator.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/TestKerberosAuthenticator.java b/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/TestKerberosAuthenticator.java
index 8ba1205..7db53ba 100644
--- a/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/TestKerberosAuthenticator.java
+++ b/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/TestKerberosAuthenticator.java
@@ -28,33 +28,20 @@ import org.apache.hadoop.security.authentication.server.PseudoAuthenticationHand
import org.apache.hadoop.security.authentication.server.KerberosAuthenticationHandler;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.runners.Parameterized;
-import org.junit.runner.RunWith;
import org.junit.Test;
import java.io.File;
import java.net.HttpURLConnection;
import java.net.URL;
-import java.util.Arrays;
-import java.util.Collection;
import java.util.Properties;
import java.util.concurrent.Callable;
-@RunWith(Parameterized.class)
+/**
+ * Test class for {@link KerberosAuthenticator}.
+ */
public class TestKerberosAuthenticator extends KerberosSecurityTestcase {
- private boolean useTomcat = false;
-
- public TestKerberosAuthenticator(boolean useTomcat) {
- this.useTomcat = useTomcat;
- }
-
- @Parameterized.Parameters
- public static Collection booleans() {
- return Arrays.asList(new Object[][] {
- { false },
- { true }
- });
+ public TestKerberosAuthenticator() {
}
@Before
@@ -93,7 +80,7 @@ public class TestKerberosAuthenticator extends KerberosSecurityTestcase {
@Test(timeout=60000)
public void testFallbacktoPseudoAuthenticator() throws Exception {
- AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat);
+ AuthenticatorTestCase auth = new AuthenticatorTestCase();
Properties props = new Properties();
props.setProperty(AuthenticationFilter.AUTH_TYPE, "simple");
props.setProperty(PseudoAuthenticationHandler.ANONYMOUS_ALLOWED, "false");
@@ -103,7 +90,7 @@ public class TestKerberosAuthenticator extends KerberosSecurityTestcase {
@Test(timeout=60000)
public void testFallbacktoPseudoAuthenticatorAnonymous() throws Exception {
- AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat);
+ AuthenticatorTestCase auth = new AuthenticatorTestCase();
Properties props = new Properties();
props.setProperty(AuthenticationFilter.AUTH_TYPE, "simple");
props.setProperty(PseudoAuthenticationHandler.ANONYMOUS_ALLOWED, "true");
@@ -113,7 +100,7 @@ public class TestKerberosAuthenticator extends KerberosSecurityTestcase {
@Test(timeout=60000)
public void testNotAuthenticated() throws Exception {
- AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat);
+ AuthenticatorTestCase auth = new AuthenticatorTestCase();
AuthenticatorTestCase.setAuthenticationHandlerConfig(getAuthenticationHandlerConfiguration());
auth.start();
try {
@@ -129,7 +116,7 @@ public class TestKerberosAuthenticator extends KerberosSecurityTestcase {
@Test(timeout=60000)
public void testAuthentication() throws Exception {
- final AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat);
+ final AuthenticatorTestCase auth = new AuthenticatorTestCase();
AuthenticatorTestCase.setAuthenticationHandlerConfig(
getAuthenticationHandlerConfiguration());
KerberosTestUtils.doAsClient(new Callable<Void>() {
@@ -143,7 +130,7 @@ public class TestKerberosAuthenticator extends KerberosSecurityTestcase {
@Test(timeout=60000)
public void testAuthenticationPost() throws Exception {
- final AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat);
+ final AuthenticatorTestCase auth = new AuthenticatorTestCase();
AuthenticatorTestCase.setAuthenticationHandlerConfig(
getAuthenticationHandlerConfiguration());
KerberosTestUtils.doAsClient(new Callable<Void>() {
@@ -157,7 +144,7 @@ public class TestKerberosAuthenticator extends KerberosSecurityTestcase {
@Test(timeout=60000)
public void testAuthenticationHttpClient() throws Exception {
- final AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat);
+ final AuthenticatorTestCase auth = new AuthenticatorTestCase();
AuthenticatorTestCase.setAuthenticationHandlerConfig(
getAuthenticationHandlerConfiguration());
KerberosTestUtils.doAsClient(new Callable<Void>() {
@@ -171,7 +158,7 @@ public class TestKerberosAuthenticator extends KerberosSecurityTestcase {
@Test(timeout=60000)
public void testAuthenticationHttpClientPost() throws Exception {
- final AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat);
+ final AuthenticatorTestCase auth = new AuthenticatorTestCase();
AuthenticatorTestCase.setAuthenticationHandlerConfig(
getAuthenticationHandlerConfiguration());
KerberosTestUtils.doAsClient(new Callable<Void>() {
@@ -185,7 +172,7 @@ public class TestKerberosAuthenticator extends KerberosSecurityTestcase {
@Test(timeout = 60000)
public void testNotAuthenticatedWithMultiAuthHandler() throws Exception {
- AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat);
+ AuthenticatorTestCase auth = new AuthenticatorTestCase();
AuthenticatorTestCase
.setAuthenticationHandlerConfig(getMultiAuthHandlerConfiguration());
auth.start();
@@ -204,7 +191,7 @@ public class TestKerberosAuthenticator extends KerberosSecurityTestcase {
@Test(timeout = 60000)
public void testAuthenticationWithMultiAuthHandler() throws Exception {
- final AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat);
+ final AuthenticatorTestCase auth = new AuthenticatorTestCase();
AuthenticatorTestCase
.setAuthenticationHandlerConfig(getMultiAuthHandlerConfiguration());
KerberosTestUtils.doAsClient(new Callable<Void>() {
@@ -219,7 +206,7 @@ public class TestKerberosAuthenticator extends KerberosSecurityTestcase {
@Test(timeout = 60000)
public void testAuthenticationHttpClientPostWithMultiAuthHandler()
throws Exception {
- final AuthenticatorTestCase auth = new AuthenticatorTestCase(useTomcat);
+ final AuthenticatorTestCase auth = new AuthenticatorTestCase();
AuthenticatorTestCase
.setAuthenticationHandlerConfig(getMultiAuthHandlerConfiguration());
KerberosTestUtils.doAsClient(new Callable<Void>() {
http://git-wip-us.apache.org/repos/asf/hadoop/blob/09dd709d/hadoop-project/pom.xml
----------------------------------------------------------------------
diff --git a/hadoop-project/pom.xml b/hadoop-project/pom.xml
index 66958a2..82f3b55 100644
--- a/hadoop-project/pom.xml
+++ b/hadoop-project/pom.xml
@@ -644,16 +644,6 @@
<version>${jetty.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-core</artifactId>
- <version>7.0.55</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-logging-juli</artifactId>
- <version>7.0.55</version>
- </dependency>
- <dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org