org.apache.qpid.test.framework.distributedtesting
Class FanOutTestDecorator

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.extensions.TestDecorator
          extended by org.apache.qpid.junit.extensions.WrappedSuiteTestDecorator
              extended by org.apache.qpid.test.framework.distributedtesting.DistributedTestDecorator
                  extended by org.apache.qpid.test.framework.distributedtesting.FanOutTestDecorator
All Implemented Interfaces:
MessageListener, junit.framework.Test

public class FanOutTestDecorator
extends DistributedTestDecorator
implements MessageListener

FanOutTestDecorator is an DistributedTestDecorator that runs one test client in the sender role, and the remainder in the receivers role. It also has the capability to listen for new test cases joining the test beyond the initial start point. This feature can be usefull when experimenting with adding more load, in the form of more test clients, to assess its impact on a running test.

CRC Card
Responsibilities Collaborations
Execute coordinated test cases. FrameworkBaseCase
Accept test clients joining a running test.


Field Summary
(package private)  FrameworkBaseCase currentTest
          Holds the currently running test case.
 
Fields inherited from class org.apache.qpid.test.framework.distributedtesting.DistributedTestDecorator
allClients, connection, controlTopic, conversationFactory, testSuite
 
Fields inherited from class org.apache.qpid.junit.extensions.WrappedSuiteTestDecorator
suite
 
Fields inherited from class junit.extensions.TestDecorator
fTest
 
Constructor Summary
FanOutTestDecorator(org.apache.qpid.junit.extensions.WrappedSuiteTestDecorator suite, Set<TestClientDetails> availableClients, ConversationFactory controlConversation, Connection controlConnection)
          Creates a wrapped suite test decorator from another one.
 
Method Summary
 CircuitFactory getTestSequencer()
          Should provide the distributed test sequencer to pass to FrameworkBaseCase tests.
 void onMessage(Message message)
          Listens to incoming messages on the control topic.
 void run(junit.framework.TestResult testResult)
          Broadcasts a test invitation and accepts enlists from participating clients.
 String toString()
          Prints a string summarizing this test decorator, mainly for debugging purposes.
 
Methods inherited from class org.apache.qpid.test.framework.distributedtesting.DistributedTestDecorator
signupClients
 
Methods inherited from class org.apache.qpid.junit.extensions.WrappedSuiteTestDecorator
countTestCases, getAllUnderlyingTests, testAt
 
Methods inherited from class junit.extensions.TestDecorator
basicRun, getTest
 
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

currentTest

FrameworkBaseCase currentTest
Holds the currently running test case.

Constructor Detail

FanOutTestDecorator

public FanOutTestDecorator(org.apache.qpid.junit.extensions.WrappedSuiteTestDecorator suite,
                           Set<TestClientDetails> availableClients,
                           ConversationFactory controlConversation,
                           Connection controlConnection)
Creates a wrapped suite test decorator from another one.

Parameters:
suite - The test suite.
availableClients - The list of all clients that responded to the compulsory invite.
controlConversation - The conversation helper for the control level, test coordination conversation.
controlConnection - The connection that the coordination messages are sent over.
Method Detail

run

public void run(junit.framework.TestResult testResult)
Broadcasts a test invitation and accepts enlists from participating clients. The wrapped test cases are run with one test client in the sender role, and the remaining test clients in the receiving role.

Any JMSExceptions during the invite/enlist conversation will be allowed to fall through as runtime exceptions, resulting in the non-completion of the test run.

Specified by:
run in interface junit.framework.Test
Specified by:
run in class DistributedTestDecorator
Parameters:
testResult - The the results object to monitor the test results with.
Todo:
Better error recovery for failure of the invite/enlist conversation could be added.

getTestSequencer

public CircuitFactory getTestSequencer()
Should provide the distributed test sequencer to pass to FrameworkBaseCase tests.

Specified by:
getTestSequencer in class DistributedTestDecorator
Returns:
A distributed test sequencer.

onMessage

public void onMessage(Message message)
Listens to incoming messages on the control topic. If the messages are 'join' messages, signalling a new test client wishing to join the current test, then the new client will be added to the current test in the receivers role.

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

toString

public String toString()
Prints a string summarizing this test decorator, mainly for debugging purposes.

Overrides:
toString in class DistributedTestDecorator
Returns:
String representation for debugging purposes.


Licensed to the Apache Software Foundation