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 2006/03/06 04:39:54 UTC

svn commit: r383459 [2/2] - in /incubator/activemq/trunk/openwire-dotnet: src/ src/ActiveMQ/OpenWire/ src/ActiveMQ/OpenWire/V1/ src/ActiveMQ/Transport/Tcp/ tests/ tests/ActiveMQ/OpenWire/ tests/JMS/

Modified: incubator/activemq/trunk/openwire-dotnet/tests/JMS/MapMessageTest.cs
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-dotnet/tests/JMS/MapMessageTest.cs?rev=383459&r1=383458&r2=383459&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-dotnet/tests/JMS/MapMessageTest.cs (original)
+++ incubator/activemq/trunk/openwire-dotnet/tests/JMS/MapMessageTest.cs Sun Mar  5 19:39:51 2006
@@ -31,6 +31,11 @@
         int e = 0x12345678;
         long f = 0x1234567812345678;
         string g = "Hello World!";
+		bool h = false;
+        byte i = 0xFF;
+        short j = -0x1234;
+        int k = -0x12345678;
+        long l = -0x1234567812345678;
         
 		[SetUp]
         override public void SetUp()
@@ -61,6 +66,11 @@
             message.Body["e"] = e;
             message.Body["f"] = f;
             message.Body["g"] = g;
+            message.Body["h"] = h;
+            message.Body["i"] = i;
+            message.Body["j"] = j;
+            message.Body["k"] = k;
+            message.Body["l"] = l;
             
             return message;
         }
@@ -83,6 +93,11 @@
             Assert.AreEqual(e, mapMessage.Body["e"], "generic map entry: e");
             Assert.AreEqual(f, mapMessage.Body["f"], "generic map entry: f");
             Assert.AreEqual(g, mapMessage.Body["g"], "generic map entry: g");
+            Assert.AreEqual(h, mapMessage.Body["h"], "generic map entry: h");
+            Assert.AreEqual(i, mapMessage.Body["i"], "generic map entry: i");
+            Assert.AreEqual(j, mapMessage.Body["j"], "generic map entry: j");
+            Assert.AreEqual(k, mapMessage.Body["k"], "generic map entry: k");
+            Assert.AreEqual(l, mapMessage.Body["l"], "generic map entry: l");
             
             // use type safe APIs
             Assert.AreEqual(a, mapMessage.Body.GetBool("a"), "map entry: a");
@@ -92,8 +107,12 @@
             Assert.AreEqual(e, mapMessage.Body.GetInt("e"), "map entry: e");
             Assert.AreEqual(f, mapMessage.Body.GetLong("f"), "map entry: f");
             Assert.AreEqual(g, mapMessage.Body.GetString("g"), "map entry: g");
-            
-            
+            Assert.AreEqual(h, mapMessage.Body.GetBool("h"), "map entry: h");
+            Assert.AreEqual(i, mapMessage.Body.GetByte("i"), "map entry: i");
+            Assert.AreEqual(j, mapMessage.Body.GetShort("j"), "map entry: j");
+            Assert.AreEqual(k, mapMessage.Body.GetInt("k"), "map entry: k");
+            Assert.AreEqual(l, mapMessage.Body.GetLong("l"), "map entry: l");
+            			
         }
         
         protected string ToHex(long value)

