tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kkoli...@apache.org
Subject svn commit: r1150975 - in /tomcat/trunk: test/org/apache/catalina/tribes/test/channel/ webapps/docs/
Date Tue, 26 Jul 2011 02:58:30 GMT
Author: kkolinko
Date: Tue Jul 26 02:58:29 2011
New Revision: 1150975

URL: http://svn.apache.org/viewvc?rev=1150975&view=rev
Log:
Converting tribes tests to JUnit 4 - done.
Update changelog.

Modified:
    tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestDataIntegrity.java
    tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestMulticastPackages.java
    tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java
    tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestUdpPackages.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestDataIntegrity.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestDataIntegrity.java?rev=1150975&r1=1150974&r2=1150975&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestDataIntegrity.java (original)
+++ tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestDataIntegrity.java Tue Jul
26 02:58:29 2011
@@ -20,7 +20,11 @@ import java.io.Serializable;
 import java.util.Arrays;
 import java.util.Random;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 import org.apache.catalina.tribes.Channel;
 import org.apache.catalina.tribes.ChannelListener;
@@ -38,16 +42,18 @@ import org.apache.catalina.tribes.group.
  * @author not attributable
  * @version 1.0
  */
-public class TestDataIntegrity extends TestCase {
-    int msgCount = 500;
-    int threadCount = 20;
-    GroupChannel channel1;
-    GroupChannel channel2;
-    Listener listener1;
-    int threadCounter = 0;
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
+public class TestDataIntegrity {
+    private int msgCount = 500;
+    private int threadCount = 20;
+    private GroupChannel channel1;
+    private GroupChannel channel2;
+    private Listener listener1;
+
+    @SuppressWarnings("unused")
+    private int threadCounter = 0;
+
+    @Before
+    public void setUp() throws Exception {
         channel1 = new GroupChannel();
         channel1.addInterceptor(new MessageDispatch15Interceptor());
         channel2 = new GroupChannel();
@@ -58,13 +64,13 @@ public class TestDataIntegrity extends T
         channel2.start(Channel.DEFAULT);
     }
 
-    @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
+    @After
+    public void tearDown() throws Exception {
         channel1.stop(Channel.DEFAULT);
         channel2.stop(Channel.DEFAULT);
     }
 
+    @Test
     public void testDataSendNO_ACK() throws Exception {
         System.err.println("Starting NO_ACK");
         Thread[] threads = new Thread[threadCount];
@@ -94,6 +100,7 @@ public class TestDataIntegrity extends T
         assertEquals("Checking success messages.",msgCount*threadCount,listener1.count);
     }
 
+    @Test
     public void testDataSendASYNCM() throws Exception {
             System.err.println("Starting ASYNC MULTI THREAD");
             Thread[] threads = new Thread[threadCount];
@@ -122,6 +129,8 @@ public class TestDataIntegrity extends T
             System.err.println("Finished ASYNC MULTI THREAD ["+listener1.count+"]");
             assertEquals("Checking success messages.",msgCount*threadCount,listener1.count);
     }
+
+    @Test
     public void testDataSendASYNC() throws Exception {
         System.err.println("Starting ASYNC");
         for (int i=0; i<msgCount; i++) channel1.send(new Member[] {channel2.getLocalMember(false)},Data.createRandomData(),Channel.SEND_OPTIONS_ASYNCHRONOUS);
@@ -132,6 +141,7 @@ public class TestDataIntegrity extends T
         assertEquals("Checking success messages.",msgCount,listener1.count);
     }
 
+    @Test
     public void testDataSendACK() throws Exception {
         System.err.println("Starting ACK");
         for (int i=0; i<msgCount; i++) channel1.send(new Member[] {channel2.getLocalMember(false)},Data.createRandomData(),Channel.SEND_OPTIONS_USE_ACK);
@@ -140,6 +150,7 @@ public class TestDataIntegrity extends T
         assertEquals("Checking success messages.",msgCount,listener1.count);
     }
 
+    @Test
     public void testDataSendSYNCACK() throws Exception {
         System.err.println("Starting SYNC_ACK");
         for (int i=0; i<msgCount; i++) channel1.send(new Member[] {channel2.getLocalMember(false)},Data.createRandomData(),Channel.SEND_OPTIONS_SYNCHRONIZED_ACK|Channel.SEND_OPTIONS_USE_ACK);

Modified: tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestMulticastPackages.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestMulticastPackages.java?rev=1150975&r1=1150974&r2=1150975&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestMulticastPackages.java (original)
+++ tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestMulticastPackages.java Tue
Jul 26 02:58:29 2011
@@ -22,7 +22,11 @@ import java.util.Random;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 import org.apache.catalina.tribes.Channel;
 import org.apache.catalina.tribes.ChannelListener;
@@ -38,16 +42,18 @@ import org.apache.catalina.tribes.transp
 
 /**
  */
-public class TestMulticastPackages extends TestCase {
-    int msgCount = 500;
-    int threadCount = 20;
-    GroupChannel channel1;
-    GroupChannel channel2;
-    Listener listener1;
-    int threadCounter = 0;
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
+public class TestMulticastPackages {
+    private int msgCount = 500;
+    private int threadCount = 20;
+    private GroupChannel channel1;
+    private GroupChannel channel2;
+    private Listener listener1;
+
+    @SuppressWarnings("unused")
+    private int threadCounter = 0;
+
+    @Before
+    public void setUp() throws Exception {
         channel1 = new GroupChannel();
         channel1.addInterceptor(new MessageDispatch15Interceptor());
         channel2 = new GroupChannel();
@@ -68,13 +74,13 @@ public class TestMulticastPackages exten
         channel2.start(Channel.DEFAULT);
     }
 
-    @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
+    @After
+    public void tearDown() throws Exception {
         channel1.stop(Channel.DEFAULT);
         channel2.stop(Channel.DEFAULT);
     }
 
+    @Test
     public void testSingleDataSendNO_ACK() throws Exception {
         AbstractSender s1 =(AbstractSender) ((ReplicationTransmitter)channel1.getChannelSender()).getTransport();
         AbstractSender s2 =(AbstractSender) ((ReplicationTransmitter)channel2.getChannelSender()).getTransport();
@@ -96,6 +102,7 @@ public class TestMulticastPackages exten
         System.out.println();
     }
 
+    @Test
     public void testDataSendASYNCM() throws Exception {
         final AtomicInteger counter = new AtomicInteger(0);
         ReceiverBase rb1 = (ReceiverBase)channel1.getChannelReceiver();
@@ -138,6 +145,8 @@ public class TestMulticastPackages exten
         printMissingMsgs(listener1.nrs,counter.get());
         assertEquals("Checking success messages.",msgCount*threadCount,listener1.count.get());
     }
+
+    @Test
     public void testDataSendASYNC() throws Exception {
         System.err.println("Starting ASYNC");
         for (int i=0; i<msgCount; i++) channel1.send(new Member[] {channel2.getLocalMember(false)},Data.createRandomData(1024),Channel.SEND_OPTIONS_ASYNCHRONOUS|Channel.SEND_OPTIONS_MULTICAST);
@@ -148,6 +157,7 @@ public class TestMulticastPackages exten
         assertEquals("Checking success messages.",msgCount,listener1.count.get());
     }
 
+    @Test
     public void testDataSendACK() throws Exception {
         System.err.println("Starting ACK");
         for (int i=0; i<msgCount; i++) channel1.send(new Member[] {channel2.getLocalMember(false)},Data.createRandomData(1024),Channel.SEND_OPTIONS_USE_ACK|Channel.SEND_OPTIONS_MULTICAST);
@@ -156,6 +166,7 @@ public class TestMulticastPackages exten
         assertEquals("Checking success messages.",msgCount,listener1.count.get());
     }
 
+    @Test
     public void testDataSendSYNCACK() throws Exception {
         System.err.println("Starting SYNC_ACK");
         for (int i=0; i<msgCount; i++) channel1.send(new Member[] {channel2.getLocalMember(false)},Data.createRandomData(1024),Channel.SEND_OPTIONS_SYNCHRONIZED_ACK|Channel.SEND_OPTIONS_USE_ACK|Channel.SEND_OPTIONS_MULTICAST);

Modified: tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java?rev=1150975&r1=1150974&r2=1150975&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java
(original)
+++ tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java
Tue Jul 26 02:58:29 2011
@@ -21,7 +21,11 @@ import java.io.Serializable;
 import java.util.Arrays;
 import java.util.Random;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 import org.apache.catalina.tribes.Channel;
 import org.apache.catalina.tribes.ChannelListener;
@@ -38,14 +42,14 @@ import org.apache.catalina.tribes.group.
  * @author not attributable
  * @version 1.0
  */
-public class TestRemoteProcessException extends TestCase {
-    int msgCount = 10000;
-    GroupChannel channel1;
-    GroupChannel channel2;
-    Listener listener1;
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
+public class TestRemoteProcessException {
+    private int msgCount = 10000;
+    private GroupChannel channel1;
+    private GroupChannel channel2;
+    private Listener listener1;
+
+    @Before
+    public void setUp() throws Exception {
         channel1 = new GroupChannel();
         channel2 = new GroupChannel();
         listener1 = new Listener();
@@ -54,13 +58,13 @@ public class TestRemoteProcessException 
         channel2.start(Channel.DEFAULT);
     }
 
-    @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
+    @After
+    public void tearDown() throws Exception {
         channel1.stop(Channel.DEFAULT);
         channel2.stop(Channel.DEFAULT);
     }
 
+    @Test
     public void testDataSendSYNCACK() throws Exception {
         System.err.println("Starting SYNC_ACK");
         int errC=0, nerrC=0;

Modified: tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestUdpPackages.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestUdpPackages.java?rev=1150975&r1=1150974&r2=1150975&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestUdpPackages.java (original)
+++ tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestUdpPackages.java Tue Jul
26 02:58:29 2011
@@ -22,7 +22,11 @@ import java.util.Random;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 import org.apache.catalina.tribes.Channel;
 import org.apache.catalina.tribes.ChannelListener;
@@ -38,16 +42,18 @@ import org.apache.catalina.tribes.transp
 
 /**
  */
-public class TestUdpPackages extends TestCase {
-    int msgCount = 500;
-    int threadCount = 20;
-    GroupChannel channel1;
-    GroupChannel channel2;
-    Listener listener1;
-    int threadCounter = 0;
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
+public class TestUdpPackages {
+    private int msgCount = 500;
+    private int threadCount = 20;
+    private GroupChannel channel1;
+    private GroupChannel channel2;
+    private Listener listener1;
+
+    @SuppressWarnings("unused")
+    private int threadCounter = 0;
+
+    @Before
+    public void setUp() throws Exception {
         channel1 = new GroupChannel();
         channel1.addInterceptor(new MessageDispatch15Interceptor());
         channel2 = new GroupChannel();
@@ -68,13 +74,13 @@ public class TestUdpPackages extends Tes
         channel2.start(Channel.DEFAULT);
     }
 
-    @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
+    @After
+    public void tearDown() throws Exception {
         channel1.stop(Channel.DEFAULT);
         channel2.stop(Channel.DEFAULT);
     }
 
+    @Test
     public void testSingleDataSendNO_ACK() throws Exception {
         AbstractSender s1 =(AbstractSender) ((ReplicationTransmitter)channel1.getChannelSender()).getTransport();
         AbstractSender s2 =(AbstractSender) ((ReplicationTransmitter)channel2.getChannelSender()).getTransport();
@@ -88,7 +94,7 @@ public class TestUdpPackages extends Tes
         assertEquals("Checking success messages.",1,listener1.count.get());
     }
 
-    
+    @Test
     public void testDataSendNO_ACK() throws Exception {
         final AtomicInteger counter = new AtomicInteger(0);
         ReceiverBase rb1 = (ReceiverBase)channel1.getChannelReceiver();
@@ -139,6 +145,7 @@ public class TestUdpPackages extends Tes
         System.out.println();
     }
 
+    @Test
     public void testDataSendASYNCM() throws Exception {
         final AtomicInteger counter = new AtomicInteger(0);
         ReceiverBase rb1 = (ReceiverBase)channel1.getChannelReceiver();
@@ -181,6 +188,8 @@ public class TestUdpPackages extends Tes
         printMissingMsgs(listener1.nrs,counter.get());
         assertEquals("Checking success messages.",msgCount*threadCount,listener1.count.get());
     }
+
+    @Test
     public void testDataSendASYNC() throws Exception {
         System.err.println("Starting ASYNC");
         for (int i=0; i<msgCount; i++) channel1.send(new Member[] {channel2.getLocalMember(false)},Data.createRandomData(1024),Channel.SEND_OPTIONS_ASYNCHRONOUS|Channel.SEND_OPTIONS_UDP);
@@ -191,6 +200,7 @@ public class TestUdpPackages extends Tes
         assertEquals("Checking success messages.",msgCount,listener1.count.get());
     }
 
+    @Test
     public void testDataSendACK() throws Exception {
         System.err.println("Starting ACK");
         for (int i=0; i<msgCount; i++) channel1.send(new Member[] {channel2.getLocalMember(false)},Data.createRandomData(1024),Channel.SEND_OPTIONS_USE_ACK|Channel.SEND_OPTIONS_UDP);
@@ -199,6 +209,7 @@ public class TestUdpPackages extends Tes
         assertEquals("Checking success messages.",msgCount,listener1.count.get());
     }
 
+    @Test
     public void testDataSendSYNCACK() throws Exception {
         System.err.println("Starting SYNC_ACK");
         for (int i=0; i<msgCount; i++) channel1.send(new Member[] {channel2.getLocalMember(false)},Data.createRandomData(1024),Channel.SEND_OPTIONS_SYNCHRONIZED_ACK|Channel.SEND_OPTIONS_USE_ACK|Channel.SEND_OPTIONS_UDP);

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1150975&r1=1150974&r2=1150975&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Tue Jul 26 02:58:29 2011
@@ -158,6 +158,9 @@
         <bug>51531</bug>: Update sample Eclipse classpath file to reflect
         updated ECJ jar. Patch provided by Ian Brandt. (markt)
       </fix>
+      <update>
+        Converted Tomcat unit tests to JUnit 4. (kkolinko)
+      </update>
     </changelog>
   </subsection>
 </section>



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


Mime
View raw message