org.apache.qpid.sustained
Class SustainedClientTestCase

java.lang.Object
  extended by org.apache.qpid.interop.clienttestcases.TestCase3BasicPubSub
      extended by org.apache.qpid.sustained.SustainedClientTestCase
All Implemented Interfaces:
ExceptionListener, MessageListener, org.apache.qpid.test.framework.distributedtesting.TestClientControlledTest

public class SustainedClientTestCase
extends TestCase3BasicPubSub
implements ExceptionListener, MessageListener

Implements test case 3, basic pub/sub. Sends/received a specified number of messages to a specified route on the default topic exchange, using the specified number of receivers connections. Produces reports on the actual number of messages sent/received.

CRC Card
Responsibilities Collaborations
Supply the name of the test case that this implements.
Accept/Reject invites based on test parameters.
Adapt to assigned roles.
Send required number of test messages using pub/sub.
Generate test reports.


Nested Class Summary
(package private)  class SustainedClientTestCase.SustainedListener
          Inner class that listens for messages and sends a report for the time taken between receiving the 'start' and 'end' messages.
(package private)  class SustainedClientTestCase.SustainedRateAdapter
          This class is used here to adjust the _delay value which in turn is used to control the number of messages/second that are sent through the test system.
 
Nested classes/interfaces inherited from interface org.apache.qpid.test.framework.distributedtesting.TestClientControlledTest
org.apache.qpid.test.framework.distributedtesting.TestClientControlledTest.Roles
 
Field Summary
(package private)  int _batchSize
           
(package private)  SustainedClientTestCase.SustainedRateAdapter _rateAdapter
          Adapter that adjusts the send rate based on the updates from clients.
(package private)  MessageProducer producer
          The producer to send the test messages with.
 
Constructor Summary
SustainedClientTestCase()
           
 
Method Summary
 void assignRole(org.apache.qpid.test.framework.distributedtesting.TestClientControlledTest.Roles role, Message assignRoleMessage)
          Assigns the role to be played by this test case.
 String getName()
          Should provide the name of the test case that this class implements.
 Message getReport(Session session)
          Gets a report on the actions performed by the test case in its assigned role.
 void onException(JMSException jmsException)
           
 void start(int numMessages)
          Performs the test case actions.
 void terminate()
           
 
Methods inherited from class org.apache.qpid.interop.clienttestcases.TestCase3BasicPubSub
acceptInvite, onMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.jms.MessageListener
onMessage
 

Field Detail

producer

MessageProducer producer
The producer to send the test messages with.


_rateAdapter

SustainedClientTestCase.SustainedRateAdapter _rateAdapter
Adapter that adjusts the send rate based on the updates from clients.


_batchSize

int _batchSize
Constructor Detail

SustainedClientTestCase

public SustainedClientTestCase()
Method Detail

getName

public String getName()
Should provide the name of the test case that this class implements. The exact names are defined in the interop testing spec.

Specified by:
getName in interface org.apache.qpid.test.framework.distributedtesting.TestClientControlledTest
Overrides:
getName in class TestCase3BasicPubSub
Returns:
The name of the test case that this implements.

assignRole

public void assignRole(org.apache.qpid.test.framework.distributedtesting.TestClientControlledTest.Roles role,
                       Message assignRoleMessage)
                throws JMSException
Assigns the role to be played by this test case. The test parameters are fully specified in the assignment message. When this method return the test case will be ready to execute.

Specified by:
assignRole in interface org.apache.qpid.test.framework.distributedtesting.TestClientControlledTest
Overrides:
assignRole in class TestCase3BasicPubSub
Parameters:
role - The role to be played; sender or receivers.
assignRoleMessage - The role assingment message, contains the full test parameters.
Throws:
JMSException - Any JMSException resulting from reading the message are allowed to fall through.

start

public void start(int numMessages)
           throws JMSException
Performs the test case actions.

Specified by:
start in interface org.apache.qpid.test.framework.distributedtesting.TestClientControlledTest
Overrides:
start in class TestCase3BasicPubSub
Parameters:
numMessages -
Throws:
JMSException - Any JMSException resulting from reading the message are allowed to fall through.

terminate

public void terminate()
               throws JMSException,
                      InterruptedException
Throws:
JMSException
InterruptedException

getReport

public Message getReport(Session session)
                  throws JMSException
Gets a report on the actions performed by the test case in its assigned role.

Specified by:
getReport in interface org.apache.qpid.test.framework.distributedtesting.TestClientControlledTest
Overrides:
getReport in class TestCase3BasicPubSub
Parameters:
session - The controlSession to create the report message in.
Returns:
The report message.
Throws:
JMSException - Any JMSExceptions resulting from creating the report are allowed to fall through.

onException

public void onException(JMSException jmsException)
Specified by:
onException in interface ExceptionListener


Licensed to the Apache Software Foundation