Added: incubator/activemq/trunk/openwire-dotnet/tests/JMS/MessageTest.cs
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-dotnet/tests/JMS/MessageTest.cs?rev=383459&view=auto
==============================================================================
--- incubator/activemq/trunk/openwire-dotnet/tests/JMS/MessageTest.cs (added)
+++ incubator/activemq/trunk/openwire-dotnet/tests/JMS/MessageTest.cs Sun Mar  5 19:39:51 2006
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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 JMS;
+using NUnit.Framework;
+using System;
+
+namespace tests
+{
+	[ TestFixture ]
+	public class MessageTest : JMSTestSupport
+	{
+		bool a = true;
+        byte b = 123;
+        char c = 'c';
+        short d = 0x1234;
+        int e = 0x12345678;
+        long f = 0x1234567812345678;
+        string g = "Hello World!";
+		bool h = false;
+        byte i = 0xFF;
+        short j = -0x1234;
+        int k = -0x12345678;
+        long l = -0x1234567812345678;
+        
+		[SetUp]
+        override public void SetUp()
+        {
+			base.SetUp();
+        }
+		
+        [TearDown]
+        override public void TearDown()
+        {
+			base.TearDown();
+        }
+		
+        [ Test ]
+        public override void SendAndSyncReceive()
+        {
+            base.SendAndSyncReceive();
+        }
+		
+        protected override IMessage CreateMessage()
+        {
+            IMessage message = session.CreateMessage();
+            
+            message.Properties["a"] = a;
+            message.Properties["b"] = b;
+            message.Properties["c"] = c;
+            message.Properties["d"] = d;
+            message.Properties["e"] = e;
+            message.Properties["f"] = f;
+            message.Properties["g"] = g;
+            message.Properties["h"] = h;
+            message.Properties["i"] = i;
+            message.Properties["j"] = j;
+            message.Properties["k"] = k;
+            message.Properties["l"] = l;
+            
+            return message;
+        }
+        
+        protected override void AssertValidMessage(IMessage message)
+        {
+            Console.WriteLine("Received message: " + message);
+            Console.WriteLine("Received Count: " + message.Properties.Count);
+			
+            Assert.AreEqual(ToHex(f), ToHex(message.Properties.GetLong("f")), "map entry: f as hex");
+            
+            // use generic API to access entries
+            Assert.AreEqual(a, message.Properties["a"], "generic map entry: a");
+            Assert.AreEqual(b, message.Properties["b"], "generic map entry: b");
+            Assert.AreEqual(c, message.Properties["c"], "generic map entry: c");
+            Assert.AreEqual(d, message.Properties["d"], "generic map entry: d");
+            Assert.AreEqual(e, message.Properties["e"], "generic map entry: e");
+            Assert.AreEqual(f, message.Properties["f"], "generic map entry: f");
+            Assert.AreEqual(g, message.Properties["g"], "generic map entry: g");
+            Assert.AreEqual(h, message.Properties["h"], "generic map entry: h");
+            Assert.AreEqual(i, message.Properties["i"], "generic map entry: i");
+            Assert.AreEqual(j, message.Properties["j"], "generic map entry: j");
+            Assert.AreEqual(k, message.Properties["k"], "generic map entry: k");
+            Assert.AreEqual(l, message.Properties["l"], "generic map entry: l");
+            
+            // use type safe APIs
+            Assert.AreEqual(a, message.Properties.GetBool("a"), "map entry: a");
+            Assert.AreEqual(b, message.Properties.GetByte("b"), "map entry: b");
+            Assert.AreEqual(c, message.Properties.GetChar("c"), "map entry: c");
+            Assert.AreEqual(d, message.Properties.GetShort("d"), "map entry: d");
+            Assert.AreEqual(e, message.Properties.GetInt("e"), "map entry: e");
+            Assert.AreEqual(f, message.Properties.GetLong("f"), "map entry: f");
+            Assert.AreEqual(g, message.Properties.GetString("g"), "map entry: g");
+            Assert.AreEqual(h, message.Properties.GetBool("h"), "map entry: h");
+            Assert.AreEqual(i, message.Properties.GetByte("i"), "map entry: i");
+            Assert.AreEqual(j, message.Properties.GetShort("j"), "map entry: j");
+            Assert.AreEqual(k, message.Properties.GetInt("k"), "map entry: k");
+            Assert.AreEqual(l, message.Properties.GetLong("l"), "map entry: l");
+            
+        }
+        
+        protected string ToHex(long value)
+        {
+            return String.Format("{0:x}", value);
+        }
+		
+	}
+}

Modified: incubator/activemq/trunk/openwire-dotnet/tests/tests.csproj
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-dotnet/tests/tests.csproj?rev=383459&r1=383458&r2=383459&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-dotnet/tests/tests.csproj (original)
+++ incubator/activemq/trunk/openwire-dotnet/tests/tests.csproj Sun Mar  5 19:39:51 2006
@@ -52,6 +52,7 @@
         <Compile Include="JMS\JMSPropertyTest.cs"/>
         <Compile Include="JMS\JMSTestSupport.cs"/>
         <Compile Include="JMS\MapMessageTest.cs"/>
+        <Compile Include="JMS\MessageTest.cs"/>
         <Compile Include="JMS\TextMessage.cs"/>
         <Compile Include="JMS\TransactionTest.cs"/>
     </ItemGroup>