org.apache.qpid.ping
Class PingLatencyTestPerf

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
                  extended by org.apache.qpid.ping.PingLatencyTestPerf
All Implemented Interfaces:
junit.framework.Test, org.apache.qpid.junit.extensions.InstrumentedTest, org.apache.qpid.junit.extensions.TestThreadAware, org.apache.qpid.junit.extensions.TimingControllerAware

public class PingLatencyTestPerf
extends PingTestPerf
implements org.apache.qpid.junit.extensions.TimingControllerAware

PingLatencyTestPerf is a performance test that outputs multiple timings from its test method, using the timing controller interface supplied by the test runner from a seperate listener thread. It outputs round trip timings for individual ping messages rather than for how long a complete batch of messages took to process. It also differs from the PingTestPerf test that it extends because it can output timings as replies are received, rather than waiting until all expected replies are received.

This test does not output timings for every single ping message, as when running at high volume, writing the test log for a vast number of messages would slow the testing down. Instead samples ping latency occasionally. The frequency of ping sampling is set using the TEST_RESULTS_BATCH_SIZE_PROPNAME property, to override the default of every DEFAULT_TEST_RESULTS_BATCH_SIZE.

The size parameter logged for each individual ping is set to the size of the batch of messages that the individual timed ping was taken from, rather than 1 for a single message. This is so that the total throughput (messages / time) can be calculated in order to examine the relationship between throughput and latency.

CRC Card
Responsibilities Collaborations
Send many ping messages and output timings for sampled individual pings.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.qpid.ping.PingTestPerf
PingTestPerf.PerThreadSetup
 
Field Summary
static int DEFAULT_TEST_RESULTS_BATCH_SIZE
          Holds the default test results logging batch size.
static String TEST_RESULTS_BATCH_SIZE_PROPNAME
          Holds the name of the property to get the test results logging batch size.
 
Fields inherited from class org.apache.qpid.ping.PingTestPerf
testParameters, threadSetup
 
Constructor Summary
PingLatencyTestPerf(String name)
          Creates a new asynchronous ping performance test with the specified name.
 
Method Summary
 org.apache.qpid.junit.extensions.TimingController getTimingController()
          Gets the timing controller passed in by the test runner.
 void setTimingController(org.apache.qpid.junit.extensions.TimingController timingController)
          Accepts a timing controller from the test runner.
static junit.framework.Test suite()
          Compile all the tests into a test suite.
 void testPingLatency(int numPings)
          Sends the specified number of pings, asynchronously outputs timings on every batch boundary, and waits until all replies have been received or a time out occurs before exiting this method.
 void threadSetUp()
          Performs test fixture creation on a per thread basis.
 
Methods inherited from class org.apache.qpid.ping.PingTestPerf
postThreadSetUp, testPingOk, threadTearDown
 
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

TEST_RESULTS_BATCH_SIZE_PROPNAME

public static final String TEST_RESULTS_BATCH_SIZE_PROPNAME
Holds the name of the property to get the test results logging batch size.

See Also:
Constant Field Values

DEFAULT_TEST_RESULTS_BATCH_SIZE

public static final int DEFAULT_TEST_RESULTS_BATCH_SIZE
Holds the default test results logging batch size.

See Also:
Constant Field Values
Constructor Detail

PingLatencyTestPerf

public PingLatencyTestPerf(String name)
Creates a new asynchronous ping performance test with the specified name.

Parameters:
name - The test name.
Method Detail

suite

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


setTimingController

public void setTimingController(org.apache.qpid.junit.extensions.TimingController timingController)
Accepts a timing controller from the test runner.

Specified by:
setTimingController in interface org.apache.qpid.junit.extensions.TimingControllerAware
Parameters:
timingController - The timing controller to register mutliple timings with.

getTimingController

public org.apache.qpid.junit.extensions.TimingController getTimingController()
Gets the timing controller passed in by the test runner.

Returns:
The timing controller passed in by the test runner.

testPingLatency

public void testPingLatency(int numPings)
                     throws Exception
Sends the specified number of pings, asynchronously outputs timings on every batch boundary, and waits until all replies have been received or a time out occurs before exiting this method.

Parameters:
numPings - The number of pings to send.
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
Overrides:
threadSetUp in class PingTestPerf


Licensed to the Apache Software Foundation