[jboss-cvs] JBoss Messaging SVN: r2187 - in trunk/tests/src/org/jboss/test/messaging: tools/aop and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Feb 5 16:04:06 EST 2007
Author: clebert.suconic at jboss.com
Date: 2007-02-05 16:04:06 -0500 (Mon, 05 Feb 2007)
New Revision: 2187
Modified:
trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
trunk/tests/src/org/jboss/test/messaging/jms/clustering/MultiThreadFailoverTest.java
trunk/tests/src/org/jboss/test/messaging/tools/aop/PoisonInterceptor.java
Log:
http://jira.jboss.org/jira/browse/JBMESSAGING-809 - adding new assertion on testcases
Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java 2007-02-05 15:46:22 UTC (rev 2186)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java 2007-02-05 21:04:06 UTC (rev 2187)
@@ -1787,12 +1787,20 @@
private void failureOnInvocation(int typeOfFailure) throws Exception
{
Connection conn = null;
+ Connection conn0 = null;
try
{
- conn = cf.createConnection();
- conn.close();
+ conn0 = cf.createConnection();
+ assertEquals(0, ((JBossConnection)conn0).getServerID());
+
+ Session session0 = conn0.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageConsumer consumer0 = session0.createConsumer(queue[0]);
+
+ conn0.start();
+
conn = cf.createConnection();
assertEquals(1, ((JBossConnection)conn).getServerID());
@@ -1828,6 +1836,8 @@
assertNull(tm);
+ assertNull(consumer0.receive(5000));
+
}
finally
{
@@ -1835,6 +1845,10 @@
{
conn.close();
}
+ if (conn0 != null)
+ {
+ conn0.close();
+ }
}
}
Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/MultiThreadFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/MultiThreadFailoverTest.java 2007-02-05 15:46:22 UTC (rev 2186)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/MultiThreadFailoverTest.java 2007-02-05 21:04:06 UTC (rev 2187)
@@ -134,33 +134,44 @@
// Crash the Server when you have two clients in receive and send simultaneously
public void testFailureOnSendReceiveSynchronized() throws Throwable
{
- Connection conn = null;
+ Connection conn0 = null;
+ Connection conn1 = null;
+ Connection conn2 = null;
try
{
- conn = cf.createConnection();
- conn.close();
+ conn0 = cf.createConnection();
+ conn0.close();
+ conn0 = null;
- conn = cf.createConnection();
+ conn1 = cf.createConnection();
- assertEquals(1, ((JBossConnection)conn).getServerID());
+ conn2 = cf.createConnection();
+ assertEquals(1, ((JBossConnection)conn1).getServerID());
+ assertEquals(2, ((JBossConnection)conn2).getServerID());
+
// we "cripple" the remoting connection by removing ConnectionListener. This way, failures
// cannot be "cleanly" detected by the client-side pinger, and we'll fail on an invocation
- JMSRemotingConnection rc = ((ClientConnectionDelegate)((JBossConnection)conn).
+ JMSRemotingConnection rc = ((ClientConnectionDelegate)((JBossConnection)conn1).
getDelegate()).getRemotingConnection();
rc.removeConnectionListener();
// poison the server
ServerManagement.poisonTheServer(1, PoisonInterceptor.FAIL_SYNCHRONIZED_SEND_RECEIVE);
- conn.start();
+ conn1.start();
- final Session sessionProducer = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ Session sessionConsumer2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageConsumer consumer2 = sessionConsumer2.createConsumer(queue[0]);
+ conn2.start();
+ final Session sessionProducer = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
final MessageProducer producer = sessionProducer.createProducer(queue[0]);
- final Session sessionConsumer = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ final Session sessionConsumer = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);
final MessageConsumer consumer = sessionConsumer.createConsumer(queue[0]);
@@ -212,17 +223,26 @@
t1.join();
t2.join();
+ Object receivedServer2 = consumer2.receive(5000);
+
+ if (receivedServer2 != null)
+ {
+ log.info("### Server2 original message also received ");
+ }
+
if (!failures.isEmpty())
{
throw (Throwable)failures.iterator().next();
}
+ assertNull(receivedServer2);
+
}
finally
{
- if (conn != null)
+ if (conn1 != null)
{
- conn.close();
+ conn1.close();
}
}
Modified: trunk/tests/src/org/jboss/test/messaging/tools/aop/PoisonInterceptor.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/aop/PoisonInterceptor.java 2007-02-05 15:46:22 UTC (rev 2186)
+++ trunk/tests/src/org/jboss/test/messaging/tools/aop/PoisonInterceptor.java 2007-02-05 21:04:06 UTC (rev 2187)
@@ -145,8 +145,7 @@
invocation.invokeNext();
synchronized (sync)
{
- log.info("#### Will wait till an acknowledge comes to fail at the same time",
- new Exception());
+ log.info("#### Will wait till an acknowledge comes to fail at the same time");
sync.wait();
}
crash(target);
@@ -154,8 +153,7 @@
else if (target instanceof SessionAdvised && "acknowledgeDelivery".equals(methodName))
{
invocation.invokeNext();
- log.info("#### Notifying sender thread to crash the server, as ack was completed",
- new Exception());
+ log.info("#### Notifying sender thread to crash the server, as ack was completed");
synchronized (sync)
{
sync.notifyAll();
More information about the jboss-cvs-commits
mailing list