[jboss-cvs] JBoss Messaging SVN: r3444 - in branches/Branch_JBMESSAGING-544: src/main/org/jboss/jms/client/remoting and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Dec 7 07:13:13 EST 2007


Author: jmesnil
Date: 2007-12-07 07:13:13 -0500 (Fri, 07 Dec 2007)
New Revision: 3444

Added:
   branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/MinaServiceWrapper.java
   branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/MinaServiceWrapperMBean.java
   branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/PortUtil.java
Removed:
   branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/RemotingJMXWrapper.java
   branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/RemotingJMXWrapperMBean.java
Modified:
   branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/client/delegate/ClientClusteredConnectionFactoryDelegate.java
   branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java
   branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java
   branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/server/ConnectionFactoryManager.java
   branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java
   branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java
   branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/core/remoting/wireformat/PacketTypeTest.java
   branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java
   branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
   branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
   branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java
   branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/Server.java
   branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/ServiceContainer.java
Log:
http://jira.jboss.org/jira/browse/JBMESSAGING-544 Replace client-server transport with NIO based transport
* removed unused classes specific to JBoss Remoting

Modified: branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/client/delegate/ClientClusteredConnectionFactoryDelegate.java
===================================================================
--- branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/client/delegate/ClientClusteredConnectionFactoryDelegate.java	2007-12-07 11:23:37 UTC (rev 3443)
+++ branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/client/delegate/ClientClusteredConnectionFactoryDelegate.java	2007-12-07 12:13:13 UTC (rev 3444)
@@ -96,11 +96,14 @@
       {
          if (trace) log.trace("Closing current callback");
          closeCallback();
-
+         
          if (trace) log.trace("Trying communication on server(" + server + ")=" + delegates[server].getServerLocatorURI());
          try
          {
-            remoting = new JMSRemotingConnection(delegates[server].getServerLocatorURI(), delegates[server].getStrictTck());
+            String serverHost = delegates[server].getServerHost();
+            int serverPort = delegates[server].getServerPort();
+            
+            remoting = new JMSRemotingConnection(serverHost, serverPort, delegates[server].getStrictTck());
             remoting.start();
             currentDelegate = delegates[server];
             if (trace) log.trace("Adding callback");

Modified: branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java
===================================================================
--- branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java	2007-12-07 11:23:37 UTC (rev 3443)
+++ branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java	2007-12-07 12:13:13 UTC (rev 3444)
@@ -41,7 +41,6 @@
 import org.jboss.messaging.core.remoting.wireformat.GetClientAOPStackRequest;
 import org.jboss.messaging.core.remoting.wireformat.GetClientAOPStackResponse;
 import org.jboss.messaging.util.Version;
-import org.jboss.remoting.InvokerLocator;
 
 /**
  * The client-side ConnectionFactory delegate class.
@@ -67,8 +66,10 @@
 
    private String uniqueName;
 
-   private String serverLocatorURI;
+   private String serverHost;
 
+   private int serverPort;
+
    private Version serverVersion;
  
    private int serverID;
@@ -105,14 +106,15 @@
 
    // Constructors ---------------------------------------------------------------------------------
 
-   public ClientConnectionFactoryDelegate(String uniqueName, String objectID, int serverID, String serverLocatorURI,
-                                          Version serverVersion, boolean clientPing, boolean strictTck)
+   public ClientConnectionFactoryDelegate(String uniqueName, String objectID, int serverID, String host,
+                                          int port, Version serverVersion, boolean clientPing, boolean strictTck)
    {
       super(objectID);
 
       this.uniqueName = uniqueName;
       this.serverID = serverID;
-      this.serverLocatorURI = serverLocatorURI;
+      this.serverHost = host;
+      this.serverPort = port;
       this.serverVersion = serverVersion;
       this.clientPing = clientPing;
       this.strictTck = strictTck;
@@ -149,7 +151,7 @@
       
       try
       {
-         remotingConnection = new JMSRemotingConnection(serverLocatorURI, strictTck);
+         remotingConnection = new JMSRemotingConnection(serverHost, serverPort, strictTck);
        
          remotingConnection.start();
          client = remotingConnection.getRemotingClient();
@@ -231,11 +233,22 @@
       return "ConnectionFactoryDelegate[" + id + ", SID=" + serverID + "]";
    }
    
+   public String getServerHost()
+   {
+      return serverHost;
+   }
+   
+   public int getServerPort()
+   {
+      return serverPort;
+   }
+   
    public String getServerLocatorURI()
    {
-      return serverLocatorURI;
+      return "tcp://" + serverHost + ":" + serverPort;
    }
 
+   
    public int getServerID()
    {
       return serverID;
@@ -275,9 +288,8 @@
       
       try
       {
-         InvokerLocator locator = new InvokerLocator(serverLocatorURI);
          client = new Client();
-         client.connect(locator.getHost(), locator.getPort() + 1000, TCP);
+         client.connect(serverHost, serverPort, TCP);
       }
       catch (Exception e)
       {
@@ -293,7 +305,9 @@
    {      
       super.read(in);
       
-      serverLocatorURI = in.readUTF();
+      serverHost = in.readUTF();
+
+      serverPort = in.readInt();
       
       serverVersion = new Version();
       
@@ -310,7 +324,9 @@
    {
       super.write(out);
       
-      out.writeUTF(serverLocatorURI);
+      out.writeUTF(serverHost);
+
+      out.writeInt(serverPort);
       
       serverVersion.write(out);
       

Modified: branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java
===================================================================
--- branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java	2007-12-07 11:23:37 UTC (rev 3443)
+++ branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java	2007-12-07 12:13:13 UTC (rev 3444)
@@ -24,7 +24,6 @@
 import org.jboss.logging.Logger;
 import org.jboss.messaging.core.remoting.Client;
 import org.jboss.messaging.core.remoting.TransportType;
-import org.jboss.remoting.InvokerLocator;
 
 /**
  * Encapsulates the state and behaviour from MINA needed for a JMS connection.
@@ -47,8 +46,12 @@
 
    // Attributes -----------------------------------------------------------------------------------
 
+   private String serverHost;
+
+   private int serverPort;
+
    private Client client;
-   private InvokerLocator serverLocator;
+
    private CallbackManager callbackManager;
    private boolean strictTck;
 
@@ -59,11 +62,13 @@
    // explicitly remove it from the remoting client
    private ConsolidatedRemotingConnectionListener remotingConnectionListener;
 
+
    // Constructors ---------------------------------------------------------------------------------
 
-   public JMSRemotingConnection(String serverLocatorURI, boolean strictTck) throws Exception
+   public JMSRemotingConnection(String serverHost, int serverPort, boolean strictTck) throws Exception
    {
-      serverLocator = new InvokerLocator(serverLocatorURI);
+      this.serverHost = serverHost;
+      this.serverPort = serverPort;
       this.strictTck = strictTck;
 
       log.trace(this + " created");
@@ -78,7 +83,7 @@
       callbackManager = new CallbackManager();
 
       client = new Client();
-      client.connect(serverLocator.getHost(), serverLocator.getPort() + 1000, TransportType.TCP);
+      client.connect(serverHost, serverPort, TransportType.TCP);
 
       log.trace(this + " started");
    }
@@ -175,7 +180,7 @@
 
    public String toString()
    {
-      return "JMSRemotingConnection[" + serverLocator.getLocatorURI() + "]";
+      return "JMSRemotingConnection[" + serverHost + ":" + serverPort + "]";
    }
 
    // Package protected ----------------------------------------------------------------------------

Modified: branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/server/ConnectionFactoryManager.java
===================================================================
--- branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/server/ConnectionFactoryManager.java	2007-12-07 11:23:37 UTC (rev 3443)
+++ branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/server/ConnectionFactoryManager.java	2007-12-07 12:13:13 UTC (rev 3444)
@@ -39,7 +39,7 @@
     *        AOP subsystem, but not bound in JNDI.
     */
    void registerConnectionFactory(String uniqueName, String clientID, JNDIBindings jndiBindings,
-                                 String locatorURI, boolean clientPing,
+                                 String host, int port, boolean clientPing,
                                  int prefetchSize,
                                  boolean slowConsumers,
                                  int defaultTempQueueFullSize,

Modified: branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java
===================================================================
--- branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java	2007-12-07 11:23:37 UTC (rev 3443)
+++ branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactory.java	2007-12-07 12:13:13 UTC (rev 3444)
@@ -17,7 +17,6 @@
 import org.jboss.jms.server.ServerPeer;
 import org.jboss.messaging.util.ExceptionUtil;
 import org.jboss.messaging.util.JMXAccessor;
-import org.jboss.remoting.InvokerLocator;
 import org.jboss.system.ServiceMBeanSupport;
 import org.w3c.dom.Element;
 
@@ -117,7 +116,8 @@
                                                "each Connection Factory");
          }
       
-         String locatorURI = (String)JMXAccessor.getJMXAttributeOverSecurity(server, connectorObjectName, "InvokerLocator");
+         String host = (String)JMXAccessor.getJMXAttributeOverSecurity(server, connectorObjectName, "Host");
+         int port = ((Integer)JMXAccessor.getJMXAttributeOverSecurity(server, connectorObjectName, "Port")).intValue();
 
          ServerPeer serverPeer = (ServerPeer)JMXAccessor.getJMXAttributeOverSecurity(server, serverPeerObjectName, "Instance");
 
@@ -126,56 +126,6 @@
             this.supportsFailover = false;
          }
          
