Commit 9fba1798 authored by Andre Freyssinet's avatar Andre Freyssinet
Browse files

Adds test for stop/restart with a lot of pending messages (JORAM-358,

JORAM-359).
parent 1622a1c5
......@@ -194,7 +194,7 @@
<param name="transaction" value="fr.dyade.aaa.ext.JDBCTransaction"/>
<param name="a3props" value="a3jdbc.props"/>
</antcall>
<antcall target="perf.test6">
<antcall target="___perf.test6">
<param name="transaction" value="fr.dyade.aaa.ext.JDBCTransaction"/>
<param name="a3props" value="a3jdbc.props"/>
</antcall>
......@@ -447,6 +447,7 @@
<antcall target="perf.test34"/>
<antcall target="perf.test47"/>
<antcall target="perf.test54"/>
<antcall target="perf.test55"/>
<antcall target="perf.asynctest"/>
<antcall target="rest.client9"/>
</target>
......@@ -3351,6 +3352,13 @@
<target name="perf.test6"
description=" --> statistics for queue and topic">
<antcall target="___perf.test6">
<param name="a3props" value="a3none.props"/>
</antcall>
</target>
<target name="___perf.test6"
description=" --> statistics for queue and topic">
<antcall target="perf.test6-1"/>
<antcall target="perf.test6-2"/>
</target>
......@@ -3776,11 +3784,18 @@
<!-- Queue and topic statistics in multi-sender mode -->
<target name="perf.test6M"
description="Queue and topic statistics in multi-sender mode">
<antcall target="perf.test6M-1"/>
<antcall target="perf.test6M-2"/>
</target>
<target name="perf.test6M"
description="Queue and topic statistics in multi-sender mode">
<antcall target="___perf.test6M">
<param name="a3props" value="a3none.props"/>
</antcall>
</target>
<target name="___perf.test6M"
description="Queue and topic statistics in multi-sender mode">
<antcall target="perf.test6M-1"/>
<antcall target="perf.test6M-2"/>
</target>
<!-- Queue statistics in multi-sender mode -->
......@@ -4089,10 +4104,11 @@
<param name="className" value="joram.perfs.Test55"/>
<param name="testid" value="perf.test55"/>
<param name="engine" value="fr.dyade.aaa.agent.Engine"/>
<param name="transaction" value="fr.dyade.aaa.util.NTransaction"/>
<param name="transaction" value="fr.dyade.aaa.ext.NGTransaction"/>
<param name="jndiconf" value="perfs/jndi.properties"/>
<param name="a3conf" value="perfs/a3servers1.xml"/>
<param name="jvmargs" value="-DNbMsg=15000 -DMsgSize=1680000 -Dmin=5000 -Dmax=6000 -DNTLogFileSize=32"/>
<!-- param name="jvmargs" value="-DNbMsg=15000 -DMsgSize=1680000 -Dmin=5000 -Dmax=6000 -DNTLogFileSize=32"/ -->
<param name="jvmargs" value="-DNbMsg=15000 -DMsgSize=15000 -Dmin=5000 -Dmax=6000 -DTransaction.NbLogFile=16 -DTransaction.MaxLogFileSize=16 -DTransaction.minObjInLog=0"/>
<!-- param name="jvmargs" value="-DNbMsg=15000 -DMsgSize=1680000 -Dmin=5000 -Dmax=6000 -DNTLogFileSize=32 -Dorg.objectweb.joram.mom.messages.SWAPALLOWED=true"/ -->
</antcall>
</target>
......@@ -4725,7 +4741,7 @@
</antcall>
</target>
<target name="noreg.test57" depends="noreg.test57-1,noreg.test57-2"/>
<target name="noreg.test57" depends="noreg.test57-1,noreg.test57-2,noreg.test57-3,noreg.test57-4"/>
<target name="noreg.test57-1" depends="init.a3props,compile"
description=" --> Test server restart with a lot of big messages">
......@@ -4745,7 +4761,31 @@
<param name="jndiconf" value="noreg/jndi.properties"/>
<param name="a3conf" value="noreg/a3servers1.xml"/>
<param name="testid" value="noreg.test57-2"/>
<param name="jvmargs" value="-DMomMessageClass=org.objectweb.joram.shared.messages.MessageSoftRef -DDestination=org.objectweb.joram.client.jms.Queue -DMsgSize=256 -DNbMsg=5000"/>
<param name="jvmargs" value="-Dorg.objectweb.joram.mom.messages.SWAPALLOWED=true -DDestination=org.objectweb.joram.client.jms.Queue -DMsgSize=256 -DNbMsg=5000"/>
</antcall>
</target>
<target name="noreg.test57-3" depends="init.a3props,compile"
description=" --> Test server restart with a very big number of normal (1Kb) messages">
<!-- Use tuned NGTransaction configuration to avoid garbage -->
<antcall target="test.run" inheritAll="true">
<param name="className" value="joram.noreg.Test57"/>
<param name="jndiconf" value="noreg/jndi.properties"/>
<param name="a3conf" value="noreg/a3servers2.xml"/>
<param name="testid" value="noreg.test57-4"/>
<param name="jvmargs" value="-Dorg.objectweb.joram.mom.messages.SWAPALLOWED=true -DDestination=org.objectweb.joram.client.jms.Queue -DMsgSize=1 -DNbMsg=160000"/>
</antcall>
</target>
<target name="noreg.test57-4" depends="init.a3props,compile"
description=" --> Test server restart with a very big number of normal (1Kb) messages">
<!-- Use tuned NGTransaction configuration to avoid garbage, and fixedInMemory to force queue load at starting -->
<antcall target="test.run" inheritAll="true">
<param name="className" value="joram.noreg.Test57"/>
<param name="jndiconf" value="noreg/jndi.properties"/>
<param name="a3conf" value="noreg/a3servers2.xml"/>
<param name="testid" value="noreg.test57-5"/>
<param name="jvmargs" value="-DMomMessageClass=org.objectweb.joram.shared.messages.MessageSoftRef -DDestination=org.objectweb.joram.client.jms.Queue -DMsgSize=1 -DfixedInMemory=true -DNbMsg=160000"/>
</antcall>
</target>
......@@ -4805,7 +4845,7 @@
</target>
<target name="noreg.test63" depends="init.a3props,compile"
description=" --> ">
description=" --> Test context cleaning in case of server dead.">
<antcall target="test.run" inheritAll="true">
<param name="className" value="joram.noreg.Test63"/>
<param name="testid" value="noreg.test63"/>
......
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2008 ScalAgent Distributed Technologies
* Copyright (C) 2008 - 2020 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -22,6 +22,8 @@
*/
package joram.noreg;
import java.util.Properties;
import javax.jms.BytesMessage;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
......@@ -30,14 +32,17 @@ import javax.jms.MessageProducer;
import javax.jms.Session;
import org.objectweb.joram.client.jms.Destination;
import org.objectweb.joram.client.jms.Queue;
import org.objectweb.joram.client.jms.admin.AdminModule;
import org.objectweb.joram.client.jms.admin.User;
import org.objectweb.joram.shared.DestinationConstants;
import framework.TestCase;
/**
* Test a server restart with lot of big messages.
* Test a server restart with lot of waiting (big) messages.
* Verify that all messages are delivered in the right order.
*/
public class Test57 extends BaseTest {
static int MsgSize = 1*1024*1024;
......@@ -54,88 +59,122 @@ public class Test57 extends BaseTest {
}
public void run(String[] args) {
try{
System.out.println("server start");
TestCase.startAgentServer((short)0);
Thread.sleep(2000);
writeIntoFile("===================== start test 57 =====================");
MsgSize = Integer.getInteger("MsgSize", MsgSize/1024).intValue() *1024;
NbMsg = Integer.getInteger("NbMsg", NbMsg).intValue();
String destc = System.getProperty("Destination",
"org.objectweb.joram.client.jms.Queue");
writeIntoFile("----------------------------------------------------");
writeIntoFile("Destination: " + destc);
writeIntoFile("MsgSize: " + MsgSize);
writeIntoFile("NbMsg: " + NbMsg);
writeIntoFile("----------------------------------------------------");
cf = TcpBaseTest.createConnectionFactory();
AdminModule.connect(cf);
dest = createDestination(destc);
User.create("anonymous", "anonymous", 0);
dest.setFreeReading();
dest.setFreeWriting();
org.objectweb.joram.client.jms.admin.AdminModule.disconnect();
Connection cnx = cf.createConnection();
Session sess = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer prod = sess.createProducer(dest);
cnx.start();
byte[] content = new byte[MsgSize];
for (int i = 0; i< MsgSize; i++)
content[i] = (byte) (i & 0xFF);
boolean fixedInMemory = false;
try {
try {
for (int nb=0; nb<NbMsg; nb++) {
BytesMessage msg = sess.createBytesMessage();
msg.writeBytes(content);
prod.send(msg);
System.out.println("message sent" +nb);
System.out.println("server start");
TestCase.startAgentServer((short) 0);
Thread.sleep(2000);
writeIntoFile("===================== start test 57 =====================");
MsgSize = Integer.getInteger("MsgSize", MsgSize/1024).intValue() *1024;
NbMsg = Integer.getInteger("NbMsg", NbMsg).intValue();
String destc = System.getProperty("Destination",
"org.objectweb.joram.client.jms.Queue");
fixedInMemory = Boolean.getBoolean("fixedInMemory");
writeIntoFile("----------------------------------------------------");
writeIntoFile("Destination: " + destc + " fixedInMemory: " + fixedInMemory);
writeIntoFile("MsgSize: " + MsgSize);
writeIntoFile("NbMsg: " + NbMsg);
writeIntoFile("----------------------------------------------------");
cf = TcpBaseTest.createConnectionFactory();
AdminModule.connect(cf);
if (fixedInMemory) {
Properties props = new Properties();
props.setProperty(DestinationConstants.FIXED_IN_MEMORY, "true");
dest = Queue.create(0, props);
} else {
dest = createDestination(destc);
}
User.create("anonymous", "anonymous", 0);
dest.setFreeReading();
dest.setFreeWriting();
org.objectweb.joram.client.jms.admin.AdminModule.disconnect();
} catch(Throwable exc){
exc.printStackTrace();
error(exc);
return;
}
System.out.println("message sent");
prod.close();
sess.close();
cnx.close();
String[] sentMsgId = new String[NbMsg];
try {
Connection cnx = cf.createConnection();
Session sess = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer prod = sess.createProducer(dest);
cnx.start();
byte[] content = new byte[MsgSize];
for (int i = 0; i< MsgSize; i++)
content[i] = (byte) (i & 0xFF);
long start = System.currentTimeMillis();
for (int nb=0; nb<NbMsg; nb++) {
BytesMessage msg = sess.createBytesMessage();
msg.writeBytes(content);
prod.send(msg);
sentMsgId[nb] = msg.getJMSMessageID();
System.out.println("message sent #" +nb);
}
long end = System.currentTimeMillis();
System.out.println("All messages sent: " + ((end -start)/1000L));
prod.close();
sess.close();
cnx.close();
} catch (javax.jms.JMSException exc) {
exc.printStackTrace();
error(exc);
return;
}
// kill and restart server
System.out.println("Server stop ");
Thread.sleep(30000L);
TestCase.stopAgentServer((short)0);
System.out.println("server start");
TestCase.startAgentServer((short)0);
Thread.sleep(30000L);
cnx = cf.createConnection();
sess = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageConsumer cons = sess.createConsumer(dest);
cnx.start();
for (int nb=0; nb<NbMsg; nb++) {
BytesMessage msg = (BytesMessage) cons.receive();
System.out.println("message received" + nb);
try {
// kill and restart server
System.out.println("Server stop ");
TestCase.stopAgentServer((short) 0);
// Thread.sleep(30000L);
Thread.sleep(1000L);
System.out.println("server start");
TestCase.startAgentServer((short) 0);
Thread.sleep(1000L);
} catch (Exception exc) {
exc.printStackTrace();
error(exc);
return;
}
System.out.println("message received");
cons.close();
sess.close();
cnx.close();
}catch(Throwable exc){
exc.printStackTrace();
error(exc);
}finally{
try {
Connection cnx = cf.createConnection();
Session sess = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageConsumer cons = sess.createConsumer(dest);
cnx.start();
long start = System.currentTimeMillis();
for (int nb=0; nb<NbMsg; nb++) {
BytesMessage msg = (BytesMessage) cons.receive();
boolean good = msg.getJMSMessageID().equals(sentMsgId[nb]);
BaseTest.assertTrue("Receive bad msg #" + nb, good);
System.out.println("message received#" + nb + (good?" ok":" nok"));
}
long end = System.currentTimeMillis();
System.out.println("All messages received: " + ((end -start)/1000L));
cons.close();
sess.close();
cnx.close();
} catch(Throwable exc){
exc.printStackTrace();
error(exc);
return;
}
} finally{
TestCase.stopAgentServer((short)0);
endTest();
}
System.exit(0);
}
}
<?xml version="1.0"?>
<config>
<property name="Engine" value="@engine@"/>
<property name="Transaction" value="@transaction@"/>
<property name="Transaction.NbLogFile" value="16" />
<property name="Transaction.MaxLogFileSize" value="32" />
<server id="0" name="S0" hostname="localhost">
<property name="fr.dyade.aaa.util.ReliableTcpConnection.windowSize"
value="100"/>
<service class="org.objectweb.joram.mom.proxies.ConnectionManager"
args="root root"/>
<service class="fr.dyade.aaa.agent.AdminProxy" args="7890"/>
<service class="org.objectweb.joram.mom.proxies.tcp.TcpProxyService"
args="16010"/>
<service class="fr.dyade.aaa.jndi2.server.JndiServer" args="16400"/>
</server>
</config>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment