Class JmsTool

java.lang.Object
com.sun.ts.tests.jms.common.JmsTool

public class JmsTool extends Object
  • Field Details

  • Constructor Details

    • JmsTool

      public JmsTool(int type, String m) throws Exception
      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 JmsTool(int type, String user, String pw, String lookup, String m) throws Exception
      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 JmsTool(int type, String user, String pw, String m) throws Exception
      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

      public jakarta.jms.ConnectionFactory getConnectionFactory() throws Exception
      Default getter's for COMMON QUEUE or COMMON TOPIC created objects
      Throws:
      Exception
    • getDefaultConnection

      public jakarta.jms.Connection getDefaultConnection() throws Exception
      Throws:
      Exception
    • getDefaultSession

      public jakarta.jms.Session getDefaultSession() throws Exception
      Throws:
      Exception
    • getDefaultProducer

      public jakarta.jms.MessageProducer getDefaultProducer() throws Exception
      Throws:
      Exception
    • getDefaultConsumer

      public jakarta.jms.MessageConsumer getDefaultConsumer() throws Exception
      Throws:
      Exception
    • getDefaultDestination

      public jakarta.jms.Destination getDefaultDestination() throws Exception
      Throws:
      Exception
    • createNewTopic

      public jakarta.jms.Topic createNewTopic(String topicName) throws Exception
      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

      public jakarta.jms.Queue createNewQueue(String queueName) throws Exception
      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

      public void closeAllResources() throws Exception
      Close all resources created by JmsTool except connection resource which gets closed in the closeAllConnections() or closeDefaultConnections() methods.
      Throws:
      Exception
    • closeAllConnections

      public void closeAllConnections(ArrayList connections) throws Exception
      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

      public void closeDefaultConnections() throws Exception
      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

      public jakarta.jms.Destination getQueueDestination(String lookup) throws Exception
      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

      public jakarta.jms.Destination getTopicDestination(String lookup) throws Exception
      Throws:
      Exception
    • doClientQueueTestCleanup

      public void doClientQueueTestCleanup(ArrayList connections, ArrayList queues)
      Use this method at cleanup time to remove any connections and messages that have remained on the queue.
      Parameters:
      ArrayList - connections list of open connections
      ArrayList - queues list of queues to flush
    • flushDestination

      public void flushDestination() throws Exception
      Use this method at cleanup time to remove any messages that have remained on the queue.
      Throws:
      Exception
    • flushQueue

      public void flushQueue(ArrayList qToFlush) throws Exception
      Use this method at cleanup time to remove any messages that have remained on the queue.
      Parameters:
      Queue - qToFlush[] QUEUE
      Throws:
      Exception
    • flushQueue

      public void flushQueue() throws Exception
      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

      public jakarta.jms.Connection getNewConnection(int type) throws Exception
      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

      public void flushDestinationJMSContext() throws Exception
      flushDestinationJMSContext Flush destination Queue using JMSContext Use this method at cleanup time to remove any messages that have remained on the queue.
      Throws:
      Exception