-         InvokerLocator locator = new InvokerLocator(locatorURI);
-         
-         String protocol = locator.getProtocol();
-         
-         if (!disableRemotingChecks && (protocol.equals("bisocket") || protocol.equals("sslbisocket")))
-         {         
-	         //Sanity check - If users are using the AS Service Binding Manager to provide the remoting connector
-	         //configuration, it is quite easy for them to end up using an old version depending on what version on 
-	         //the AS they are running in - e.g. if they have forgotten to update it.
-	         //This can lead to subtle errors - therefore we do a sanity check by checking the existence of some properties
-	         //which should always be there
-	         Map params = locator.getParameters();	         
-	         
-	         //The "compulsory" parameters
-	         boolean cont =
-	         	checkParam(params, "marshaller", "org.jboss.jms.wireformat.JMSWireFormat") &&	         		
-		         checkParam(params, "unmarshaller", "org.jboss.jms.wireformat.JMSWireFormat") &&
-		         checkParam(params, "dataType", "jms") &&
-		         checkParam(params, "timeout", "0") &&
-		         checkParam(params, "clientSocketClass", "org.jboss.jms.client.remoting.ClientSocketWrapper") &&
-		         checkParam(params, "numberOfCallRetries", "1") &&
-		         checkParam(params, "pingFrequency", "214748364") &&
-		         checkParam(params, "pingWindowFactor", "10");
-	         
-	         if (!cont)
-	         {
-	         	throw new IllegalArgumentException("Failed to deploy connection factory since remoting configuration seems incorrect.");	         			                            
-	         }
-
-	         String val = (String)params.get("clientLeasePeriod");	  
-	         if (val != null)
-	         {
-		         int i = Integer.parseInt(val);
-		         if (i < 5000)
-		         {
-		         	log.warn("Value of clientLeasePeriod at " + i + " seems low. Normal values are >= 5000");
-		         }
-	         }
-	         
-	         val = (String)params.get("clientMaxPoolSize");	
-	         if (val != null)
-	         {
-		         int i = Integer.parseInt(val);
-		         if (i < 50)
-		         {
-		         	log.warn("Value of clientMaxPoolSize at " + i + " seems low. Normal values are >= 50");
-		         }
-	         }
-         }
-
          connectionFactoryManager = serverPeer.getConnectionFactoryManager();
          connectorManager = serverPeer.getConnectorManager();
          connectionManager = serverPeer.getConnectionManager();
