KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfox > jms > JMSConnectionFactoryTest


1 /* JFox, the OpenSource J2EE Application Server
2  *
3  * Distributable under GNU LGPL license by gun.org
4  * more details please visit http://www.huihoo.org/jfox
5  */

6
7 package org.jfox.jms;
8
9 import javax.jms.Connection JavaDoc;
10 import javax.naming.InitialContext JavaDoc;
11
12 import junit.framework.TestCase;
13
14 /**
15  * @author <a HREF="mailto:young_yy@hotmail.com">Young Yang</a>
16  */

17
18 public class JMSConnectionFactoryTest extends TestCase {
19     JMSConnectionFactory jmsConnectionFactory;
20
21     public void setUp() throws Exception JavaDoc {
22         super.setUp();
23         InitialContext JavaDoc ctx = new InitialContext JavaDoc();
24         Object JavaDoc cf = ctx.lookup("jms/defaultcf");
25         jmsConnectionFactory = (JMSConnectionFactory) javax.rmi.PortableRemoteObject.narrow(cf, JMSConnectionFactory.class);
26     }
27
28     public void tearDown() throws Exception JavaDoc {
29         super.tearDown();
30     }
31
32     public void testInstance() throws Exception JavaDoc {
33         System.out.println("toString: " + jmsConnectionFactory.toString());
34     }
35
36     public void testCreateConnection() throws Exception JavaDoc {
37         Connection JavaDoc conn = jmsConnectionFactory.createConnection();
38         System.out.println("create connection: " + conn);
39     }
40
41 }
42
Popular Tags