You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2010/09/09 22:33:13 UTC

svn commit: r995570 - in /activemq/activemq-dotnet: Apache.NMS.ActiveMQ/trunk/src/main/csharp/ Apache.NMS.ActiveMQ/trunk/src/test/csharp/ Apache.NMS.Stomp/trunk/src/main/csharp/ Apache.NMS.Stomp/trunk/src/test/csharp/

Author: tabish
Date: Thu Sep  9 20:33:13 2010
New Revision: 995570

URL: http://svn.apache.org/viewvc?rev=995570&view=rev
Log:
fix for: https://issues.apache.org/activemq/browse/AMQNET-281

Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/ConnectionFactory.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSConnectionFactoryTest.cs
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/ConnectionFactory.cs
    activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/test/csharp/NMSConnectionFactoryTest.cs

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=995570&r1=995569&r2=995570&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 Thu Sep  9 20:33:13 2010
@@ -164,10 +164,14 @@ namespace Apache.NMS.ActiveMQ
 			set
 			{
 				brokerUri = new Uri(URISupport.StripPrefix(value.OriginalString, "activemq:"));
-
-				if(brokerUri.Query != null)
+				
+				if(!String.IsNullOrEmpty(brokerUri.Query) && !brokerUri.OriginalString.EndsWith(")"))
 				{
-					StringDictionary properties = URISupport.ParseQuery(brokerUri.Query);
+					// Since the Uri class will return the end of a Query string found in a Composite
+					// URI we must ensure that we trim that off before we proceed.
+					string query = brokerUri.Query.Substring(brokerUri.Query.LastIndexOf(")") + 1);						
+					
+					StringDictionary properties = URISupport.ParseQuery(query);
 
 					StringDictionary connection = URISupport.ExtractProperties(properties, "connection.");
 					StringDictionary nms = URISupport.ExtractProperties(properties, "nms.");

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=995570&r1=995569&r2=995570&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 Thu Sep  9 20:33:13 2010
@@ -43,6 +43,9 @@ namespace Apache.NMS.ActiveMQ.Test
 		[TestCase("activemq:failover://(tcp://${activemqhost}:61616)?transport.initialReconnectDelay=100")]
 		[TestCase("activemq:failover:(tcp://${activemqhost}:61616)?connection.asyncSend=true")]
 		[TestCase("activemq:failover:(tcp://${activemqhost}:61616)?transport.timeout=100&connection.asyncSend=true")]
+		[TestCase("activemq:failover:tcp://${activemqhost}:61616?keepAlive=false&wireFormat.maxInactivityDuration=1000")]
+		[TestCase("activemq:failover:(tcp://${activemqhost}:61616?keepAlive=false&wireFormat.maxInactivityDuration=1000)")]
+		[TestCase("activemq:failover:(tcp://${activemqhost}:61616?keepAlive=false&wireFormat.maxInactivityDuration=1000)?connection.asyncclose=false")]
 
 #if false
 		[TestCase("activemq:discovery:multicast://default")]
@@ -81,6 +84,7 @@ namespace Apache.NMS.ActiveMQ.Test
 			using(IConnection connection = factory.CreateConnection("", ""))
 			{
 				Assert.IsNotNull(connection);
+				connection.Close();
 			}
 		}
 
@@ -105,6 +109,8 @@ namespace Apache.NMS.ActiveMQ.Test
                 Assert.IsNotNull(this.info);
                 Assert.AreEqual(username, info.UserName);
                 Assert.AreEqual(password, info.Password);
+				
+				connection.Close();
             }
         }
 
@@ -143,7 +149,9 @@ namespace Apache.NMS.ActiveMQ.Test
                 Assert.AreEqual(topicPrefetch, amqConnection.PrefetchPolicy.TopicPrefetch);
                 Assert.AreEqual(durableTopicPrefetch, amqConnection.PrefetchPolicy.DurableTopicPrefetch);
                 Assert.AreEqual(maximumPendingMessageLimit, amqConnection.PrefetchPolicy.MaximumPendingMessageLimit);
-            }
+
+				connection.Close();
+			}
         }
     }
 }

Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/ConnectionFactory.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/ConnectionFactory.cs?rev=995570&r1=995569&r2=995570&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/ConnectionFactory.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/ConnectionFactory.cs Thu Sep  9 20:33:13 2010
@@ -160,9 +160,13 @@ namespace Apache.NMS.Stomp
             {
                 brokerUri = new Uri(URISupport.StripPrefix(value.OriginalString, "stomp:"));
 
-                if(brokerUri.Query != null)
+                if(!String.IsNullOrEmpty(brokerUri.Query) && !brokerUri.OriginalString.EndsWith(")"))
                 {
-                    StringDictionary properties = URISupport.ParseQuery(brokerUri.Query);
+                    // Since the Uri class will return the end of a Query string found in a Composite
+                    // URI we must ensure that we trim that off before we proceed.
+                    string query = brokerUri.Query.Substring(brokerUri.Query.LastIndexOf(")") + 1);
+
+                    StringDictionary properties = URISupport.ParseQuery(query);
                 
                     StringDictionary connection = URISupport.ExtractProperties(properties, "connection.");
                     StringDictionary nms = URISupport.ExtractProperties(properties, "nms.");

Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/test/csharp/NMSConnectionFactoryTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/test/csharp/NMSConnectionFactoryTest.cs?rev=995570&r1=995569&r2=995570&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/test/csharp/NMSConnectionFactoryTest.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/test/csharp/NMSConnectionFactoryTest.cs Thu Sep  9 20:33:13 2010
@@ -28,6 +28,8 @@ namespace Apache.NMS.Stomp.Test
         [Test]
 #if !NETCF
         [TestCase("stomp:tcp://${activemqhost}:61613")]
+        [TestCase("stomp:failover:(tcp://${activemqhost}:61616?keepAlive=false&wireFormat.maxInactivityDuration=1000)")]
+        [TestCase("stomp:failover:(tcp://${activemqhost}:61616?keepAlive=false&wireFormat.maxInactivityDuration=1000)?connection.asyncSend=false")]
 		[TestCase("stomp:tcp://${activemqhost}:61613?connection.asyncsend=false")]
 		[TestCase("stomp:tcp://${activemqhost}:61613?connection.InvalidParameter=true", ExpectedException = typeof(NMSConnectionException))]
 		[TestCase("stomp:tcp://${activemqhost}:61613?connection.InvalidParameter=true", ExpectedException = typeof(NMSConnectionException))]