activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1196186 - in /activemq/activemq-dotnet: Apache.NMS.ActiveMQ/trunk/src/test/csharp/Commands/ActiveMQMessageTest.cs Apache.NMS/trunk/src/main/csharp/Util/MessagePropertyIntercepter.cs
Date Tue, 01 Nov 2011 18:15:55 GMT
Author: tabish
Date: Tue Nov  1 18:15:54 2011
New Revision: 1196186

URL: http://svn.apache.org/viewvc?rev=1196186&view=rev
Log:
fix for: https://issues.apache.org/jira/browse/AMQNET-340 with some testing in NMS.ActiveMQ


Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Commands/ActiveMQMessageTest.cs
    activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/MessagePropertyIntercepter.cs

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Commands/ActiveMQMessageTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Commands/ActiveMQMessageTest.cs?rev=1196186&r1=1196185&r2=1196186&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Commands/ActiveMQMessageTest.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Commands/ActiveMQMessageTest.cs
Tue Nov  1 18:15:54 2011
@@ -148,7 +148,19 @@ namespace Apache.NMS.ActiveMQ.Test.Comma
         {
             ActiveMQMessage msg = new ActiveMQMessage();
             msg.NMSCorrelationID = this.nmsCorrelationID;
-            Assert.IsTrue(msg.NMSCorrelationID.Equals(this.nmsCorrelationID));
+            Assert.IsTrue(msg.NMSCorrelationID.Equals(this.nmsCorrelationID));		
+			
+			// Check that we get the real value even if we go through the properties
+			string nmsCorrelationId = msg.Properties.GetString("NMSCorrelationID");
+			Assert.IsTrue(nmsCorrelationId.Equals(this.nmsCorrelationID));
+			
+			// We shouldn't get the expected value though if we use the inner property 
+			// name from ActiveMQMessage
+			string correlationId = (string) msg.Properties["correlationId"];
+			Assert.IsNullOrEmpty(correlationId);			
+			msg.Properties["correlationId"] = "TEST";
+			correlationId = (string) msg.Properties["correlationId"];
+			Assert.IsFalse(msg.Properties["NMSCorrelationID"].Equals(msg.Properties["correlationId"]));
         }
     
         [Test]

Modified: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/MessagePropertyIntercepter.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/MessagePropertyIntercepter.cs?rev=1196186&r1=1196185&r2=1196186&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/MessagePropertyIntercepter.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/MessagePropertyIntercepter.cs
Tue Nov  1 18:15:54 2011
@@ -55,20 +55,23 @@ namespace Apache.NMS.Util
 		{
 			PropertyInfo propertyInfo = this.messageType.GetProperty(name, publicBinding);
 
-			if(null != propertyInfo && propertyInfo.CanRead)
-			{
-				return propertyInfo.GetValue(this.message, null);
-			}
-			else
-			{
-				FieldInfo fieldInfo = this.messageType.GetField(name, publicBinding);
-
-				if(null != fieldInfo)
+			if(name.StartsWith("NMS"))
+			{			
+				if(null != propertyInfo && propertyInfo.CanRead)
 				{
-					return fieldInfo.GetValue(this.message);
+					return propertyInfo.GetValue(this.message, null);
+				}
+				else
+				{
+					FieldInfo fieldInfo = this.messageType.GetField(name, publicBinding);
+	
+					if(null != fieldInfo)
+					{
+						return fieldInfo.GetValue(this.message);
+					}
 				}
 			}
-
+			
 			return base.GetObjectProperty(name);
 		}
 
@@ -76,7 +79,11 @@ namespace Apache.NMS.Util
 		{
 			PropertyInfo propertyInfo = this.messageType.GetProperty(name, publicBinding);
 
-			if(null != propertyInfo && propertyInfo.CanWrite)
+			if(!name.StartsWith("NMS"))
+			{
+                base.SetObjectProperty(name, value);
+			}			
+			else if(null != propertyInfo && propertyInfo.CanWrite)
 			{
 				propertyInfo.SetValue(this.message, value, null);
 			}



Mime
View raw message