1 18 package org.apache.activemq; 19 20 import javax.jms.JMSException ; 21 import javax.jms.Session ; 22 23 import org.apache.activemq.ActiveMQConnection; 24 import org.apache.activemq.ActiveMQConnectionFactory; 25 26 import junit.framework.TestCase; 27 28 31 public class ConnectionCleanupTest extends TestCase { 32 33 private ActiveMQConnection connection; 34 35 protected void setUp() throws Exception { 36 ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("vm://localhost"); 37 connection = (ActiveMQConnection) factory.createConnection(); 38 } 39 40 43 protected void tearDown() throws Exception { 44 connection.close(); 45 } 46 47 50 public void testChangeClientID() throws JMSException { 51 52 connection.setClientID("test"); 53 Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); 54 55 try { 56 connection.setClientID("test"); 57 } catch ( JMSException e ) { 59 } 60 61 connection.cleanup(); 62 connection.setClientID("test"); 63 64 connection.createSession(false, Session.AUTO_ACKNOWLEDGE); 65 66 try { 67 connection.setClientID("test"); 68 } catch ( JMSException e ) { 70 } 71 } 72 73 } 74 | Popular Tags |