Package com.sun.ts.tests.jms.common
Class JmsTool
java.lang.Object
com.sun.ts.tests.jms.common.JmsTool
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final String
static final int
static final int
static final int
static final String
static final int
static final int
static final int
static final int
static final int
static final int
static final String
static final String
static final int
static final int
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final int
static final int
static final String
static final int
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
closeAllConnections
(ArrayList connections) Close any connections opened by the testsvoid
Close all resources created by JmsTool except connection resource which gets closed in the closeAllConnections() or closeDefaultConnections() methods.void
Close default connectionsjakarta.jms.Queue
createNewQueue
(String queueName) Creates a new Queue for tests that require more than the Queue.jakarta.jms.Topic
createNewTopic
(String topicName) Creates a new Topic for tests that require more than the Topic.void
doClientQueueTestCleanup
(ArrayList connections, ArrayList queues) Use this method at cleanup time to remove any connections and messages that have remained on the queue.void
Use this method at cleanup time to remove any messages that have remained on the queue.void
flushDestinationJMSContext Flush destination Queue using JMSContext Use this method at cleanup time to remove any messages that have remained on the queue.void
void
flushQueue
(ArrayList qToFlush) Use this method at cleanup time to remove any messages that have remained on the queue.jakarta.jms.ConnectionFactory
Default getter's for COMMON QUEUE or COMMON TOPIC created objectsjakarta.jms.Connection
jakarta.jms.MessageConsumer
jakarta.jms.Destination
jakarta.jms.MessageProducer
jakarta.jms.Queue
jakarta.jms.QueueConnection
jakarta.jms.QueueReceiver
jakarta.jms.QueueSender
jakarta.jms.QueueSession
jakarta.jms.Session
jakarta.jms.Topic
jakarta.jms.TopicConnection
jakarta.jms.TopicPublisher
jakarta.jms.TopicSession
jakarta.jms.TopicSubscriber
jakarta.jms.Connection
getNewConnection
(int type) Returns a new Connection for tests that require more than the default connection.jakarta.jms.Connection
getNewConnection
(int type, String username, String password) Returns a new Queue Connection for tests that require more than the default connection.jakarta.jms.Connection
getNewConnection
(int type, String username, String password, String lookup) Returns a new Topic Connection for tests that require more than the default connection.jakarta.jms.QueueConnectionFactory
Default getter's for QUEUE created objectsjakarta.jms.Destination
getQueueDestination
(String lookup) jakarta.jms.TopicConnectionFactory
Default getter's for TOPIC created objectsjakarta.jms.Destination
getTopicDestination
(String lookup) int
getType()
Return connection type (QUEUE or TOPIC)
-
Field Details
-
QUEUE
public static final int QUEUE- See Also:
-
TOPIC
public static final int TOPIC- See Also:
-
TX_QUEUE
public static final int TX_QUEUE- See Also:
-
TX_TOPIC
public static final int TX_TOPIC- See Also:
-
DURABLE_TOPIC
public static final int DURABLE_TOPIC- See Also:
-
DURABLE_TX_TOPIC
public static final int DURABLE_TX_TOPIC- See Also:
-
FACTORIES_ONLY
public static final int FACTORIES_ONLY- See Also:
-
QUEUE_FACTORY
public static final int QUEUE_FACTORY- See Also:
-
TOPIC_FACTORY
public static final int TOPIC_FACTORY- See Also:
-
DURABLE_TOPIC_FACTORY
public static final int DURABLE_TOPIC_FACTORY- See Also:
-
FACTORY_Q
public static final int FACTORY_Q- See Also:
-
FACTORY_T
public static final int FACTORY_T- See Also:
-
FACTORY_DT
public static final int FACTORY_DT- See Also:
-
COMMON_Q
public static final int COMMON_Q- See Also:
-
COMMON_T
public static final int COMMON_T- See Also:
-
COMMON_QTX
public static final int COMMON_QTX- See Also:
-
COMMON_TTX
public static final int COMMON_TTX- See Also:
-
COMMON_FACTORY
public static final int COMMON_FACTORY- See Also:
-
JMS_VERSION
- See Also:
-
JMS_MAJOR_VERSION
public static final int JMS_MAJOR_VERSION- See Also:
-
JMS_MINOR_VERSION
public static final int JMS_MINOR_VERSION- See Also:
-
TCKTESTQUEUENAME
- See Also:
-
TCKTESTTOPICNAME
- See Also:
-
TCKCONNECTIONFACTORY
- See Also:
-
TCKQUEUECONNECTIONFACTORY
- See Also:
-
TCKTOPICCONNECTIONFACTORY
- See Also:
-
TCKDURABLETOPICCONNECTIONFACTORY
- See Also:
-
TESTQUEUENAME
- See Also:
-
TESTTOPICNAME
- See Also:
-
CONNECTIONFACTORY
- See Also:
-
QUEUECONNECTIONFACTORY
- See Also:
-
TOPICCONNECTIONFACTORY
- See Also:
-
DURABLETOPICCONNECTIONFACTORY
- See Also:
-
JMSDEFAULT
- See Also:
-
-
Constructor Details
-
JmsTool
Public constructor. Takes a connection type and mode argument. Create connection factory, connection type, and single producer/consumer for either QUEUE or TOPIC client.- Parameters:
int
- type (QUEUE type or TOPIC type)String
- m (JakartaEE mode or Standalone mode)- Throws:
Exception
-
JmsTool
Public constructor. Takes connection type, username, password, jndi lookup name, and mode argument. Create connection factory, connection type, and single producer/consumer for TOPIC client.- Parameters:
int
- type (TOPIC type)String
- user (username)String
- pw (password)String
- lookup (connection factory to lookup)String
- m (JakartaEE mode or Standalone mode)- Throws:
Exception
-
JmsTool
Public constructor. Takes connection type, username, password, and mode argument. Create connection factory, connection type, and single producer/consumer for either QUEUE or TOPIC client. If just a FACTORY type is passed then just create the connection factory type.- Parameters:
int
- type (QUEUE type or TOPIC type or FACTORY type)String
- user (username)String
- pw (password)String
- m (JakartaEE mode or Standalone mode)- Throws:
Exception
-
-
Method Details
-
getConnectionFactory
Default getter's for COMMON QUEUE or COMMON TOPIC created objects- Throws:
Exception
-
getDefaultConnection
- Throws:
Exception
-
getDefaultSession
- Throws:
Exception
-
getDefaultProducer
- Throws:
Exception
-
getDefaultConsumer
- Throws:
Exception
-
getDefaultDestination
- Throws:
Exception
-
createNewTopic
Creates a new Topic for tests that require more than the Topic. The topic should be setup by the administrator- Parameters:
String
- the topic name- Throws:
Exception
-
createNewQueue
Creates a new Queue for tests that require more than the Queue. The queue should already be setup by the administrator- Parameters:
String
- the queue name- Throws:
Exception
-
closeAllResources
Close all resources created by JmsTool except connection resource which gets closed in the closeAllConnections() or closeDefaultConnections() methods.- Throws:
Exception
-
closeAllConnections
Close any connections opened by the tests- Throws:
Exception
- See Also:
-
is allowable to do a second call to close connection per the JMS Specification
-
closeDefaultConnections
Close default connections- Throws:
Exception
- See Also:
-
is allowable to do a second call to close connection per the JMS Specification
-
getQueueConnectionFactory
public jakarta.jms.QueueConnectionFactory getQueueConnectionFactory()Default getter's for QUEUE created objects -
getDefaultQueueConnection
public jakarta.jms.QueueConnection getDefaultQueueConnection() -
getDefaultQueueSession
public jakarta.jms.QueueSession getDefaultQueueSession() -
getDefaultQueueReceiver
public jakarta.jms.QueueReceiver getDefaultQueueReceiver() -
getDefaultQueueSender
public jakarta.jms.QueueSender getDefaultQueueSender() -
getDefaultQueue
public jakarta.jms.Queue getDefaultQueue() -
getQueueDestination
- Throws:
Exception
-
getTopicConnectionFactory
public jakarta.jms.TopicConnectionFactory getTopicConnectionFactory()Default getter's for TOPIC created objects -
getDefaultTopicConnection
public jakarta.jms.TopicConnection getDefaultTopicConnection() -
getDefaultTopicSession
public jakarta.jms.TopicSession getDefaultTopicSession() -
getDefaultTopicSubscriber
public jakarta.jms.TopicSubscriber getDefaultTopicSubscriber() -
getDefaultTopicPublisher
public jakarta.jms.TopicPublisher getDefaultTopicPublisher() -
getDefaultTopic
public jakarta.jms.Topic getDefaultTopic() -
getTopicDestination
- Throws:
Exception
-
doClientQueueTestCleanup
Use this method at cleanup time to remove any connections and messages that have remained on the queue.- Parameters:
ArrayList
- connections list of open connectionsArrayList
- queues list of queues to flush
-
flushDestination
Use this method at cleanup time to remove any messages that have remained on the queue.- Throws:
Exception
-
flushQueue
Use this method at cleanup time to remove any messages that have remained on the queue.- Parameters:
Queue
- qToFlush[] QUEUE- Throws:
Exception
-
flushQueue
- Throws:
Exception
-
getNewConnection
public jakarta.jms.Connection getNewConnection(int type, String username, String password) throws Exception Returns a new Queue Connection for tests that require more than the default connection. The returned Connection object must be explicitly cast into a QueueConnection.- Parameters:
int
- type (QUEUE type)- Returns:
- Connection from the default ConnectionFactory
- Throws:
Exception
-
getNewConnection
public jakarta.jms.Connection getNewConnection(int type, String username, String password, String lookup) throws Exception Returns a new Topic Connection for tests that require more than the default connection. The returned Connection object must be explicitly cast into a TopicConnection.- Parameters:
int
- type (TOPIC type)- Returns:
- Connection from the default ConnectionFactory
- Throws:
Exception
-
getNewConnection
Returns a new Connection for tests that require more than the default connection. The returned Connection object must be explicitly cast into a QueueConnection or TopicConnection.- Parameters:
int
- type (QUEUE type or TOPIC type)- Returns:
- Connection from the default Queue or Topic ConnectionFactory
- Throws:
Exception
-
getType
public int getType()Return connection type (QUEUE or TOPIC) -
flushDestinationJMSContext
flushDestinationJMSContext Flush destination Queue using JMSContext Use this method at cleanup time to remove any messages that have remained on the queue.- Throws:
Exception
-