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