org.apache.qpid.test.framework
Interface Circuit

All Known Implementing Classes:
DistributedCircuitImpl, LocalCircuitImpl

public interface Circuit

A Circuit is the basic test unit against which test cases are to be written. A circuit consists of two 'ends', an instigating 'publisher' end and a more passive 'receivers' end.

Once created, the life-cycle of a circuit may be controlled by start()ing it, or close()ing it. Once started, the circuit is ready to send messages over. Once closed the circuit can no longer be used.

The state of the circuit may be taken with the check() method, and asserted against by the applyAssertions(java.util.List) method.

There is a default test procedure which may be performed against the circuit. The outline of this procedure is:

 Start the circuit.
 Send test messages.
 Request a status report.
 Assert conditions on the publishing end of the circuit.
 Assert conditions on the receiving end of the circuit.
 Close the circuit.
 Pass with no failed assertions or fail with a list of failed assertions.
 

CRC Card
Responsibilities
Supply the publishing and receiving ends of a test messaging circuit.
Start the circuit running.
Close the circuit down.
Take a reading of the circuits state.
Apply assertions against the circuits state.
Send test messages over the circuit.
Perform the default test procedue on the circuit.


Method Summary
 List<Assertion> applyAssertions(List<Assertion> assertions)
          Applied a list of assertions against the test circuit.
 void check()
          Checks the test circuit.
 void close()
          Closes the circuit.
 Publisher getPublisher()
          Gets the interface on the publishing end of the circuit.
 Receiver getReceiver()
          Gets the interface on the receiving end of the circuit.
 void start()
          Connects and starts the circuit.
 List<Assertion> test(int numMessages, List<Assertion> assertions)
          Runs the default test procedure against the circuit, and checks that all of the specified assertions hold.
 

Method Detail

getPublisher

Publisher getPublisher()
Gets the interface on the publishing end of the circuit.

Returns:
The publishing end of the circuit.

getReceiver

Receiver getReceiver()
Gets the interface on the receiving end of the circuit.

Returns:
The receiving end of the circuit.

start

void start()
Connects and starts the circuit. After this method is called the circuit is ready to send messages.


check

void check()
Checks the test circuit. The effect of this is to gather the circuits state, for both ends of the circuit, into a report, against which assertions may be checked.


close

void close()
Closes the circuit. All associated resources are closed.


applyAssertions

List<Assertion> applyAssertions(List<Assertion> assertions)
Applied a list of assertions against the test circuit. The check() method should be called before doing this, to ensure that the circuit has gathered its state into a report to assert against.

Parameters:
assertions - The list of assertions to apply to the circuit.
Returns:
Any assertions that failed.

test

List<Assertion> test(int numMessages,
                     List<Assertion> assertions)
Runs the default test procedure against the circuit, and checks that all of the specified assertions hold.

Parameters:
numMessages - The number of messages to send using the default test procedure.
assertions - The list of assertions to apply.
Returns:
Any assertions that failed.


Licensed to the Apache Software Foundation