[mapguide-commits] r9772 - in sandbox/jng/vanilla_swig/Bindings: . src src/Bindings/Common/DotNet src/Test/DotNet src/Test/DotNet/src/TestCommon src/Test/DotNet/src/TestMapGuideApi src/Test/DotNet/src/TestMisc src/Test/DotNet/src/TestMisc/Properties src/Test/DotNet/src/TestRunner src/Test/DotNet/src/TestRunner/Properties
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu Nov 12 06:21:52 PST 2020
Author: jng
Date: 2020-11-12 06:21:51 -0800 (Thu, 12 Nov 2020)
New Revision: 9772
Added:
sandbox/jng/vanilla_swig/Bindings/setup_test_data.cmd
sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/Properties/
sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/Properties/launchSettings.json
Modified:
sandbox/jng/vanilla_swig/Bindings/TODO.txt
sandbox/jng/vanilla_swig/Bindings/src/
sandbox/jng/vanilla_swig/Bindings/src/Bindings/Common/DotNet/coreclr_compat.i
sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/
sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestCommon/
sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestCommon/TestCommon.csproj
sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMapGuideApi/
sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMapGuideApi/TestMapGuideApi.csproj
sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/
sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/Program.cs
sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/TestMisc.csproj
sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestRunner/
sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestRunner/Properties/launchSettings.json
sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestRunner/TestRunner.csproj
Log:
- Add batch file to setup test data
- Update test runners to target netcoreapp3.1
- Add missing nuget packages for test projects
- Fix up MgObjectFactory to scan assemblies in the current AppDomain for the requested .net type instead of just the current assembly
Modified: sandbox/jng/vanilla_swig/Bindings/TODO.txt
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/TODO.txt 2020-11-12 13:09:50 UTC (rev 9771)
+++ sandbox/jng/vanilla_swig/Bindings/TODO.txt 2020-11-12 14:21:51 UTC (rev 9772)
@@ -1,4 +1,4 @@
- - Check that .net error messages are being read (https://github.com/jumpinjackie/mapguide-api-bindings/issues/35)
+ - [ ] Check that .net error messages are being read (https://github.com/jumpinjackie/mapguide-api-bindings/issues/35)
- 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)
@@ -5,7 +5,7 @@
- Install same compilers/tools as the same docker image used to produce the common libs tarball
- Generate and build the .net/Java SWIG glue libraries
- Copy the compiled libs out of the docker container and into the same native library staging area for Java/.net
- - [ ] Refactor current .net test suite to reference these nuget packages
+ - [x] Refactor current .net test suite to reference these nuget packages
- [ ] Verify test suite still passes (Windows)
- [ ] Verify test suite still passes (Linux)
- Automatic class id generation (https://github.com/jumpinjackie/mapguide-api-bindings/issues/34)
@@ -13,8 +13,8 @@
- [ ] 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
- Test Suite
- - [ ] Sync up current test data under /UnitTest to match what is in GitHub repo
- - [ ] 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
+ - [x] Sync up current test data under /UnitTest to match what is in GitHub repox
+ - [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
- Java binding
- [ ] Re-shuffle MgBase64 and AppThrowable to a .internal package (so we can bulk svn ignore *.java/*.class in the current dir where sources are generated)
- [ ] Verify test suite still passes (Windows)
Added: sandbox/jng/vanilla_swig/Bindings/setup_test_data.cmd
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/setup_test_data.cmd (rev 0)
+++ sandbox/jng/vanilla_swig/Bindings/setup_test_data.cmd 2020-11-12 14:21:51 UTC (rev 9772)
@@ -0,0 +1 @@
+xcopy /S /Y /I ..\UnitTest\TestData src\TestData
\ No newline at end of file
Index: sandbox/jng/vanilla_swig/Bindings/src
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src 2020-11-12 13:09:50 UTC (rev 9771)
+++ sandbox/jng/vanilla_swig/Bindings/src 2020-11-12 14:21:51 UTC (rev 9772)
Property changes on: sandbox/jng/vanilla_swig/Bindings/src
___________________________________________________________________
Modified: svn:ignore
## -1,2 +1,3 ##
+TestData
lib
obj
Modified: sandbox/jng/vanilla_swig/Bindings/src/Bindings/Common/DotNet/coreclr_compat.i
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Bindings/Common/DotNet/coreclr_compat.i 2020-11-12 13:09:50 UTC (rev 9771)
+++ sandbox/jng/vanilla_swig/Bindings/src/Bindings/Common/DotNet/coreclr_compat.i 2020-11-12 14:21:51 UTC (rev 9772)
@@ -183,6 +183,19 @@
internal static class MgObjectFactory
{
+ static global::System.Collections.Generic.Dictionary<string, string> assemblyNameMap;
+
+ static MgObjectFactory()
+ {
+ assemblyNameMap = new global::System.Collections.Generic.Dictionary<string, string>();
+
+ assemblyNameMap["OSGeo.MapGuide.Foundation"] = "OSGeo.MapGuide.Foundation";
+ assemblyNameMap["OSGeo.MapGuide.Geometry"] = "OSGeo.MapGuide.Geometry";
+ assemblyNameMap["OSGeo.MapGuide.PlatformBase"] = "OSGeo.MapGuide.PlatformBase";
+ assemblyNameMap["OSGeo.MapGuide.MapGuideCommon"] = "OSGeo.MapGuide.MapGuideCommon";
+ assemblyNameMap["OSGeo.MapGuide.Web"] = "OSGeo.MapGuide.Web";
+ }
+
static string GetClassName(global::System.IntPtr objPtr)
{
var cPtr = $imclassname.GetClassName(objPtr);
@@ -200,8 +213,32 @@
{
throw new global::System.Exception("Could not resolve .net type for this unmanaged pointer. The unmanaged pointer reported a class ID of: " + clsId);
}
+
+ var type = global::System.Type.GetType(typeName);
+ if (type == null)
+ {
+ // Find the specified class in the pre-defined assemblies
+ var assemblies = global::System.AppDomain.CurrentDomain.GetAssemblies();
+ foreach (var assem in assemblies)
+ {
+ var assemblyName = new global::System.Reflection.AssemblyName(assem.FullName);
+ if (assemblyNameMap.ContainsKey(assemblyName.Name))
+ {
+ type = assem.GetType(typeName, false);
+ if (type != null)
+ break;
+ }
+ }
- var type = global::System.Type.GetType(typeName);
+ // Fall back to finding the type in every assembly in the current appdomain
+ foreach (var assem in global::System.AppDomain.CurrentDomain.GetAssemblies())
+ {
+ type = assem.GetType(typeName, false);
+ if (type != null)
+ break;
+ }
+ }
+
if (type == null) //Shouldn't happen. But if it did, this would mean we didn't expose this class to SWIG
{
throw new global::System.Exception("The type " + typeName + " does not exist. The unmanaged pointer reported a class ID of: " + clsId);
Index: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet 2020-11-12 13:09:50 UTC (rev 9771)
+++ sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet 2020-11-12 14:21:51 UTC (rev 9772)
Property changes on: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet
___________________________________________________________________
Added: svn:ignore
## -0,0 +1 ##
+.vs
Index: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestCommon
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestCommon 2020-11-12 13:09:50 UTC (rev 9771)
+++ sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestCommon 2020-11-12 14:21:51 UTC (rev 9772)
Property changes on: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestCommon
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,2 ##
+bin
+obj
Modified: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestCommon/TestCommon.csproj
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestCommon/TestCommon.csproj 2020-11-12 13:09:50 UTC (rev 9771)
+++ sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestCommon/TestCommon.csproj 2020-11-12 14:21:51 UTC (rev 9772)
@@ -14,6 +14,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.SQLite" Version="2.0.1" />
+ <PackageReference Include="OSGeo.MapGuide.Foundation" Version="4.0.0" />
+ <PackageReference Include="OSGeo.MapGuide.Geometry" Version="4.0.0" />
<PackageReference Include="OSGeo.MapGuide.PlatformBase" Version="4.0.0" />
</ItemGroup>
</Project>
\ No newline at end of file
Index: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMapGuideApi
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMapGuideApi 2020-11-12 13:09:50 UTC (rev 9771)
+++ sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMapGuideApi 2020-11-12 14:21:51 UTC (rev 9772)
Property changes on: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMapGuideApi
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,2 ##
+bin
+obj
Modified: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMapGuideApi/TestMapGuideApi.csproj
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMapGuideApi/TestMapGuideApi.csproj 2020-11-12 13:09:50 UTC (rev 9771)
+++ sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMapGuideApi/TestMapGuideApi.csproj 2020-11-12 14:21:51 UTC (rev 9772)
@@ -17,6 +17,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.SQLite" Version="2.0.1" />
+ <PackageReference Include="OSGeo.MapGuide.Foundation" Version="4.0.0" />
+ <PackageReference Include="OSGeo.MapGuide.Geometry" Version="4.0.0" />
<PackageReference Include="OSGeo.MapGuide.MapGuideCommon" Version="4.0.0" />
<PackageReference Include="OSGeo.MapGuide.Web" Version="4.0.0" />
</ItemGroup>
Index: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc 2020-11-12 13:09:50 UTC (rev 9771)
+++ sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc 2020-11-12 14:21:51 UTC (rev 9772)
Property changes on: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,2 ##
+obj
+bin
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-12 13:09:50 UTC (rev 9771)
+++ sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/Program.cs 2020-11-12 14:21:51 UTC (rev 9772)
@@ -8,11 +8,29 @@
{
static void TestBody(string webConfigPath)
{
- MapGuideApi.MgInitializeWebTier(webConfigPath);
+ try
+ {
+ MapGuideApi.MgInitializeWebTier(webConfigPath);
+ }
+ catch (MgException ex)
+ {
+ OnException(ex);
+ return;
+ }
Console.WriteLine("[dotnet]: Initialized");
- var user = new MgUserInformation("Anonymous", "");
- var conn = new MgSiteConnection();
- conn.Open(user);
+ MgUserInformation user;
+ MgSiteConnection conn;
+ try
+ {
+ user = new MgUserInformation("Anonymous", "");
+ conn = new MgSiteConnection();
+ conn.Open(user);
+ }
+ catch (MgException ex)
+ {
+ OnException(ex);
+ return;
+ }
// Create a session repository
var site = conn.GetSite();
var sessionID = site.CreateSession();
@@ -86,10 +104,7 @@
}
catch (MgException ex)
{
- Console.WriteLine("[dotnet]: MgException caught");
- Console.WriteLine($"[dotnet]: MgException - Message: {ex.GetExceptionMessage()}");
- Console.WriteLine($"[dotnet]: MgException - Details: {ex.GetDetails()}");
- Console.WriteLine($"[dotnet]: MgException - Stack: {ex.GetStackTrace()}");
+ OnException(ex);
}
Console.WriteLine("[dotnet]: Trigger another exception");
try
@@ -98,13 +113,18 @@
}
catch (MgException ex)
{
- Console.WriteLine("[dotnet]: MgException caught");
- Console.WriteLine($"[dotnet]: MgException - Message: {ex.GetExceptionMessage()}");
- Console.WriteLine($"[dotnet]: MgException - Details: {ex.GetDetails()}");
- Console.WriteLine($"[dotnet]: MgException - Stack: {ex.GetStackTrace()}");
+ OnException(ex);
}
}
+ static void OnException(MgException ex)
+ {
+ Console.WriteLine("[dotnet]: MgException caught");
+ Console.WriteLine($"[dotnet]: MgException - Message: {ex.GetExceptionMessage()}");
+ Console.WriteLine($"[dotnet]: MgException - Details: {ex.GetDetails()}");
+ Console.WriteLine($"[dotnet]: MgException - Stack: {ex.GetStackTrace()}");
+ }
+
static void Main(string[] args)
{
string path = args[0];
Added: 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 (rev 0)
+++ sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/Properties/launchSettings.json 2020-11-12 14:21:51 UTC (rev 9772)
@@ -0,0 +1,9 @@
+{
+ "profiles": {
+ "TestMisc": {
+ "commandName": "Project",
+ "commandLineArgs": "..\\..\\..\\..\\..\\..\\..\\..\\..\\Web\\src\\webconfig.ini",
+ "nativeDebugging": true
+ }
+ }
+}
\ No newline at end of file
Modified: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/TestMisc.csproj
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/TestMisc.csproj 2020-11-12 13:09:50 UTC (rev 9771)
+++ sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestMisc/TestMisc.csproj 2020-11-12 14:21:51 UTC (rev 9772)
@@ -2,11 +2,13 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
- <TargetFramework>netcoreapp2.1</TargetFramework>
+ <TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.2.1" />
+ <PackageReference Include="OSGeo.MapGuide.Foundation" Version="4.0.0" />
+ <PackageReference Include="OSGeo.MapGuide.Geometry" Version="4.0.0" />
<PackageReference Include="OSGeo.MapGuide.MapGuideCommon" Version="4.0.0" />
<PackageReference Include="OSGeo.MapGuide.Web" Version="4.0.0" />
</ItemGroup>
Index: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestRunner
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestRunner 2020-11-12 13:09:50 UTC (rev 9771)
+++ sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestRunner 2020-11-12 14:21:51 UTC (rev 9772)
Property changes on: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestRunner
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,2 ##
+bin
+obj
Modified: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestRunner/Properties/launchSettings.json
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestRunner/Properties/launchSettings.json 2020-11-12 13:09:50 UTC (rev 9771)
+++ sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestRunner/Properties/launchSettings.json 2020-11-12 14:21:51 UTC (rev 9772)
@@ -2,8 +2,8 @@
"profiles": {
"TestRunner": {
"commandName": "Project",
- "commandLineArgs": "--web-config-path \"C:\\Program Files\\OSGeo\\MapGuide\\Web\\www\\webconfig.ini\" --dictionary-path \"C:\\Program Files\\OSGeo\\MapGuide\\CS-Map\\Dictionaries\" --test-data-root \"D:\\workspace\\mapguide-api-bindings\\src\\TestData\"",
- "workingDirectory": "D:\\Workspace\\mapguide-api-bindings\\src\\Test\\DotNet\\src\\TestRunner"
+ "commandLineArgs": "--web-config-path \"..\\..\\..\\..\\..\\..\\..\\..\\..\\Web\\src\\webconfig.ini\" --dictionary-path \"..\\..\\..\\..\\..\\..\\..\\..\\..\\Oem\\CsMap\\CsMapDev\\Dictionaries\" --test-data-root \"..\\..\\..\\..\\..\\..\\..\\TestData\"",
+ "nativeDebugging": true
}
}
}
\ No newline at end of file
Modified: sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestRunner/TestRunner.csproj
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestRunner/TestRunner.csproj 2020-11-12 13:09:50 UTC (rev 9771)
+++ sandbox/jng/vanilla_swig/Bindings/src/Test/DotNet/src/TestRunner/TestRunner.csproj 2020-11-12 14:21:51 UTC (rev 9772)
@@ -2,7 +2,7 @@
<PropertyGroup>
<Description>TestRunner Console Application</Description>
<Authors>OSGeo</Authors>
- <TargetFrameworks>netcoreapp2.1</TargetFrameworks>
+ <TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<AssemblyName>TestRunner</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>TestRunner</PackageId>
@@ -19,6 +19,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.2.1" />
+ <PackageReference Include="OSGeo.MapGuide.Foundation" Version="4.0.0" />
+ <PackageReference Include="OSGeo.MapGuide.Geometry" Version="4.0.0" />
<PackageReference Include="OSGeo.MapGuide.Web" Version="4.0.0" />
</ItemGroup>
</Project>
\ No newline at end of file
More information about the mapguide-commits
mailing list