Author: kkolinko
Date: Tue Jan  5 16:41:04 2016
New Revision: 1723117

URL: http://svn.apache.org/viewvc?rev=1723117&view=rev
Log:
Convert test to JUnit 4.
Use TesterUtil.addRandomDomain() to allow several tests to run in parallel, 
backport from Tomcat 7.

This test fails in Tomcat 7, Tomcat 9 as well and is excluded when running 
tests via build.xml.

This test creates random messages, half of those are failing at receiver side 
by an explicit "throw new IllegalStateException()".
This causes send() call in the test to fail with a ChannelException, which is 
uncaught and fails the whole test run.

Modified:
    
tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java

Modified: 
tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java?rev=1723117&r1=1723116&r2=1723117&view=diff
==============================================================================
--- 
tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java
 (original)
+++ 
tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java
 Tue Jan  5 16:41:04 2016
@@ -16,14 +16,22 @@
  */
 package org.apache.catalina.tribes.test.channel;
 
-import junit.framework.TestCase;
+import java.io.PrintStream;
 import java.io.Serializable;
-import java.util.Random;
 import java.util.Arrays;
+import java.util.Random;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
 import org.apache.catalina.tribes.ChannelListener;
+import org.apache.catalina.tribes.ManagedChannel;
 import org.apache.catalina.tribes.Member;
+import org.apache.catalina.tribes.TesterUtil;
 import org.apache.catalina.tribes.group.GroupChannel;
-import java.io.PrintStream;
 
 /**
  * <p>Title: </p> 
@@ -35,27 +43,30 @@ import java.io.PrintStream;
  * @author not attributable
  * @version 1.0
  */
-public class TestRemoteProcessException extends TestCase {
-    int msgCount = 10000;
-    GroupChannel channel1;
-    GroupChannel channel2;
-    Listener listener1;
-    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();
         channel2.addChannelListener(listener1);
+        TesterUtil.addRandomDomain(new ManagedChannel[] {channel1, channel2});
         channel1.start(GroupChannel.DEFAULT);
         channel2.start(GroupChannel.DEFAULT);
     }
 
-    protected void tearDown() throws Exception {
-        super.tearDown();
+    @After
+    public void tearDown() throws Exception {
         channel1.stop(GroupChannel.DEFAULT);
         channel2.stop(GroupChannel.DEFAULT);
     }
 
+    @Test
     public void testDataSendSYNCACK() throws Exception {
         System.err.println("Starting SYNC_ACK");
         int errC=0, nerrC=0;
@@ -107,6 +118,7 @@ public class TestRemoteProcessException
     }
 
     public static class Data implements Serializable {
+        private static final long serialVersionUID = 1L;
         public int length;
         public byte[] data;
         public byte key;



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

Reply via email to