1 9 package org.jboss.test.remoting.lifecycle; 10 11 import org.jboss.remoting.InvalidConfigurationException; 12 import org.jboss.remoting.InvokerLocator; 13 import org.jboss.remoting.transport.Connector; 14 15 import junit.framework.TestCase; 16 17 20 public class InvokerLifecycleTestCase extends TestCase 21 { 22 public InvokerLifecycleTestCase(String name) 23 { 24 super(name); 25 } 26 27 public void testMultipleConnectors() throws Exception 28 { 29 InvokerLocator serverLocator = new InvokerLocator("socket://localhost:2222"); 30 Connector connector1 = new Connector(); 31 connector1.setInvokerLocator(serverLocator.getLocatorURI()); 32 connector1.start(); 33 34 Connector connector2 = new Connector(); 35 connector2.setInvokerLocator(serverLocator.getLocatorURI()); 36 37 try 38 { 39 connector2.start(); 40 } 41 catch(InvalidConfigurationException ice) 42 { 43 assertTrue("Got InvalidConfigurationException as expected.", true); 44 return; 45 } 46 finally 47 { 48 connector1.stop(); 49 connector2.stop(); 50 } 51 52 assertTrue("Did not get InvalidConfiguration which was NOT expected.", false); 53 } 54 55 public void testNonConcurrentConnectors() throws Exception 56 { 57 InvokerLocator serverLocator = new InvokerLocator("socket://localhost:2222"); 58 Connector connector1 = new Connector(); 59 connector1.setInvokerLocator(serverLocator.getLocatorURI()); 60 connector1.start(); 61 connector1.stop(); 62 63 Connector connector2 = new Connector(); 64 connector2.setInvokerLocator(serverLocator.getLocatorURI()); 65 66 try 67 { 68 connector2.start(); 69 } 70 catch(InvalidConfigurationException ice) 71 { 72 assertTrue("Got InvalidConfigurationException which was unexpected.", false); 73 return; 74 } 75 finally 76 { 77 connector2.stop(); 78 } 79 80 assertTrue("Did not get InvalidConfiguration which is as expected.", true); 81 82 } 83 } | Popular Tags |