User: chirino Date: 01/12/29 09:42:02 Modified: src/main/org/jboss/test/jbossmq/test ConnectionUnitTestCase.java Log: Added a test to see if 10 back to back connections to the server caused any errors Revision Changes Path 1.3 +91 -69 jbosstest/src/main/org/jboss/test/jbossmq/test/ConnectionUnitTestCase.java Index: ConnectionUnitTestCase.java =================================================================== RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/jbossmq/test/ConnectionUnitTestCase.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ConnectionUnitTestCase.java 2001/11/11 00:18:39 1.2 +++ ConnectionUnitTestCase.java 2001/12/29 17:42:02 1.3 @@ -22,80 +22,102 @@ * established with JBossMQ * * @author [EMAIL PROTECTED] - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ */ public class ConnectionUnitTestCase extends JBossTestCase { - public ConnectionUnitTestCase(String name) { - super(name); - } + public ConnectionUnitTestCase(String name) { + super(name); + } - protected void setUp() throws Exception { - } + protected void setUp() throws Exception { + } - public void testOILConnectViaJNDI() throws Exception { - InitialContext ctx = new InitialContext(); - - QueueConnectionFactory cf = (QueueConnectionFactory)ctx.lookup("ConnectionFactory"); - QueueConnection c = cf.createQueueConnection(); - c.close(); - - XAQueueConnectionFactory xacf = (XAQueueConnectionFactory)ctx.lookup("XAConnectionFactory"); - XAQueueConnection xac = xacf.createXAQueueConnection(); - xac.close(); - } - - public void testOILConnectNoJNDI() throws Exception { - - Properties props = new Properties(); - props.setProperty(OILServerILFactory.SERVER_IL_FACTORY_KEY, OILServerILFactory.SERVER_IL_FACTORY); - props.setProperty(OILServerILFactory.CLIENT_IL_SERVICE_KEY, OILServerILFactory.CLIENT_IL_SERVICE); - props.setProperty(OILServerILFactory.PING_PERIOD_KEY, "1000"); - props.setProperty(OILServerILFactory.OIL_ADDRESS_KEY, "localhost"); - props.setProperty(OILServerILFactory.OIL_PORT_KEY, "8090"); - - QueueConnectionFactory cf = new SpyConnectionFactory(props); - QueueConnection c = cf.createQueueConnection(); - c.close(); - - XAQueueConnectionFactory xacf = new SpyXAConnectionFactory(props); - XAQueueConnection xac = xacf.createXAQueueConnection(); - xac.close(); - - } - - public void testUILConnectViaJNDI() throws Exception { - InitialContext ctx = new InitialContext(); - - QueueConnectionFactory cf = (QueueConnectionFactory)ctx.lookup("UILConnectionFactory"); - QueueConnection c = cf.createQueueConnection(); - c.close(); - - XAQueueConnectionFactory xacf = (XAQueueConnectionFactory)ctx.lookup("UILXAConnectionFactory"); - XAQueueConnection xac = xacf.createXAQueueConnection(); - xac.close(); - } - - public void testUILConnectNoJNDI() throws Exception { - - Properties props = new Properties(); - props.setProperty(UILServerILFactory.SERVER_IL_FACTORY_KEY, UILServerILFactory.SERVER_IL_FACTORY); - props.setProperty(UILServerILFactory.CLIENT_IL_SERVICE_KEY, UILServerILFactory.CLIENT_IL_SERVICE); - props.setProperty(UILServerILFactory.PING_PERIOD_KEY, "1000"); - props.setProperty(UILServerILFactory.UIL_ADDRESS_KEY, "localhost"); - props.setProperty(UILServerILFactory.UIL_PORT_KEY, "8091"); - - QueueConnectionFactory cf = new SpyConnectionFactory(props); - QueueConnection c = cf.createQueueConnection(); - c.close(); + public void testMultipleOILConnectViaJNDI() throws Exception { + + getLog().debug("Starting testMultipleOILConnectViaJNDI"); + + InitialContext ctx = new InitialContext(); + + QueueConnectionFactory cf = (QueueConnectionFactory) ctx.lookup("ConnectionFactory"); + + QueueConnection connections[] = new QueueConnection[10]; - XAQueueConnectionFactory xacf = new SpyXAConnectionFactory(props); - XAQueueConnection xac = xacf.createXAQueueConnection(); - xac.close(); - } + getLog().debug("Creating "+connections.length+" connections."); + for( int i=0; i < connections.length; i++ ) { + connections[i] = cf.createQueueConnection(); + } + + getLog().debug("Closing the connections."); + for( int i=0; i < connections.length; i++ ) { + connections[i].close(); + } + + getLog().debug("Finished testMultipleOILConnectViaJNDI"); + } + + public void testOILConnectViaJNDI() throws Exception { + InitialContext ctx = new InitialContext(); + + QueueConnectionFactory cf = (QueueConnectionFactory) ctx.lookup("ConnectionFactory"); + QueueConnection c = cf.createQueueConnection(); + c.close(); + + XAQueueConnectionFactory xacf = (XAQueueConnectionFactory) ctx.lookup("XAConnectionFactory"); + XAQueueConnection xac = xacf.createXAQueueConnection(); + xac.close(); + } + + public void testOILConnectNoJNDI() throws Exception { + + Properties props = new Properties(); + props.setProperty(OILServerILFactory.SERVER_IL_FACTORY_KEY, OILServerILFactory.SERVER_IL_FACTORY); + props.setProperty(OILServerILFactory.CLIENT_IL_SERVICE_KEY, OILServerILFactory.CLIENT_IL_SERVICE); + props.setProperty(OILServerILFactory.PING_PERIOD_KEY, "1000"); + props.setProperty(OILServerILFactory.OIL_ADDRESS_KEY, "localhost"); + props.setProperty(OILServerILFactory.OIL_PORT_KEY, "8090"); + + QueueConnectionFactory cf = new SpyConnectionFactory(props); + QueueConnection c = cf.createQueueConnection(); + c.close(); + + XAQueueConnectionFactory xacf = new SpyXAConnectionFactory(props); + XAQueueConnection xac = xacf.createXAQueueConnection(); + xac.close(); + + } + + public void testUILConnectViaJNDI() throws Exception { + InitialContext ctx = new InitialContext(); + + QueueConnectionFactory cf = (QueueConnectionFactory) ctx.lookup("UILConnectionFactory"); + QueueConnection c = cf.createQueueConnection(); + c.close(); + + XAQueueConnectionFactory xacf = (XAQueueConnectionFactory) ctx.lookup("UILXAConnectionFactory"); + XAQueueConnection xac = xacf.createXAQueueConnection(); + xac.close(); + } + + public void testUILConnectNoJNDI() throws Exception { + + Properties props = new Properties(); + props.setProperty(UILServerILFactory.SERVER_IL_FACTORY_KEY, UILServerILFactory.SERVER_IL_FACTORY); + props.setProperty(UILServerILFactory.CLIENT_IL_SERVICE_KEY, UILServerILFactory.CLIENT_IL_SERVICE); + props.setProperty(UILServerILFactory.PING_PERIOD_KEY, "1000"); + props.setProperty(UILServerILFactory.UIL_ADDRESS_KEY, "localhost"); + props.setProperty(UILServerILFactory.UIL_PORT_KEY, "8091"); + + QueueConnectionFactory cf = new SpyConnectionFactory(props); + QueueConnection c = cf.createQueueConnection(); + c.close(); + XAQueueConnectionFactory xacf = new SpyXAConnectionFactory(props); + XAQueueConnection xac = xacf.createXAQueueConnection(); + xac.close(); + } - public static void main(java.lang.String[] args) { - junit.textui.TestRunner.run(ConnectionUnitTestCase.class); - } -} + public static void main(java.lang.String[] args) { + junit.textui.TestRunner.run(ConnectionUnitTestCase.class); + } +} \ No newline at end of file
_______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development