diff --git a/hadoop-common-project/hadoop-auth/pom.xml b/hadoop-common-project/hadoop-auth/pom.xml index 8cffeae9f8..9308d0cb17 100644 --- a/hadoop-common-project/hadoop-auth/pom.xml +++ b/hadoop-common-project/hadoop-auth/pom.xml @@ -65,16 +65,6 @@ org.eclipse.jetty jetty-servlet test - - - org.apache.tomcat.embed - tomcat-embed-core - test - - - org.apache.tomcat.embed - tomcat-embed-logging-juli - test javax.servlet 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 8b9d45e0e8..969cd7b686 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.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 @@ protected int getLocalPort() throws Exception { } protected void start() throws Exception { - if (useTomcat) startTomcat(); - else startJetty(); + startJetty(); } protected void startJetty() throws Exception { @@ -142,32 +131,8 @@ protected void startJetty() throws Exception { 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 @@ protected void stopJetty() throws Exception { } } - 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"; } 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 8ba1205b44..7db53bae06 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.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 @@ private Properties getMultiAuthHandlerConfiguration() { @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 void testFallbacktoPseudoAuthenticator() throws Exception { @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 void testFallbacktoPseudoAuthenticatorAnonymous() throws Exception { @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 void testNotAuthenticated() throws Exception { @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() { @@ -143,7 +130,7 @@ public Void call() throws Exception { @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() { @@ -157,7 +144,7 @@ public Void call() throws Exception { @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() { @@ -171,7 +158,7 @@ public Void call() throws Exception { @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() { @@ -185,7 +172,7 @@ public Void call() throws Exception { @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 void testNotAuthenticatedWithMultiAuthHandler() throws Exception { @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() { @@ -219,7 +206,7 @@ public Void call() throws Exception { @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() { diff --git a/hadoop-project/pom.xml b/hadoop-project/pom.xml index 66958a29f7..82f3b552bf 100644 --- a/hadoop-project/pom.xml +++ b/hadoop-project/pom.xml @@ -643,16 +643,6 @@ jetty-util-ajax ${jetty.version} - - org.apache.tomcat.embed - tomcat-embed-core - 7.0.55 - - - org.apache.tomcat.embed - tomcat-embed-logging-juli - 7.0.55 - javax.servlet.jsp jsp-api