01: package org.objectweb.celtix.bus.transports.jms;
02:
03: import javax.jms.Destination;
04: import javax.jms.MessageConsumer;
05: import javax.jms.MessageProducer;
06: import javax.jms.Session;
07:
08: import junit.framework.TestCase;
09:
10: import org.easymock.classextension.EasyMock;
11:
12: public class PooledSessionTest extends TestCase {
13:
14: public PooledSessionTest(String arg0) {
15: super (arg0);
16: }
17:
18: public static void main(String[] args) {
19: junit.textui.TestRunner.run(PooledSessionTest.class);
20: }
21:
22: public void testPooledSession() throws Exception {
23:
24: Session sess = EasyMock.createMock(Session.class);
25: Destination dest = EasyMock.createMock(Destination.class);
26: MessageProducer mproducer = EasyMock
27: .createMock(MessageProducer.class);
28: MessageConsumer mconsumer = EasyMock
29: .createMock(MessageConsumer.class);
30:
31: PooledSession ps = new PooledSession(sess, dest, mproducer,
32: mconsumer);
33:
34: assertTrue(ps.session().equals(sess));
35: assertTrue(ps.destination().equals(dest));
36: assertTrue(ps.consumer().equals(mconsumer));
37: assertTrue(ps.producer().equals(mproducer));
38:
39: MessageConsumer mcons = EasyMock
40: .createMock(MessageConsumer.class);
41: assertFalse(mconsumer.equals(mcons));
42:
43: ps.consumer(mcons);
44:
45: assertTrue(ps.consumer().equals(mcons));
46:
47: Destination mdest = EasyMock.createMock(Destination.class);
48: assertFalse(dest.equals(mdest));
49:
50: ps.destination(mdest);
51: assertTrue(mdest.equals(ps.destination()));
52: }
53: }
|