org.apache.qpid.test.framework.localcircuit
Class LocalReceiverImpl

java.lang.Object
  extended by org.apache.qpid.test.framework.CircuitEndBase
      extended by org.apache.qpid.test.framework.localcircuit.LocalReceiverImpl
All Implemented Interfaces:
CircuitEnd, Receiver

public class LocalReceiverImpl
extends CircuitEndBase
implements Receiver

Provides an implementation of the Receiver interface that wraps a single message producer and consumer on a single controlSession, as a CircuitEnd. A local receiver also acts as a circuit end, because for a locally located circuit the assertions may be applied directly, there does not need to be any inter process messaging between the publisher and its single circuit end, in order to ascertain its status.

CRC Card
Responsibilities Collaborations
Provide a message producer for sending messages.
Provide a message consumer for receiving messages.
Provide assertion that the receivers received no exceptions.
Provide assertion that the receivers received all test messages sent to it.


Constructor Summary
LocalReceiverImpl(CircuitEndBase end)
          Creates a circuit end point from the producer, consumer and controlSession in a circuit end base implementation.
LocalReceiverImpl(MessageProducer producer, MessageConsumer consumer, Session session, MessageMonitor messageMonitor, ExceptionMonitor exceptionMonitor)
          Creates a circuit end point on the specified producer, consumer and controlSession.
 
Method Summary
 Assertion allMessagesReceivedAssertion(org.apache.qpid.junit.extensions.util.ParsedProperties testProps)
          Provides an assertion that the receivers got all messages that were sent to it.
 Assertion channelClosedAssertion(org.apache.qpid.junit.extensions.util.ParsedProperties testProps)
          Provides an assertion that the AMQP channel was forcibly closed by an error condition.
 Assertion exceptionAssertion(org.apache.qpid.junit.extensions.util.ParsedProperties testProps, Class<? extends Exception> exceptionClass)
          Provides an assertion that the receiver got a given exception during the test.
 Assertion noExceptionsAssertion(org.apache.qpid.junit.extensions.util.ParsedProperties testProps)
          Provides an assertion that the receivers encountered no exceptions.
 Assertion noMessagesReceivedAssertion(org.apache.qpid.junit.extensions.util.ParsedProperties testProps)
          Provides an assertion that the receivers got none of the messages that were sent to it.
 void setCircuit(LocalCircuitImpl circuit)
          Sets the contianing circuit.
 
Methods inherited from class org.apache.qpid.test.framework.CircuitEndBase
close, getConsumer, getExceptionMonitor, getMessageMonitor, getProducer, getSession, send
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalReceiverImpl

public LocalReceiverImpl(MessageProducer producer,
                         MessageConsumer consumer,
                         Session session,
                         MessageMonitor messageMonitor,
                         ExceptionMonitor exceptionMonitor)
Creates a circuit end point on the specified producer, consumer and controlSession. Monitors are also configured for messages and exceptions received by the circuit end.

Parameters:
producer - The message producer for the circuit end point.
consumer - The message consumer for the circuit end point.
session - The controlSession for the circuit end point.
messageMonitor - The monitor to notify of all messages received by the circuit end.
exceptionMonitor - The monitor to notify of all exceptions received by the circuit end.

LocalReceiverImpl

public LocalReceiverImpl(CircuitEndBase end)
Creates a circuit end point from the producer, consumer and controlSession in a circuit end base implementation.

Parameters:
end - The circuit end base implementation to take producers and consumers from.
Method Detail

noExceptionsAssertion

public Assertion noExceptionsAssertion(org.apache.qpid.junit.extensions.util.ParsedProperties testProps)
Provides an assertion that the receivers encountered no exceptions.

Specified by:
noExceptionsAssertion in interface Receiver
Parameters:
testProps - The test configuration properties.
Returns:
An assertion that the receivers encountered no exceptions.

channelClosedAssertion

public Assertion channelClosedAssertion(org.apache.qpid.junit.extensions.util.ParsedProperties testProps)
Provides an assertion that the AMQP channel was forcibly closed by an error condition.

Specified by:
channelClosedAssertion in interface Receiver
Parameters:
testProps - The test configuration properties.
Returns:
An assertion that the AMQP channel was forcibly closed by an error condition.

allMessagesReceivedAssertion

public Assertion allMessagesReceivedAssertion(org.apache.qpid.junit.extensions.util.ParsedProperties testProps)
Provides an assertion that the receivers got all messages that were sent to it.

Specified by:
allMessagesReceivedAssertion in interface Receiver
Parameters:
testProps - The test configuration properties.
Returns:
An assertion that the receivers got all messages that were sent to it.

noMessagesReceivedAssertion

public Assertion noMessagesReceivedAssertion(org.apache.qpid.junit.extensions.util.ParsedProperties testProps)
Provides an assertion that the receivers got none of the messages that were sent to it.

Specified by:
noMessagesReceivedAssertion in interface Receiver
Parameters:
testProps - The test configuration properties.
Returns:
An assertion that the receivers got none of the messages that were sent to it.

exceptionAssertion

public Assertion exceptionAssertion(org.apache.qpid.junit.extensions.util.ParsedProperties testProps,
                                    Class<? extends Exception> exceptionClass)
Provides an assertion that the receiver got a given exception during the test.

Specified by:
exceptionAssertion in interface Receiver
Parameters:
testProps - The test configuration properties.
exceptionClass - The exception class to check for. @return An assertion that the receiver got a given exception during the test.
Returns:
An assertion that the receiver got a given exception during the test.

setCircuit

public void setCircuit(LocalCircuitImpl circuit)
Sets the contianing circuit.

Parameters:
circuit - The containing circuit.


Licensed to the Apache Software Foundation