tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kkoli...@apache.org
Subject svn commit: r1150866 - in /tomcat/trunk/test/org/apache/catalina: loader/ mbeans/ servlets/ startup/
Date Mon, 25 Jul 2011 19:54:23 GMT
Author: kkolinko
Date: Mon Jul 25 19:54:21 2011
New Revision: 1150866

URL: http://svn.apache.org/viewvc?rev=1150866&view=rev
Log:
Converted the tests to JUnit 4.

Modified:
    tomcat/trunk/test/org/apache/catalina/loader/TestVirtualWebappLoader.java
    tomcat/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java
    tomcat/trunk/test/org/apache/catalina/mbeans/TestRegistration.java
    tomcat/trunk/test/org/apache/catalina/servlets/TestDefaultServlet.java
    tomcat/trunk/test/org/apache/catalina/servlets/TestWebdavServlet.java
    tomcat/trunk/test/org/apache/catalina/startup/TestContextConfig.java
    tomcat/trunk/test/org/apache/catalina/startup/TestListener.java
    tomcat/trunk/test/org/apache/catalina/startup/TestTomcat.java
    tomcat/trunk/test/org/apache/catalina/startup/TestTomcatClassLoader.java

Modified: tomcat/trunk/test/org/apache/catalina/loader/TestVirtualWebappLoader.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/loader/TestVirtualWebappLoader.java?rev=1150866&r1=1150865&r2=1150866&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/loader/TestVirtualWebappLoader.java (original)
+++ tomcat/trunk/test/org/apache/catalina/loader/TestVirtualWebappLoader.java Mon Jul 25 19:54:21
2011
@@ -18,19 +18,27 @@ package org.apache.catalina.loader;
 
 import java.io.File;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+
+import org.junit.Test;
+
 import org.apache.catalina.core.StandardContext;
 import org.apache.catalina.startup.Tomcat;
-import org.apache.catalina.startup.TomcatBaseTest;
+import org.apache.catalina.startup.TomcatBaseTestJUnit4;
 import org.apache.naming.resources.FileDirContext;
 
