[jboss-cvs] JBoss Messaging SVN: r1499 - trunk/tests/src/org/jboss/test/messaging/jms
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Oct 18 18:06:08 EDT 2006
Author: clebert.suconic at jboss.com
Date: 2006-10-18 18:06:07 -0400 (Wed, 18 Oct 2006)
New Revision: 1499
Modified:
trunk/tests/src/org/jboss/test/messaging/jms/ManualClusteringTest.java
Log:
http://jira.jboss.org/jira/browse/JBMESSAGING-519 - a testcase with the requirements we need on HA for durable subscriptions
Modified: trunk/tests/src/org/jboss/test/messaging/jms/ManualClusteringTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/ManualClusteringTest.java 2006-10-18 08:09:03 UTC (rev 1498)
+++ trunk/tests/src/org/jboss/test/messaging/jms/ManualClusteringTest.java 2006-10-18 22:06:07 UTC (rev 1499)
@@ -1293,5 +1293,76 @@
}
}
+
+ /** This is what is planned to be executed when a durable subscriber's connection fail.
+ * The durable subscription will be created on the second node, and the first node will be closed/failed.
+ * If this test passes we will have most of what we need for HA server recovery */
+ public void testHAFailoeverRequirementsOnDurable() throws Exception
+ {
+ Connection conn1 = null;
+
+ Connection conn2 = null;
+
+ try
+ {
+
+ conn1 = cf1.createConnection();
+ conn1.setClientID("wib1");
+ Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer prod1 = sess1.createProducer(topic1);
+ prod1.setDeliveryMode(DeliveryMode.PERSISTENT);
+ try{sess1.unsubscribe("sub1");}catch(Exception ignored){}
+ MessageConsumer cons1 = sess1.createDurableSubscriber(topic1, "sub1"); // cons2 will receive messages only if we comment out this line
+ conn1.start();
+
+ // Send at node2, receiving at node1
+
+ final int NUM_MESSAGES=20;
+ for (int i = 0; i < NUM_MESSAGES; i++)
+ {
+ TextMessage tm = sess1.createTextMessage("message" + i);
+
+ prod1.send(tm);
+ }
+
+ assertNotNull(cons1.receive(1000));
+
+ conn1.close(); // This should be to the server as the same thing as a failover event
+
+
+ conn2 = cf2.createConnection(); // the test will work if we use cf1 instead
+ conn2.setClientID("wib1");
+ Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer prod2 = sess2.createProducer(topic1);
+ prod2.setDeliveryMode(DeliveryMode.PERSISTENT);
+ MessageConsumer cons2 = sess2.createDurableSubscriber(topic1, "sub1");
+ conn2.start();
+
+ for (int i = 1; i < NUM_MESSAGES; i++)
+ {
+ TextMessage tm = (TextMessage)cons2.receive(1000);
+ assertNotNull(tm);
+ }
+ assertNull(cons2.receive(1000));
+ try
+ {
+ sess1.unsubscribe("sub1");
+
+ sess2.unsubscribe("sub1");
+ }
+ catch (Exception ignored)
+ {
+ }
+
+ }
+ finally
+ {
+ try{if (conn1 != null) conn1.close();} catch (Exception e){}
+ try{if (conn2 != null) conn2.close();} catch (Exception e){}
+ }
+
+ }
+
+
}
More information about the jboss-cvs-commits
mailing list