You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2008/02/13 21:16:11 UTC
svn commit: r627579 - in /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk:
src/test/csharp/StompHelperTest.cs vs2005-activemq-test.csproj
vs2005-activemq.csproj
Author: chirino
Date: Wed Feb 13 12:16:08 2008
New Revision: 627579
URL: http://svn.apache.org/viewvc?rev=627579&view=rev
Log:
Fixing some screwups I did while applying Jim's patches
Added:
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/StompHelperTest.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/vs2005-activemq.csproj
- copied unchanged from r627537, activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/vs2005-activemq.csproj
Removed:
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/vs2005-activemq-test.csproj
Added: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/StompHelperTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/StompHelperTest.cs?rev=627579&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/StompHelperTest.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/StompHelperTest.cs Wed Feb 13 12:16:08 2008
@@ -0,0 +1,90 @@
+/*
+ * 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 Apache.NMS.ActiveMQ.Commands;
+using Apache.NMS.ActiveMQ.Transport.Stomp;
+using NUnit.Framework;
+
+namespace Apache.NMS.ActiveMQ.Test
+{
+ [TestFixture]
+ public class StompHelperTest
+ {
+ [Test]
+ public void ConsumerIdMarshallingWorks()
+ {
+ ConsumerId id = new ConsumerId();
+ id.ConnectionId = "cheese";
+ id.SessionId = 2;
+ id.Value = 3;
+
+ string text = StompHelper.ToStomp(id);
+ Assert.AreEqual("cheese:2:3", text, "ConsumerId as stomp");
+
+ ConsumerId another = StompHelper.ToConsumerId("abc:5:6");
+ Assert.AreEqual("abc", another.ConnectionId, "extracting consumerId.ConnectionId");
+ Assert.AreEqual(5, another.SessionId, "extracting consumerId.SessionId");
+ Assert.AreEqual(6, another.Value, "extracting consumerId.Value");
+ }
+
+ [Test]
+ public void MessageIdMarshallingWorks()
+ {
+ ProducerId id = new ProducerId();
+ id.ConnectionId = "cheese";
+ id.SessionId = 2;
+ id.Value = 3;
+
+ MessageId mid = new MessageId();
+ mid.ProducerId = id;
+ mid.BrokerSequenceId = 5;
+ mid.ProducerSequenceId = 6;
+
+ string text = StompHelper.ToStomp(mid);
+ Assert.AreEqual("cheese:2:3:6", text, "MessageId as stomp");
+
+ MessageId mid2 = StompHelper.ToMessageId("abc:5:6:7:8");
+ Assert.AreEqual(8, mid2.ProducerSequenceId, "extracting mid2.ProducerSequenceId");
+
+ ProducerId another = mid2.ProducerId;
+ 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
+
+ [Test]
+ public void DestinationMarshallingWorks()
+ {
+ Assert.AreEqual("/queue/FOO.BAR", StompHelper.ToStomp(new ActiveMQQueue("FOO.BAR")), "queue");
+ Assert.AreEqual("/topic/FOO.BAR", StompHelper.ToStomp(new ActiveMQTopic("FOO.BAR")), "topic");
+ Assert.AreEqual("/temp-queue/FOO.BAR", StompHelper.ToStomp(new ActiveMQTempQueue("FOO.BAR")),
+ "temporary queue");
+ Assert.AreEqual("/temp-topic/FOO.BAR", StompHelper.ToStomp(new ActiveMQTempTopic("FOO.BAR")),
+ "temporary topic");
+
+ Assert.AreEqual(new ActiveMQQueue("FOO.BAR"), StompHelper.ToDestination("/queue/FOO.BAR"),
+ "queue from Stomp");
+ Assert.AreEqual(new ActiveMQTopic("FOO.BAR"), StompHelper.ToDestination("/topic/FOO.BAR"),
+ "topic from Stomp");
+ Assert.AreEqual(new ActiveMQTempQueue("FOO.BAR"),
+ StompHelper.ToDestination("/temp-queue/FOO.BAR"), "temporary queue from Stomp");
+ Assert.AreEqual(new ActiveMQTempTopic("FOO.BAR"),
+ StompHelper.ToDestination("/temp-topic/FOO.BAR"), "temporary topic from Stomp");
+ }
+ }
+}