com.mockrunner.mock.jms
Class MockDestination

java.lang.Object
  extended bycom.mockrunner.mock.jms.MockDestination
All Implemented Interfaces:
javax.jms.Destination
Direct Known Subclasses:
MockQueue, MockTopic

public abstract class MockDestination
extends java.lang.Object
implements javax.jms.Destination

Mock implementation of JMS Destination.


Constructor Summary
MockDestination()
           
 
Method Summary
protected  void acknowledgeMessage(javax.jms.Message message, MockSession session)
           
abstract  void addMessage(javax.jms.Message message)
          Adds a message.
 void addSession(javax.jms.Session session)
          Adds a Session.
 void clear()
          Clears all current messages.
protected  java.util.List currentMessageList()
           
 java.util.List getCurrentMessageList()
          Returns a List of all messages.
 javax.jms.Message getMatchingMessage(org.activemq.filter.mockrunner.Filter filter)
          Returns the next message that matches the filter.
 javax.jms.Message getMessage()
          Returns the next message.
 java.util.List getReceivedMessageList()
          Returns a List of all received messages.
 boolean isEmpty()
          Returns if this destination contains messages.
protected  java.util.List receivedMessageList()
           
 void reset()
          Clears all current messages and resets the list of received messages.
protected  java.util.Set sessionSet()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockDestination

public MockDestination()
Method Detail

addMessage

public abstract void addMessage(javax.jms.Message message)
                         throws javax.jms.JMSException
Adds a message. Implemented by MockQueue and MockTopic.

Throws:
javax.jms.JMSException

isEmpty

public boolean isEmpty()
Returns if this destination contains messages.

Returns:
false if there's at least one message, true otherwise

clear

public void clear()
Clears all current messages.


reset

public void reset()
Clears all current messages and resets the list of received messages.


getMessage

public javax.jms.Message getMessage()
Returns the next message. The message will be deleted. If there's no message null will be returned.

Returns:
the Message

getMatchingMessage

public javax.jms.Message getMatchingMessage(org.activemq.filter.mockrunner.Filter filter)
Returns the next message that matches the filter. The message will be deleted. If there's no matching message null will be returned.

Parameters:
filter - the message filter
Returns:
the Message

getCurrentMessageList

public java.util.List getCurrentMessageList()
Returns a List of all messages. No messages will be deleted.

Returns:
the List of messages

getReceivedMessageList

public java.util.List getReceivedMessageList()
Returns a List of all received messages.

Returns:
the List of messages

addSession

public void addSession(javax.jms.Session session)
Adds a Session.

Parameters:
session - the session

receivedMessageList

protected java.util.List receivedMessageList()

currentMessageList

protected java.util.List currentMessageList()

sessionSet

protected java.util.Set sessionSet()

acknowledgeMessage

protected void acknowledgeMessage(javax.jms.Message message,
                                  MockSession session)
                           throws javax.jms.JMSException
Throws:
javax.jms.JMSException