@@ -184,13 +134,13 @@
          
          connectionFactoryManager.
             registerConnectionFactory(getServiceName().getCanonicalName(), clientID, jndiBindings,
-                                      locatorURI, false, prefetchSize, slowConsumers,
+                                      host, port, false, prefetchSize, slowConsumers,
                                       defaultTempQueueFullSize, defaultTempQueuePageSize,                                      
                                       defaultTempQueueDownCacheSize, dupsOKBatchSize, supportsFailover, supportsLoadBalancing,
                                       loadBalancingFactory, strictTck);               
          
-         String info = "Connector " + locator.getProtocol() + "://" +
-            locator.getHost() + ":" + locator.getPort();
+         String info = "Connector "  + "mina://" +
+            host + ":" + port;
                  
          info += " has lease disabled";
       

Modified: branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java
===================================================================
--- branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java	2007-12-07 11:23:37 UTC (rev 3443)
+++ branches/Branch_JBMESSAGING-544/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java	2007-12-07 12:13:13 UTC (rev 3444)
@@ -53,7 +53,6 @@
 import org.jboss.messaging.core.remoting.PacketDispatcher;
 import org.jboss.messaging.util.JNDIUtil;
 import org.jboss.messaging.util.Version;
-import org.jboss.remoting.InvokerLocator;
 
 /**
  * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
@@ -105,7 +104,8 @@
    public synchronized void registerConnectionFactory(String uniqueName,
                                                       String clientID,
                                                       JNDIBindings jndiBindings,
-                                                      String locatorURI,
+                                                      String host,
+                                                      int port,
                                                       boolean clientPing,
                                                       int prefetchSize,
                                                       boolean slowConsumers,
@@ -170,7 +170,7 @@
 
       ClientConnectionFactoryDelegate localDelegate =
          new ClientConnectionFactoryDelegate(uniqueName, id, serverPeer.getServerPeerID(),
-                                             locatorURI, version, clientPing, useStrict);
+                                             host, port, version, clientPing, useStrict);
 
       log.debug(this + " created local delegate " + localDelegate);
 
@@ -490,52 +490,52 @@
    
    private boolean sanityCheckFactories(Collection factories) throws Exception
    {
-   	Iterator iter = factories.iterator();
-   	InvokerLocator prevLocator = null;
-   	while (iter.hasNext())
-   	{
-   		ClientConnectionFactoryDelegate fact = (ClientConnectionFactoryDelegate)iter.next();
-   		
-   		//Sanity check - the locator protocol and params MUST be the same on each node
-   		String locatorString = fact.getServerLocatorURI();
-   		
-   		InvokerLocator locator = new InvokerLocator(locatorString);
-   		
-   		if (prevLocator != null)
-   		{
-   			//Do checks
-   			
-   			if (!locator.getProtocol().equals(prevLocator.getProtocol()))
-   			{
-   				log.error("Protocol to be used for connection factory does not match protocol specified at other nodes in the cluster " +
-   						    locator.getProtocol() + ", " + prevLocator.getProtocol());
-   				return false;
-   			}
-   			Map prevParams = prevLocator.getParameters();
-   			Map params = locator.getParameters();
-   			if (prevParams.size() != params.size())
-   			{
-   				log.error("Locator for connection factory has different number of parameters");
-   				return false;
-   			}
-   			Iterator iter2 = prevParams.entrySet().iterator();
-   			while (iter2.hasNext())
-   			{
-   				Map.Entry entry = (Map.Entry)iter2.next();
-   				
-   				String prevKey = (String)entry.getKey();
-   				String prevValue = (String)entry.getValue();
-   				String value = (String)params.get(prevKey);
-   				if (value == null || !prevValue.equals(value))
-   				{
-   					log.error("Locator param does not exist or has wrong value");
-   					return false;
-   				}   				
-   			}
-   		}
-   		
-   		prevLocator = locator;   		
-   	}
+//   	Iterator iter = factories.iterator();
+//   	InvokerLocator prevLocator = null;
+//   	while (iter.hasNext())
+//   	{
+//   		ClientConnectionFactoryDelegate fact = (ClientConnectionFactoryDelegate)iter.next();
+//   		
+//   		//Sanity check - the locator protocol and params MUST be the same on each node
+//   		String locatorString = fact.getServerLocatorURI();
+//   		
+//   		InvokerLocator locator = new InvokerLocator(locatorString);
+//   		
+//   		if (prevLocator != null)
+//   		{
+//   			//Do checks
+//   			
+//   			if (!locator.getProtocol().equals(prevLocator.getProtocol()))
+//   			{
+//   				log.error("Protocol to be used for connection factory does not match protocol specified at other nodes in the cluster " +
+//   						    locator.getProtocol() + ", " + prevLocator.getProtocol());
+//   				return false;
+//   			}
+//   			Map prevParams = prevLocator.getParameters();
+//   			Map params = locator.getParameters();
+//   			if (prevParams.size() != params.size())
+//   			{
+//   				log.error("Locator for connection factory has different number of parameters");
+//   				return false;
+//   			}
+//   			Iterator iter2 = prevParams.entrySet().iterator();
+//   			while (iter2.hasNext())
+//   			{
+//   				Map.Entry entry = (Map.Entry)iter2.next();
+//   				
+//   				String prevKey = (String)entry.getKey();
+//   				String prevValue = (String)entry.getValue();
+//   				String value = (String)params.get(prevKey);
+//   				if (value == null || !prevValue.equals(value))
+//   				{
+//   					log.error("Locator param does not exist or has wrong value");
+//   					return false;
+//   				}   				
+//   			}
+//   		}
+//   		
+//   		prevLocator = locator;   		
+//   	}
    	return true;
    }
 

Modified: branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/core/remoting/wireformat/PacketTypeTest.java
===================================================================
--- branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/core/remoting/wireformat/PacketTypeTest.java	2007-12-07 11:23:37 UTC (rev 3443)
+++ branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/core/remoting/wireformat/PacketTypeTest.java	2007-12-07 12:13:13 UTC (rev 3444)
@@ -95,7 +95,6 @@
 import org.jboss.messaging.core.remoting.codec.AcknowledgeDeliveriesRequestCodec;
 import org.jboss.messaging.core.remoting.codec.AcknowledgeDeliveryRequestCodec;
 import org.jboss.messaging.core.remoting.codec.AcknowledgeDeliveryResponseCodec;
-import org.jboss.messaging.core.remoting.codec.UpdateCallbackMessageCodec;
 import org.jboss.messaging.core.remoting.codec.AddTemporaryDestinationMessageCodec;
 import org.jboss.messaging.core.remoting.codec.BrowserHasNextMessageResponseCodec;
 import org.jboss.messaging.core.remoting.codec.BrowserNextMessageBlockRequestCodec;
@@ -133,6 +132,7 @@
 import org.jboss.messaging.core.remoting.codec.SetClientIDMessageCodec;
 import org.jboss.messaging.core.remoting.codec.TextPacketCodec;
 import org.jboss.messaging.core.remoting.codec.UnsubscribeMessageCodec;
+import org.jboss.messaging.core.remoting.codec.UpdateCallbackMessageCodec;
 import org.jboss.messaging.core.remoting.wireformat.AbstractPacket;
 import org.jboss.messaging.core.remoting.wireformat.AcknowledgeDeliveriesMessage;
 import org.jboss.messaging.core.remoting.wireformat.AcknowledgeDeliveryRequest;
@@ -217,6 +217,11 @@
       return random.nextLong();
    }
 
+   private static int randomInt()
+   {
+      return random.nextInt();
+   }
+
    private static byte randomByte()
    {
       return Integer.valueOf(random.nextInt()).byteValue();
@@ -520,9 +525,9 @@
       // FIXME should use mock objects with a correct interface
       ClientConnectionFactoryDelegate[] delegates = new ClientConnectionFactoryDelegate[] {
             new ClientConnectionFactoryDelegate(randomString(), randomString(),
-                  23, randomString(), Version.instance(), false, true),
+                  23, randomString(), randomInt(), Version.instance(), false, true),
             new ClientConnectionFactoryDelegate(randomString(), randomString(),
-                  33, randomString(), Version.instance(), true, false) };
+                  33, randomString(), randomInt(), Version.instance(), true, false) };
       TopologyResult topology = new TopologyResult(randomString(), delegates,
             new HashMap());
       GetTopologyResponse response = new GetTopologyResponse(topology);

Modified: branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java
===================================================================
--- branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java	2007-12-07 11:23:37 UTC (rev 3443)
+++ branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java	2007-12-07 12:13:13 UTC (rev 3444)
@@ -177,7 +177,7 @@
       ServerManagement.undeploy(on);
    }
          
-   public void testAdministrativelyConfiguredConnectors() throws Exception
+   public void _testAdministrativelyConfiguredConnectors() throws Exception
    {
       //Deploy a few connectors
       String name1 = "jboss.messaging:service=Connector1,transport=bisocket";

Modified: branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
===================================================================
--- branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/ServerManagement.java	2007-12-07 11:23:37 UTC (rev 3443)
+++ branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/ServerManagement.java	2007-12-07 12:13:13 UTC (rev 3444)
@@ -41,7 +41,6 @@
 import org.jboss.logging.Logger;
 import org.jboss.messaging.core.contract.MessageStore;
 import org.jboss.messaging.core.contract.PersistenceManager;
-import org.jboss.remoting.ServerInvocationHandler;
 import org.jboss.test.messaging.tools.aop.PoisonInterceptor;
 import org.jboss.test.messaging.tools.container.InVMInitialContextFactory;
 import org.jboss.test.messaging.tools.container.LocalTestServer;
@@ -807,38 +806,6 @@
       return servers[0].getServer().getServerPeerObjectName();
    }
 
-   /**
-    * @return a Set<String> with the subsystems currently registered with the Connector.
-    *         This method is supposed to work locally as well as remotely.
-    */
-   public static Set getConnectorSubsystems() throws Exception
-   {
-      insureStarted();
-      return servers[0].getServer().getConnectorSubsystems();
-   }
-
-   /**
-    * Add a ServerInvocationHandler to the remoting Connector. This method is supposed to work
-    * locally as well as remotely.
-    */
-   public static void addServerInvocationHandler(String subsystem,
-                                                 ServerInvocationHandler handler) throws Exception
-   {
-      insureStarted();
-      servers[0].getServer().addServerInvocationHandler(subsystem, handler);
-   }
-
-   /**
-    * Remove a ServerInvocationHandler from the remoting Connector. This method is supposed to work
-    * locally as well as remotely.
-    */
-   public static void removeServerInvocationHandler(String subsystem)
-      throws Exception
-   {
-      insureStarted();
-      servers[0].getServer().removeServerInvocationHandler(subsystem);
-   }
-
    public static MessageStore getMessageStore() throws Exception
    {
       insureStarted();

Modified: branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java
===================================================================
--- branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java	2007-12-07 11:23:37 UTC (rev 3443)
+++ branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/LocalTestServer.java	2007-12-07 12:13:13 UTC (rev 3444)
@@ -43,7 +43,6 @@
 import org.jboss.messaging.core.contract.PersistenceManager;
 import org.jboss.messaging.core.contract.PostOffice;
 import org.jboss.messaging.util.XMLUtil;
-import org.jboss.remoting.ServerInvocationHandler;
 import org.jboss.test.messaging.tools.ServerManagement;
 import org.jboss.test.messaging.tools.aop.PoisonInterceptor;
 import org.jboss.test.messaging.tools.jboss.MBeanConfigurationElement;
@@ -530,31 +529,6 @@
       return serverPeerObjectName;
    }
 
