01: package com.mockrunner.mock.jms;
02:
03: import javax.jms.JMSException;
04: import javax.jms.QueueSession;
05: import javax.jms.ServerSession;
06: import javax.jms.Session;
07:
08: /**
09: * Mock implementation of JMS <code>ServerSession</code>.
10: * The <code>ServerSession</code> is not meant for application
11: * use.
12: */
13: public class MockServerSession implements ServerSession {
14: private MockConnection connection;
15: private Session session;
16: private boolean started;
17:
18: public MockServerSession(MockConnection connection) {
19: this .connection = connection;
20: session = new MockSession(connection, false,
21: QueueSession.AUTO_ACKNOWLEDGE);
22: started = false;
23: }
24:
25: /**
26: * Returns if this server session was started.
27: * @return <code>true</code> if this server session is started
28: */
29: public boolean isStarted() {
30: return started;
31: }
32:
33: public void setSession(Session session) {
34: this .session = session;
35: }
36:
37: public Session getSession() throws JMSException {
38: connection.throwJMSException();
39: return session;
40: }
41:
42: public void start() throws JMSException {
43: connection.throwJMSException();
44: started = true;
45: }
46: }
|