tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kkoli...@apache.org
Subject svn commit: r1150899 - in /tomcat/trunk/test/org/apache/tomcat/util: http/mapper/TestMapperWelcomeFiles.java net/TestClientCert.java net/TestCustomSsl.java net/TestSsl.java scan/TestJarScanner.java
Date Mon, 25 Jul 2011 20:46:13 GMT
Author: kkolinko
Date: Mon Jul 25 20:46:11 2011
New Revision: 1150899

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

Modified:
    tomcat/trunk/test/org/apache/tomcat/util/http/mapper/TestMapperWelcomeFiles.java
    tomcat/trunk/test/org/apache/tomcat/util/net/TestClientCert.java
    tomcat/trunk/test/org/apache/tomcat/util/net/TestCustomSsl.java
    tomcat/trunk/test/org/apache/tomcat/util/net/TestSsl.java
    tomcat/trunk/test/org/apache/tomcat/util/scan/TestJarScanner.java

Modified: tomcat/trunk/test/org/apache/tomcat/util/http/mapper/TestMapperWelcomeFiles.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/http/mapper/TestMapperWelcomeFiles.java?rev=1150899&r1=1150898&r2=1150899&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/util/http/mapper/TestMapperWelcomeFiles.java (original)
+++ tomcat/trunk/test/org/apache/tomcat/util/http/mapper/TestMapperWelcomeFiles.java Mon Jul
25 20:46:11 2011
@@ -26,13 +26,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.assertTrue;
+
+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.tomcat.util.buf.ByteChunk;
 