-   public Set getConnectorSubsystems() throws Exception
-   {
-      RemotingJMXWrapper remoting =
-         (RemotingJMXWrapper)sc.getService(ServiceContainer.REMOTING_OBJECT_NAME);
-
-      return remoting.getConnectorSubsystems();
-   }
-
-   public void addServerInvocationHandler(String subsystem, ServerInvocationHandler handler)
-      throws Exception
-   {
-      RemotingJMXWrapper remoting =
-         (RemotingJMXWrapper)sc.getService(ServiceContainer.REMOTING_OBJECT_NAME);
-
-      remoting.addInvocationHandler(subsystem, handler);
-   }
-
-   public void removeServerInvocationHandler(String subsystem) throws Exception
-   {
-      RemotingJMXWrapper remoting =
-         (RemotingJMXWrapper)sc.getService(ServiceContainer.REMOTING_OBJECT_NAME);
-
-      remoting.removeInvocationHandler(subsystem);
-   }
-
    /**
     * Only for in-VM use!
     */

Added: branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/MinaServiceWrapper.java
===================================================================
--- branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/MinaServiceWrapper.java	                        (rev 0)
+++ branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/MinaServiceWrapper.java	2007-12-07 12:13:13 UTC (rev 3444)
@@ -0,0 +1,88 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.messaging.tools.container;
+
+import org.jboss.messaging.core.remoting.internal.MinaService;
+
+
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2928 $</tt>
+ *
+ * $Id: RemotingJMXWrapper.java 2928 2007-07-27 00:33:55Z timfox $
+ */
+public class MinaServiceWrapper implements MinaServiceWrapperMBean
+{
+   // Constants -----------------------------------------------------
+   
+   // Static --------------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   private String host;
+   private int port;
+   private MinaService service;
+
+   // Constructors --------------------------------------------------
+
+   public MinaServiceWrapper(String host, int port)
+   {
+      this.host = host;
+      this.port = port;
+      service = new MinaService();
+      service.setPort(port);
+   }
+
+   // RemotingJMXWrapper implementation -----------------------------
+
+   public void start() throws Exception
+   {
+      service.start();
+   }
+
+   public void stop() throws Exception
+   {
+      service.stop();
+   }
+
+   public String getHost()
+   {
+      return host;
+   }
+
+   public int getPort()
+   {
+      return port;
+   }
+
+   // Public --------------------------------------------------------
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}

