org.osesb.objectpools.test
Class ThreadedKeyPooledJMSClientTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.osesb.utilities.junit.OSESBTestCase
              extended by org.osesb.utilities.junit.OSESBThreadedTestCase
                  extended by org.osesb.objectpools.test.ThreadedKeyPooledJMSClientTest
All Implemented Interfaces:
junit.framework.Test

public class ThreadedKeyPooledJMSClientTest
extends OSESBThreadedTestCase

Threaded JMSClientKeyedPoolFactory Test.

In Test.properties, uncomment the 'keyPooledJMSClientConfiguration' entry for the platform where the JMS Destinations are deployed.

Queues and Topics must be set up in the target JMS provider according to the JMS client configurations in the pool configuration file defined by the 'keyPooledJMSClientConfiguration' entry in Test.properties.

The testKeyPooledJMSClient() method exercises the sendXMLMessage() method of JMSQueueSender and JMSTopicPublisher, which are the pooled classes. In addition, setup() starts JMSQueueListener(s) and JMSTopicListener(s) to receive the messages on the configured Topics and Queues. The number of messages received by all listeners is reported by tearDown(). This value should be equal to the total number of messages sent as reported by testKeyPooledJMSClient() and both of these values should be equal to the numberOfTestThreads * numberOfIterations.

This test directly verifies the correct operation of the following components:

Collects performance statistics and reports average time to send messages across all threads in milliseconds.


Field Summary
 
Fields inherited from class org.osesb.utilities.junit.OSESBThreadedTestCase
numberOfIterations, numberOfTestThreads, threadDelay
 
Fields inherited from class org.osesb.utilities.junit.OSESBTestCase
configFile, log, reader, testDataDirectory, testProperties, thisClassName
 
Constructor Summary
ThreadedKeyPooledJMSClientTest(java.lang.String name)
          Construct a new instance.
 
Method Summary
static void main(java.lang.String[] args)
          The main method runs all the tests in the text ui
 void setUp()
          This method is called before a test is executed.
static junit.framework.Test suite()
          The suite method runs all the tests
 void tearDown()
          This method is called after a test is executed.
 void testKeyPooledJMSClient()
          Test key-pooled JMS clients.
 
Methods inherited from class org.osesb.utilities.junit.OSESBThreadedTestCase
displayStartupMessage
 
Methods inherited from class org.osesb.utilities.junit.OSESBTestCase
getBooleanTestProperty, getIntTestProperty, getLongTestProperty, getTestResourcesAsStreams, getTestResourcesAsText, getTestResourcesFiles, loadTestProperties, readTestFilesAsStreams
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ThreadedKeyPooledJMSClientTest

public ThreadedKeyPooledJMSClientTest(java.lang.String name)
Construct a new instance.

Ancestor constructors do the following:

  1. Instantiates a logging implementation.
  2. Instantiates an instance of ClassLoaderFileReader for reading test files from the ClassPath (not the file system).
  3. Loads Test.properties into ResourceBundle testProperties.
  4. Sets the testDataDirectory property using the testDataDirectory entry from Test.properties.
  5. Override standard values for numberOfTestThreads, numberOfIterations, and numberOfIterations from values in Test.properties.

Method Detail

suite

public static junit.framework.Test suite()
The suite method runs all the tests


setUp

public void setUp()
           throws java.lang.Exception
This method is called before a test is executed.

Overrides:
setUp in class OSESBTestCase
Throws:
java.lang.Exception

tearDown

public void tearDown()
              throws java.lang.Exception
This method is called after a test is executed.

Overrides:
tearDown in class OSESBTestCase
Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)
The main method runs all the tests in the text ui


testKeyPooledJMSClient

public void testKeyPooledJMSClient()
                            throws java.lang.Exception
Test key-pooled JMS clients.

Throws:
java.lang.Exception