org.apache.qpid.ping
Class PingTestPerf

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.ping.PingTestPerf
All Implemented Interfaces:
junit.framework.Test, org.apache.qpid.junit.extensions.InstrumentedTest, org.apache.qpid.junit.extensions.TestThreadAware
Direct Known Subclasses:
PingAsyncTestPerf, PingLatencyTestPerf

public class PingTestPerf
extends org.apache.qpid.junit.extensions.AsymptoticTestCase
implements org.apache.qpid.junit.extensions.TestThreadAware

PingTestPerf is a ping test, that has been written with the intention of being scaled up to run many times simultaneously to simluate many clients/producers/connections.

A single run of the test using the default JUnit test runner will result in the sending and timing of a single full round trip ping. This test may be scaled up using a suitable JUnit test runner.

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/threads that may be run, except if the connection is lost in which case an attempt to re-establish the setup is made.

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 a message on the original queue and waits for a response 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 PingTestPerf.PerThreadSetup
           
 
Field Summary
protected  org.apache.qpid.junit.extensions.util.ParsedProperties testParameters
          Holds a property reader to extract the test parameters from.
(package private)  ThreadLocal<PingTestPerf.PerThreadSetup> threadSetup
          Thread local to hold the per-thread test setup fields.
 
Constructor Summary
PingTestPerf(String name)
           
 
Method Summary
 void postThreadSetUp()
          Called after all threads have completed their setup.
static junit.framework.Test suite()
          Compile all the tests into a test suite.
 void testPingOk(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<PingTestPerf.PerThreadSetup> threadSetup
Thread local to hold the per-thread test setup fields.


testParameters

protected org.apache.qpid.junit.extensions.util.ParsedProperties testParameters
Holds a property reader to extract the test parameters from.

Constructor Detail

PingTestPerf

public PingTestPerf(String name)
Method Detail

suite

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

Returns:
The test method testPingOk.

testPingOk

public void testPingOk(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.

Specified by:
threadSetUp in interface org.apache.qpid.junit.extensions.TestThreadAware

postThreadSetUp

public void postThreadSetUp()
Called after all threads have completed their setup.

Specified by:
postThreadSetUp in interface org.apache.qpid.junit.extensions.TestThreadAware

threadTearDown

public void threadTearDown()
Performs test fixture clean

Specified by:
threadTearDown in interface org.apache.qpid.junit.extensions.TestThreadAware


Licensed to the Apache Software Foundation