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