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/23 17:59:46 UTC

svn commit: r1000511 - in /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.4.x: ./ src/main/csharp/Connection.cs src/main/csharp/ConnectionFactory.cs src/test/csharp/ConnectionFactoryTest.cs

Author: tabish
Date: Thu Sep 23 15:59:46 2010
New Revision: 1000511

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

Fix error in CreateSession URI parsing, adds a test to ensure this is fixed.  

Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.4.x/   (props changed)
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.4.x/src/main/csharp/Connection.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.4.x/src/main/csharp/ConnectionFactory.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.4.x/src/test/csharp/ConnectionFactoryTest.cs

Propchange: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.4.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Sep 23 15:59:46 2010
@@ -1,3 +1,3 @@
 /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.0.0:692591,693525
 /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0:788230,788233,790183
-/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk:995570
+/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk:995570,1000486-1000507

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.4.x/src/main/csharp/Connection.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.4.x/src/main/csharp/Connection.cs?rev=1000511&r1=1000510&r2=1000511&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.4.x/src/main/csharp/Connection.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.4.x/src/main/csharp/Connection.cs Thu Sep 23 15:59:46 2010
@@ -440,10 +440,14 @@ namespace Apache.NMS.ActiveMQ
             Session session = new Session(this, info, sessionAcknowledgementMode, this.dispatchAsync);
 
             // Set propertieDs on session using parameters prefixed with "session."
-			StringDictionary options = URISupport.ParseQuery(this.brokerUri.Query);
-			options = URISupport.GetProperties(options, "session.");
-            URISupport.SetProperties(session, options);
-
+			if(!String.IsNullOrEmpty(brokerUri.Query) && !brokerUri.OriginalString.EndsWith(")"))
+			{
+				string query = brokerUri.Query.Substring(brokerUri.Query.LastIndexOf(")") + 1);						
+				StringDictionary options = URISupport.ParseQuery(query);
+				options = URISupport.GetProperties(options, "session.");
+	            URISupport.SetProperties(session, options);
+			}
+			
 			session.ConsumerTransformer = this.ConsumerTransformer;
 			session.ProducerTransformer = this.ProducerTransformer;
 

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.4.x/src/main/csharp/ConnectionFactory.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.4.x/src/main/csharp/ConnectionFactory.cs?rev=1000511&r1=1000510&r2=1000511&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.4.x/src/main/csharp/ConnectionFactory.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.4.x/src/main/csharp/ConnectionFactory.cs Thu Sep 23 15:59:46 2010
@@ -163,6 +163,8 @@ namespace Apache.NMS.ActiveMQ
 			get { return brokerUri; }
 			set
 			{
+				Tracer.Info("BrokerUri set = " + value.OriginalString);
+				
 				brokerUri = new Uri(URISupport.StripPrefix(value.OriginalString, "activemq:"));
 				
 				if(!String.IsNullOrEmpty(brokerUri.Query) && !brokerUri.OriginalString.EndsWith(")"))

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.4.x/src/test/csharp/ConnectionFactoryTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.4.x/src/test/csharp/ConnectionFactoryTest.cs?rev=1000511&r1=1000510&r2=1000511&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.4.x/src/test/csharp/ConnectionFactoryTest.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.4.x/src/test/csharp/ConnectionFactoryTest.cs Thu Sep 23 15:59:46 2010
@@ -18,6 +18,7 @@
 using System;
 
 using Apache.NMS.Test;
+using Apache.NMS.Util;
 using Apache.NMS.ActiveMQ;
 
 using NUnit.Framework;
@@ -27,6 +28,79 @@ namespace Apache.NMS.ActiveMQ.Test
 	[TestFixture]
 	public class ConnectionFactoryTest : NMSTestSupport
 	{
+		[Test]
+		[TestCase("tcp://${activemqhost}:61616")]
+		[TestCase("tcp://${activemqhost}:61616")]
+		[TestCase("tcp://${activemqhost}:61616/0.0.0.0:0")]
+		[TestCase("tcp://${activemqhost}:61616?connection.asyncclose=false")]
+		[TestCase("failover:tcp://${activemqhost}:61616")]
+		[TestCase("failover:(tcp://${activemqhost}:61616)")]
+		[TestCase("failover:(tcp://${activemqhost}:61616,tcp://${activemqhost}:61616)")]
+		[TestCase("failover://(tcp://${activemqhost}:61616)?transport.initialReconnectDelay=100")]
+		[TestCase("failover:(tcp://${activemqhost}:61616)?connection.asyncSend=true")]
+		[TestCase("failover:(tcp://${activemqhost}:61616)?transport.timeout=100&connection.asyncSend=true")]
+		[TestCase("failover:tcp://${activemqhost}:61616?keepAlive=false&wireFormat.maxInactivityDuration=1000")]
+		[TestCase("failover:(tcp://${activemqhost}:61616?keepAlive=false&wireFormat.maxInactivityDuration=1000)")]
+		[TestCase("failover:(tcp://${activemqhost}:61616?keepAlive=false&wireFormat.maxInactivityDuration=1000)?connection.asyncclose=false")]
+		[TestCase("failover:(tcp://${activemqhost}:61616?keepAlive=true&wireFormat.maxInactivityDuration=300000&wireFormat.tcpNoDelayEnabled=true)?initialReconnectDelay=100&randomize=false&timeout=15000")]
+		public void TestURI(string connectionURI)
+		{
+			{
+				Uri uri = URISupport.CreateCompatibleUri(NMSTestSupport.ReplaceEnvVar(connectionURI));
+				ConnectionFactory factory = new ConnectionFactory(uri);
+				Assert.IsNotNull(factory);
+				using(IConnection connection = factory.CreateConnection("", ""))
+				{
+					Assert.IsNotNull(connection);
+					
+					using(ISession session = connection.CreateSession())
+					{
+						IDestination destination = session.CreateTemporaryTopic();
+						using(IMessageProducer producer = session.CreateProducer(destination))
+						{
+							producer.Close();
+						}
+						
+						using(IMessageConsumer consumer = session.CreateConsumer(destination))
+						{
+							consumer.Close();
+						}
+						
+						session.Close();
+					}
+					
+					connection.Close();
+				}
+			}
+
+			{
+				ConnectionFactory factory = new ConnectionFactory(NMSTestSupport.ReplaceEnvVar(connectionURI));
+				Assert.IsNotNull(factory);
+				using(IConnection connection = factory.CreateConnection("", ""))
+				{
+					Assert.IsNotNull(connection);
+
+					using(ISession session = connection.CreateSession())
+					{
+						IDestination destination = session.CreateTemporaryTopic();
+						using(IMessageProducer producer = session.CreateProducer(destination))
+						{
+							producer.Close();
+						}
+						
+						using(IMessageConsumer consumer = session.CreateConsumer(destination))
+						{
+							consumer.Close();
+						}
+						
+						session.Close();
+					}
+					
+					connection.Close();
+				}
+			}
+		}		
+		
 		[Test, Sequential]
 		public void TestConnectionFactorySetParams(
 			[Values("tcp://${activemqhost}:61616", "activemq:tcp://${activemqhost}:61616")]