org.apache.qpid.ping
Class PingAsyncTestPerf

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.PingAsyncTestPerf
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 PingAsyncTestPerf
extends PingTestPerf
implements org.apache.qpid.junit.extensions.TimingControllerAware

PingAsyncTestPerf 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 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 is less 'blocky' than the tests in PingTestPerf, and provides a truer simulation of sending and recieving clients working asynchronously.

CRC Card
Responsibilities Collaborations
Send many ping messages and output timings asynchronously on batches received.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.qpid.ping.PingTestPerf
PingTestPerf.PerThreadSetup
 
Field Summary
static int TEST_RESULTS_BATCH_SIZE_DEFAULT
          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
PingAsyncTestPerf(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 testAsyncPingOk(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

TEST_RESULTS_BATCH_SIZE_DEFAULT

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

See Also:
Constant Field Values
Constructor Detail

PingAsyncTestPerf

public PingAsyncTestPerf(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.

Returns:
The test suite to run. Should only contain testAsyncPingOk method.

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.

testAsyncPingOk

public void testAsyncPingOk(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 - pass all errors out to the test harness

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