org.apache.qpid.test.testcases
Class MessageThroughputPerf

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.qpid.test.utils.QpidTestCase
              extended by org.apache.qpid.test.utils.QpidBrokerTestCase
                  extended by org.apache.qpid.test.framework.FrameworkBaseCase
                      extended by org.apache.qpid.test.testcases.MessageThroughputPerf
All Implemented Interfaces:
junit.framework.Test, org.apache.qpid.junit.extensions.SetupTaskAware, org.apache.qpid.junit.extensions.TestThreadAware, org.apache.qpid.junit.extensions.TimingControllerAware, org.apache.qpid.test.framework.BrokerLifecycleAware, org.apache.qpid.test.framework.FrameworkTestContext

public class MessageThroughputPerf
extends org.apache.qpid.test.framework.FrameworkBaseCase
implements org.apache.qpid.junit.extensions.TimingControllerAware, org.apache.qpid.junit.extensions.TestThreadAware

MessageThroughputPerf runs a test over a Circuit controlled by the test parameters. It logs timings of the time required to receive samples consisting of batches of messages.

CRC Card
Responsibilities Collaborations
Measure message throughput accross a test circuit. Circuit

Todo:
Check that all of the messages were sent. Check that the receiving end got the same number of messages as the publishing end., Set this up to run with zero sized tests. Size zero means send forever. Continuous sending to be interrupted by completion of the test duration, or shutdown hook when the user presses Ctrl-C.

Nested Class Summary
protected static class MessageThroughputPerf.PerThreadSetup
          Holds the per-thread test configurations.
 
Nested classes/interfaces inherited from class org.apache.qpid.test.utils.QpidBrokerTestCase
org.apache.qpid.test.utils.QpidBrokerTestCase.MessageType
 
Field Summary
(package private)  ThreadLocal<MessageThroughputPerf.PerThreadSetup> threadSetup
          Thread local to hold the per-thread test setup fields.
 
Fields inherited from class org.apache.qpid.test.utils.QpidBrokerTestCase
_broker, _brokerLanguage, _brokerLogPrefix, _brokerOutputStream, _brokerPersistent, _brokers, _configFile, _connectionFactory, _connections, _initialContext, _interleaveBrokerLog, _logger, _output, _outputFile, _testName, BROKER_READY, CONTENT, CPP, DEFAULT_MANAGEMENT_PORT, DEFAULT_MESSAGE_SIZE, DEFAULT_PORT, DEFAULT_SSL_PORT, DEFAULT_VM_PORT, EXTERNAL, INDEX, JAVA, LOGMONITOR_TIMEOUT, QPID_HOME, QpidHome, QUEUE, RECEIVE_TIMEOUT, TOPIC, VM
 
Fields inherited from class org.apache.qpid.test.utils.QpidTestCase
MEMORY_STORE_CLASS_NAME, MS_CLASS_NAME_KEY
 
Constructor Summary
MessageThroughputPerf(String name)
          Creates a new test case with the specified name.
 
Method Summary
 String getTestCaseNameForTestMethod(String methodName)
          Should provide a translation from the junit method name of a test to its test case name as known to the test clients that will run the test.
 void postThreadSetUp()
          Called after all threads have completed their setup.
 void setTimingController(org.apache.qpid.junit.extensions.TimingController controller)
          Used by test runners that can supply a TimingController to set the controller on an aware test.
protected  void setUp()
          Overrides the parent setUp method so that the in-vm broker creation is not done on a per test basis.
static junit.framework.Test suite()
          Compiles all the tests in this class into a suite.
protected  void tearDown()
          Overrides the parent setUp method so that the in-vm broker clean-up is not done on a per test basis.
 void testThroughput(int numMessages)
          Performs the a basic P2P test case.
 void threadSetUp()
          Performs test fixture creation on a per thread basis.
 void threadTearDown()
          Called when a test thread is destroyed.
 
Methods inherited from class org.apache.qpid.test.framework.FrameworkBaseCase
assertionList, assertionsToString, assertNoFailures, chainSetupTask, chainTearDownTask, getCircuitFactory, getFailureMechanism, getLiveBroker, getTaskHandler, getTestCaseVector, getTestParameters, getTestProps, setCircuitFactory, setFailureMechanism, setInVmBrokers, setLiveBroker, setTestProps, usingInVmBroker
 
Methods inherited from class org.apache.qpid.test.utils.QpidBrokerTestCase
cleanBroker, createMessage, createNextMessage, drainQueue, getBroker, getBrokerCommand, getClientConnection, getConfigurationStringProperty, getConnection, getConnection, getConnection, getConnectionFactory, getConnectionFactory, getConnectionURL, getInitialContext, getLogger, getManagementPort, getMessageSize, getPort, getPort, getTestConfigFile, getTestQueue, getTestQueueName, getTestVirtualhostsFile, isBroker010, isBroker08, isBrokerStorePersistent, isCppBroker, isExternalBroker, isJavaBroker, makeVirtualHostPersistent, reloadBrokerSecurityConfig, restartBroker, restartBroker, revertLoggingLevels, revertSystemProperties, runBare, saveTestConfiguration, saveTestVirtualhosts, sendMessage, sendMessage, sendMessage, setBrokerEnvironment, setBrokerOnlySystemProperty, setConfigurationProperty, setLoggerLevel, setMessageSize, setSystemProperty, setSystemProperty, setTestClientSystemProperty, startBroker, startBroker, stopBroker, stopBroker
 
Methods inherited from class org.apache.qpid.test.utils.QpidTestCase
getTestProfileMessageStoreClassName, run
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

threadSetup

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

Constructor Detail

MessageThroughputPerf

public MessageThroughputPerf(String name)
Creates a new test case with the specified name.

Parameters:
name - The test case name.
Method Detail

testThroughput

public void testThroughput(int numMessages)
Performs the a basic P2P test case.

Parameters:
numMessages - The number of messages to send in the test.

getTestCaseNameForTestMethod

public String getTestCaseNameForTestMethod(String methodName)
Should provide a translation from the junit method name of a test to its test case name as known to the test clients that will run the test. The purpose of this is to convert the JUnit method name into the correct test case name to place into the test invite. For example the method "testP2P" might map onto the interop test case name "TC2_BasicP2P".

Overrides:
getTestCaseNameForTestMethod in class org.apache.qpid.test.framework.FrameworkBaseCase
Parameters:
methodName - The name of the JUnit test method.
Returns:
The name of the corresponding interop test case.

setTimingController

public void setTimingController(org.apache.qpid.junit.extensions.TimingController controller)
Used by test runners that can supply a TimingController to set the controller on an aware test.

Specified by:
setTimingController in interface org.apache.qpid.junit.extensions.TimingControllerAware
Parameters:
controller - The timing controller.

setUp

protected void setUp()
              throws Exception
Overrides the parent setUp method so that the in-vm broker creation is not done on a per test basis.

Overrides:
setUp in class org.apache.qpid.test.framework.FrameworkBaseCase
Throws:
Exception - Any exceptions allowed to fall through and fail the test.

tearDown

protected void tearDown()
Overrides the parent setUp method so that the in-vm broker clean-up is not done on a per test basis.

Overrides:
tearDown in class org.apache.qpid.test.framework.FrameworkBaseCase

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()
Called when a test thread is destroyed.

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

suite

public static junit.framework.Test suite()
Compiles all the tests in this class into a suite.

Returns:
The test suite.


Licensed to the Apache Software Foundation