Methods Summary |
---|
protected void | setUp()
super.setUp();
channel1 = new GroupChannel();
channel1.addInterceptor(new MessageDispatch15Interceptor());
channel2 = new GroupChannel();
channel2.addInterceptor(new MessageDispatch15Interceptor());
listener1 = new Listener();
channel2.addChannelListener(listener1);
channel1.start(GroupChannel.DEFAULT);
channel2.start(GroupChannel.DEFAULT);
|
protected void | tearDown()
super.tearDown();
channel1.stop(GroupChannel.DEFAULT);
channel2.stop(GroupChannel.DEFAULT);
|
public void | testDataSendACK()
System.err.println("Starting ACK");
for (int i=0; i<msgCount; i++) channel1.send(new Member[] {channel2.getLocalMember(false)},Data.createRandomData(),GroupChannel.SEND_OPTIONS_USE_ACK);
Thread.sleep(250);
System.err.println("Finished ACK");
assertEquals("Checking success messages.",msgCount,listener1.count);
|
public void | testDataSendASYNC()
System.err.println("Starting ASYNC");
for (int i=0; i<msgCount; i++) channel1.send(new Member[] {channel2.getLocalMember(false)},Data.createRandomData(),GroupChannel.SEND_OPTIONS_ASYNCHRONOUS);
//sleep for 50 sec, let the other messages in
long start = System.currentTimeMillis();
while ( (System.currentTimeMillis()-start)<5000 && msgCount!=listener1.count) Thread.sleep(500);
System.err.println("Finished ASYNC");
assertEquals("Checking success messages.",msgCount,listener1.count);
|
public void | testDataSendASYNCM()
System.err.println("Starting ASYNC MULTI THREAD");
Thread[] threads = new Thread[threadCount];
for (int x=0; x<threads.length; x++ ) {
threads[x] = new Thread() {
public void run() {
try {
long start = System.currentTimeMillis();
for (int i = 0; i < msgCount; i++) channel1.send(new Member[] {channel2.getLocalMember(false)}, Data.createRandomData(),GroupChannel.SEND_OPTIONS_ASYNCHRONOUS);
System.out.println("Thread["+this.getName()+"] sent "+msgCount+" messages in "+(System.currentTimeMillis()-start)+" ms.");
}catch ( Exception x ) {
x.printStackTrace();
return;
} finally {
threadCounter++;
}
}
};
}
for (int x=0; x<threads.length; x++ ) { threads[x].start();}
for (int x=0; x<threads.length; x++ ) { threads[x].join();}
//sleep for 50 sec, let the other messages in
long start = System.currentTimeMillis();
while ( (System.currentTimeMillis()-start)<15000 && msgCount*threadCount!=listener1.count) Thread.sleep(500);
System.err.println("Finished ASYNC MULTI THREAD ["+listener1.count+"]");
assertEquals("Checking success messages.",msgCount*threadCount,listener1.count);
|
public void | testDataSendNO_ACK()
System.err.println("Starting NO_ACK");
Thread[] threads = new Thread[threadCount];
for (int x=0; x<threads.length; x++ ) {
threads[x] = new Thread() {
public void run() {
try {
long start = System.currentTimeMillis();
for (int i = 0; i < msgCount; i++) channel1.send(new Member[] {channel2.getLocalMember(false)}, Data.createRandomData(),0);
System.out.println("Thread["+this.getName()+"] sent "+msgCount+" messages in "+(System.currentTimeMillis()-start)+" ms.");
}catch ( Exception x ) {
x.printStackTrace();
return;
} finally {
threadCounter++;
}
}
};
}
for (int x=0; x<threads.length; x++ ) { threads[x].start();}
for (int x=0; x<threads.length; x++ ) { threads[x].join();}
//sleep for 50 sec, let the other messages in
long start = System.currentTimeMillis();
while ( (System.currentTimeMillis()-start)<15000 && msgCount*threadCount!=listener1.count) Thread.sleep(500);
System.err.println("Finished NO_ACK ["+listener1.count+"]");
assertEquals("Checking success messages.",msgCount*threadCount,listener1.count);
|
public void | testDataSendSYNCACK()
System.err.println("Starting SYNC_ACK");
for (int i=0; i<msgCount; i++) channel1.send(new Member[] {channel2.getLocalMember(false)},Data.createRandomData(),GroupChannel.SEND_OPTIONS_SYNCHRONIZED_ACK|GroupChannel.SEND_OPTIONS_USE_ACK);
Thread.sleep(250);
System.err.println("Finished SYNC_ACK");
assertEquals("Checking success messages.",msgCount,listener1.count);
|