activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r893218 - in /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src: main/csharp/Connection.cs main/csharp/ConnectionFactory.cs main/csharp/Util/IdGenerator.cs test/csharp/NMSConnectionFactoryTest.cs
Date Tue, 22 Dec 2009 16:22:57 GMT
Author: tabish
Date: Tue Dec 22 16:22:57 2009
New Revision: 893218

URL: http://svn.apache.org/viewvc?rev=893218&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQNET-227

Improved ConnectionFactory to allow options to be set programmatically as well as through
the URI.  The URI is now parsed on creation of the ConnectionFactory and options are set on
parse, options set after the URI is parsed override the URI values.  IdGenerator is added
to create Connection and Client Ids that match those in the Java client for better interoperability.

Added:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/IdGenerator.cs
  (with props)
Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionFactory.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSConnectionFactoryTest.cs

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs?rev=893218&r1=893217&r2=893218&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs Tue Dec
22 16:22:57 2009
@@ -18,6 +18,7 @@
 using System;
 using System.Collections;
 using System.Threading;
+using Apache.NMS.ActiveMQ.Util;
 using Apache.NMS.ActiveMQ.Commands;
 using Apache.NMS.ActiveMQ.Transport;
 using Apache.NMS;
@@ -30,17 +31,10 @@
     /// </summary>
     public class Connection : IConnection
     {
-        private readonly Uri brokerUri;
-        private ITransport transport;
-        private readonly ConnectionInfo info;
+        private static readonly IdGenerator CONNECTION_ID_GENERATOR = new IdGenerator();
+
+        // Uri configurable options.
         private AcknowledgementMode acknowledgementMode = AcknowledgementMode.AutoAcknowledge;
-        private TimeSpan requestTimeout;
-        private BrokerInfo brokerInfo; // from broker
-        private WireFormatInfo brokerWireFormatInfo; // from broker
-        private readonly IList sessions = ArrayList.Synchronized(new ArrayList());
-        private readonly IDictionary producers = Hashtable.Synchronized(new Hashtable());
-        private readonly IDictionary dispatchers = Hashtable.Synchronized(new Hashtable());
-        private readonly object myLock = new object();
         private bool asyncSend = false;
         private bool alwaysSyncSend = false;
         private bool asyncClose = true;
@@ -49,6 +43,18 @@
         private bool sendAcksAsync = false;
         private bool dispatchAsync = true;
         private int producerWindowSize = 0;
+
+        private bool userSpecifiedClientID;
+        private readonly Uri brokerUri;
+        private ITransport transport;
+        private ConnectionInfo info;
+        private TimeSpan requestTimeout;
+        private BrokerInfo brokerInfo; // from broker
+        private WireFormatInfo brokerWireFormatInfo; // from broker
+        private readonly IList sessions = ArrayList.Synchronized(new ArrayList());
+        private readonly IDictionary producers = Hashtable.Synchronized(new Hashtable());
+        private readonly IDictionary dispatchers = Hashtable.Synchronized(new Hashtable());
+        private readonly object myLock = new object();
         private bool connected = false;
         private bool closed = false;
         private bool closing = false;
@@ -61,17 +67,25 @@
         private IRedeliveryPolicy redeliveryPolicy;
         private PrefetchPolicy prefetchPolicy = new PrefetchPolicy();
         private ICompressionPolicy compressionPolicy = new CompressionPolicy();
+        private IdGenerator clientIdGenerator;
 
-        public Connection(Uri connectionUri, ITransport transport, ConnectionInfo info)
+        public Connection(Uri connectionUri, ITransport transport, IdGenerator clientIdGenerator)
         {
             this.brokerUri = connectionUri;
-            this.info = info;
             this.requestTimeout = transport.RequestTimeout;
+            this.clientIdGenerator = clientIdGenerator;
+
             this.transport = transport;
             this.transport.Command = new CommandHandler(OnCommand);
             this.transport.Exception = new ExceptionHandler(OnException);
             this.transport.Interrupted = new InterruptedHandler(OnTransportInterrupted);
             this.transport.Resumed = new ResumedHandler(OnTransportResumed);
+
+            ConnectionId id = new ConnectionId();
+            id.Value = CONNECTION_ID_GENERATOR.GenerateId();
+
+            this.info = new ConnectionInfo();
+            this.info.ConnectionId = id;
         }
 
         ~Connection()
@@ -98,6 +112,18 @@
 
         #region Properties
 
+        public String UserName
+        {
+            get { return this.info.UserName; }
+            set { this.info.UserName = value; }
+        }
+
+        public String Password
+        {
+            get { return this.info.Password; }
+            set { this.info.Password = value; }
+        }
+
         /// <summary>
         /// This property indicates what version of the Protocol we are using to
         /// communicate with the Broker, if not set we return the lowest version
@@ -252,11 +278,26 @@
             get { return info.ClientId; }
             set
             {
-                if(connected)
+                if(this.connected)
                 {
                     throw new NMSException("You cannot change the ClientId once the Connection
is connected");
                 }
-                info.ClientId = value;
+
+                this.info.ClientId = value;
+                this.userSpecifiedClientID = true;
+                CheckConnected();
+            }
+        }
+
+        /// <summary>
+        /// The Default Client Id used if the ClientId property is not set explicity.
+        /// </summary>
+        public string DefaultClientId
+        {
+            set
+            {
+                this.info.ClientId = value;
+                this.userSpecifiedClientID = true;
             }
         }
 
@@ -576,6 +617,11 @@
 
             if(!connected)
             {
+                if(!this.userSpecifiedClientID)
+                {
+                    this.info.ClientId = this.clientIdGenerator.GenerateId();
+                }
+
                 connected = true;
                 // now lets send the connection and see if we get an ack/nak
                 if(null == SyncRequest(info))
@@ -788,7 +834,7 @@
             return id;
         }
 
-        protected SessionInfo CreateSessionInfo(AcknowledgementMode sessionAcknowledgementMode)
+        private SessionInfo CreateSessionInfo(AcknowledgementMode sessionAcknowledgementMode)
         {
             SessionInfo answer = new SessionInfo();
             SessionId sessionId = new SessionId();

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionFactory.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionFactory.cs?rev=893218&r1=893217&r2=893218&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionFactory.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionFactory.cs
Tue Dec 22 16:22:57 2009
@@ -16,6 +16,7 @@
  */
 
 using System;
+using Apache.NMS.ActiveMQ.Util;
 using Apache.NMS.ActiveMQ.Commands;
 using Apache.NMS.ActiveMQ.Transport;
 using Apache.NMS;
@@ -36,9 +37,19 @@
 		private Uri brokerUri;
 		private string connectionUserName;
 		private string connectionPassword;
-		private string clientId;
+        private string clientId;
+        private string clientIdPrefix;
+        private IdGenerator clientIdGenerator;
+
         private bool useCompression;
-        
+        private bool copyMessageOnSend = true;
+        private bool dispatchAsync=true;
+        private bool asyncSend;
+        private bool asyncClose;
+        private bool alwaysSyncSend;
+        private bool sendAcksAsync=true;
+        private AcknowledgementMode acknowledgementMode = AcknowledgementMode.AutoAcknowledge;
+
         private IRedeliveryPolicy redeliveryPolicy = new RedeliveryPolicy();
         private PrefetchPolicy prefetchPolicy = new PrefetchPolicy();
         private ICompressionPolicy compressionPolicy = new CompressionPolicy();
@@ -79,8 +90,8 @@
 
 		public ConnectionFactory(Uri brokerUri, string clientID)
 		{
-			this.brokerUri = brokerUri;
-			this.clientId = clientID;
+			this.BrokerUri = brokerUri;
+			this.ClientId = clientID;
 		}
 
 		public IConnection CreateConnection()
@@ -90,37 +101,60 @@
 
 		public IConnection CreateConnection(string userName, string password)
 		{
-			// Strip off the activemq prefix, if it exists.
-			Uri uri = new Uri(URISupport.stripPrefix(brokerUri.OriginalString, "activemq:"));
-
-			Tracer.InfoFormat("Connecting to: {0}", uri.ToString());
+            Connection connection = null;
 
-			ConnectionInfo info = CreateConnectionInfo(userName, password);
-			ITransport transport = TransportFactory.CreateTransport(uri);
-			Connection connection = new Connection(uri, transport, info);
-
-            // Set the Factory level configuration to the Connection, this can be overriden
by
-            // the params on the Connection URI so we do this before applying the params.
-            connection.UseCompression = this.useCompression;
-            connection.RedeliveryPolicy = this.redeliveryPolicy.Clone() as IRedeliveryPolicy;
-            connection.PrefetchPolicy = this.prefetchPolicy.Clone() as PrefetchPolicy;
-            connection.CompressionPolicy = this.compressionPolicy.Clone() as ICompressionPolicy;
-            
-			// Set properties on connection using parameters prefixed with "connection."
-			// Since this could be a composite Uri, assume the connection-specific parameters
-			// are associated with the outer-most specification of the composite Uri. What's nice
-			// is that this works with simple Uri as well.
-			URISupport.CompositeData c = URISupport.parseComposite(uri);
-			URISupport.SetProperties(connection, c.Parameters, "connection.");
+            try
+            {
+    			// Strip off the activemq prefix, if it exists.
+    			Uri uri = new Uri(URISupport.stripPrefix(brokerUri.OriginalString, "activemq:"));
+    
+    			Tracer.InfoFormat("Connecting to: {0}", uri.ToString());
+    
+                ITransport transport = TransportFactory.CreateTransport(uri);
+    
+                connection = new Connection(uri, transport, this.ClientIdGenerator);
+    
+                ConfigureConnection(connection);
+    
+                connection.UserName = this.connectionUserName;
+                connection.Password = this.connectionPassword;
+    
+                if(this.clientId != null)
+                {
+                    connection.DefaultClientId = this.clientId;
+                }
+    
+    			connection.ITransport.Start();
+    
+    			return connection;
+            }
+            catch(NMSException e)
+            {
+                try
+                {
+                    connection.Close();
+                }
+                catch
+                {
+                }
 
-            URISupport.SetProperties(connection.PrefetchPolicy, c.Parameters, "nms.PrefetchPolicy.");
-            URISupport.SetProperties(connection.RedeliveryPolicy, c.Parameters, "nms.RedeliveryPolicy.");
+                throw e;
+            }
+            catch(Exception e)
+            {
+                try
+                {
+                    connection.Close();
+                }
+                catch
+                {
+                }
 
-			connection.ITransport.Start();
-			return connection;
+                throw NMSExceptionSupport.Create("Could not connect to broker URL: " + this.brokerUri
+ ". Reason: " + e.Message, e);
+            }
 		}
 
-		// Properties
+        #region ConnectionFactory Properties
 
 		/// <summary>
 		/// Get/or set the broker Uri.
@@ -128,7 +162,17 @@
 		public Uri BrokerUri
 		{
 			get { return brokerUri; }
-			set { brokerUri = value; }
+			set
+            {
+                brokerUri = value;
+
+                Uri uri = new Uri(URISupport.stripPrefix(brokerUri.OriginalString, "activemq:"));
+
+                URISupport.CompositeData c = URISupport.parseComposite(uri);
+                URISupport.SetProperties(this, c.Parameters, "connection.");
+                URISupport.SetProperties(this.PrefetchPolicy, c.Parameters, "nms.PrefetchPolicy.");
+                URISupport.SetProperties(this.RedeliveryPolicy, c.Parameters, "nms.RedeliveryPolicy.");
+            }
 		}
 
 		public string UserName
@@ -149,12 +193,71 @@
 			set { clientId = value; }
 		}
 
+        public string ClientIdPrefix
+        {
+            get { return clientIdPrefix; }
+            set { clientIdPrefix = value; }
+        }
+
         public bool UseCompression
         {
             get { return this.useCompression; }
             set { this.useCompression = value; }
         }
 
+        public bool CopyMessageOnSend
+        {
+            get { return copyMessageOnSend; }
+            set { copyMessageOnSend = value; }
+        }
+
+        public bool AlwaysSyncSend
+        {
+            get { return alwaysSyncSend; }
+            set { alwaysSyncSend = value; }
+        }
+
+        public bool AsyncClose
+        {
+            get { return asyncClose; }
+            set { asyncClose = value; }
+        }
+
+        public bool SendAcksAsync
+        {
+            get { return sendAcksAsync; }
+            set { sendAcksAsync = value; }
+        }
+
+        public bool AsyncSend
+        {
+            get { return asyncSend; }
+            set { asyncSend = value; }
+        }
+
+        public bool DispatchAsync
+        {
+            get { return this.dispatchAsync; }
+            set { this.dispatchAsync = value; }
+        }
+
+        public string AckMode
+        {
+            set { this.acknowledgementMode = NMSConvert.ToAcknowledgementMode(value); }
+        }
+
+        public AcknowledgementMode AcknowledgementMode
+        {
+            get { return acknowledgementMode; }
+            set { this.acknowledgementMode = value; }
+        }
+
+        public PrefetchPolicy PrefetchPolicy
+        {
+            get { return this.prefetchPolicy; }
+            set { this.prefetchPolicy = value; }
+        }
+
         public IRedeliveryPolicy RedeliveryPolicy
         {
             get { return this.redeliveryPolicy; }
@@ -177,7 +280,31 @@
                     this.compressionPolicy = value; 
                 }
             }
