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

java.lang.Object
  extended by org.apache.qpid.test.framework.CircuitEndBase
      extended by org.apache.qpid.test.framework.localcircuit.LocalPublisherImpl
All Implemented Interfaces:
CircuitEnd, Publisher
Direct Known Subclasses:
LocalAMQPPublisherImpl

public class LocalPublisherImpl
extends CircuitEndBase
implements Publisher

Provides an implementation of the Publisher interface and wraps a single message producer and consumer on a single controlSession, as a CircuitEnd. A local publisher 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 publisher received no exceptions.
Provide assertion that the publisher received a no consumers error code.
Provide assertion that the publisher received a no route error code.


Field Summary
protected  LocalCircuitImpl circuit
          Holds a reference to the containing circuit.
 
Constructor Summary
LocalPublisherImpl(CircuitEndBase end)
          Creates a circuit end point from the producer, consumer and controlSession in a circuit end base implementation.
LocalPublisherImpl(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 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 publisher got a given exception during the test.
 Assertion noExceptionsAssertion(org.apache.qpid.junit.extensions.util.ParsedProperties testProps)
          Provides an assertion that the publisher encountered no exceptions.
 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
 

Field Detail

circuit

protected LocalCircuitImpl circuit
Holds a reference to the containing circuit.

Constructor Detail

LocalPublisherImpl

public LocalPublisherImpl(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.

LocalPublisherImpl

public LocalPublisherImpl(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 publisher encountered no exceptions.

Specified by:
noExceptionsAssertion in interface Publisher
Parameters:
testProps -
Returns:
An assertion that the publisher 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 Publisher
Parameters:
testProps - The test configuration properties.
Returns:
An assertion that the AMQP channel was forcibly closed by an error condition.

exceptionAssertion

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

Specified by:
exceptionAssertion in interface Publisher
Parameters:
testProps - The test configuration properties.
exceptionClass - The exception class to check for.
Returns:
An assertion that the publisher 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