[jboss-cvs] JBoss Messaging SVN: r5831 - branches/Branch_1416_merge/tests/src/org/jboss/test/messaging/jms.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Feb 6 03:34:29 EST 2009
Author: gaohoward
Date: 2009-02-06 03:34:28 -0500 (Fri, 06 Feb 2009)
New Revision: 5831
Modified:
branches/Branch_1416_merge/tests/src/org/jboss/test/messaging/jms/OrderingGroupGeneralTest.java
Log:
fix tests
Modified: branches/Branch_1416_merge/tests/src/org/jboss/test/messaging/jms/OrderingGroupGeneralTest.java
===================================================================
--- branches/Branch_1416_merge/tests/src/org/jboss/test/messaging/jms/OrderingGroupGeneralTest.java 2009-02-06 07:32:05 UTC (rev 5830)
+++ branches/Branch_1416_merge/tests/src/org/jboss/test/messaging/jms/OrderingGroupGeneralTest.java 2009-02-06 08:34:28 UTC (rev 5831)
@@ -216,6 +216,8 @@
{
assertEquals("ordering" + i, rcvBuffer.get(i).getText());
}
+
+ rcvBuffer.clear();
}
finally
{
@@ -314,6 +316,8 @@
{
assertEquals("ordering" + i, rcvBuffer.get(i).getText());
}
+
+ rcvBuffer.clear();
}
finally
{
@@ -380,40 +384,54 @@
TextMessage[] testMsgs2 = new TextMessage[NUM_MSG];
Random rand = new Random();
- for (int i = 0; i < NUM_MSG; i++)
+ int i1 = 0;
+ int i2 = 0;
+ boolean dowork1 = true;
+ boolean dowork2 = true;
+
+ while( dowork1 || dowork2 )
{
- testMsgs1[i] = sess1.createTextMessage("ordering" + i);
- testMsgs2[i] = sess1.createTextMessage("ordering" + i);
-
//sending, make sending random, to see if two groups interfere each other
boolean first = rand.nextBoolean();
int indx = rand.nextInt(2);
int priority = rand.nextInt(10);
- if (first)
+ if (first && dowork1)
{
+ testMsgs1[i1] = sess1.createTextMessage("ordering" + i1);
//sending group 1
if (indx == 0)
{
- prods[0].send(testMsgs1[i], DeliveryMode.PERSISTENT, priority, 0);
+ prods[0].send(testMsgs1[i1], DeliveryMode.PERSISTENT, priority, 0);
}
else
{
- prods[2].send(testMsgs1[i], DeliveryMode.PERSISTENT, priority, 0);
+ prods[2].send(testMsgs1[i1], DeliveryMode.PERSISTENT, priority, 0);
}
+ i1++;
+ if (i1 >= NUM_MSG)
+ {
+ dowork1 = false;
+ }
}
- else
+ else if (dowork2)
{
+ testMsgs2[i2] = sess1.createTextMessage("ordering" + i2);
//sending group2
if (indx == 0)
{
- prods[1].send(testMsgs2[i], DeliveryMode.PERSISTENT, priority, 0);
+ prods[1].send(testMsgs2[i2], DeliveryMode.PERSISTENT, priority, 0);
}
else
{
- prods[3].send(testMsgs2[i], DeliveryMode.PERSISTENT, priority, 0);
- }
+ prods[3].send(testMsgs2[i2], DeliveryMode.PERSISTENT, priority, 0);
+ }
+ i2++;
+ if (i2 >= NUM_MSG)
+ {
+ dowork2 = false;
+ }
}
}
@@ -428,7 +446,7 @@
for (int i = 0; i < NUM_MSG*2; i++)
{
- TextMessage rm = (TextMessage)cons.receive(500);
+ TextMessage rm = (TextMessage)cons.receive(2000);
assertNotNull(rm);
if (isGroup(rm, ORDER_GROUP_NAME1))
@@ -553,8 +571,10 @@
assertEquals(NUM_MSG, rcvBuffer1.size());
for (int i = 0; i < NUM_MSG; i++)
{
- assertEquals("ordering" + i, rcvBuffer.get(i).getText());
+ assertEquals("ordering" + i, rcvBuffer1.get(i).getText());
}
+
+ rcvBuffer1.clear();
}
finally
{
@@ -653,8 +673,10 @@
assertEquals(NUM_MSG, rcvBuffer1.size());
for (int i = 0; i < NUM_MSG; i++)
{
- assertEquals("ordering" + i, rcvBuffer.get(i).getText());
+ assertEquals("ordering" + i, rcvBuffer1.get(i).getText());
}
+
+ rcvBuffer1.clear();
}
finally
{
More information about the jboss-cvs-commits
mailing list