You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by fh...@apache.org on 2006/07/03 19:27:07 UTC
svn commit: r418809 -
/tomcat/container/tc5.5.x/modules/groupcom/test/java/org/apache/catalina/tribes/test/channel/TestDataIntegrity.java
Author: fhanik
Date: Mon Jul 3 10:27:07 2006
New Revision: 418809
URL: http://svn.apache.org/viewvc?rev=418809&view=rev
Log:
Added multithreaded to the test
Modified:
tomcat/container/tc5.5.x/modules/groupcom/test/java/org/apache/catalina/tribes/test/channel/TestDataIntegrity.java
Modified: tomcat/container/tc5.5.x/modules/groupcom/test/java/org/apache/catalina/tribes/test/channel/TestDataIntegrity.java
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/groupcom/test/java/org/apache/catalina/tribes/test/channel/TestDataIntegrity.java?rev=418809&r1=418808&r2=418809&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/test/java/org/apache/catalina/tribes/test/channel/TestDataIntegrity.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/test/java/org/apache/catalina/tribes/test/channel/TestDataIntegrity.java Mon Jul 3 10:27:07 2006
@@ -8,6 +8,7 @@
import org.apache.catalina.tribes.Member;
import org.apache.catalina.tribes.group.GroupChannel;
import org.apache.catalina.tribes.test.channel.TestDataIntegrity.Listener;
+import org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor;
/**
* <p>Title: </p>
@@ -23,13 +24,16 @@
*/
public class TestDataIntegrity extends TestCase {
int msgCount = 10000;
+ int threadCount = 8;
GroupChannel channel1;
GroupChannel channel2;
Listener listener1;
protected void setUp() throws Exception {
super.setUp();
channel1 = new GroupChannel();
+ channel1.addInterceptor(new MessageDispatchInterceptor());
channel2 = new GroupChannel();
+ channel2.addInterceptor(new MessageDispatchInterceptor());
listener1 = new Listener();
channel2.addChannelListener(listener1);
channel1.start(GroupChannel.DEFAULT);
@@ -44,10 +48,24 @@
public void testDataSendNO_ACK() throws Exception {
System.err.println("Starting NO_ACK");
- for (int i=0; i<msgCount; i++) channel1.send(channel1.getMembers(),Data.createRandomData(),0);
- Thread.sleep(250);
+ Thread[] threads = new Thread[threadCount];
+ for (int x=0; x<threads.length; x++ ) {
+ threads[x] = new Thread() {
+ public void run() {
+ try {
+ for (int i = 0; i < msgCount; i++) channel1.send(channel1.getMembers(), Data.createRandomData(),GroupChannel.SEND_OPTIONS_ASYNCHRONOUS);
+ }catch ( Exception x ) {
+ x.printStackTrace();
+ return;
+ }
+ }
+ };
+ }
+ for (int x=0; x<threads.length; x++ ) { threads[x].start();}
+ for (int x=0; x<threads.length; x++ ) { threads[x].join();}
+ Thread.sleep(25000);
System.err.println("Finished NO_ACK");
- assertEquals("Checking success messages.",msgCount,listener1.count);
+ assertEquals("Checking success messages.",msgCount*threadCount,listener1.count);
}
public void testDataSendACK() throws Exception {
@@ -78,7 +96,7 @@
System.err.println("ERROR");
} else {
count++;
- if ((count %100) ==0 ) {
+ if ((count %1000) ==0 ) {
System.err.println("SUCCESS:"+count);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org