[hornetq-commits] JBoss hornetq SVN: r12036 - branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/failover.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Jan 19 06:41:40 EST 2012
Author: ataylor
Date: 2012-01-19 06:41:39 -0500 (Thu, 19 Jan 2012)
New Revision: 12036
Modified:
branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
Log:
test for https://issues.jboss.org/browse/HORNETQ-828
Modified: branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
===================================================================
--- branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2012-01-17 23:33:31 UTC (rev 12035)
+++ branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2012-01-19 11:41:39 UTC (rev 12036)
@@ -41,6 +41,8 @@
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.api.core.client.SessionFailureListener;
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
+import org.hornetq.core.client.impl.ClientSessionImpl;
+import org.hornetq.core.client.impl.DelegatingSession;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.transaction.impl.XidImpl;
import org.hornetq.jms.client.HornetQTextMessage;
@@ -130,6 +132,73 @@
return sf.createSession(xa, autoCommitSends, autoCommitAcks);
}
+ //https://issues.jboss.org/browse/HORNETQ-828
+ public void _testSessionClosedOnFailover() throws Exception
+ {
+ this.backupServer.stop();
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnDurableSend(true);
+ locator.setAckBatchSize(0);
+ locator.setReconnectAttempts(-1);
+
+ final ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal)locator.createSessionFactory();
+
+ final ClientSession session = createSession(sf, true, true);
+
+ try
+ {
+ final ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS);
+
+ final CountDownLatch latch = new CountDownLatch(1);
+ sf.addFailureListener(new SessionFailureListener()
+ {
+ public void beforeReconnect(HornetQException exception)
+ {
+ latch.countDown();
+ }
+
+ public void connectionFailed(HornetQException exception, boolean failedOver)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ });
+ crash(false, session);
+
+ latch.await(5000, TimeUnit.MILLISECONDS);
+
+ final CountDownLatch unblocked = new CountDownLatch(1);
+
+ Thread t = new Thread(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ producer.send(session.createMessage(true));
+ System.out.println("FailoverTest.run");
+ unblocked.countDown();
+ }
+ catch (HornetQException e)
+ {
+ //
+ }
+ }
+ });
+
+ t.start();
+
+ Thread.sleep(1000);
+
+ sf.close();
+
+ assertTrue(unblocked.await(10000, TimeUnit.MILLISECONDS));
+ }
+ finally
+ {
+ ((DelegatingSession)session).getChannel().unlock();
+ }
+ }
+
// https://issues.jboss.org/browse/HORNETQ-685
public void testTimeoutOnFailover() throws Exception
{
More information about the hornetq-commits
mailing list