1 22 package org.objectweb.petals.jbi.transport; 23 24 import java.util.concurrent.ArrayBlockingQueue ; 25 26 import javax.jms.Connection ; 27 import javax.jms.JMSException ; 28 import javax.jms.Session ; 29 import javax.naming.NamingException ; 30 31 import org.easymock.EasyMock; 32 33 import junit.framework.TestCase; 34 35 import org.objectweb.petals.jbi.transport.mock.MockInitialContext; 36 37 42 public class JoramConnectionTest extends TestCase { 43 44 protected MockInitialContext initialContext; 45 46 protected JoramConnection joramConnection; 47 48 public void setUp() throws NamingException { 49 initialContext = new MockInitialContext(); 50 joramConnection = new JoramConnection(1, 16200, "petals", "petals", "127.0.0.1", 51 initialContext); 52 } 53 343 public void testStop() throws JMSException , NamingException { 344 Session session = EasyMock.createMock(Session .class); 345 Connection conn= EasyMock.createMock(Connection .class); 346 347 session.close(); 348 conn.stop(); 349 350 EasyMock.replay(session); 351 EasyMock.replay(conn); 352 353 joramConnection.sessionsPool = new ArrayBlockingQueue <Session >(1); 354 joramConnection.session = session; 355 joramConnection.connection = conn; 356 joramConnection.stop(); 357 } 358 } 359 | Popular Tags |