activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r512253 - in /activemq/activemq-dotnet/trunk/src: main/csharp/ActiveMQ/Util/DateUtils.cs test/csharp/NMS/Test/MapMessageTest.cs test/csharp/NMS/Test/NMSPropertyTest.cs
Date Tue, 27 Feb 2007 13:56:36 GMT
Author: jstrachan
Date: Tue Feb 27 05:56:33 2007
New Revision: 512253

URL: http://svn.apache.org/viewvc?view=rev&rev=512253
Log:
Added more test cases for AMQNET-9

Modified:
    activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/DateUtils.cs
    activemq/activemq-dotnet/trunk/src/test/csharp/NMS/Test/MapMessageTest.cs
    activemq/activemq-dotnet/trunk/src/test/csharp/NMS/Test/NMSPropertyTest.cs

Modified: activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/DateUtils.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/DateUtils.cs?view=diff&rev=512253&r1=512252&r2=512253
==============================================================================
--- activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/DateUtils.cs (original)
+++ activemq/activemq-dotnet/trunk/src/main/csharp/ActiveMQ/Util/DateUtils.cs Tue Feb 27 05:56:33
2007
@@ -1,44 +1,44 @@
-/*
- * 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 System;
-
-namespace ActiveMQ.Util
-{
-	internal class DateUtils
-	{
-		/// <summary>
-		/// The difference between the Windows epoch (1601-01-01 00:00:00)
-		/// and the Unix epoch (1970-01-01 00:00:00) in milliseconds.
-		/// </summary>
-		public static readonly long EPOCH_DIFF = 11644473600000L;
-
-        /// <summary>
-        /// The start of the UNIX epoch
-        /// </summary>
-        public static readonly DateTime UNIX_EPOCH = new DateTime(1970, 1, 1, 0, 0, 0, 0);
-
-	    public static long ToJavaTime(DateTime dateTime)
-		{
-			return dateTime.ToFileTime() + EPOCH_DIFF;
-		}
-
-        public static DateTime ToDateTime(long dateTime)
-        {
-            return UNIX_EPOCH.AddMilliseconds(dateTime);
-        }
-	}
-}
+/*
+ * 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 System;
+
+namespace ActiveMQ.Util
+{
+	internal class DateUtils
+	{
+		/// <summary>
+		/// The difference between the Windows epoch (1601-01-01 00:00:00)
+		/// and the Unix epoch (1970-01-01 00:00:00) in milliseconds.
+		/// </summary>
+		public static readonly long EPOCH_DIFF = 11644473600000L;
+
+        /// <summary>
+        /// The start of the UNIX epoch
+        /// </summary>
+        public static readonly DateTime UNIX_EPOCH = new DateTime(1970, 1, 1, 0, 0, 0, 0);
+
+	    public static long ToJavaTime(DateTime dateTime)
+		{
+			return dateTime.ToFileTime() + EPOCH_DIFF;
+		}
+
+        public static DateTime ToDateTime(long dateTime)
+        {
+            return UNIX_EPOCH.AddMilliseconds(dateTime);
+        }
+	}
+}

Modified: activemq/activemq-dotnet/trunk/src/test/csharp/NMS/Test/MapMessageTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/trunk/src/test/csharp/NMS/Test/MapMessageTest.cs?view=diff&rev=512253&r1=512252&r2=512253
==============================================================================
--- activemq/activemq-dotnet/trunk/src/test/csharp/NMS/Test/MapMessageTest.cs (original)
+++ activemq/activemq-dotnet/trunk/src/test/csharp/NMS/Test/MapMessageTest.cs Tue Feb 27 05:56:33
2007
@@ -24,7 +24,7 @@
 {
 	[ TestFixture ]
     abstract public class MapMessageTest : NMSTestSupport
-    {	    
+    {
         bool a = true;
         byte b = 123;
         char c = 'c';
@@ -37,6 +37,8 @@
         short j = -0x1234;
         int k = -0x12345678;
         long l = -0x1234567812345678;
+		float m = 2.1F;
+		double n = 2.3;
         
 		[SetUp]
         override public void SetUp()
@@ -72,6 +74,8 @@
             message.Body["j"] = j;
             message.Body["k"] = k;
             message.Body["l"] = l;
+            message.Body["m"] = m;
+            message.Body["n"] = n;
             
             return message;
         }
@@ -99,7 +103,9 @@
             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");
-            
+            Assert.AreEqual(m, mapMessage.Body["m"], "generic map entry: m");
+            Assert.AreEqual(n, mapMessage.Body["n"], "generic map entry: n");
+			
             // use type safe APIs
             Assert.AreEqual(a, mapMessage.Body.GetBool("a"), "map entry: a");
             Assert.AreEqual(b, mapMessage.Body.GetByte("b"), "map entry: b");
@@ -113,6 +119,8 @@
             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");
+            Assert.AreEqual(m, mapMessage.Body.GetFloat("m"), "map entry: m");
+            Assert.AreEqual(n, mapMessage.Body.GetDouble("n"), "map entry: n");
 			
         }
         

Modified: activemq/activemq-dotnet/trunk/src/test/csharp/NMS/Test/NMSPropertyTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/trunk/src/test/csharp/NMS/Test/NMSPropertyTest.cs?view=diff&rev=512253&r1=512252&r2=512253
==============================================================================
--- activemq/activemq-dotnet/trunk/src/test/csharp/NMS/Test/NMSPropertyTest.cs (original)
+++ activemq/activemq-dotnet/trunk/src/test/csharp/NMS/Test/NMSPropertyTest.cs Tue Feb 27
05:56:33 2007
@@ -41,6 +41,8 @@
         int custom4 = 0x12345678;
         long custom5 = 0x1234567812345678;
         char custom6 = 'J';
+		float custom7 = 2.1F;
+		double custom8 = 2.3;
         
         [SetUp]
         override public void SetUp()
@@ -82,6 +84,8 @@
             message.Properties["custom4"] = custom4;
             message.Properties["custom5"] = custom5;
             message.Properties["custom6"] = custom6;
+            message.Properties["custom7"] = custom7;
+            message.Properties["custom8"] = custom8;
             
             return message;
         }
@@ -111,20 +115,27 @@
             Assert.AreEqual(custom2, message.Properties["custom2"], "custom2");
             Assert.AreEqual(custom3, message.Properties["custom3"], "custom3");
             Assert.AreEqual(custom4, message.Properties["custom4"], "custom4");
-            // TODO
+			
             Assert.AreEqual(custom5, message.Properties["custom5"], "custom5");
             Object value6 = message.Properties["custom6"];
             Object expected6 = custom6;
             Console.WriteLine("actual type is: " + value6.GetType() + " value: " + value6);
             Console.WriteLine("expected type is: " + expected6.GetType() + " value: " + expected6);
             Assert.AreEqual(custom6, value6, "custom6 which is of type: " + value6.GetType());
-            
+
+            Assert.AreEqual(custom6, message.Properties["custom6"], "custom6");
+            Assert.AreEqual(custom7, message.Properties["custom7"], "custom7");
+			Assert.AreEqual(custom8, message.Properties["custom8"], "custom8");
+			
+			// compare generic headers
             Assert.AreEqual(custom1, message.Properties.GetBool("custom1"), "custom1");
             Assert.AreEqual(custom2, message.Properties.GetByte("custom2"), "custom2");
             Assert.AreEqual(custom3, message.Properties.GetShort("custom3"), "custom3");
             Assert.AreEqual(custom4, message.Properties.GetInt("custom4"), "custom4");
             Assert.AreEqual(custom5, message.Properties.GetLong("custom5"), "custom5");
-            //Assert.AreEqual(custom6, message.Properties.GetChar("custom6"), "custom6");
+            Assert.AreEqual(custom6, message.Properties.GetChar("custom6"), "custom6");
+            Assert.AreEqual(custom7, message.Properties.GetFloat("custom7"), "custom7");
+			Assert.AreEqual(custom8, message.Properties.GetDouble("custom8"), "custom8");
             
             // lets now look at some standard NMS headers
             Console.WriteLine("NMSExpiration: " + message.NMSExpiration);



Mime
View raw message