001 package com.mockrunner.jms;
002
003 import java.io.Serializable;
004
005 /**
006 * The <code>ConfigurationManager</code> is used
007 * for global settings of the JMS test framework.
008 */
009 public class ConfigurationManager implements Serializable
010 {
011 private boolean doCloneOnSend;
012 private boolean useMessageSelectors;
013
014 public ConfigurationManager()
015 {
016 doCloneOnSend = false;
017 useMessageSelectors = true;
018 }
019
020 /**
021 * Get the clone on send flag, see {@link #setDoCloneOnSend}
022 * for a description of this option.
023 * @return the clone on send flag
024 */
025 public boolean getDoCloneOnSend()
026 {
027 return doCloneOnSend;
028 }
029
030 /**
031 * Set if a message should be cloned before sending it.
032 * Default is <code>false</code>, i.e. the message is not
033 * cloned. This has the advantage that the sent message can
034 * be examined afterwards (e.g. if it is acknowledged).
035 * If you set this to <code>true</code>, the message will
036 * be cloned, i.e. the sent message will not be altered
037 * and you have to obtain the received message in order
038 * to examine it. However, the <code>true</code> option
039 * is closer to a real JMS server, where you can send
040 * the same message multiple times and the messages do
041 * not influence each other.
042 * @param doCloneOnSend the clone on send flag,
043 * default is <code>false</code>
044 */
045 public void setDoCloneOnSend(boolean doCloneOnSend)
046 {
047 this.doCloneOnSend = doCloneOnSend;
048 }
049
050 /**
051 * Get if message selectors should be used.
052 * @return <code>true</code> use message selectors,
053 * <code>false</code> ignore message selectors
054 */
055 public boolean getUseMessageSelectors()
056 {
057 return useMessageSelectors;
058 }
059
060 /**
061 * Set if message selectors should be used or simply
062 * ignored while testing. Default is <code>true</code>,
063 * i.e. message selectors are used. Message selector support
064 * of Mockrunner is based on a modified version of the
065 * selector parser of the open source JMS implementation
066 * ActiveMQ. It is a bit experimental at the moment. If there
067 * are problems with the parsing or if you don't need message
068 * selectors at all, turn them off. Disabling selector parsing also
069 * results in a better test performance.
070 * @param useMessageSelectors <code>true</code> use message selectors,
071 * <code>false</code> ignore message selectors
072 */
073 public void setUseMessageSelectors(boolean useMessageSelectors)
074 {
075 this.useMessageSelectors = useMessageSelectors;
076 }
077 }