[mapguide-commits] r6307 - trunk/Tools/Maestro/MaestroAPITests

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Dec 8 03:06:33 EST 2011


Author: jng
Date: 2011-12-08 00:06:33 -0800 (Thu, 08 Dec 2011)
New Revision: 6307

Added:
   trunk/Tools/Maestro/MaestroAPITests/TestControl.cs
Modified:
   trunk/Tools/Maestro/MaestroAPITests/CapabilityTests.cs
   trunk/Tools/Maestro/MaestroAPITests/ConfigurationTests.cs
   trunk/Tools/Maestro/MaestroAPITests/ExpressionTests.cs
   trunk/Tools/Maestro/MaestroAPITests/FeatureReaderTests.cs
   trunk/Tools/Maestro/MaestroAPITests/HttpConnectionTests.cs
   trunk/Tools/Maestro/MaestroAPITests/HttpSiteTests.cs
   trunk/Tools/Maestro/MaestroAPITests/MaestroAPITests.csproj
   trunk/Tools/Maestro/MaestroAPITests/ObjectTests.cs
   trunk/Tools/Maestro/MaestroAPITests/ResourceTests.cs
   trunk/Tools/Maestro/MaestroAPITests/RuntimeMapTests.cs
   trunk/Tools/Maestro/MaestroAPITests/SchemaTests.cs
   trunk/Tools/Maestro/MaestroAPITests/SerializationTests.cs
   trunk/Tools/Maestro/MaestroAPITests/ValidationTests.cs
Log:
Add a failing test for #1882. Also clean up some of the unit tests

