mirror of https://github.com/apache/activemq.git
resolve AMQ-2062 - add setExceptionListener to amq connection factory
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@733803 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4a1279639f
commit
0b34f3c89f
|
@ -23,6 +23,7 @@ import java.io.ObjectOutputStream;
|
|||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
import javax.jms.ExceptionListener;
|
||||
import javax.jms.JMSException;
|
||||
import javax.jms.Session;
|
||||
|
||||
|
@ -157,6 +158,28 @@ public class ActiveMQConnectionFactoryTest extends CombinationTestSupport {
|
|||
cf = (ActiveMQConnectionFactory)objectsIn.readObject();
|
||||
assertEquals(cf.getClientID(), clientID);
|
||||
}
|
||||
|
||||
public void testSetExceptionListener() throws Exception {
|
||||
ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
|
||||
connection = (ActiveMQConnection)cf.createConnection();
|
||||
assertNull(connection.getExceptionListener());
|
||||
|
||||
ExceptionListener exListener = new ExceptionListener() {
|
||||
public void onException(JMSException arg0) {
|
||||
}
|
||||
};
|
||||
cf.setExceptionListener(exListener);
|
||||
|
||||
connection = (ActiveMQConnection)cf.createConnection();
|
||||
assertNotNull(connection.getExceptionListener());
|
||||
assertEquals(exListener, connection.getExceptionListener());
|
||||
|
||||
connection = (ActiveMQConnection)cf.createConnection();
|
||||
assertEquals(exListener, connection.getExceptionListener());
|
||||
|
||||
assertEquals(exListener, cf.getExceptionListener());
|
||||
|
||||
}
|
||||
|
||||
protected void assertCreateConnection(String uri) throws Exception {
|
||||
// Start up a broker with a tcp connector.
|
||||
|
|
Loading…
Reference in New Issue