-        }        
+        }
+
+        public IdGenerator ClientIdGenerator
+        {
+            set { this.clientIdGenerator = value; }
+            get
+            {
+                lock(this)
+                {
+                    if(this.clientIdGenerator == null)
+                    {
+                        if(this.clientIdPrefix != null)
+                        {
+                            this.clientIdGenerator = new IdGenerator(this.clientIdPrefix);
+                        }
+                        else
+                        {
+                            this.clientIdGenerator = new IdGenerator();
+                        }
+                    }
+
+                    return this.clientIdGenerator;
+                }
+            }
+        }
 
 		public event ExceptionListener OnException
 		{
@@ -191,24 +318,22 @@
 			}
 		}
 
-		protected virtual ConnectionInfo CreateConnectionInfo(string userName, string password)
-		{
-			ConnectionInfo answer = new ConnectionInfo();
-			ConnectionId connectionId = new ConnectionId();
-			connectionId.Value = CreateNewGuid();
+        #endregion
 
-			answer.ConnectionId = connectionId;
-			answer.UserName = userName;
-			answer.Password = password;
-			answer.ClientId = clientId ?? CreateNewGuid();
-
-			return answer;
-		}
-
-		protected static string CreateNewGuid()
-		{
-			return Guid.NewGuid().ToString();
-		}
+        protected virtual void ConfigureConnection(Connection connection)
+        {
+            connection.AsyncClose = this.AsyncClose;
+            connection.AsyncSend = this.AsyncSend;
+            connection.CopyMessageOnSend = this.CopyMessageOnSend;
+            connection.AlwaysSyncSend = this.AlwaysSyncSend;
+            connection.DispatchAsync = this.DispatchAsync;
+            connection.SendAcksAsync = this.SendAcksAsync;
+            connection.AcknowledgementMode = this.acknowledgementMode;
+            connection.UseCompression = this.useCompression;
+            connection.RedeliveryPolicy = this.redeliveryPolicy.Clone() as IRedeliveryPolicy;
+            connection.PrefetchPolicy = this.prefetchPolicy.Clone() as PrefetchPolicy;
+            connection.CompressionPolicy = this.compressionPolicy.Clone() as ICompressionPolicy;
+        }
 
 		protected static void ExceptionHandler(Exception ex)
 		{

Added: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/IdGenerator.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/IdGenerator.cs?rev=893218&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/IdGenerator.cs
(added)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/IdGenerator.cs
Tue Dec 22 16:22:57 2009
@@ -0,0 +1,193 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Net;
+using System.Net.Sockets;
+using System.Threading;
+
+namespace Apache.NMS.ActiveMQ.Util
+{
+    public class IdGenerator
+    {
+        private static String UNIQUE_STUB;
+        private static int instanceCount;
+        private static String hostName;
+        private String seed;
+        private long sequence;
+    
+        static IdGenerator()
+        {
+            String stub = "-1-" + DateTime.Now.Ticks;
+            hostName = "localhost";
+
+            try
+            {
+                hostName = Dns.GetHostName();
+                IPEndPoint endPoint = new IPEndPoint(IPAddress.Any, 0);
+                Socket tempSocket = new Socket(endPoint.AddressFamily, SocketType.Stream,
ProtocolType.Tcp);
+                tempSocket.Bind(endPoint);
+                stub = "-" + ((IPEndPoint)tempSocket.LocalEndPoint).Port + "-" + DateTime.Now.Ticks
+ "-";
+                Thread.Sleep(100);
+                tempSocket.Close();
+            }
+            catch(Exception ioe)
+            {
+                Tracer.Warn("could not generate unique stub: " + ioe.Message);
+            }
+
+            UNIQUE_STUB = stub;
+        }
+    
+        /**
+         * Construct an IdGenerator
+         */
+        public IdGenerator(String prefix)
+        {
+            lock(UNIQUE_STUB)
+            {
+                this.seed = prefix + UNIQUE_STUB + (instanceCount++) + ":";
+            }
+        }
+
+        public IdGenerator() : this("ID:" + hostName)
+        {
+        }
+    
+        /// <summary>
+        /// As we have to find the hostname as a side-affect of generating a unique
+        /// stub, we allow it's easy retrevial here
+        /// </summary>
+        public static String HostName
+        {
+            get { return hostName; }
+        }
+
+        /// <summary>
+        /// Generate a Unique Id
+        /// </summary>
+        /// <returns>
+        /// A <see cref="String"/>
+        /// </returns>
+        public String GenerateId()
+        {
+            lock(UNIQUE_STUB)
+            {
+                return this.seed + (this.sequence++);
+            }
+        }
+
+        /// <summary>
+        /// Generate a unique ID - that is friendly for a URL or file system
+        /// </summary>
+        /// <returns>
+        /// A <see cref="String"/>
+        /// </returns>
+        public String GenerateSanitizedId()
+        {
+            String result = GenerateId();
+            result = result.Replace(':', '-');
+            result = result.Replace('_', '-');
+            result = result.Replace('.', '-');
+            return result;
+        }
+    
+        /// <summary>
+        /// From a generated id - return the seed (i.e. minus the count)
+        /// </summary>
+        /// <param name="id">
+        /// A <see cref="String"/>
+        /// </param>
+        /// <returns>
+        /// A <see cref="String"/>
+        /// </returns>
+        public static String GetSeedFromId(String id)
+        {
+            String result = id;
+
+            if(id != null)
+            {
+                int index = id.LastIndexOf(':');
+                if(index > 0 && (index + 1) < id.Length)
+                {
+                    result = id.Substring(0, index + 1);
+                }
+            }
+
+            return result;
+        }
+    
+        /// <summary>
+        /// From a generated id - return the generator count
+        /// </summary>
+        /// <param name="id">
+        /// A <see cref="String"/>
+        /// </param>
+        /// <returns>
+        /// A <see cref="System.Int64"/>
+        /// </returns>
+        public static long GetSequenceFromId(String id)
+        {
+            long result = -1;
+            if(id != null)
+            {
+                int index = id.LastIndexOf(':');
+    
+                if(index > 0 && (index + 1) < id.Length)
+                {
+                    String numStr = id.Substring(index + 1, id.Length);
+                    result = Int64.Parse(numStr);
+                }
+            }
+            return result;
+        }
+
+        /// <summary>
+        /// Does a proper compare on the ids
+        /// </summary>
+        /// <param name="id1">
+        /// A <see cref="String"/>
+        /// </param>
+        /// <param name="id2">
+        /// A <see cref="String"/>
+        /// </param>
+        /// <returns>
+        /// A <see cref="System.Int32"/>
+        /// </returns>
+        public static int Compare(String id1, String id2)
+        {
+            int result = -1;
+
+            String seed1 = IdGenerator.GetSeedFromId(id1);
+            String seed2 = IdGenerator.GetSeedFromId(id2);
+
+            if(seed1 != null && seed2 != null)
+            {
+                result = seed1.CompareTo(seed2);
+
+                if(result == 0)
+                {
+                    long count1 = IdGenerator.GetSequenceFromId(id1);
+                    long count2 = IdGenerator.GetSequenceFromId(id2);
+                    result = (int)(count1 - count2);
+                }
+            }
+
+            return result;
+        }
+    }
+}

Propchange: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Util/IdGenerator.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSConnectionFactoryTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSConnectionFactoryTest.cs?rev=893218&r1=893217&r2=893218&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSConnectionFactoryTest.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSConnectionFactoryTest.cs
Tue Dec 22 16:22:57 2009
@@ -45,20 +45,20 @@
 		[Row("activemq:tcp://InvalidHost:61616", ExpectedException = typeof(NMSConnectionException))]
 		[Row("activemq:tcp://InvalidHost:61616?connection.asyncclose=false", ExpectedException
= typeof(NMSConnectionException))]
 
-		[Row("tcp://${activemqhost}:61616?connection.InvalidParameter=true", ExpectedException
= typeof(NMSException))]
-		[Row("activemq:tcp://${activemqhost}:61616?connection.InvalidParameter=true", ExpectedException
= typeof(NMSException))]
-		[Row("activemq:failover:tcp://${activemqhost}:61616?connection.InvalidParameter=true",
ExpectedException = typeof(NMSException))]
-		[Row("activemq:failover:(tcp://${activemqhost}:61616)?connection.InvalidParameter=true",
ExpectedException = typeof(NMSException))]
-		[Row("activemq:failover:(tcp://${activemqhost}:61616,tcp://${activemqbackuphost}:61616)?connection.InvalidParameter=true",
ExpectedException = typeof(NMSException))]
+		[Row("tcp://${activemqhost}:61616?connection.InvalidParameter=true", ExpectedException
= typeof(NMSConnectionException))]
+		[Row("activemq:tcp://${activemqhost}:61616?connection.InvalidParameter=true", ExpectedException
= typeof(NMSConnectionException))]
+		[Row("activemq:failover:tcp://${activemqhost}:61616?connection.InvalidParameter=true",
ExpectedException = typeof(NMSConnectionException))]
+		[Row("activemq:failover:(tcp://${activemqhost}:61616)?connection.InvalidParameter=true",
ExpectedException = typeof(NMSConnectionException))]
+		[Row("activemq:failover:(tcp://${activemqhost}:61616,tcp://${activemqbackuphost}:61616)?connection.InvalidParameter=true",
ExpectedException = typeof(NMSConnectionException))]
 
 		[Row("ftp://${activemqhost}:61616", ExpectedException = typeof(NMSConnectionException))]
 		[Row("http://${activemqhost}:61616", ExpectedException = typeof(NMSConnectionException))]
 		[Row("discovery://${activemqhost}:6155", ExpectedException = typeof(NMSConnectionException))]
 		[Row("sms://${activemqhost}:61616", ExpectedException = typeof(NMSConnectionException))]
 		[Row("activemq:multicast://${activemqhost}:6155", ExpectedException = typeof(NMSConnectionException))]
+		[Row("activemq:(tcp://${activemqhost}:61616)?connection.asyncClose=false", ExpectedException
= typeof(NMSConnectionException))]
 
-		[Row("activemq:(tcp://${activemqhost}:61616)?connection.asyncclose=false", ExpectedException
= typeof(UriFormatException))]
-		[Row("(tcp://${activemqhost}:61616,tcp://${activemqhost}:61616)", ExpectedException = typeof(UriFormatException))]
+        [Row("(tcp://${activemqhost}:61616,tcp://${activemqhost}:61616)", ExpectedException
= typeof(UriFormatException))]
 		[Row("tcp://${activemqhost}:61616,tcp://${activemqhost}:61616", ExpectedException = typeof(UriFormatException))]
 		public void TestURI(string connectionURI)
 		{



Mime
View raw message