Modified: trunk/Tools/Maestro/MaestroAPITests/CapabilityTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/CapabilityTests.cs	2011-12-08 05:54:30 UTC (rev 6306)
+++ trunk/Tools/Maestro/MaestroAPITests/CapabilityTests.cs	2011-12-08 08:06:33 UTC (rev 6307)
@@ -29,7 +29,7 @@
 
 namespace MaestroAPITests
 {
-    [TestFixture]
+    [TestFixture(Ignore = TestControl.IgnoreCapabilityTests)]
     public class CapabilityTests
     {
         private Mockery _mocks;

Modified: trunk/Tools/Maestro/MaestroAPITests/ConfigurationTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/ConfigurationTests.cs	2011-12-08 05:54:30 UTC (rev 6306)
+++ trunk/Tools/Maestro/MaestroAPITests/ConfigurationTests.cs	2011-12-08 08:06:33 UTC (rev 6307)
@@ -29,7 +29,7 @@
 
 namespace MaestroAPITests
 {
-    [TestFixture]
+    [TestFixture(Ignore = TestControl.IgnoreConfigurationTests)]
     public class ConfigurationTests
     {
         [Test]

Modified: trunk/Tools/Maestro/MaestroAPITests/ExpressionTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/ExpressionTests.cs	2011-12-08 05:54:30 UTC (rev 6306)
+++ trunk/Tools/Maestro/MaestroAPITests/ExpressionTests.cs	2011-12-08 08:06:33 UTC (rev 6307)
@@ -39,7 +39,7 @@
     // 2 | snafu  | (null)
     // 2 | (null) | (null)
 
-    [TestFixture]
+    [TestFixture(Ignore = TestControl.IgnoreExpressionTests)]
     public class ExpressionTests
     {
         [Test]

Modified: trunk/Tools/Maestro/MaestroAPITests/FeatureReaderTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/FeatureReaderTests.cs	2011-12-08 05:54:30 UTC (rev 6306)
+++ trunk/Tools/Maestro/MaestroAPITests/FeatureReaderTests.cs	2011-12-08 08:06:33 UTC (rev 6307)
@@ -28,7 +28,7 @@
 
 namespace MaestroAPITests
 {
-    [TestFixture]
+    [TestFixture(Ignore = TestControl.IgnoreFeatureReaderTests)]
     public class FeatureReaderTests
     {
         [Test]

Modified: trunk/Tools/Maestro/MaestroAPITests/HttpConnectionTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/HttpConnectionTests.cs	2011-12-08 05:54:30 UTC (rev 6306)
+++ trunk/Tools/Maestro/MaestroAPITests/HttpConnectionTests.cs	2011-12-08 08:06:33 UTC (rev 6307)
@@ -23,10 +23,11 @@
 using NUnit.Framework;
 using OSGeo.MapGuide.MaestroAPI;
 using OSGeo.MapGuide.MaestroAPI.Services;
+using System.IO;
 
 namespace MaestroAPITests
 {
-    [TestFixture]
+    [TestFixture(Ignore = TestControl.IgnoreHttpConnectionTests)]
     public class HttpConnectionTests
     {
         [Test]
@@ -121,5 +122,16 @@
                 }
             }
         }
+
+        [Test]
+        public void TestAnyStreamInput()
+        {
+            var conn = ConnectionUtil.CreateTestHttpConnection();
+            var resSvc = conn.ResourceService;
+            if (!resSvc.ResourceExists("Library://UnitTests/Data/HydrographicPolygons.FeatureSource"))
+                resSvc.SetResourceXmlData("Library://UnitTests/Data/HydrographicPolygons.FeatureSource", File.OpenRead("TestData/MappingService/UT_HydrographicPolygons.fs"));
+
+            resSvc.SetResourceXmlData("Library://UnitTests/Data/TestAnyStreamInput.FeatureSource", resSvc.GetResourceXmlData("Library://UnitTests/Data/HydrographicPolygons.FeatureSource"));
+        }
     }
 }

Modified: trunk/Tools/Maestro/MaestroAPITests/HttpSiteTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/HttpSiteTests.cs	2011-12-08 05:54:30 UTC (rev 6306)
+++ trunk/Tools/Maestro/MaestroAPITests/HttpSiteTests.cs	2011-12-08 08:06:33 UTC (rev 6307)
@@ -29,15 +29,12 @@
 
 namespace MaestroAPITests
 {
-    [TestFixture(Ignore = false)]
+    [TestFixture(Ignore = TestControl.IgnoreHttpSiteTests)]
     public class HttpSiteTests
     {
         private IServerConnection CreateTestConnection()
         {
-            return ConnectionProviderRegistry.CreateConnection("Maestro.Http",
-                "Url", "http://" + Environment.MachineName + "/mapguide/mapagent/mapagent.fcgi",
-                "Username", "Administrator",
-                "Password", "admin");
+            return ConnectionUtil.CreateTestHttpConnection();
         }
 
         [Test]

Modified: trunk/Tools/Maestro/MaestroAPITests/MaestroAPITests.csproj
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/MaestroAPITests.csproj	2011-12-08 05:54:30 UTC (rev 6306)
+++ trunk/Tools/Maestro/MaestroAPITests/MaestroAPITests.csproj	2011-12-08 08:06:33 UTC (rev 6307)
@@ -87,6 +87,7 @@
     <Compile Include="RuntimeMapTests.cs" />
     <Compile Include="SchemaTests.cs" />
     <Compile Include="SerializationTests.cs" />
+    <Compile Include="TestControl.cs" />
     <Compile Include="ValidationTests.cs" />
   </ItemGroup>
   <ItemGroup>

Modified: trunk/Tools/Maestro/MaestroAPITests/ObjectTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/ObjectTests.cs	2011-12-08 05:54:30 UTC (rev 6306)
+++ trunk/Tools/Maestro/MaestroAPITests/ObjectTests.cs	2011-12-08 08:06:33 UTC (rev 6307)
@@ -32,7 +32,7 @@
     /// 
     /// Also tests for various classes (not belonging to any particular group) reside here
     /// </summary>
-    [TestFixture]
+    [TestFixture(Ignore = TestControl.IgnoreObjectTests)]
     public class ObjectTests
     {
         [Test]

Modified: trunk/Tools/Maestro/MaestroAPITests/ResourceTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/ResourceTests.cs	2011-12-08 05:54:30 UTC (rev 6306)
+++ trunk/Tools/Maestro/MaestroAPITests/ResourceTests.cs	2011-12-08 08:06:33 UTC (rev 6307)
@@ -45,7 +45,7 @@
 
 namespace MaestroAPITests
 {
-    [TestFixture]
+    [TestFixture(Ignore = TestControl.IgnoreResourceTests)]
     public class ResourceTests
     {
         private Mockery _mocks;

Modified: trunk/Tools/Maestro/MaestroAPITests/RuntimeMapTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/RuntimeMapTests.cs	2011-12-08 05:54:30 UTC (rev 6306)
+++ trunk/Tools/Maestro/MaestroAPITests/RuntimeMapTests.cs	2011-12-08 08:06:33 UTC (rev 6307)
@@ -922,6 +922,25 @@
             Assert.AreEqual(0, map.Groups.Count);
         }
 
+        [Test]
+        public virtual void TestMapManipulation4()
+        {
+            IServerConnection conn = CreateTestConnection();
+            IMappingService mapSvc = (IMappingService)conn.GetService((int)ServiceType.Mapping);
+            string mapdefinition = "Library://UnitTests/Maps/Sheboygan.MapDefinition";
+            ResourceIdentifier rtmX = new ResourceIdentifier(mapdefinition);
+            string rtmDef = "Library://UnitTests/Cache/" + rtmX.Fullpath.Replace(":", "_").Replace("/", "_");
+            string mapName = rtmX.Name;
+            ResourceIdentifier mapid = new ResourceIdentifier(mapName, ResourceTypes.RuntimeMap, conn.SessionID);
+            IMapDefinition mdef = (IMapDefinition)conn.ResourceService.GetResource(mapdefinition);
+            RuntimeMap rtm = mapSvc.CreateMap(mdef); // Create new runtime map
+            rtm.Save();
+            RuntimeMap tmprtm = mapSvc.CreateMap(mapid, mdef); // Create new map in data cache
+            tmprtm.Save();
+
+            RuntimeMap mymap = mapSvc.OpenMap(mapid); 
+        }
+
         public virtual void TestResourceEvents()
         {
             bool deleteCalled = false;
@@ -1008,17 +1027,25 @@
         }
     }
 
-    [TestFixture(Ignore = false)]
-    public class HttpRuntimeMapTests : RuntimeMapTests
+    public class ConnectionUtil
     {
-        protected override IServerConnection CreateTestConnection()
+        public static IServerConnection CreateTestHttpConnection()
         {
             return ConnectionProviderRegistry.CreateConnection("Maestro.Http",
                 "Url", "http://" + Environment.MachineName + "/mapguide/mapagent/mapagent.fcgi",
                 "Username", "Administrator",
                 "Password", "admin");
         }
+    }
 
+    [TestFixture(Ignore = TestControl.IgnoreHttpRuntimeMapTests)]
+    public class HttpRuntimeMapTests : RuntimeMapTests
+    {
+        protected override IServerConnection CreateTestConnection()
+        {
+            return ConnectionUtil.CreateTestHttpConnection();
+        }
+        /*
         [Test]
         public override void TestResourceEvents()
         {
@@ -1078,9 +1105,15 @@
         {
             base.TestLargeMapCreatePerformance();
         }
+        */
+        [Test]
+        public override void TestMapManipulation4()
+        {
+            base.TestMapManipulation4();
+        }
     }
 
-    [TestFixture(Ignore = true)]
+    [TestFixture(Ignore = TestControl.IgnoreLocalRuntimeMapTests)]
     public class LocalRuntimeMapTests : RuntimeMapTests
     {
         protected override IServerConnection CreateTestConnection()

Modified: trunk/Tools/Maestro/MaestroAPITests/SchemaTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/SchemaTests.cs	2011-12-08 05:54:30 UTC (rev 6306)
+++ trunk/Tools/Maestro/MaestroAPITests/SchemaTests.cs	2011-12-08 08:06:33 UTC (rev 6307)
@@ -27,7 +27,7 @@
 
 namespace MaestroAPITests
 {
-    [TestFixture]
+    [TestFixture(Ignore = TestControl.IgnoreSchemaTests)]
     public class SchemaTests
     {
         //These tests are to verify that we can read FDO XML configuration and schema documents without problems

Modified: trunk/Tools/Maestro/MaestroAPITests/SerializationTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/SerializationTests.cs	2011-12-08 05:54:30 UTC (rev 6306)
+++ trunk/Tools/Maestro/MaestroAPITests/SerializationTests.cs	2011-12-08 08:06:33 UTC (rev 6307)
@@ -27,7 +27,7 @@
 
 namespace MaestroAPITests
 {
-    [TestFixture]
+    [TestFixture(Ignore = TestControl.IgnoreSerializationTests)]
     public class SerializationTests
     {
         [Test]

Added: trunk/Tools/Maestro/MaestroAPITests/TestControl.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/TestControl.cs	                        (rev 0)
+++ trunk/Tools/Maestro/MaestroAPITests/TestControl.cs	2011-12-08 08:06:33 UTC (rev 6307)
@@ -0,0 +1,44 @@
+#region Disclaimer / License
+// Copyright (C) 2011, 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;
+
+namespace MaestroAPITests
+{
+    //Use this to toggle individual test suites
+
+    public class TestControl
+    {
+        public const bool IgnoreConfigurationTests = false;
+        public const bool IgnoreCapabilityTests = false;
+        public const bool IgnoreExpressionTests = false;
+        public const bool IgnoreFeatureReaderTests = false;
+        public const bool IgnoreHttpConnectionTests = false;
+        public const bool IgnoreHttpSiteTests = false;
+        public const bool IgnoreObjectTests = false;
+        public const bool IgnoreResourceTests = false;
+        public const bool IgnoreHttpRuntimeMapTests = false;
+        public const bool IgnoreLocalRuntimeMapTests = true;
+        public const bool IgnoreSchemaTests = false;
+        public const bool IgnoreSerializationTests = false;
+        public const bool IgnoreValidationTests = false;
+    }
+}

Modified: trunk/Tools/Maestro/MaestroAPITests/ValidationTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/ValidationTests.cs	2011-12-08 05:54:30 UTC (rev 6306)
+++ trunk/Tools/Maestro/MaestroAPITests/ValidationTests.cs	2011-12-08 08:06:33 UTC (rev 6307)
@@ -35,7 +35,7 @@
 
 namespace MaestroAPITests
 {
-    [TestFixture]
+    [TestFixture(Ignore = TestControl.IgnoreValidationTests)]
     public class ValidationTests
     {
         [Test]



More information about the mapguide-commits mailing list