[jboss-cvs] JBossAS SVN: r61744 - branches/Branch_4_2/testsuite/src/main/org/jboss/test/jbossmq/test.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Mar 27 11:40:12 EDT 2007
Author: adrian at jboss.org
Date: 2007-03-27 11:40:12 -0400 (Tue, 27 Mar 2007)
New Revision: 61744
Modified:
branches/Branch_4_2/testsuite/src/main/org/jboss/test/jbossmq/test/UIL2DisconnectClientsUnitTestCase.java
Log:
[JBAS-2813] - Add more tests for restarting parts of the server triggering the ExceptionListener on the client
Modified: branches/Branch_4_2/testsuite/src/main/org/jboss/test/jbossmq/test/UIL2DisconnectClientsUnitTestCase.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/jbossmq/test/UIL2DisconnectClientsUnitTestCase.java 2007-03-27 15:39:48 UTC (rev 61743)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/jbossmq/test/UIL2DisconnectClientsUnitTestCase.java 2007-03-27 15:40:12 UTC (rev 61744)
@@ -21,75 +21,27 @@
*/
package org.jboss.test.jbossmq.test;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import org.jboss.mx.util.ObjectNameFactory;
-import org.jboss.test.JBossTestCase;
-import EDU.oswego.cs.dl.util.concurrent.SynchronizedBoolean;
-
/**
* A test to make sure exception listeners are fired when the UIL2 service is stopped
*
* @author <a href="mailto:adrian at jboss.org>Adrian Brock</a>
* @version <tt>$Revision: 57211 $</tt>
*/
-public class UIL2DisconnectClientsUnitTestCase extends JBossTestCase implements ExceptionListener
+public class UIL2DisconnectClientsUnitTestCase extends AbstractRestartDisconnectClientsTest
{
- static String FACTORY = "ConnectionFactory";
static ObjectName UIL2 = ObjectNameFactory.create("jboss.mq:service=InvocationLayer,type=UIL2");
- private SynchronizedBoolean exceptionListenerFired = new SynchronizedBoolean(false);
-
public UIL2DisconnectClientsUnitTestCase(String name) throws Exception
{
super(name);
}
- public synchronized void onException(JMSException exception)
+ protected ObjectName getRestartObjectName()
{
- exceptionListenerFired.set(true);
- notifyAll();
+ return UIL2;
}
-
- public void testDisconnect() throws Exception
- {
- ConnectionFactory factory = (ConnectionFactory) getInitialContext().lookup(FACTORY);
- Connection connection = factory.createConnection();
- try
- {
- connection.setExceptionListener(this);
- connection.start();
- MBeanServerConnection server = getServer();
- server.invoke(UIL2, "stop", null, null);
- try
- {
- // Shouldn't really have to wait for the ping timeout, but just in case
- synchronized (this)
- {
- wait(60 * 1000);
- }
- assertTrue("Exception Listener should have been invoked", exceptionListenerFired.get());
- }
- finally
- {
- server.invoke(UIL2, "start", null, null);
- }
- }
- finally
- {
- try
- {
- connection.close();
- }
- catch (JMSException ignored)
- {
- }
- }
- }
}
More information about the jboss-cvs-commits
mailing list