KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mockobjects > jms > MockMessage


1 package com.mockobjects.jms;
2
3 import com.mockobjects.*;
4 import javax.jms.*;
5
6 public abstract class MockMessage extends MockObject implements Message {
7
8     protected ExpectationCounter myAcknowledgeCount =
9         new ExpectationCounter("MockMessage.acknowledge");
10     protected ExpectationValue myJMSReplyTo =
11         new ExpectationValue("MockMessage.setJMSReplyTo");
12     protected ExpectationCounter mySetJMSCorrelationIDCalls =
13         new ExpectationCounter("MockMessage.setJMSCorrelationID");
14
15     private JMSException myException;
16     /**
17     * Used for both messageID and correlationID
18     */

19     private final ReturnValue myJMSMessageID = new ReturnValue("messageID / correlationID");
20
21     public void acknowledge() throws JMSException {
22         myAcknowledgeCount.inc();
23     }
24
25     public void setExpectedAcknowledgeCalls(int calls) {
26         myAcknowledgeCount.setExpected(calls);
27     }
28
29     public void clearBody() {
30         notImplemented();
31     }
32
33     public void clearProperties() {
34         notImplemented();
35     }
36
37     public boolean getBooleanProperty(String JavaDoc name) {
38         notImplemented();
39         return false;
40     }
41
42     public byte getByteProperty(String JavaDoc name) {
43         notImplemented();
44         return 0;
45     }
46
47     public double getDoubleProperty(String JavaDoc name) {
48         notImplemented();
49         return 0;
50     }
51
52     public float getFloatProperty(String JavaDoc name) {
53         notImplemented();
54         return 0;
55     }
56
57     public int getIntProperty(String JavaDoc name) {
58         notImplemented();
59         return 0;
60     }
61
62     public String JavaDoc getJMSCorrelationID() {
63         return (String JavaDoc)myJMSMessageID.getValue();
64     }
65
66     public byte[] getJMSCorrelationIDAsBytes() {
67         notImplemented();
68         return null;
69     }
70
71     public int getJMSDeliveryMode() {
72         notImplemented();
73         return 0;
74     }
75
76     public Destination getJMSDestination() {
77         notImplemented();
78         return null;
79     }
80
81     public long getJMSExpiration() {
82         notImplemented();
83         return 0;
84     }
85
86     public String JavaDoc getJMSMessageID() {
87         return (String JavaDoc)myJMSMessageID.getValue();
88     }
89
90     public int getJMSPriority() {
91         notImplemented();
92         return 0;
93     }
94
95     public boolean getJMSRedelivered() {
96         notImplemented();
97         return false;
98     }
99
100     public Destination getJMSReplyTo() {
101         notImplemented();
102         return null;
103     }
104
105     public long getJMSTimestamp() {
106         notImplemented();
107         return 0;
108     }
109
110     public String JavaDoc getJMSType() {
111         notImplemented();
112         return null;
113     }
114
115     public long getLongProperty(String JavaDoc name) {
116         notImplemented();
117         return 0;
118     }
119
120     public Object JavaDoc getObjectProperty(String JavaDoc name) {
121         notImplemented();
122         return null;
123     }
124
125     public java.util.Enumeration JavaDoc getPropertyNames() {
126         notImplemented();
127         return null;
128     }
129
130     public short getShortProperty(String JavaDoc name) {
131         notImplemented();
132         return 0;
133     }
134
135     public String JavaDoc getStringProperty(String JavaDoc name) {
136         notImplemented();
137         return null;
138     }
139
140     public boolean propertyExists(String JavaDoc name) {
141         notImplemented();
142         return false;
143     }
144
145     public void setBooleanProperty(String JavaDoc name, boolean value) {
146         notImplemented();
147     }
148
149     public void setByteProperty(String JavaDoc name, byte value) {
150         notImplemented();
151     }
152
153     public void setDoubleProperty(String JavaDoc name, double value) {
154         notImplemented();
155     }
156
157     public void setFloatProperty(String JavaDoc name, float value) {
158         notImplemented();
159     }
160
161     public void setIntProperty(String JavaDoc name, int value) {
162         notImplemented();
163     }
164
165     public void setJMSCorrelationID(String JavaDoc jmsCorrelationID) {
166     mySetJMSCorrelationIDCalls.inc();
167     }
168
169     public void setJMSCorrelationIDAsBytes(byte[] correlationID) {
170         notImplemented();
171     }
172
173     public void setJMSDeliveryMode(int deliveryMode) {
174         notImplemented();
175     }
176
177     public void setJMSDestination(Destination destination) {
178         notImplemented();
179     }
180
181     public void setJMSExpiration(long expiration) {
182         notImplemented();
183     }
184
185     public void setJMSMessageID(String JavaDoc id) {
186         notImplemented();
187     }
188
189     public void setJMSPriority(int priority) {
190         notImplemented();
191     }
192
193     public void setJMSRedelivered(boolean redelivered) {
194         notImplemented();
195     }
196
197     public void setJMSReplyTo(Destination replyTo) throws JMSException {
198     throwExceptionIfAny();
199     myJMSReplyTo.setActual(replyTo);
200     }
201
202     public void setJMSTimestamp(long timestamp) {
203         notImplemented();
204     }
205
206     public void setJMSType(String JavaDoc type) {
207         notImplemented();
208     }
209
210     public void setLongProperty(String JavaDoc name, long value) {
211         notImplemented();
212     }
213
214     public void setObjectProperty(String JavaDoc name, Object JavaDoc value) {
215         notImplemented();
216     }
217
218     public void setShortProperty(String JavaDoc name, short value) {
219         notImplemented();
220     }
221
222     public void setStringProperty(String JavaDoc name, String JavaDoc value) {
223         notImplemented();
224     }
225
226     public void setExpectedJMSReplyTo(Destination expectedJMSReplyTo) {
227         myJMSReplyTo.setExpected(expectedJMSReplyTo);
228     }
229
230     public void setExpectedSetJMSCorrelationIDCalls(int callCount) {
231         mySetJMSCorrelationIDCalls.setExpected(callCount);
232     }
233
234     public void setupJMSMessageID(String JavaDoc jmsMessageID) {
235         myJMSMessageID.setValue(jmsMessageID);
236     }
237
238     public void setupThrowException(JMSException e) {
239         myException = e;
240     }
241
242     protected void throwExceptionIfAny() throws JMSException {
243         if (null != myException) {
244             throw myException;
245         }
246     }
247 }
248
249
Popular Tags