[hornetq-commits] JBoss hornetq SVN: r8292 - trunk/tests/src/org/hornetq/tests/integration/replication.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Nov 16 10:43:05 EST 2009


Author: jmesnil
Date: 2009-11-16 10:43:05 -0500 (Mon, 16 Nov 2009)
New Revision: 8292

Modified:
   trunk/tests/src/org/hornetq/tests/integration/replication/ReplicationOrderTest.java
Log:
HORNETQ-218: Incorrect order when persistent and non-persistent messages are sent over replication

* added ReplicationOrderTest for transaction case

Modified: trunk/tests/src/org/hornetq/tests/integration/replication/ReplicationOrderTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/replication/ReplicationOrderTest.java	2009-11-16 15:07:00 UTC (rev 8291)
+++ trunk/tests/src/org/hornetq/tests/integration/replication/ReplicationOrderTest.java	2009-11-16 15:43:05 UTC (rev 8292)
@@ -57,7 +57,7 @@
       for (int i = 0; i < 100; i++)
       {
          System.out.println("<<<<<< " + i + " >>>>>>>");
-         testMixedPersistentAndNonPersistentMessagesOrderWithReplicatedBackup();
+         testTxMixedPersistentAndNonPersistentMessagesOrderWithReplicatedBackup();
          tearDown();
          setUp();
       }
@@ -65,13 +65,31 @@
 
    public void testMixedPersistentAndNonPersistentMessagesOrderWithReplicatedBackup() throws Exception
    {
+      doTestMixedPersistentAndNonPersistentMessagesOrderWithReplicatedBackup(false);
+   }
+
+   public void testTxMixedPersistentAndNonPersistentMessagesOrderWithReplicatedBackup() throws Exception
+   {
+      doTestMixedPersistentAndNonPersistentMessagesOrderWithReplicatedBackup(true);
+   }
+
+   private void doTestMixedPersistentAndNonPersistentMessagesOrderWithReplicatedBackup(boolean transactional) throws Exception
+   {
       String address = randomString();
       String queue = randomString();
 
       ClientSessionFactory csf = new ClientSessionFactoryImpl(getConnectorTransportConfiguration(true));
       csf.setBlockOnNonPersistentSend(false);
       csf.setBlockOnPersistentSend(false);
-      ClientSession session = csf.createSession(true, true);
+      ClientSession session = null;
+      if (transactional)
+      {
+         session = csf.createSession(false, false);
+      }
+      else
+      {
+         session = csf.createSession(true, true);
+      }
       session.createQueue(address, queue, true);
       ClientProducer producer = session.createProducer(address);
       for (int i = 0; i < NUM; i++)
@@ -81,6 +99,10 @@
          msg.putIntProperty("counter", i);
          producer.send(msg);
       }
+      if (transactional)
+      {
+         session.commit();
+      }
       session.close();
 
       csf = new ClientSessionFactoryImpl(getConnectorTransportConfiguration(true));
@@ -93,10 +115,10 @@
          assertNotNull(message);
          assertEquals(i, message.getIntProperty("counter").intValue());
       }
-      
+
       consumer.close();
       session.deleteQueue(queue);
-      
+
       session.close();
    }
 



More information about the hornetq-commits mailing list