-public class TestVirtualWebappLoader extends TomcatBaseTest {
+public class TestVirtualWebappLoader extends TomcatBaseTestJUnit4 {
 
+    @Test
     public void testModified() throws Exception {
         WebappLoader loader = new WebappLoader();
         assertNull(loader.getClassLoader());
         assertFalse(loader.modified());
     }
-    
+
+    @Test
     public void testStartInternal() throws Exception {
         Tomcat tomcat = getTomcatInstance();
         File appDir = new File("test/webapp-3.0");      

Modified: tomcat/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java?rev=1150866&r1=1150865&r2=1150866&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java (original)
+++ tomcat/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java Mon
Jul 25 19:54:21 2011
@@ -25,13 +25,18 @@ import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+
 import org.apache.catalina.Context;
 import org.apache.catalina.core.StandardContext;
 import org.apache.catalina.startup.Tomcat;
-import org.apache.catalina.startup.TomcatBaseTest;
+import org.apache.catalina.startup.TomcatBaseTestJUnit4;
 
-public class TestWebappClassLoaderMemoryLeak extends TomcatBaseTest {
+public class TestWebappClassLoaderMemoryLeak extends TomcatBaseTestJUnit4 {
 
+    @Test
     public void testTimerThreadLeak() throws Exception {
         Tomcat tomcat = getTomcatInstance();
         

Modified: tomcat/trunk/test/org/apache/catalina/mbeans/TestRegistration.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/mbeans/TestRegistration.java?rev=1150866&r1=1150865&r2=1150866&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/mbeans/TestRegistration.java (original)
+++ tomcat/trunk/test/org/apache/catalina/mbeans/TestRegistration.java Mon Jul 25 19:54:21
2011
@@ -25,9 +25,15 @@ import java.util.Set;
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+
 import org.apache.catalina.core.StandardHost;
 import org.apache.catalina.startup.Tomcat;
-import org.apache.catalina.startup.TomcatBaseTest;
+import org.apache.catalina.startup.TomcatBaseTestJUnit4;
 import org.apache.tomcat.util.modeler.Registry;
 
 /**
@@ -35,7 +41,7 @@ import org.apache.tomcat.util.modeler.Re
  * don't necessarily apply to one specific Tomcat class.
  *
  */
-public class TestRegistration extends TomcatBaseTest {
+public class TestRegistration extends TomcatBaseTestJUnit4 {
 
     private static final String contextName = "/foo";
 
@@ -102,6 +108,7 @@ public class TestRegistration extends To
      * registered.
      * @author Marc Guillemot
      */
+    @Test
     public void testMBeanDeregistration() throws Exception {
         final MBeanServer mbeanServer = Registry.getRegistry(null, null).getMBeanServer();
         Set<ObjectName> onames = mbeanServer.queryNames(new ObjectName("Catalina:*"),
null);

Modified: tomcat/trunk/test/org/apache/catalina/servlets/TestDefaultServlet.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/servlets/TestDefaultServlet.java?rev=1150866&r1=1150865&r2=1150866&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/servlets/TestDefaultServlet.java (original)
+++ tomcat/trunk/test/org/apache/catalina/servlets/TestDefaultServlet.java Mon Jul 25 19:54:21
2011
@@ -30,19 +30,28 @@ import java.util.TimeZone;
 
 import javax.servlet.http.HttpServletResponse;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+
 import static org.apache.catalina.startup.SimpleHttpClient.CRLF;
 
 import org.apache.catalina.startup.SimpleHttpClient;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.catalina.startup.TomcatBaseTest;
+import org.apache.catalina.startup.TomcatBaseTestJUnit4;
 import org.apache.tomcat.util.buf.ByteChunk;
 
-public class TestDefaultServlet extends TomcatBaseTest {
+public class TestDefaultServlet extends TomcatBaseTestJUnit4 {
 
     /**
      * Test attempting to access special paths (WEB-INF/META-INF) using
      * DefaultServlet. 
      */
+    @Test
     public void testGetSpecials() throws Exception {
         Tomcat tomcat = getTomcatInstance();
         
@@ -82,6 +91,7 @@ public class TestDefaultServlet extends 
      * Test https://issues.apache.org/bugzilla/show_bug.cgi?id=50026
      * Verify serving of resources from context root with subpath mapping.
      */
+    @Test
     public void testGetWithSubpathmount() throws Exception {
         Tomcat tomcat = getTomcatInstance();
         
@@ -151,6 +161,7 @@ public class TestDefaultServlet extends 
      * Test https://issues.apache.org/bugzilla/show_bug.cgi?id=50413 Serving a
      * custom error page
      */
+    @Test
     public void testCustomErrorPage() throws Exception {
         File appDir = new File(getTemporaryDirectory(), "MyApp");
         File webInf = new File(appDir, "WEB-INF");
@@ -235,6 +246,7 @@ public class TestDefaultServlet extends 
      * Test what happens if a custom 404 page is configured,
      * but its file is actually missing.
      */
+    @Test
     public void testCustomErrorPageMissing() throws Exception {
         File appDir = new File(getTemporaryDirectory(), "MyApp");
         File webInf = new File(appDir, "WEB-INF");

Modified: tomcat/trunk/test/org/apache/catalina/servlets/TestWebdavServlet.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/servlets/TestWebdavServlet.java?rev=1150866&r1=1150865&r2=1150866&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/servlets/TestWebdavServlet.java (original)
+++ tomcat/trunk/test/org/apache/catalina/servlets/TestWebdavServlet.java Mon Jul 25 19:54:21
2011
@@ -23,15 +23,21 @@ import java.util.Map;
 
 import javax.servlet.http.HttpServletResponse;
 
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
 import org.apache.catalina.startup.Tomcat;
 import org.apache.catalina.startup.TomcatBaseTest;
+import org.apache.catalina.startup.TomcatBaseTestJUnit4;
 import org.apache.tomcat.util.buf.ByteChunk;
 
-public class TestWebdavServlet extends TomcatBaseTest {
+public class TestWebdavServlet extends TomcatBaseTestJUnit4 {
 
     /**
      * Test attempting to access special paths (WEB-INF/META-INF) using WebdavServlet 
      */
+    @Test
     public void testGetSpecials() throws Exception {
         Tomcat tomcat = getTomcatInstance();
         
@@ -75,6 +81,7 @@ public class TestWebdavServlet extends T
      * Test https://issues.apache.org/bugzilla/show_bug.cgi?id=50026
      * Verify protection of special paths with re-mount of web app resource root.
      */
+    @Test
     public void testGetWithSubpathmount() throws Exception {
         Tomcat tomcat = getTomcatInstance();
         

Modified: tomcat/trunk/test/org/apache/catalina/startup/TestContextConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TestContextConfig.java?rev=1150866&r1=1150865&r2=1150866&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/startup/TestContextConfig.java (original)
+++ tomcat/trunk/test/org/apache/catalina/startup/TestContextConfig.java Mon Jul 25 19:54:21
2011
@@ -29,15 +29,22 @@ import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
 import org.apache.catalina.core.StandardContext;
 import org.apache.tomcat.util.buf.ByteChunk;
 
-public class TestContextConfig extends TomcatBaseTest {
+public class TestContextConfig extends TomcatBaseTestJUnit4 {
 
+    @Test
     public void testOverrideWithSCIDefaultName() throws Exception {
         doTestOverrideDefaultServletWithSCI("default");
     }
 
+    @Test
     public void testOverrideWithSCIDefaultMapping() throws Exception {
         doTestOverrideDefaultServletWithSCI("anything");
     }
@@ -69,6 +76,7 @@ public class TestContextConfig extends T
         assertEquals("OK - Custom default Servlet", res.toString());
     }
 
+    @Test
     public void testBug51396() throws Exception {
         Tomcat tomcat = getTomcatInstance();
 

Modified: tomcat/trunk/test/org/apache/catalina/startup/TestListener.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TestListener.java?rev=1150866&r1=1150865&r2=1150866&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/startup/TestListener.java (original)
+++ tomcat/trunk/test/org/apache/catalina/startup/TestListener.java Mon Jul 25 19:54:21 2011
@@ -24,15 +24,21 @@ import javax.servlet.ServletContextEvent
 import javax.servlet.ServletContextListener;
 import javax.servlet.ServletException;
 
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
 import org.apache.catalina.Context;
 
-public class TestListener extends TomcatBaseTest {
+public class TestListener extends TomcatBaseTestJUnit4 {
 
     /**
      * Check that a ServletContainerInitializer can install a
      * {@link ServletContextListener} and that it gets initialized.
      * @throws Exception
      */
+    @Test
     public void testServletContainerInitializer() throws Exception {
         Tomcat tomcat = getTomcatInstance();
 
@@ -49,6 +55,7 @@ public class TestListener extends Tomcat
      * {@link ServletContextInitializer}.
      * @throws Exception
      */
+    @Test
     public void testServletContextListener() throws Exception {
         Tomcat tomcat = getTomcatInstance();
 

Modified: tomcat/trunk/test/org/apache/catalina/startup/TestTomcat.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TestTomcat.java?rev=1150866&r1=1150865&r2=1150866&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/startup/TestTomcat.java (original)
+++ tomcat/trunk/test/org/apache/catalina/startup/TestTomcat.java Mon Jul 25 19:54:21 2011
@@ -36,13 +36,19 @@ import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
 import org.apache.catalina.deploy.ContextEnvironment;
 import org.apache.catalina.deploy.ContextResourceLink;
 import org.apache.catalina.realm.GenericPrincipal;
 import org.apache.catalina.realm.RealmBase;
 import org.apache.tomcat.util.buf.ByteChunk;
 
-public class TestTomcat extends TomcatBaseTest {
+public class TestTomcat extends TomcatBaseTestJUnit4 {
 
     /**
      * Simple servlet to test in-line registration 
@@ -182,6 +188,7 @@ public class TestTomcat extends TomcatBa
      * 
      * @throws Exception 
      */
+    @Test
     public void testProgrammatic() throws Exception {
         Tomcat tomcat = getTomcatInstance();
         
@@ -200,6 +207,7 @@ public class TestTomcat extends TomcatBa
         assertEquals("Hello world", res.toString());
     }
 
+    @Test
     public void testSingleWebapp() throws Exception {
         Tomcat tomcat = getTomcatInstance();
 
@@ -213,7 +221,8 @@ public class TestTomcat extends TomcatBa
                 "/examples/servlets/servlet/HelloWorldExample");
         assertTrue(res.toString().indexOf("<h1>Hello World!</h1>") > 0);
     }
-    
+
+    @Test
     public void testJsps() throws Exception {
         Tomcat tomcat = getTomcatInstance();
 
@@ -227,7 +236,8 @@ public class TestTomcat extends TomcatBa
                 "/examples/jsp/jsp2/el/basic-arithmetic.jsp");
         assertTrue(res.toString().indexOf("<td>${(1==2) ? 3 : 4}</td>") >
0);
     }
-    
+
+    @Test
     public void testLaunchTime() throws Exception {
         Tomcat tomcat = getTomcatInstance();
         long t0 = System.currentTimeMillis();
@@ -241,6 +251,7 @@ public class TestTomcat extends TomcatBa
     /** 
      * Test for enabling JNDI.
      */
+    @Test
     public void testEnableNaming() throws Exception {
         Tomcat tomcat = getTomcatInstance();
         
@@ -271,6 +282,7 @@ public class TestTomcat extends TomcatBa
     /** 
      * Test for enabling JNDI and using global resources.
      */
+    @Test
     public void testEnableNamingGlobal() throws Exception {
         Tomcat tomcat = getTomcatInstance();
         
@@ -307,6 +319,7 @@ public class TestTomcat extends TomcatBa
     /**
      * Test for https://issues.apache.org/bugzilla/show_bug.cgi?id=47866
      */
+    @Test
     public void testGetResource() throws Exception {
         Tomcat tomcat = getTomcatInstance();
         
@@ -330,6 +343,7 @@ public class TestTomcat extends TomcatBa
         assertTrue(res.toString().contains("<?xml version=\"1.0\" "));
     }
 
+    @Test
     public void testBug50826() throws Exception {
         Tomcat tomcat = getTomcatInstance();
         String contextPath = "/examples";

Modified: tomcat/trunk/test/org/apache/catalina/startup/TestTomcatClassLoader.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TestTomcatClassLoader.java?rev=1150866&r1=1150865&r2=1150866&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/startup/TestTomcatClassLoader.java (original)
+++ tomcat/trunk/test/org/apache/catalina/startup/TestTomcatClassLoader.java Mon Jul 25 19:54:21
2011
@@ -26,12 +26,17 @@ import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
 import org.apache.catalina.Context;
 import org.apache.catalina.loader.WebappClassLoader;
 import org.apache.tomcat.util.buf.ByteChunk;
 
-public class TestTomcatClassLoader extends TomcatBaseTest {
+public class TestTomcatClassLoader extends TomcatBaseTestJUnit4 {
 
+    @Test
     public void testDefaultClassLoader() throws Exception {
         Tomcat tomcat = getTomcatInstance();
 
@@ -47,7 +52,8 @@ public class TestTomcatClassLoader exten
         ByteChunk res = getUrl("http://localhost:" + getPort() + "/");
         assertEquals("WEBAPP,SYSTEM,OTHER,", res.toString());
     }
-    
+
+    @Test
     public void testNonDefaultClassLoader() throws Exception {
         
         ClassLoader cl = new URLClassLoader(new URL[0],



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message