Added: branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/MinaServiceWrapperMBean.java
===================================================================
--- branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/MinaServiceWrapperMBean.java	                        (rev 0)
+++ branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/MinaServiceWrapperMBean.java	2007-12-07 12:13:13 UTC (rev 3444)
@@ -0,0 +1,36 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.messaging.tools.container;
+
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ * @version <tt>$Revision$</tt>
+ */
+public interface MinaServiceWrapperMBean
+{
+   void start() throws Exception;
+   void stop() throws Exception;
+
+   String getHost();
+   int getPort();
+}

Added: branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/PortUtil.java
===================================================================
--- branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/PortUtil.java	                        (rev 0)
+++ branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/PortUtil.java	2007-12-07 12:13:13 UTC (rev 3444)
@@ -0,0 +1,153 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.test.messaging.tools.container;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.security.SecureRandom;
+
+import org.jboss.logging.Logger;
+
+/**
+ * PortUtil is a set of utilities for dealing with TCP/IP ports
+ *
+ * @author <a href="mailto:jhaynie at vocalocity.net">Jeff Haynie</a>
+ * @author <a href="mailto:tom at jboss.org">Tom Elrod</a>
+ * @version $Revision$
+ */
+public class PortUtil
+{
+   private static final Logger log = Logger.getLogger(PortUtil.class);
+   private static final int MIN_UNPRIVILEGED_PORT = 1024;
+   private static final int MAX_LEGAL_PORT = 65535;
+
+   private static int portCounter = 0;
+   private static int retryMax = 50;
+
+   static
+   {
+      portCounter = getRandomStartingPort();
+   }
+
+   /**
+    * Checks to see if the specified port is free.
+    *
+    * @param p
+    * @return true if available, false if already in use
+    */
+   public static boolean checkPort(int p, String host)
+   {
+      boolean available = true;
+      ServerSocket socket = null;
+      try
+      {
+         InetAddress inetAddress = InetAddress.getByName(host);
+         socket = new ServerSocket(p, 0, inetAddress);
+      }
+      catch(IOException e)
+      {
+         log.debug("port " + p + " already in use.  Will try another.");
+         available = false;
+      }
+      finally
+      {
+         if(socket != null)
+         {
+            try
+            {
+               socket.close();
+            }
+            catch(IOException e)
+            {
+
+            }
+         }
+      }
+      return available;
+
+   }
+
+   /**
+    * Will try to find a port that is not in use up to 50 tries, at which point,
+    * will throw an exception.
+    * @return
+    */
+   public static int findFreePort(String host) throws IOException
+   {
+      Integer port = null;
+      int tryCount = 0;
+      while(port == null && tryCount < retryMax)
+      {
+         port = getFreePort(host);
+         if(port != null)
+         {
+            // validate port again, just in case two instances start on the port at same time.
+            if(!checkPort(port.intValue(), host))
+            {
+               port = null;
+            }
+         }
+         tryCount++;
+      }
+      if(tryCount >= retryMax)
+      {
+         throw new IOException("Can not find a free port for use.");
+      }
+      return port.intValue();
+   }
+
+   private static Integer getFreePort(String host)
+   {
+      int p = getNextPort();
+
+      if(checkPort(p, host))
+      {
+         return new Integer(p);
+      }
+      else
+      {
+         return null;
+      }
+   }
+
+   private static synchronized int getNextPort()
+   {
+	  if (portCounter < MAX_LEGAL_PORT)
+		  return portCounter++;
+	  
+	  portCounter = MIN_UNPRIVILEGED_PORT;
+	  return MAX_LEGAL_PORT;
+   }
+
+   public static int getRandomStartingPort()
+   {
+      Object o = new Object();
+      String os = o.toString();
+      os = os.substring(17);
+      int n = Integer.parseInt(os, 16);
+      int p = Math.abs(new SecureRandom(String.valueOf(System.currentTimeMillis() + n).getBytes()).nextInt(2000)) + 2000;
+      return p;
+   }
+
+}