-public class TestMapperWelcomeFiles extends TomcatBaseTest {
+public class TestMapperWelcomeFiles extends TomcatBaseTestJUnit4 {
 
+    @Test
     public void testWelcomeFileNotStrict() throws Exception {
 
         Tomcat tomcat = getTomcatInstance();
@@ -59,7 +65,8 @@ public class TestMapperWelcomeFiles exte
         assertEquals(HttpServletResponse.SC_OK, rc);
         assertTrue(bc.toString().contains("Servlet"));
     }
-    
+
+    @Test
     public void testWelcomeFileStrict() throws Exception {
 
         Tomcat tomcat = getTomcatInstance();

Modified: tomcat/trunk/test/org/apache/tomcat/util/net/TestClientCert.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/net/TestClientCert.java?rev=1150899&r1=1150898&r2=1150899&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/util/net/TestClientCert.java (original)
+++ tomcat/trunk/test/org/apache/tomcat/util/net/TestClientCert.java Mon Jul 25 20:46:11 2011
@@ -18,8 +18,12 @@ package org.apache.tomcat.util.net;
 
 import java.util.Arrays;
 
+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;
 
 /**
@@ -27,8 +31,9 @@ import org.apache.tomcat.util.buf.ByteCh
  * generated using a test CA the files for which are in the Tomcat PMC private
  * repository since not all of them are AL2 licensed.
  */
-public class TestClientCert extends TomcatBaseTest {
-    
+public class TestClientCert extends TomcatBaseTestJUnit4 {
+
+    @Test
     public void testClientCertGet() throws Exception {
         if (!TesterSupport.isRenegotiationSupported(getTomcatInstance())) {
             return;
@@ -44,25 +49,28 @@ public class TestClientCert extends Tomc
         assertEquals("OK", res.toString());
     }
 
+    @Test
     public void testClientCertPostSmaller() throws Exception {
         Tomcat tomcat = getTomcatInstance();
         int bodySize = tomcat.getConnector().getMaxSavePostSize() / 2; 
         doTestClientCertPost(bodySize, false);
     }
 
+    @Test
     public void testClientCertPostSame() throws Exception {
         Tomcat tomcat = getTomcatInstance();
         int bodySize = tomcat.getConnector().getMaxSavePostSize(); 
         doTestClientCertPost(bodySize, false);
     }
 
+    @Test
     public void testClientCertPostLarger() throws Exception {
         Tomcat tomcat = getTomcatInstance();
         int bodySize = tomcat.getConnector().getMaxSavePostSize() * 2; 
         doTestClientCertPost(bodySize, true);
     }
 
-    public void doTestClientCertPost(int bodySize, boolean expectProtectedFail)
+    private void doTestClientCertPost(int bodySize, boolean expectProtectedFail)
             throws Exception {
         if (!TesterSupport.isRenegotiationSupported(getTomcatInstance())) {
             return;

Modified: tomcat/trunk/test/org/apache/tomcat/util/net/TestCustomSsl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/net/TestCustomSsl.java?rev=1150899&r1=1150898&r2=1150899&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/util/net/TestCustomSsl.java (original)
+++ tomcat/trunk/test/org/apache/tomcat/util/net/TestCustomSsl.java Mon Jul 25 20:46:11 2011
@@ -21,9 +21,15 @@ import java.net.SocketException;
 
 import javax.net.ssl.SSLHandshakeException;
 
+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.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
-import org.apache.catalina.startup.TomcatBaseTest;
+import org.apache.catalina.startup.TomcatBaseTestJUnit4;
 import org.apache.coyote.ProtocolHandler;
 import org.apache.coyote.http11.AbstractHttp11JsseProtocol;
 import org.apache.tomcat.util.buf.ByteChunk;
@@ -34,8 +40,9 @@ import org.apache.tomcat.util.net.jsse.T
  * generated using a test CA the files for which are in the Tomcat PMC private
  * repository since not all of them are AL2 licensed.
  */
-public class TestCustomSsl extends TomcatBaseTest {
+public class TestCustomSsl extends TomcatBaseTestJUnit4 {
 
+    @Test
     public void testCustomSslImplementation() throws Exception {
 
         TesterSupport.configureClientSsl();
@@ -71,10 +78,12 @@ public class TestCustomSsl extends Tomca
         assertTrue(res.toString().indexOf("<h1>Hello World!</h1>") > 0);
     }
 
+    @Test
     public void testCustomTrustManager1() throws Exception {
         doTestCustomTrustManager(false);
     }
-    
+
+    @Test
     public void testCustomTrustManager2() throws Exception {
         doTestCustomTrustManager(true);
     }

Modified: tomcat/trunk/test/org/apache/tomcat/util/net/TestSsl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/net/TestSsl.java?rev=1150899&r1=1150898&r2=1150899&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/util/net/TestSsl.java (original)
+++ tomcat/trunk/test/org/apache/tomcat/util/net/TestSsl.java Mon Jul 25 20:46:11 2011
@@ -30,8 +30,13 @@ import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLSocket;
 import javax.net.ssl.SSLSocketFactory;
 
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+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;
 
 /**
@@ -39,8 +44,9 @@ import org.apache.tomcat.util.buf.ByteCh
  * generated using a test CA the files for which are in the Tomcat PMC private
  * repository since not all of them are AL2 licensed.
  */
-public class TestSsl extends TomcatBaseTest {
+public class TestSsl extends TomcatBaseTestJUnit4 {
 
+    @Test
     public void testSimpleSsl() throws Exception {
         TesterSupport.configureClientSsl();
         
@@ -57,6 +63,7 @@ public class TestSsl extends TomcatBaseT
         assertTrue(res.toString().indexOf("<h1>Hello World!</h1>") > 0);
     }
 
+    @Test
     public void testKeyPass() throws Exception {
         TesterSupport.configureClientSsl();
         
@@ -76,7 +83,8 @@ public class TestSsl extends TomcatBaseT
 
 
     boolean handshakeDone = false;
-    
+
+    @Test
     public void testRenegotiateFail() throws Exception {
         
         // If RFC5746 is supported, renegotiation will always work (and will
@@ -143,7 +151,8 @@ public class TestSsl extends TomcatBaseT
         
         fail("Re-negotiation worked");
     }
-    
+
+    @Test
     public void testRenegotiateWorks() throws Exception {
         Tomcat tomcat = getTomcatInstance();
 

Modified: tomcat/trunk/test/org/apache/tomcat/util/scan/TestJarScanner.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/scan/TestJarScanner.java?rev=1150899&r1=1150898&r2=1150899&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/util/scan/TestJarScanner.java (original)
+++ tomcat/trunk/test/org/apache/tomcat/util/scan/TestJarScanner.java Mon Jul 25 20:46:11
2011
@@ -19,10 +19,18 @@ package org.apache.tomcat.util.scan;
 
 import java.util.StringTokenizer;
 
-import org.apache.catalina.startup.TomcatBaseTest;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
-public class TestJarScanner extends TomcatBaseTest {
+import org.junit.Test;
 
+import org.apache.catalina.startup.TomcatBaseTestJUnit4;
+
+public class TestJarScanner extends TomcatBaseTestJUnit4 {
+
+    @Test
     public void testJarsToSkipFormat() {
 
         String jarList = System.getProperty(Constants.SKIP_JARS_PROPERTY);



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


Mime
View raw message