org.apache.qpid.interop.clienttestcases
Class TestCase3BasicPubSub

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

public class TestCase3BasicPubSub
extends Object
implements org.apache.qpid.test.framework.distributedtesting.TestClientControlledTest, 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
 
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)  MessageProducer producer
          The producer to send the test messages with.
 
Constructor Summary
TestCase3BasicPubSub()
           
 
Method Summary
 boolean acceptInvite(Message inviteMessage)
          Determines whether the test invite that matched this test case is acceptable.
 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 onMessage(Message message)
          Counts incoming test messages.
 void start(int numMessages)
          Performs the test case actions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

producer

MessageProducer producer
The producer to send the test messages with.

Constructor Detail

TestCase3BasicPubSub

public TestCase3BasicPubSub()
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
Returns:
The name of the test case that this implements.

acceptInvite

public boolean acceptInvite(Message inviteMessage)
                     throws JMSException
Determines whether the test invite that matched this test case is acceptable.

Specified by:
acceptInvite in interface org.apache.qpid.test.framework.distributedtesting.TestClientControlledTest
Parameters:
inviteMessage - The invitation to accept or reject.
Returns:
true to accept the invitation, false to reject it.
Throws:
JMSException - Any JMSException resulting from reading the message are allowed to fall through.

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
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. Returning from here, indicates that the sending role has completed its test.

Specified by:
start in interface org.apache.qpid.test.framework.distributedtesting.TestClientControlledTest
Parameters:
numMessages - The number of test messages to send.
Throws:
JMSException - Any JMSException resulting from reading the message are allowed to fall through.

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
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.

onMessage

public void onMessage(Message message)
Counts incoming test messages.

Specified by:
onMessage in interface MessageListener
Parameters:
message - The incoming test message.


Licensed to the Apache Software Foundation