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

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
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
FanOutTestDecorator, InteropTestDecorator

public abstract class DistributedTestDecorator
extends org.apache.qpid.junit.extensions.WrappedSuiteTestDecorator

DistributedTestDecorator is a base class for writing test decorators that invite test clients to participate in distributed test cases. It provides a helper method, signupClients(org.apache.qpid.test.framework.FrameworkBaseCase), that broadcasts an invitation and returns the set of test clients that are available to particiapte in the test.

When used to wrap a FrameworkBaseCase test, it replaces the default CircuitFactory implementations with a suitable circuit factory for distributed tests. Concrete implementations can use this to configure the sending and receiving roles on the test.

CRC Card
Responsibilities Collaborations
Broadcast test invitations and collect enlists. ConversationFactory.


Field Summary
(package private)  Set<TestClientDetails> allClients
          Holds the contact information for all test clients that are available and that may take part in the test.
(package private)  Connection connection
          Holds the connection that the control conversation is held over.
protected  Destination controlTopic
          Holds the control topic, on which test invitations are broadcast.
(package private)  ConversationFactory conversationFactory
          Holds the conversation helper for the control level conversation for coordinating the test through.
(package private)  org.apache.qpid.junit.extensions.WrappedSuiteTestDecorator testSuite
          Holds the underlying test suite that this decorator wraps.
 
Fields inherited from class org.apache.qpid.junit.extensions.WrappedSuiteTestDecorator
suite
 
Fields inherited from class junit.extensions.TestDecorator
fTest
 
Constructor Summary
DistributedTestDecorator(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
abstract  CircuitFactory getTestSequencer()
          Should provide the distributed test sequencer to pass to FrameworkBaseCase tests.
abstract  void run(junit.framework.TestResult testResult)
          Should run all of the tests in the wrapped test suite.
protected  Set<TestClientDetails> signupClients(FrameworkBaseCase coordTest)
          Broadcasts an invitation to participate in a coordinating test case to find out what clients are available to run the test case.
 String toString()
          Prints a string summarizing this test decorator, mainly for debugging purposes.
 
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

allClients

Set<TestClientDetails> allClients
Holds the contact information for all test clients that are available and that may take part in the test.


conversationFactory

ConversationFactory conversationFactory
Holds the conversation helper for the control level conversation for coordinating the test through.


connection

Connection connection
Holds the connection that the control conversation is held over.


testSuite

org.apache.qpid.junit.extensions.WrappedSuiteTestDecorator testSuite
Holds the underlying test suite that this decorator wraps.


controlTopic

protected Destination controlTopic
Holds the control topic, on which test invitations are broadcast.

Constructor Detail

DistributedTestDecorator

public DistributedTestDecorator(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 abstract void run(junit.framework.TestResult testResult)
Should run all of the tests in the wrapped test suite.

Specified by:
run in interface junit.framework.Test
Overrides:
run in class junit.extensions.TestDecorator
Parameters:
testResult - The the results object to monitor the test results with.

getTestSequencer

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

Returns:
A distributed test sequencer.

signupClients

protected Set<TestClientDetails> signupClients(FrameworkBaseCase coordTest)
Broadcasts an invitation to participate in a coordinating test case to find out what clients are available to run the test case.

Parameters:
coordTest - The coordinating test case to broadcast an inviate for.
Returns:
A set of test clients that accepted the invitation.

toString

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

Overrides:
toString in class junit.extensions.TestDecorator
Returns:
String representation for debugging purposes.


Licensed to the Apache Software Foundation