org.mockejb.jms
Class MockTopic

java.lang.Object
  extended byorg.mockejb.jms.MockDestination
      extended byorg.mockejb.jms.MockTopic
All Implemented Interfaces:
javax.jms.Destination, javax.jms.Topic

public class MockTopic
extends org.mockejb.jms.MockDestination
implements javax.jms.Topic

Topic implementation.

Author:
Dimitar Gospodinov
See Also:
Topic

Constructor Summary
MockTopic(java.lang.String name)
          Creates MockTopic with the specified name name
 
Method Summary
 void addMessageListener(javax.jms.MessageListener listener)
           
 void clear()
          Removes all messages from this destination.
 void dispatch(javax.jms.Message msg)
           
 javax.jms.Message getMessageAt(int index)
          Retrieves message at index index.
 java.util.List getMessages()
          Retruns ordered List with all messages sent to this destination.
 java.lang.String getName()
          Returns this destination's name.
 java.lang.String getTopicName()
          Returns topic name.
 int size()
          Returns number of messages in this destination.
 java.lang.String toString()
          Returns string representation of this destination.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.jms.Topic
toString
 

Constructor Detail

MockTopic

public MockTopic(java.lang.String name)
Creates MockTopic with the specified name name

Parameters:
name -
Method Detail

getTopicName

public java.lang.String getTopicName()
                              throws javax.jms.JMSException
Returns topic name.

Specified by:
getTopicName in interface javax.jms.Topic
Returns:
topic name
Throws:
javax.jms.JMSException
See Also:
Topic.getTopicName()

addMessageListener

public void addMessageListener(javax.jms.MessageListener listener)

dispatch

public void dispatch(javax.jms.Message msg)

getName

public java.lang.String getName()
Returns this destination's name.


clear

public void clear()
Removes all messages from this destination.


toString

public java.lang.String toString()
Returns string representation of this destination.


size

public int size()
Returns number of messages in this destination.


getMessageAt

public javax.jms.Message getMessageAt(int index)
Retrieves message at index index.

Parameters:
index -

getMessages

public java.util.List getMessages()
Retruns ordered List with all messages sent to this destination. Higher priority messages appear first in the list.