[mapguide-commits] r6433 - in trunk/Tools/Maestro: MaestroAPITests OSGeo.MapGuide.MaestroAPI/Mapping

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Jan 16 08:36:41 EST 2012


Author: jng
Date: 2012-01-16 05:36:41 -0800 (Mon, 16 Jan 2012)
New Revision: 6433

Added:
   trunk/Tools/Maestro/MaestroAPITests/LocalNativePerformanceTests.cs
Modified:
   trunk/Tools/Maestro/MaestroAPITests/RuntimeMapTests.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs
Log:
#1916: Fix incorrect map extent serialization. Includes unit test. Also add performance test for #1914

Added: trunk/Tools/Maestro/MaestroAPITests/LocalNativePerformanceTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/LocalNativePerformanceTests.cs	                        (rev 0)
+++ trunk/Tools/Maestro/MaestroAPITests/LocalNativePerformanceTests.cs	2012-01-16 13:36:41 UTC (rev 6433)
@@ -0,0 +1,42 @@
+#region Disclaimer / License
+// Copyright (C) 2012, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using System.Diagnostics;
+
+namespace MaestroAPITests
+{
+    [TestFixture(Ignore = TestControl.IgnoreLocalNativePerformanceTests)]
+    public class LocalNativePerformanceTests
+    {
+        [Test]
+        public void TestCase1914()
+        {
+            var conn = LocalNativeConnectionUtil.CreateTestConnection();
+            var sw = new Stopwatch();
+            sw.Start();
+            conn.ResourceService.ResourceExists("Library://UnitTests/Data/Parcels.FeatureSource");
+            sw.Stop();
+            Trace.TraceInformation("ResourceExists() executed in {0}ms", sw.ElapsedMilliseconds);
+        }
+    }
+}

Modified: trunk/Tools/Maestro/MaestroAPITests/RuntimeMapTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/RuntimeMapTests.cs	2012-01-16 13:34:47 UTC (rev 6432)
+++ trunk/Tools/Maestro/MaestroAPITests/RuntimeMapTests.cs	2012-01-16 13:36:41 UTC (rev 6433)
@@ -111,6 +111,26 @@
 
         protected abstract IServerConnection CreateTestConnection();
 
+        public virtual void TestExtentSerialization()
+        {
+            var resSvc = _conn.ResourceService;
+            var mdf = resSvc.GetResource("Library://UnitTests/Maps/Sheboygan.MapDefinition") as IMapDefinition;
+            Assert.NotNull(mdf);
+            mdf.Extents = ObjectFactory.CreateEnvelope(1.0, 2.0, 3.0, 4.0);
+
+            var mapSvc = _conn.GetService((int)ServiceType.Mapping) as IMappingService;
+            Assert.NotNull(mapSvc);
+
+            var map = mapSvc.CreateMap("Session:" + _conn.SessionID + "//TestExtentSerialization.Map", mdf, 1.0);
+            map.Save();
+
+            var map2 = mapSvc.OpenMap("Session:" + _conn.SessionID + "//TestExtentSerialization.Map");
+            Assert.AreEqual(1.0, map2.DataExtent.MinX);
+            Assert.AreEqual(2.0, map2.DataExtent.MinY);
+            Assert.AreEqual(3.0, map2.DataExtent.MaxX);
+            Assert.AreEqual(4.0, map2.DataExtent.MaxY);
+        }
+
         public virtual void TestCreate()
         {
             //Create a runtime map from its map definition, verify layer/group
@@ -1074,6 +1094,12 @@
         {
             return ConnectionUtil.CreateTestHttpConnection();
         }
+
+        [Test]
+        public override void TestExtentSerialization()
+        {
+            base.TestExtentSerialization();
+        }
         
         [Test]
         public override void TestResourceEvents()
@@ -1157,6 +1183,12 @@
         }
 
         [Test]
+        public override void TestExtentSerialization()
+        {
+            base.TestExtentSerialization();
+        }
+
+        [Test]
         public override void TestResourceEvents()
         {
             base.TestResourceEvents();

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs	2012-01-16 13:34:47 UTC (rev 6432)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Mapping/RuntimeMap.cs	2012-01-16 13:36:41 UTC (rev 6433)
@@ -685,8 +685,8 @@
 
             s.Write(env.MinX);
             s.Write(env.MinY);
+            s.Write(env.MaxX);
             s.Write(env.MaxY);
-            s.Write(env.MaxY);
         }
 
         private Dictionary<string, ChangeList> m_changeList;



More information about the mapguide-commits mailing list