Modified: branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java
===================================================================
--- branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java	2007-12-07 11:23:37 UTC (rev 3443)
+++ branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java	2007-12-07 12:13:13 UTC (rev 3444)
@@ -39,7 +39,6 @@
 import org.jboss.logging.Logger;
 import org.jboss.messaging.core.contract.MessageStore;
 import org.jboss.messaging.core.contract.PersistenceManager;
-import org.jboss.remoting.ServerInvocationHandler;
 
 /**
  * An RMI wrapper to access the ServiceContainer from a different address space.
@@ -304,22 +303,6 @@
       return server.isStarted();
    }
 
-   public Set getConnectorSubsystems() throws Exception
-   {
-      return server.getConnectorSubsystems();
-   }
-
-   public void addServerInvocationHandler(String subsystem, ServerInvocationHandler handler)
-      throws Exception
-   {
-      server.addServerInvocationHandler(subsystem, handler);
-   }
-
-   public void removeServerInvocationHandler(String subsystem) throws Exception
-   {
-      server.removeServerInvocationHandler(subsystem);
-   }
-
    public MessageStore getMessageStore() throws Exception
    {
       return server.getMessageStore();

Deleted: branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/RemotingJMXWrapper.java
===================================================================
--- branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/RemotingJMXWrapper.java	2007-12-07 11:23:37 UTC (rev 3443)
+++ branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/RemotingJMXWrapper.java	2007-12-07 12:13:13 UTC (rev 3444)
@@ -1,158 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.messaging.tools.container;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.remoting.ConnectionListener;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.ServerInvocationHandler;
-import org.jboss.remoting.transport.Connector;
-
-
-/**
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class RemotingJMXWrapper implements RemotingJMXWrapperMBean
-{
-   // Constants -----------------------------------------------------
-   
-   // Static --------------------------------------------------------
-
-   // Attributes ----------------------------------------------------
-
-   private InvokerLocator locator;
-
-   // DO NOT expose the Connector instance externally bacause consistency of subsytemToHandler map
-   //        may be compromised!
-   private Connector connector;
-
-   private Map subsystemToHandler;
-
-   // Constructors --------------------------------------------------
-
-   public RemotingJMXWrapper(InvokerLocator locator)
-   {
-      this.locator = locator;
-      this.subsystemToHandler = new HashMap();
-   }
-
-   // RemotingJMXWrapper implementation -----------------------------
-
-   public void start() throws Exception
-   {
-      if (connector != null)
-      {
-         return;
-      }
-
-      connector = new Connector();
-      connector.setInvokerLocator(locator.getLocatorURI());
-      connector.start();
-   }
-
-   public void stop() throws Exception
-   {
-      if (connector == null)
-      {
-         return;
-      }
-
-      connector.stop();
-      connector = null;
-      subsystemToHandler.clear();
-   }
-
-   public RemotingJMXWrapper getInstance()
-   {
-      return this;
-   }
-
-   public String getInvokerLocator() throws Exception
-   {
-      if (connector != null)
-      {
-         return connector.getInvokerLocator();
-      }
-      return null;
-   }
-
-   public Set getConnectorSubsystems()
-   {
-      // create a serializable Set instance
-      return new HashSet(subsystemToHandler.keySet());
-   }
-
-   public ServerInvocationHandler addInvocationHandler(String subsystem, ServerInvocationHandler h)
-      throws Exception
-   {
-      if (connector != null)
-      {
-         subsystemToHandler.put(subsystem, h);
-         return connector.addInvocationHandler(subsystem, h);
-      }
-      return null;
-   }
-
-   public void removeInvocationHandler(String subsystem) throws Exception
-   {
-      subsystemToHandler.remove(subsystem);
-      connector.removeInvocationHandler(subsystem);
-   }
-
-   public void addConnectionListener(ConnectionListener listener)
-   {
-      connector.addConnectionListener(listener);
-   }
-
-   public void removeConnectionListener(ConnectionListener listener)
-   {
-      connector.removeConnectionListener(listener);
-   }
-
-   public void setLeasePeriod(long leasePeriod)
-   {
-      connector.setLeasePeriod(leasePeriod);
-   }
-   
-   public long getLeasePeriod()
-   {
-      return connector.getLeasePeriod();
-   }
-
-   // Public --------------------------------------------------------
-
-   // Package protected ---------------------------------------------
-
-   // Protected -----------------------------------------------------
-
-   // Private -------------------------------------------------------
-
-   // Inner classes -------------------------------------------------
-
-}

Deleted: branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/RemotingJMXWrapperMBean.java
===================================================================
--- branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/RemotingJMXWrapperMBean.java	2007-12-07 11:23:37 UTC (rev 3443)
+++ branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/RemotingJMXWrapperMBean.java	2007-12-07 12:13:13 UTC (rev 3444)
@@ -1,77 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.messaging.tools.container;
-
-import java.util.Set;
-
-import org.jboss.remoting.ConnectionListener;
-import org.jboss.remoting.ServerInvocationHandler;
-
-/**
- * Note: This wrapper MUST NOT allow direct access to the Connector instance. This is necessary
- *       because the wrapper is maintaining the mapping between the Connector's
- *       ServerInvocationHandler instances and their subsystem names. Remoting should do that (it
- *       should have a Connector.getSubsystemNames() or similar), but it doesn't, so I have to do
- *       this by myself.
- *
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public interface RemotingJMXWrapperMBean
-{
-   void start() throws Exception;
-   void stop() throws Exception;
-
-   RemotingJMXWrapper getInstance();
-
-   String getInvokerLocator() throws Exception;
-
-   /**
-    * This method's signature must be identical with Connector's
-    * public ServerInvocationHandler addInvocationHandler(String subsystem,
-    *                                ServerInvocationHandler handler) throws Exception;
-    */
-   ServerInvocationHandler addInvocationHandler(String subsystem, ServerInvocationHandler h)
-         throws Exception;
-
-   /**
-    * This method's signature must be identical with Connector's
-    * public void removeInvocationHandler(String subsystem) throws Exception;
-    */
-   void removeInvocationHandler(String subsystem) throws Exception;
-
-   /**
-    * @return Set<String> containing the subsystem names various ServerInvocationHandler instances
-    *         have been added under to the Connector instance.
-    */
-   Set getConnectorSubsystems();
-
-   void addConnectionListener(ConnectionListener listener);
-
-   void removeConnectionListener(ConnectionListener listener);
-
-   void setLeasePeriod(long leasePeriod);
-   
-   long getLeasePeriod();
-}

