[mapguide-commits] r9778 - in sandbox/jng/vanilla_swig/Bindings: . src/Test/DotNet/src/TestMisc src/Test/DotNet/src/TestMisc/Properties src/Test/DotNet/src/TestRunner

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Nov 13 00:50:02 PST 2020


Author: jng
Date: 2020-11-13 00:50:02 -0800 (Fri, 13 Nov 2020)
New Revision: 9778

Modified:
   sandbox/jng/vanilla_swig/Bindings/TODO.txt
   sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/Program.cs
   sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/Properties/launchSettings.json
   sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestRunner/Program.cs
Log:
Although the .net test suite is not fully passing. It is running to completion against the split assembly layout. Progress is Progress!

Modified: sandbox/jng/vanilla_swig/Bindings/TODO.txt
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/TODO.txt	2020-11-13 08:40:13 UTC (rev 9777)
+++ sandbox/jng/vanilla_swig/Bindings/TODO.txt	2020-11-13 08:50:02 UTC (rev 9778)
@@ -1,6 +1,7 @@
  - [x] Check that .net error messages are being read (https://github.com/jumpinjackie/mapguide-api-bindings/issues/35)
  - [x] Explore whether our current instability is due to invalid class layout assumptions due to stubbing ACE_Recursive_Thread_Mutex to avoid leaking ACE headers
  - [ ] Make sure we can build debug bindings
+ - [ ] Fix up inconsistent stack direction in C# exceptions (C++ call stack are printed downwards, C# call stack is printed upwards)
  - Split .net binding into the Foundation/Geometry/PlatformBase/MapGuideCommon/Web layout (https://github.com/jumpinjackie/mapguide-api-bindings/issues/18)
    - [ ] Add CentOS 6 Dockerfile that
       - Install SWIG and common libs tarball (from docker build system)
@@ -14,6 +15,7 @@
    - [ ] Add SWIG preprocessor that controls whether the class id header should be included
    - [ ] Run SWIG in XML mode to produce an XML of the MapGuide API surface
    - [ ] Update ClassMapGen tool to generate class id files for .net/Java/PHP based on this XML file
+ - [ ] Because we've flattened the exception hierarchy, IMake needs to rewrite \exception directives to say in [Java/C#] that it throws MgException with any of the following exception codes
  - Test Suite
    - [x] Sync up current test data under /UnitTest to match what is in GitHub repo
    - [x] Add test data setup script for .net/Java test suites to copy the synced up test data under /UnitTest to the location the test suite is expecting

Modified: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/Program.cs
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/Program.cs	2020-11-13 08:40:13 UTC (rev 9777)
+++ sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/Program.cs	2020-11-13 08:50:02 UTC (rev 9778)
@@ -1,4 +1,5 @@
 using System;
+using System.IO;
 using System.Runtime.InteropServices;
 using OSGeo.MapGuide;
 
@@ -6,8 +7,16 @@
 {
     class Program
     {
-        static void TestBody(string webConfigPath)
+        static void TestBody(string webConfigPath, string mentorDictionaryPath)
         {
+            if (!Path.IsPathRooted(mentorDictionaryPath))
+                mentorDictionaryPath = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, mentorDictionaryPath));
+            Environment.SetEnvironmentVariable("MENTOR_DICTIONARY_PATH", mentorDictionaryPath, EnvironmentVariableTarget.Process);
+
+            var csFactory = new MgCoordinateSystemFactory();
+            var csCat = csFactory.GetCatalog();
+            csCat.SetDictionaryDir(mentorDictionaryPath);
+            Console.WriteLine($"Using CS Library: {csFactory.GetBaseLibrary()}");
             try
             {
                 MapGuideApi.MgInitializeWebTier(webConfigPath);
@@ -42,11 +51,20 @@
             var mappingService = (MgMappingService)conn.CreateService(MgServiceType.MappingService);
             Console.WriteLine("[dotnet]: Created Mapping Service");
             var resId = new MgResourceIdentifier("Library://UnitTest/");
+            var bExists = resourceService.ResourceExists(resId);
+            if (!bExists)
+            {
+                var adminUser = new MgUserInformation("Administrator", "admin");
+                var aConn = new MgSiteConnection();
+                aConn.Open(adminUser);
+
+                var aResSvc = (MgResourceService)aConn.CreateService(MgServiceType.ResourceService);
+                Console.WriteLine("[dotnet]: Creating folder because it doesn't exist");
+                aResSvc.SetResource(resId, null, null);
+            }
             Console.WriteLine("[dotnet]: Enumeratin'");
             var resources = resourceService.EnumerateResources(resId, -1, "");
             Console.WriteLine(resources.ToString());
-            Console.WriteLine("[dotnet]: Coordinate System");
-            var csFactory = new MgCoordinateSystemFactory();
             Console.WriteLine("[dotnet]: CS Catalog");
             var catalog = csFactory.GetCatalog();
             Console.WriteLine("[dotnet]: Category Dictionary");
@@ -115,6 +133,8 @@
             {
                 OnException(ex);
             }
+
+            Console.WriteLine("*********** ALL OK ****************");
         }
 
         static void OnException(MgException ex)
@@ -127,7 +147,13 @@
 
         static void Main(string[] args)
         {
+            if (args.Length != 2)
+            {
+                Console.WriteLine("Usage: TestMisc [path to webconfig.ini] [mentor dictionary path]");
+                Environment.Exit(1);
+            }
             string path = args[0];
+            string mentorPath = args[1];
             if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
             {
                 Console.WriteLine($"Running on Windows: {path}");
@@ -136,7 +162,7 @@
             {
                 Console.WriteLine($"Running on Linux: {path}");
             }
-            TestBody(path);
+            TestBody(path, mentorPath);
             //If you have built the .net SWIG glue wrapper with REFCOUNTING_DIAGNOSTICS, then
             //you should be seeing a whole bunch of refcounting chatter, which is verification
             //that we are actually releasing our unmanaged resources 

Modified: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/Properties/launchSettings.json
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/Properties/launchSettings.json	2020-11-13 08:40:13 UTC (rev 9777)
+++ sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/Properties/launchSettings.json	2020-11-13 08:50:02 UTC (rev 9778)
@@ -2,7 +2,7 @@
   "profiles": {
     "TestMisc": {
       "commandName": "Project",
-      "commandLineArgs": "..\\..\\..\\..\\..\\..\\..\\..\\..\\Web\\src\\webconfig.ini",
+      "commandLineArgs": "..\\..\\..\\..\\..\\..\\..\\..\\..\\Web\\src\\webconfig.ini ..\\..\\..\\..\\..\\..\\..\\..\\..\\Oem\\CsMap\\CsMapDev\\Dictionaries",
       "nativeDebugging": true
     }
   }

Modified: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestRunner/Program.cs
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestRunner/Program.cs	2020-11-13 08:40:13 UTC (rev 9777)
+++ sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestRunner/Program.cs	2020-11-13 08:50:02 UTC (rev 9778)
@@ -111,7 +111,9 @@
 
                 Environment.SetEnvironmentVariable("MENTOR_DICTIONARY_PATH", options.DictionaryPath, EnvironmentVariableTarget.Process);
 
-                MgCoordinateSystemFactory csFactory = new MgCoordinateSystemFactory();
+                var csFactory = new MgCoordinateSystemFactory();
+                var csCatalog = csFactory.GetCatalog();
+                csCatalog.SetDictionaryDir(options.DictionaryPath);
                 Console.WriteLine($"Using CS Library: {csFactory.GetBaseLibrary()}");
 
                 MapGuideApi.MgInitializeWebTier(options.WebConfigPath);



More information about the mapguide-commits mailing list