public class MockConnectionFactory extends Object implements javax.jms.QueueConnectionFactory, javax.jms.TopicConnectionFactory, Serializable
ConnectionFactory.
Can be used as generic factory for JMS 1.1.
Also implements QueueConnectionFactory and
TopicConnectionFactory and can be used to
create queue and topic connections as well as generic
JMS 1.1 connections. It is recommended to use
MockQueueConnectionFactory
if you only use queues and
MockTopicConnectionFactory
if you only use topics.
This implementation is primary for generic JMS 1.1 connections
but can also be used, if a server provides one implementation
for both domains (which is not portable).| Constructor and Description |
|---|
MockConnectionFactory(DestinationManager destinationManager,
ConfigurationManager configurationManager) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearConnections()
Clears the list of connections
|
protected ConfigurationManager |
configurationManager() |
protected List |
connections() |
javax.jms.Connection |
createConnection() |
javax.jms.Connection |
createConnection(String name,
String password) |
javax.jms.QueueConnection |
createQueueConnection() |
javax.jms.QueueConnection |
createQueueConnection(String name,
String password) |
javax.jms.TopicConnection |
createTopicConnection() |
javax.jms.TopicConnection |
createTopicConnection(String name,
String password) |
protected DestinationManager |
destinationManager() |
protected javax.jms.JMSException |
exception() |
MockConnection |
getConnection(int index)
Returns the connection with the specified index
or
null if no such connection
exists. |
MockConnection |
getLatestConnection()
Returns the latest created connection
or
null if no such connection
exists. |
void |
setJMSException(javax.jms.JMSException exception)
Set an exception that will be passed to all
created connections.
|
public MockConnectionFactory(DestinationManager destinationManager, ConfigurationManager configurationManager)
public javax.jms.Connection createConnection()
throws javax.jms.JMSException
createConnection in interface javax.jms.ConnectionFactoryjavax.jms.JMSExceptionpublic javax.jms.Connection createConnection(String name, String password) throws javax.jms.JMSException
createConnection in interface javax.jms.ConnectionFactoryjavax.jms.JMSExceptionpublic javax.jms.QueueConnection createQueueConnection()
throws javax.jms.JMSException
createQueueConnection in interface javax.jms.QueueConnectionFactoryjavax.jms.JMSExceptionpublic javax.jms.QueueConnection createQueueConnection(String name, String password) throws javax.jms.JMSException
createQueueConnection in interface javax.jms.QueueConnectionFactoryjavax.jms.JMSExceptionpublic javax.jms.TopicConnection createTopicConnection()
throws javax.jms.JMSException
createTopicConnection in interface javax.jms.TopicConnectionFactoryjavax.jms.JMSExceptionpublic javax.jms.TopicConnection createTopicConnection(String name, String password) throws javax.jms.JMSException
createTopicConnection in interface javax.jms.TopicConnectionFactoryjavax.jms.JMSExceptionpublic void setJMSException(javax.jms.JMSException exception)
MockConnection.setJMSException(javax.jms.JMSException)
for details.exception - the exceptionpublic void clearConnections()
public MockConnection getConnection(int index)
null if no such connection
exists.index - the indexpublic MockConnection getLatestConnection()
null if no such connection
exists.protected DestinationManager destinationManager()
protected ConfigurationManager configurationManager()
protected List connections()
protected javax.jms.JMSException exception()
Copyright © 2003–2020. All rights reserved.