Modified: branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/Server.java
===================================================================
--- branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/Server.java	2007-12-07 11:23:37 UTC (rev 3443)
+++ branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/Server.java	2007-12-07 12:13:13 UTC (rev 3444)
@@ -34,7 +34,6 @@
 import org.jboss.jms.server.ServerPeer;
 import org.jboss.messaging.core.contract.MessageStore;
 import org.jboss.messaging.core.contract.PersistenceManager;
-import org.jboss.remoting.ServerInvocationHandler;
 
 /**
  * The remote interface exposed by TestServer.
@@ -134,25 +133,6 @@
    boolean isStarted() throws Exception;
 
    /**
-    * @return a Set<String> with the subsystems currently registered with the Connector. It is
-    *         supposed to work locally as well as remotely.
-    */
-   Set getConnectorSubsystems() throws Exception;
-
-   /**
-    * Add a ServerInvocationHandler to the remoting Connector. This method is supposed to work
-    * locally as well as remotely.
-    */
-   void addServerInvocationHandler(String subsystem, ServerInvocationHandler handler)
-      throws Exception;
-
-   /**
-    * Remove a ServerInvocationHandler from the remoting Connector. This method is supposed to work
-    * locally as well as remotely.
-    */
-   void removeServerInvocationHandler(String subsystem) throws Exception;
-
-   /**
     * Only for in-VM use!
     */
    MessageStore getMessageStore() throws Exception;

