[jboss-cvs] JBoss Messaging SVN: r1881 - trunk/tests/src/org/jboss/test/messaging/jms/clustering
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jan 2 11:03:46 EST 2007
Author: clebert.suconic at jboss.com
Date: 2007-01-02 11:03:45 -0500 (Tue, 02 Jan 2007)
New Revision: 1881
Modified:
trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
Log:
Adding testSimpleFailover back
Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java 2006-12-31 10:51:38 UTC (rev 1880)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java 2007-01-02 16:03:45 UTC (rev 1881)
@@ -52,6 +52,68 @@
// Public ---------------------------------------------------------------------------------------
+ public void testSimpleFailover() throws Exception
+ {
+ Connection conn = null;
+
+ try
+ {
+ conn = cf.createConnection();
+ conn.close();
+
+ conn = cf.createConnection();
+ conn.start();
+
+ // create a producer/consumer on node 1
+
+ // make sure we're connecting to node 1
+
+ int nodeID = ((ConnectionState)((DelegateSupport)((JBossConnection)conn).
+ getDelegate()).getState()).getServerID();
+
+ assertEquals(1, nodeID);
+
+ Session s1 = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer c1 = s1.createConsumer(queue[1]);
+ MessageProducer p1 = s1.createProducer(queue[1]);
+ p1.setDeliveryMode(DeliveryMode.PERSISTENT);
+
+ // send a message
+
+ p1.send(s1.createTextMessage("blip"));
+
+ // kill node 1
+
+
+ ServerManagement.killAndWait(1);
+ log.info("########");
+ log.info("######## KILLED NODE 1");
+ log.info("########");
+
+ try
+ {
+ ic[1].lookup("queue"); // looking up anything
+ fail("The server still alive, kill didn't work yet");
+ }
+ catch (Exception e)
+ {
+ }
+
+ // we must receive the message
+
+ TextMessage tm = (TextMessage)c1.receive(1000);
+ assertEquals("blip", tm.getText());
+
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
+
public void testSimpleConnectionFailover() throws Exception
{
Connection conn = null;
More information about the jboss-cvs-commits
mailing list