001    package com.mockrunner.mock.jms;
002    
003    import java.io.Serializable;
004    import java.util.Enumeration;
005    import java.util.Vector;
006    
007    import javax.jms.ConnectionMetaData;
008    import javax.jms.JMSException;
009    
010    /**
011     * Mock implementation of JMS <code>ConnectionMetaData</code>.
012     */
013    public class MockConnectionMetaData implements ConnectionMetaData, Serializable
014    {
015        private Vector properties;
016        private int jmsMajorVersion;
017        private int jmsMinorVersion;
018        private String jmsProviderName;
019        private String jmsVersion;
020        private int providerMajorVersion;
021        private int providerMinorVersion;
022        private String providerVersion;
023        
024        public MockConnectionMetaData()
025        {
026            properties = new Vector();
027            jmsMajorVersion = 1;
028            jmsMinorVersion = 1;
029            jmsProviderName = "Mockrunner";
030            jmsVersion = "1.1";
031            providerMajorVersion = 1;
032            providerMinorVersion = 0;
033            providerVersion = "1.0";
034        }
035        
036        public void addJMSXPropertyName(String name)
037        {
038            properties.add(name);
039        }
040        
041        public void setJMSMajorVersion(int jmsMajorVersion)
042        {
043            this.jmsMajorVersion = jmsMajorVersion;
044        }
045    
046        public void setJMSMinorVersion(int jmsMinorVersion)
047        {
048            this.jmsMinorVersion = jmsMinorVersion;
049        }
050        
051        public void setJMSProviderName(String jmsProviderName)
052        {
053            this.jmsProviderName = jmsProviderName;
054        }
055    
056        public void setJMSVersion(String jmsVersion)
057        {
058            this.jmsVersion =jmsVersion;
059        }
060        
061        public void setProviderMajorVersion(int providerMajorVersion)
062        {
063            this.providerMajorVersion = providerMajorVersion;
064        }
065    
066        public void setProviderMinorVersion(int providerMinorVersion)
067        {
068            this.providerMinorVersion = providerMinorVersion;
069        }
070    
071        public void setProviderVersion(String providerVersion)
072        {
073            this.providerVersion = providerVersion;
074        }
075        
076        public int getJMSMajorVersion() throws JMSException
077        {
078            return jmsMajorVersion;
079        }
080    
081        public int getJMSMinorVersion() throws JMSException
082        {
083            return jmsMinorVersion;
084        }
085    
086        public String getJMSProviderName() throws JMSException
087        {
088            return jmsProviderName;
089        }
090    
091        public String getJMSVersion() throws JMSException
092        {
093            return jmsVersion;
094        }
095    
096        public Enumeration getJMSXPropertyNames() throws JMSException
097        {
098            return properties.elements();
099        }
100    
101        public int getProviderMajorVersion() throws JMSException
102        {
103            return providerMajorVersion;
104        }
105    
106        public int getProviderMinorVersion() throws JMSException
107        {
108            return providerMinorVersion;
109        }
110    
111        public String getProviderVersion() throws JMSException
112        {
113            return providerVersion;
114        }
115    }