Modified: branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/ServiceContainer.java
===================================================================
--- branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/ServiceContainer.java	2007-12-07 11:23:37 UTC (rev 3443)
+++ branches/Branch_JBMESSAGING-544/tests/src/org/jboss/test/messaging/tools/container/ServiceContainer.java	2007-12-07 12:13:13 UTC (rev 3444)
@@ -61,11 +61,8 @@
 import org.jboss.jms.jndi.JMSProviderAdapter;
 import org.jboss.jms.jndi.JNDIProviderAdapter;
 import org.jboss.logging.Logger;
-import org.jboss.messaging.core.remoting.internal.MinaService;
 import org.jboss.messaging.util.JNDIUtil;
 import org.jboss.messaging.util.XMLUtil;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.transport.PortUtil;
 import org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory;
 import org.jboss.resource.adapter.jdbc.remote.WrapperDataSourceService;
 import org.jboss.resource.adapter.jms.JmsManagedConnectionFactory;
@@ -228,8 +225,6 @@
    // so we don't start up multiple servers with services running on the same port
    private int serverIndex;
 
-   private MinaService minaService;
-
    // Static ---------------------------------------------------------------------------------------
 
    public static Object type(MBeanInfo mbeanInfo, String attributeName, String valueAsString)
@@ -528,9 +523,6 @@
 
       stopService(REMOTING_OBJECT_NAME);
 
-      if (minaService != null)
-         minaService.stop();
-
       if (httpConnectionFactory)
       {
          stopService(HTTP_REMOTING_OBJECT_NAME);
@@ -1362,47 +1354,17 @@
                               ObjectName objectName) throws Exception
    {
       log.debug("Starting remoting transport=" + transport + " objectName=" + objectName);
-      RemotingJMXWrapper mbean;
-      String locatorURI = null;
+      MinaServiceWrapperMBean mbean;
 
-      // some tests may want specific locator URI overrides to simulate special conditions; use
-      // that with priority, if available
-      Map overrideMap = null;
+      int freePort = PortUtil.findFreePort(ipAddressOrHostName);
 
-      if (attrOverrides != null)
-      {
-         overrideMap = attrOverrides.get(objectName);
+      log.debug("Using uri: " + ipAddressOrHostName + ":" + freePort);
 
-         if (overrideMap != null)
-         {
-            locatorURI = (String)overrideMap.get("LocatorURI");
-         }
-      }
-
-      if (locatorURI == null)
-      {
-         locatorURI = buildLocatorURI(transport, overrideMap);
-         log.info("creating server for: " + locatorURI);
-      }
-
-      log.debug("Using locator uri: " + locatorURI);
-
-      InvokerLocator locator = new InvokerLocator(locatorURI);
-
-      log.debug("Started remoting connector on uri:" + locator.getLocatorURI());
-
-      mbean = new RemotingJMXWrapper(locator);
+      mbean = new MinaServiceWrapper(ipAddressOrHostName, freePort);
       mbeanServer.registerMBean(mbean, objectName);
       mbeanServer.invoke(objectName, "start", new Object[0], new String[0]);
-
-      log.debug("started " + objectName);
       
-      if (!transport.equals("http"))
-      {
-         minaService = new MinaService();
-         minaService.setPort(locator.getPort() + 1000);
-         minaService.start();
-      }
+      log.debug("Started remoting connector on uri:" + ipAddressOrHostName + ":" + freePort);
    }
 
    private void startSecurityManager() throws Exception




More information about the jboss-cvs-commits mailing list