Commit 847e660d authored by afreyssin's avatar afreyssin
Browse files

Fix end test allowing a successful termination on slow nodes.

parent b44f85d6
......@@ -145,9 +145,11 @@ public class AliasInQueueTest1 extends TestCase {
}
cnx0.close();
Thread.sleep(2000L);
if ((list1.count + list2.count) != nbmsg)
Thread.sleep(2000L);
int i = 0;
while (((list1.count + list2.count) != nbmsg) && (i++<50)) {
System.out.println("queue1: " + list1.count + ", queue2: " + list2.count);
Thread.sleep(1000L);
}
assertEquals(nbmsg, list1.count + list2.count);
assertEquals((weight1 * nbmsg)/(weight1 + weigth2), list1.count);
......
......@@ -166,12 +166,13 @@ public class AliasInQueueTest2 extends TestCase {
cnx0.close();
System.out.println((System.currentTimeMillis() - start) + " - queue1: " + list1.count + ", queue2: " + list2.count);
int wait = nbmsg * (((weight1 * weight2 *100)/(weight1 + weight2)) - (weight0 *100)) /100;
System.out.println(wait);
Thread.sleep(wait +5000L);
if ((list1.count + list2.count) != nbmsg)
Thread.sleep(5000L);
int i = 0;
int wait = nbmsg * (((weight1 * weight2 *100)/(weight1 + weight2)) - (weight0 *100)) /1000;
while (((list1.count + list2.count) != nbmsg) && (i++<50)) {
System.out.println("queue1: " + list1.count + ", queue2: " + list2.count);
Thread.sleep(wait);
}
assertEquals(nbmsg, list1.count + list2.count);
System.out.println(((weight2 * nbmsg *95)/(weight1 + weight2))/100);
assertTrue(list1.count > (((weight2 * nbmsg *95)/(weight1 + weight2))/100));
......
......@@ -52,7 +52,7 @@ public class ClientTest27 extends TestCase {
try {
System.out.println("servers start");
startAgentServer((short)0, new String[]{"-DTransaction.UseLockFile=false"});
Thread.sleep(1000);
Thread.sleep(2000);
ConnectionFactory cf = TcpConnectionFactory.create("localhost", 2560);
AdminModule.connect(cf, "root", "root");
......@@ -92,7 +92,11 @@ public class ClientTest27 extends TestCase {
for (int i=0; i<10; i++)
test(nbmsgs);
Thread.sleep(2*pending);
int i = 0;
while ((topic.getSubscriptions() !=0 ) && (i++<50)) {
Thread.sleep(pending);
System.out.println(new Date() + " - Sub: " + topic.getSubscriptions());
}
assertTrue(topic.getSubscriptions()==0);
AdminModule.disconnect();
......
......@@ -97,7 +97,11 @@ public class ClientTest28 extends TestCase {
// } while (subt != 0);
// Thread.sleep(5000L);
Thread.sleep(3*pending);
int i = 0;
while ((topic.getSubscriptions() !=0 ) && (i++<50)) {
Thread.sleep(pending);
System.out.println(new Date() + " - Sub: " + topic.getSubscriptions());
}
assertTrue(topic.getSubscriptions()==0);
// Wait the end of sending.
Thread.sleep(4*pending);
......
Markdown is supported
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