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 or simply
050         * ignored while testing.
051         * @return <code>true</code> use message selectors,
052         *         <code>false</code> ignore message selectors
053         */
054        public boolean getUseMessageSelectors()
055        {
056            return useMessageSelectors;
057        }
058    
059        /**
060         * Set if message selectors should be used or simply
061         * ignored while testing. Default is <code>true</code>,
062         * i.e. message selectors are used. Message selector support
063         * of Mockrunner is based on a modified version of the
064         * selector parser of the open source JMS implementation
065         * ActiveMQ. It is a bit experimental at the moment. If there
066         * are problems with the parsing or if you don't need message
067         * selectors at all, turn them off. Disabling selector parsing also
068         * results in a better test performance.
069         * @param useMessageSelectors <code>true</code> use message selectors,
070         *                            <code>false</code> ignore message selectors
071         */
072        public void setUseMessageSelectors(boolean useMessageSelectors)
073        {
074            this.useMessageSelectors = useMessageSelectors;
075        }
076    }