activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r592776 - in /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src: main/csharp/Transport/Stomp/StompHelper.cs main/csharp/Transport/Stomp/StompWireFormat.cs test/csharp/Stomp/StompHelperTest.cs
Date Wed, 07 Nov 2007 15:10:20 GMT
Author: chirino
Date: Wed Nov  7 07:10:19 2007
New Revision: 592776

URL: http://svn.apache.org/viewvc?rev=592776&view=rev
Log:
- Fixed serveral stomp bugs that were cusing test failures.  We are now passing all test cases
again.

Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Stomp/StompHelper.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Stomp/StompWireFormat.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Stomp/StompHelperTest.cs

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Stomp/StompHelper.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Stomp/StompHelper.cs?rev=592776&r1=592775&r2=592776&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Stomp/StompHelper.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Stomp/StompHelper.cs
Wed Nov  7 07:10:19 2007
@@ -149,17 +149,10 @@
 			StringBuilder producerBuilder = new StringBuilder();
 
 			producerBuilder.Append(id.ConnectionId);
-			if(0 != id.SessionId)
-			{
-				producerBuilder.Append(":");
-				producerBuilder.Append(id.SessionId);
-			}
-
-			if(0 != id.Value)
-			{
-				producerBuilder.Append(":");
-				producerBuilder.Append(id.Value);
-			}
+            producerBuilder.Append(":");
+            producerBuilder.Append(id.SessionId);
+            producerBuilder.Append(":");
+			producerBuilder.Append(id.Value);
 
 			return producerBuilder.ToString();
 		}
@@ -176,19 +169,13 @@
 				try
 				{
 					answer.Value = Int32.Parse(text.Substring(idx + 1));
-					text = text.Substring(0, idx);
-					idx = text.LastIndexOf(':');
-					if (idx >= 0) {
-						try
-						{
-							answer.SessionId = Int32.Parse(text.Substring(idx + 1));
-							text = text.Substring(0, idx);
-						}
-						catch(Exception ex)
-						{
-							Tracer.Debug(ex.Message);
-						}
-					}
+                    text = text.Substring(0, idx);
+                    idx = text.LastIndexOf(':');
+                    if (idx >= 0)
+                    {
+                        answer.SessionId = Int32.Parse(text.Substring(idx + 1));
+                        text = text.Substring(0, idx);
+                    }
 				}
 				catch(Exception ex)
 				{
@@ -204,17 +191,8 @@
 			StringBuilder messageBuilder = new StringBuilder();
 
 			messageBuilder.Append(ToStomp(id.ProducerId));
-			if(0 != id.BrokerSequenceId)
-			{
-				messageBuilder.Append(":");
-				messageBuilder.Append(id.BrokerSequenceId);
-			}
-
-			if(0 != id.ProducerSequenceId)
-			{
-				messageBuilder.Append(":");
-				messageBuilder.Append(id.ProducerSequenceId);
-			}
+			messageBuilder.Append(":");
+			messageBuilder.Append(id.ProducerSequenceId);
 			
 			return messageBuilder.ToString();
 		}
@@ -232,18 +210,6 @@
 				{
 					answer.ProducerSequenceId = Int32.Parse(text.Substring(idx + 1));
 					text = text.Substring(0, idx);
-					idx = text.LastIndexOf(':');
-					if (idx >= 0) {
-						try
-						{
-							answer.BrokerSequenceId = Int32.Parse(text.Substring(idx + 1));
-							text = text.Substring(0, idx);
-						}
-						catch(Exception ex)
-						{
-							Tracer.Debug(ex.Message);
-						}
-					}
 				}
 				catch(Exception ex)
 				{

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Stomp/StompWireFormat.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Stomp/StompWireFormat.cs?rev=592776&r1=592775&r2=592776&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Stomp/StompWireFormat.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Stomp/StompWireFormat.cs
Wed Nov  7 07:10:19 2007
@@ -323,7 +323,9 @@
                 ss.WriteHeader("no-local", command.NoLocal);
 
 			if ( AcknowledgementMode.ClientAcknowledge == command.AcknowledgementMode
-				|| AcknowledgementMode.AutoClientAcknowledge == command.AcknowledgementMode )
+				|| AcknowledgementMode.AutoClientAcknowledge == command.AcknowledgementMode
+                || AcknowledgementMode.Transactional == command.AcknowledgementMode 
+                )
 				ss.WriteHeader("ack", "client");
 
 			// ActiveMQ extensions to STOMP
@@ -459,7 +461,7 @@
 			ss.WriteCommand(command, "ACK");
 			
 			// TODO handle bulk ACKs?
-            ss.WriteHeader("message-id", StompHelper.ToStomp(command.FirstMessageId));
+            ss.WriteHeader("message-id", StompHelper.ToStomp(command.LastMessageId));
 			if( command.TransactionId!=null )
                 ss.WriteHeader("transaction", StompHelper.ToStomp(command.TransactionId));
 

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Stomp/StompHelperTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Stomp/StompHelperTest.cs?rev=592776&r1=592775&r2=592776&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Stomp/StompHelperTest.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Stomp/StompHelperTest.cs
Wed Nov  7 07:10:19 2007
@@ -56,16 +56,15 @@
 			mid.ProducerSequenceId = 6;
 			
 			string text = StompHelper.ToStomp(mid);
-			Assert.AreEqual("cheese:2:3:5:6", text, "MessageId as stomp");
+			Assert.AreEqual("cheese:2:3:6", text, "MessageId as stomp");
 			
 			MessageId mid2 = StompHelper.ToMessageId("abc:5:6:7:8");
-			Assert.AreEqual(7, mid2.BrokerSequenceId, "extracting mid2.BrokerSequenceId");
 			Assert.AreEqual(8, mid2.ProducerSequenceId, "extracting mid2.ProducerSequenceId");
 
 			ProducerId another = mid2.ProducerId;
-			Assert.AreEqual("abc", another.ConnectionId, "extracting producerId.ConnectionId");
-			Assert.AreEqual(5, another.SessionId, "extracting producerId.SessionId");
-			Assert.AreEqual(6, another.Value, "extracting producerId.Value");
+            Assert.AreEqual(7, another.Value, "extracting another.Value");
+            Assert.AreEqual(6, another.SessionId, "extracting another.SessionId");
+			Assert.AreEqual("abc:5", another.ConnectionId, "extracting another.ConnectionId");
 		}
 
 		// TODO destination stuff



Mime
View raw message