org.apache.qpid.requestreply
Class PingPongTestPerf

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.qpid.junit.extensions.AsymptoticTestCase
              extended by org.apache.qpid.requestreply.PingPongTestPerf
All Implemented Interfaces:
junit.framework.Test, org.apache.qpid.junit.extensions.InstrumentedTest

public class PingPongTestPerf
extends org.apache.qpid.junit.extensions.AsymptoticTestCase

PingPongTestPerf is a full round trip ping test, that has been written with the intention of being scaled up to run many times simultaneously to simluate many clients/producer/connections. A full round trip ping sends a message from a producer to a conumer, then the consumer replies to the message on a temporary queue.

A single run of the test using the default JUnit test runner will result in the sending and timing of the number of pings specified by the test size and time how long it takes for all of these to complete. This test may be scaled up using a suitable JUnit test runner. See TKTestRunner for more information on how to do this.

The setup/teardown cycle establishes a connection to a broker and sets up a queue to send ping messages to and a temporary queue for replies. This setup is only established once for all the test repeats, but each test threads gets its own connection/producer/consumer, this is only re-established if the connection is lost.

The test cycle is: Connects to a queue, creates a temporary queue, creates messages containing a property that is the name of the temporary queue, fires off many messages on the original queue and waits for them all to come back on the temporary queue.

Configurable test properties: message size, transacted or not, persistent or not. Broker connection details.

CRC Card
Responsibilities Collaborations


Nested Class Summary
protected static class PingPongTestPerf.PerThreadSetup
           
 
Field Summary
(package private)  ThreadLocal<PingPongTestPerf.PerThreadSetup> threadSetup
          Thread local to hold the per-thread test setup fields.
 
Constructor Summary
PingPongTestPerf(String name)
           
 
Method Summary
static junit.framework.Test suite()
          Compile all the tests into a test suite.
 void testPingPongOk(int numPings)
           
 void threadSetUp()
          Performs test fixture creation on a per thread basis.
 void threadTearDown()
          Performs test fixture clean
 
Methods inherited from class org.apache.qpid.junit.extensions.AsymptoticTestCase
getN, getTestEndMemory, getTestStartMemory, getTestTime, reset, runTest, setN
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, setName, setUp, tearDown, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface junit.framework.Test
countTestCases, run
 

Field Detail

threadSetup

ThreadLocal<PingPongTestPerf.PerThreadSetup> threadSetup
Thread local to hold the per-thread test setup fields.

Constructor Detail

PingPongTestPerf

public PingPongTestPerf(String name)
Method Detail

suite

public static junit.framework.Test suite()
Compile all the tests into a test suite.


testPingPongOk

public void testPingPongOk(int numPings)
                    throws Exception
Throws:
Exception

threadSetUp

public void threadSetUp()
Performs test fixture creation on a per thread basis. This will only be called once for each test thread.


threadTearDown

public void threadTearDown()
Performs test fixture clean



Licensed to the Apache Software Foundation