[mapguide-commits] r10121 - in branches/4.0/MgDev: . Bindings Bindings/src/Test Bindings/src/Test/DotNet/src/TestRunner Bindings/src/Test/Java Bindings/src/Test/Java/src/org/osgeo/mapguide/test Bindings/src/Test/Java/src/org/osgeo/mapguide/test/common Bindings/src/Test/Java/src/org/osgeo/mapguide/test/mapguide Bindings/src/Test/Php UnitTest

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sat Feb 8 13:27:14 PST 2025


Author: jng
Date: 2025-02-08 13:27:11 -0800 (Sat, 08 Feb 2025)
New Revision: 10121

Added:
   branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/TestEnvConfiguration.java
   branches/4.0/MgDev/Bindings/src/Test/Php/TestContext.php
   branches/4.0/MgDev/UnitTest/run_server_tests.bat
   branches/4.0/MgDev/UnitTest/run_web_tests.bat
   branches/4.0/MgDev/UnitTest/test_readme.txt
Removed:
   branches/4.0/MgDev/UnitTest/prepare.php
   branches/4.0/MgDev/UnitTest/run_php_tests.bat
   branches/4.0/MgDev/UnitTest/set_test_params.bat
   branches/4.0/MgDev/run_tests.bat
   branches/4.0/MgDev/test_readme.txt
Modified:
   branches/4.0/MgDev/Bindings/TODO.txt
   branches/4.0/MgDev/Bindings/src/Test/
   branches/4.0/MgDev/Bindings/src/Test/DotNet/src/TestRunner/Program.cs
   branches/4.0/MgDev/Bindings/src/Test/Java/build.xml
   branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/MapGuideTestExecutorCollection.java
   branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/MapGuideTests.java
   branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/Program.java
   branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/common/CommonUtility.java
   branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/mapguide/RenderingServiceTest.java
   branches/4.0/MgDev/Bindings/src/Test/Php/
   branches/4.0/MgDev/Bindings/src/Test/Php/ExecuteOperation.php
   branches/4.0/MgDev/Bindings/src/Test/Php/ResourceServiceAPI.php
   branches/4.0/MgDev/Bindings/src/Test/Php/ResourceServiceHttpRequests.php
   branches/4.0/MgDev/Bindings/src/Test/Php/Run.php
   branches/4.0/MgDev/Bindings/src/Test/Php/RunTests.php
   branches/4.0/MgDev/build.bat
Log:
This commit improves the following:
 - Fix up test runners for all 3 language targets be driven by a common set of environment variables for key configuration points
    - Path to webconfig.ini
    - CS-Map dictionary path
    - Root directory for test data
 - Remove run_tests.bat as it tries to do too much. Instead we split this functionality into run_server_tests.bat and run_web_tests.bat
 - Remove various obsolete batch files
 - Update root build.bat to install the 3 language test runners, test data, MgTestAdmin and helper scripts to the staging area for the "test" target
 - Fix up some quirks in the PHP test runner due to the PHP 8.1 upgrade

Modified: branches/4.0/MgDev/Bindings/TODO.txt
===================================================================
--- branches/4.0/MgDev/Bindings/TODO.txt	2025-02-07 16:13:25 UTC (rev 10120)
+++ branches/4.0/MgDev/Bindings/TODO.txt	2025-02-08 21:27:11 UTC (rev 10121)
@@ -135,16 +135,16 @@
    - [ ] Port over Java binding
  - Prepare deployable test pack that can be run against an existing MG installation
    - [x] Deploy .net test runner
-   - [ ] Deploy Java test runner
-     - [ ] Allow key configuration parameters to be passed in either from the commandline or read through environment variables
-   - [ ] Deploy PHP test runner
-   - [ ] Allow all runners to support a common set of environment variables to drive test environment/configuration
+   - [x] Deploy Java test runner
+     - [x] Allow key configuration parameters to be passed in either from the commandline or read through environment variables
+   - [x] Deploy PHP test runner
+   - [x] Allow all runners to support a common set of environment variables to drive test environment/configuration
      - webconfig.ini path
      - test data root directory
      - log path
      - admin password
-   - [ ] Deploy MgTestAdmin tool into this staging area
-   - [ ] Fix up run_tests.bat/run_tests.sh to work with new layout
+   - [x] Deploy MgTestAdmin tool into this staging area
+   - [x] Fix up run_tests.bat/run_tests.sh to work with new layout
  - Old code cleanup/consolidation
    - [x] Remove old IMake
    - [x] Remove old binding projects from WebTier

Index: branches/4.0/MgDev/Bindings/src/Test
===================================================================
--- branches/4.0/MgDev/Bindings/src/Test	2025-02-07 16:13:25 UTC (rev 10120)
+++ branches/4.0/MgDev/Bindings/src/Test	2025-02-08 21:27:11 UTC (rev 10121)

Property changes on: branches/4.0/MgDev/Bindings/src/Test
___________________________________________________________________
Modified: svn:ignore
## -1 +1,2 ##
 java_dist
+.vscode
Modified: branches/4.0/MgDev/Bindings/src/Test/DotNet/src/TestRunner/Program.cs
===================================================================
--- branches/4.0/MgDev/Bindings/src/Test/DotNet/src/TestRunner/Program.cs	2025-02-07 16:13:25 UTC (rev 10120)
+++ branches/4.0/MgDev/Bindings/src/Test/DotNet/src/TestRunner/Program.cs	2025-02-08 21:27:11 UTC (rev 10121)
@@ -8,16 +8,15 @@
 namespace TestRunner
 {
     //TODO: This test runner does not support generation/update mode yet. Please use the existing PHP test runner for doing this.
-
-    class Options
+    public class Options
     {
-        [Option("web-config-path", Required = true, HelpText = "Path to webconfig.ini")]
+        [Option("web-config-path", Required = false, HelpText = "Path to webconfig.ini")]
         public string WebConfigPath { get; set; }
 
-        [Option("dictionary-path", Required = true, HelpText = "CS-Map Dictionary Path")]
+        [Option("dictionary-path", Required = false, HelpText = "CS-Map Dictionary Path")]
         public string DictionaryPath { get; set; }
 
-        [Option("test-data-root", Required = true, HelpText = "Root path of test data files")]
+        [Option("test-data-root", Required = false, HelpText = "Root path of test data files")]
         public string TestDataRoot { get; set; }
 
         [Option("log-path", Required = false, HelpText = "Custom log path. If not set, will default to UnitTests.log on the current directory")]
@@ -30,7 +29,67 @@
         public bool SkipMainSuite { get; set; }
     }
 
+    public class TestEnvConfiguration
+    {
+        public string WebConfigPath { get; }
 
+        public string LogFilePath { get; }
+
+        public string TestDataRoot { get; }
+
+        public string AdminPass { get; }
+
+        public string DictionaryPath { get; }
+
+        public TestEnvConfiguration(Options o)
+        {
+            this.WebConfigPath = this.TryGetEnvVar("MG_TEST_WEBCONFIG_PATH", "");
+            this.LogFilePath = this.TryGetEnvVar("MG_TEST_LOG_PATH", "UnitTests.log");
+            this.TestDataRoot = this.TryGetEnvVar("MG_TEST_DATA_PATH", "../..");
+            this.AdminPass = this.TryGetEnvVar("MG_TEST_ADMIN_PASS", "admin");
+            this.DictionaryPath = this.TryGetEnvVar("MENTOR_DICTIONARY_PATH", "");
+
+            if (!string.IsNullOrEmpty(o.AdminPass))
+                this.AdminPass = o.AdminPass;
+            if (!string.IsNullOrEmpty(o.WebConfigPath))
+                this.WebConfigPath = o.WebConfigPath;
+            if (!string.IsNullOrEmpty(o.TestDataRoot))
+                this.TestDataRoot = o.TestDataRoot;
+            if (!string.IsNullOrEmpty(o.LogPath))
+                this.LogFilePath = o.LogPath;
+            if (!string.IsNullOrEmpty(o.DictionaryPath))
+                this.DictionaryPath = o.DictionaryPath;
+        }
+
+        public void PrintSummary(TextWriter output)
+        {
+            output.WriteLine("Test Configuration Summary:");
+            output.WriteLine("webconfig.ini path: " + this.WebConfigPath);
+            output.WriteLine("Test Data Root: " + this.TestDataRoot);
+            output.WriteLine("Log path: " + this.LogFilePath);
+            output.WriteLine("Admin pass: " + this.AdminPass);
+            output.WriteLine("CS-Map dictionary path: " + this.DictionaryPath);
+        }
+
+        private string TryGetEnvVar(string name, string defaultValue)
+        {
+            var value = Environment.GetEnvironmentVariable(name);
+            return !string.IsNullOrWhiteSpace(value) ? value : defaultValue;
+        }
+
+        public bool WebConfigExists => File.Exists(this.WebConfigPath);
+
+        public bool DictionaryPathExists => File.Exists(Path.Combine(this.DictionaryPath, "Coordsys.CSD"));
+
+        public bool TestDataRootExists => File.Exists(Path.Combine(this.TestDataRoot, $"ResourceService{Path.DirectorySeparatorChar}ResourceServiceTest.dump"));
+
+        internal void ApplyMentorDictPath()
+        {
+            if (Environment.GetEnvironmentVariable("MENTOR_DICTIONARY_PATH") != this.DictionaryPath)
+                Environment.SetEnvironmentVariable("MENTOR_DICTIONARY_PATH", this.DictionaryPath, EnvironmentVariableTarget.Process);
+        }
+    }
+   
     public class Program
     {
         static MgUserInformation userInfo;
@@ -100,30 +159,35 @@
             return exitCode;
         }
 
-        static int Run(Options options)
+        static int Run(Options o)
         {
-            if (!File.Exists(options.WebConfigPath))
+            var conf = new TestEnvConfiguration(o);
+            conf.PrintSummary(Console.Out);
+            //if (!File.Exists(options.WebConfigPath))
+            if (!conf.WebConfigExists)
             {
                 Console.WriteLine("webconfig.ini not found");
                 return 1;
             }
-            if (!Directory.Exists(options.DictionaryPath))
+            //if (!Directory.Exists(options.DictionaryPath))
+            if (!conf.DictionaryPathExists)
             {
                 Console.WriteLine("CS-Map Dictionary Path not found");
                 return 1;
             }
-            if (!File.Exists(Path.Combine(options.TestDataRoot, $"ResourceService{Path.DirectorySeparatorChar}ResourceServiceTest.dump")))
+            //if (!File.Exists(Path.Combine(options.TestDataRoot, $"ResourceService{Path.DirectorySeparatorChar}ResourceServiceTest.dump")))
+            if (!conf.TestDataRootExists)
             {
                 Console.WriteLine("Bad test data root path");
                 return 1;
             }
 
-            string webconfig = options.WebConfigPath;
-            string logFile = options.LogPath;
+            string webconfig = conf.WebConfigPath;
+            string logFile = conf.LogFilePath;
             if (string.IsNullOrEmpty(logFile))
                 logFile = "UnitTests.log";
 
-            TestDataRoot.Path = options.TestDataRoot;
+            TestDataRoot.Path = conf.TestDataRoot;
 
             int failures = 0;
             using (var logger = new TestLoggerFile(logFile, false))
@@ -130,15 +194,15 @@
             {
                 logger.Write("Run started: {0}\n\n", DateTime.Now.ToString());
 
-                Environment.SetEnvironmentVariable("MENTOR_DICTIONARY_PATH", options.DictionaryPath, EnvironmentVariableTarget.Process);
+                conf.ApplyMentorDictPath();
 
                 var csFactory = new MgCoordinateSystemFactory();
                 var csCatalog = csFactory.GetCatalog();
-                csCatalog.SetDictionaryDir(options.DictionaryPath);
+                csCatalog.SetDictionaryDir(conf.DictionaryPath);
                 Console.WriteLine($"Using CS Library: {csFactory.GetBaseLibrary()}");
 
-                MapGuideApi.MgInitializeWebTier(options.WebConfigPath);
-                userInfo = new MgUserInformation("Administrator", options.AdminPass);
+                MapGuideApi.MgInitializeWebTier(conf.WebConfigPath);
+                userInfo = new MgUserInformation("Administrator", conf.AdminPass);
                 siteConn = new MgSiteConnection();
                 siteConn.Open(userInfo);
 
@@ -146,7 +210,7 @@
 
                 int testsRun = 0;
                 bool isEnterprise = false;
-                if (!options.SkipMainSuite)
+                if (!o.SkipMainSuite)
                 {
                     failures += ExecuteTest(ApiTypes.Platform, $"{TestDataRoot.Path}/ResourceService/ResourceServiceTest.dump", ref testsRun, logger, isEnterprise);
                     failures += ExecuteTest(ApiTypes.Platform, $"{TestDataRoot.Path}/DrawingService/DrawingServiceTest.dump", ref testsRun, logger, isEnterprise);

Modified: branches/4.0/MgDev/Bindings/src/Test/Java/build.xml
===================================================================
--- branches/4.0/MgDev/Bindings/src/Test/Java/build.xml	2025-02-07 16:13:25 UTC (rev 10120)
+++ branches/4.0/MgDev/Bindings/src/Test/Java/build.xml	2025-02-08 21:27:11 UTC (rev 10121)
@@ -20,6 +20,7 @@
   <property name="classpath" location="lib" />
   <property name="extlib" location="extlib" />
   <property name="build.target" location="64" />
+  <property name="testdata.dir" location="../../../../UnitTest/TestData" />
   <property name="binsrc.common" location="../../../../Common/bin/Release64" />
   <property name="binsrc.web" location="../../../../Web/bin/Release64" />
   <property name="jarsrc.web" location="../../../../packages/Java/Release/x64" />
@@ -183,16 +184,11 @@
       <fileset dir="${dist}" includes="**/*.bin"/>
       <fileset dir="${dist}" includes="**/*.log"/>
     </delete>
-    <!--
-    <exec executable="java" dir="${dist}">
-      <arg line="-jar MgUnitTest.jar ${mapguide.config} ${unittest.logpath}" />
-      <env key="MENTOR_DICTIONARY_PATH" value="${mapguide.dictpath}" />
-    </exec>
-    -->
     <java jar="${dist}/MgUnitTest.jar" fork="true" dir="${dist}">
       <arg value="${mapguide.config}" />
       <arg value="${unittest.logpath}" />
       <env key="MENTOR_DICTIONARY_PATH" value="${mapguide.dictpath}" />
+      <env key="MG_TEST_DATA_PATH" value="${testdata.dir}" />
     </java>
   </target>
   <target name="checkwin" depends="dist,updatewebconfig">
@@ -202,16 +198,11 @@
       <fileset dir="${dist}" includes="**/*.bin"/>
       <fileset dir="${dist}" includes="**/*.log"/>
     </delete>
-    <!--
-    <exec executable="java" dir="${dist}">
-      <arg line="-jar MgUnitTest.jar ${mapguide.config} ${unittest.logpath}" />
-      <env key="MENTOR_DICTIONARY_PATH" value="${mapguide.dictpath}" />
-    </exec>
-    -->
     <java jar="${dist}/MgUnitTest.jar" fork="true" dir="${dist}">
       <arg value="${mapguide.config}" />
       <arg value="${unittest.logpath}" />
       <env key="MENTOR_DICTIONARY_PATH" value="${mapguide.dictpath}" />
+      <env key="MG_TEST_DATA_PATH" value="${testdata.dir}" />
     </java>
   </target>
   <target name="checkunix" depends="dist,updatewebconfig">
@@ -227,18 +218,9 @@
       <arg value="${mapguide.config}" />
       <arg value="${unittest.logpath}" />
       <env key="MENTOR_DICTIONARY_PATH" value="${mapguide.dictpath}" />
+      <env key="MG_TEST_DATA_PATH" value="${testdata.dir}" />
       <sysproperty key="java.library.path" value="${mapguide.ldpath}" />
     </java>
-    <!--
-    <exec executable="java" dir="${dist}">
-      <arg value="-Djava.library.path=${mapguide.ldpath}" />
-      <arg value="-jar MgUnitTest.jar" />   
-      <arg value="${mapguide.config}" />
-      <arg value="${unittest.logpath}" />
-      <env key="LD_LIBRARY_PATH" value="${mapguide.ldpath}" />
-      <env key="MENTOR_DICTIONARY_PATH" value="${mapguide.dictpath}" />
-    </exec>
-    -->
   </target>
   <target name="clean"
         description="clean up" >

Modified: branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/MapGuideTestExecutorCollection.java
===================================================================
--- branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/MapGuideTestExecutorCollection.java	2025-02-07 16:13:25 UTC (rev 10120)
+++ branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/MapGuideTestExecutorCollection.java	2025-02-08 21:27:11 UTC (rev 10121)
@@ -31,11 +31,13 @@
 
     private MgUserInformation _userInfo;
     private MgSiteConnection _conn;
+    private TestEnvConfiguration _conf;
 
-    public MapGuideTestExecutorCollection(MgUserInformation userInfo, MgSiteConnection conn)
+    public MapGuideTestExecutorCollection(TestEnvConfiguration conf, MgUserInformation userInfo, MgSiteConnection conn)
     {
         _userInfo = userInfo;
         _conn = conn;
+        _conf = conf;
         _executors = new HashMap<String, ITestExecutor>();
     }
 
@@ -327,8 +329,9 @@
             {
                 //TestName is Test_[ServiceType]
                 String type = testName.substring(testName.indexOf("_") + 1);
-                String filePath = CommonUtility.GetPath(String.format("../../TestData/{0}/DumpFiles/{0}ApiTest", type));
-                String fileName = String.format("{0}_{1}.{2}", filePath, paramSetId, actualExtension);
+                String dataPath = _conf.getDataPath(String.format("%s/DumpFiles/%sApiTest", type, type), false);
+                String filePath = CommonUtility.GetPath(dataPath);
+                String fileName = String.format("%s_%s.%s", filePath, paramSetId, actualExtension);
 
                 if (this.TestExecutionMode == "dump")
                 {

Modified: branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/MapGuideTests.java
===================================================================
--- branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/MapGuideTests.java	2025-02-07 16:13:25 UTC (rev 10120)
+++ branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/MapGuideTests.java	2025-02-08 21:27:11 UTC (rev 10121)
@@ -8,13 +8,13 @@
 
 public class MapGuideTests
 {
-    public static int Execute(IPlatformFactory factory, ITestLogger logger, MutableInteger testsRun) {
+    public static int Execute(TestEnvConfiguration conf, IPlatformFactory factory, ITestLogger logger, MutableInteger testsRun) {
         int failures = 0;
         Vector<IExternalTest> tests = new Vector<IExternalTest>();
         
         //--------------- BEGIN Test Registration -----------------//
         tests.add(new ReadOnlyLayerCollectionTest());
-        tests.add(new RenderingServiceTest());
+        tests.add(new RenderingServiceTest(conf));
         //--------------- END Test Registration -------------------//
 
         for (IExternalTest test : tests)

Modified: branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/Program.java
===================================================================
--- branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/Program.java	2025-02-07 16:13:25 UTC (rev 10120)
+++ branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/Program.java	2025-02-08 21:27:11 UTC (rev 10121)
@@ -18,55 +18,48 @@
             System.out.println("Working Directory is: " + System.getProperty("user.dir"));
             LogManager.getLogManager().reset(); //Needed for Linux
             Logger.getLogger("com.almworks.sqlite4java").setLevel(Level.OFF);
-            if (args.length >= 1 && args.length <= 2) {
-                String webConfigPath = args[0];
-                String logFile = "UnitTests.log";
-                if (args.length == 2)
-                    logFile = args[1];
-                
-                int failures = 0;
-                try (ITestLogger logger = new TestLoggerFile(logFile)) {
-                    logger.WriteLine(String.format("Run started: %s", new Date().toString()));
-                    MapGuideJavaApi.mgInitializeWebTier(webConfigPath);
+            TestEnvConfiguration conf = new TestEnvConfiguration(args);
+            conf.printSummary(System.out);
+            int failures = 0;
+            try (ITestLogger logger = new TestLoggerFile(conf.getLogFilePath())) {
+                logger.WriteLine(String.format("Run started: %s", new Date().toString()));
+                MapGuideJavaApi.mgInitializeWebTier(conf.getWebConfigPath());
 
-                    userInfo = new MgUserInformation("Administrator", "admin");
-                    siteConn = new MgSiteConnection();
-                    siteConn.open(userInfo);
+                userInfo = new MgUserInformation("Administrator",  conf.getAdminPass());
+                siteConn = new MgSiteConnection();
+                siteConn.open(userInfo);
 
-                    //Load the Sheboygan sample data set required by some tests
-                    Console.WriteLine("Loading Sheboygan sample data package");
-                    MgByteSource bs = new MgByteSource("../../TestData/Samples/Sheboygan/Sheboygan.mgp");
-                    MgByteReader rdr = bs.getReader();
-                    MgResourceService resSvc = (MgResourceService)siteConn.createService(MgServiceType.ResourceService);
-                    resSvc.applyResourcePackage(rdr);
+                //Load the Sheboygan sample data set required by some tests
+                Console.WriteLine("Loading Sheboygan sample data package");
+                MgByteSource bs = new MgByteSource(conf.getDataPath("Samples/Sheboygan/Sheboygan.mgp", true));
+                MgByteReader rdr = bs.getReader();
+                MgResourceService resSvc = (MgResourceService)siteConn.createService(MgServiceType.ResourceService);
+                resSvc.applyResourcePackage(rdr);
 
-                    Console.WriteLine("MapGuide Initialized. Running tests");
+                Console.WriteLine("MapGuide Initialized. Running tests");
 
-                    IPlatformFactory factory = new PlatformFactory(siteConn);
+                IPlatformFactory factory = new PlatformFactory(siteConn);
 
-                    MutableInteger testsRun = new MutableInteger(0);
-                    boolean isEnterprise = false;
-                    failures += ExecuteTest(ApiTypes.Platform, "../../TestData/ResourceService/ResourceServiceTest.dump", testsRun, logger, isEnterprise);
-                    failures += ExecuteTest(ApiTypes.Platform, "../../TestData/DrawingService/DrawingServiceTest.dump", testsRun, logger, isEnterprise);
-                    failures += ExecuteTest(ApiTypes.Platform, "../../TestData/FeatureService/FeatureServiceTest.dump", testsRun, logger, isEnterprise);
-                    failures += ExecuteTest(ApiTypes.Platform, "../../TestData/SiteService/SiteServiceTest.dump", testsRun, logger, isEnterprise);
-                    failures += ExecuteTest(ApiTypes.Platform, "../../TestData/MappingService/MappingServiceTest.dump", testsRun, logger, isEnterprise);
-                    failures += ExecuteTest(ApiTypes.Platform, "../../TestData/ServerAdmin/ServerAdminTest.dump", testsRun, logger, isEnterprise);
-                    failures += ExecuteTest(ApiTypes.Platform, "../../TestData/MapLayer/MapLayerTest.dump", testsRun, logger, isEnterprise);
-                    failures += ExecuteTest(ApiTypes.Platform, "../../TestData/WebLayout/WebLayoutTest.dump", testsRun, logger, isEnterprise);
-                    failures += ExecuteTest(ApiTypes.Platform, "../../TestData/Unicode/UnicodeTest.dump", testsRun, logger, isEnterprise);
-                    //Run auxillary tests not part of the SQLite-defined suite
-                    failures += CommonTests.Execute(factory, logger, testsRun);
-                    failures += MapGuideTests.Execute(factory, logger, testsRun);
-                    logger.WriteLine("\n\nTests failed/run: %d/%d", failures, testsRun.getValue());
-                    Console.Write("\n\nTests failed/run: %d/%d\n", failures, testsRun.getValue());
-                    logger.WriteLine(String.format("Run ended: %s", new Date().toString()));
-                }
-                System.exit(failures);
-            } else {
-                System.out.println("Usage: java -jar MgUnitTest.jar <webconfig.ini path> [test log path]");
-                System.exit(1);
+                MutableInteger testsRun = new MutableInteger(0);
+                boolean isEnterprise = false;
+                failures += ExecuteTest(conf, ApiTypes.Platform, conf.getDataPath("ResourceService/ResourceServiceTest.dump", true), testsRun, logger, isEnterprise);
+                failures += ExecuteTest(conf, ApiTypes.Platform, conf.getDataPath("DrawingService/DrawingServiceTest.dump", true), testsRun, logger, isEnterprise);
+                failures += ExecuteTest(conf, ApiTypes.Platform, conf.getDataPath("FeatureService/FeatureServiceTest.dump", true), testsRun, logger, isEnterprise);
+                failures += ExecuteTest(conf, ApiTypes.Platform, conf.getDataPath("SiteService/SiteServiceTest.dump", true), testsRun, logger, isEnterprise);
+                failures += ExecuteTest(conf, ApiTypes.Platform, conf.getDataPath("MappingService/MappingServiceTest.dump", true), testsRun, logger, isEnterprise);
+                failures += ExecuteTest(conf, ApiTypes.Platform, conf.getDataPath("ServerAdmin/ServerAdminTest.dump", true), testsRun, logger, isEnterprise);
+                failures += ExecuteTest(conf, ApiTypes.Platform, conf.getDataPath("MapLayer/MapLayerTest.dump", true), testsRun, logger, isEnterprise);
+                failures += ExecuteTest(conf, ApiTypes.Platform, conf.getDataPath("WebLayout/WebLayoutTest.dump", true), testsRun, logger, isEnterprise);
+                failures += ExecuteTest(conf, ApiTypes.Platform, conf.getDataPath("Unicode/UnicodeTest.dump", true), testsRun, logger, isEnterprise);
+                //Run auxillary tests not part of the SQLite-defined suite
+                failures += CommonTests.Execute(factory, logger, testsRun);
+                failures += MapGuideTests.Execute(conf, factory, logger, testsRun);
+                logger.WriteLine("\n\nTests failed/run: %d/%d", failures, testsRun.getValue());
+                Console.Write("\n\nTests failed/run: %d/%d\n", failures, testsRun.getValue());
+                logger.WriteLine(String.format("Run ended: %s", new Date().toString()));
             }
+            System.exit(failures);
+            //System.out.println("Usage: java -jar MgUnitTest.jar <webconfig.ini path> [test log path]");
         } catch (Exception ex) {
             System.err.println(CommonUtility.ExceptionToString(ex));
             System.exit(1);
@@ -73,10 +66,10 @@
         }
     }
 
-    private static int ExecuteTest(String apiType, String dumpFile, MutableInteger testsRun, ITestLogger logger, boolean isEnterprise) {
+    private static int ExecuteTest(TestEnvConfiguration conf, String apiType, String dumpFile, MutableInteger testsRun, ITestLogger logger, boolean isEnterprise) {
         ITestExecutorCollection exec = null;
         if (apiType.equals(ApiTypes.Platform))
-            exec = new MapGuideTestExecutorCollection(userInfo, siteConn);
+            exec = new MapGuideTestExecutorCollection(conf, userInfo, siteConn);
 
         int ret = 0;
         if (exec != null)

Added: branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/TestEnvConfiguration.java
===================================================================
--- branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/TestEnvConfiguration.java	                        (rev 0)
+++ branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/TestEnvConfiguration.java	2025-02-08 21:27:11 UTC (rev 10121)
@@ -0,0 +1,81 @@
+package org.osgeo.mapguide.test;
+
+import java.io.*;
+import java.nio.file.*;
+
+public class TestEnvConfiguration
+{
+    private String _webConfigPath;
+    private String _logFilePath;
+    private String _testDataRoot;
+    private String _adminPass;
+
+    public TestEnvConfiguration(String[] args) {
+        _webConfigPath = this.getEnvironmentVariable("MG_TEST_WEBCONFIG_PATH", "");
+        _logFilePath = this.getEnvironmentVariable("MG_TEST_LOG_PATH", "UnitTests.log");
+        _testDataRoot = this.getEnvironmentVariable("MG_TEST_DATA_PATH", "../..");
+        _adminPass = this.getEnvironmentVariable("MG_TEST_ADMIN_PASS", "admin");
+        
+        if (args.length >= 1 && args.length <= 2) {
+            _webConfigPath = args[0];
+            if (args.length == 2) {
+                _logFilePath = args[1];
+            }
+        }
+        
+        File w = new File(_webConfigPath);
+        File td = new File(_testDataRoot);
+        if (!w.exists()) {
+            throw new RuntimeException("webconfig.ini path is not valid");
+        }
+        if (td.isDirectory() && !td.exists()) {
+            throw new RuntimeException("Test data root directory does not exist");
+        }
+
+        smTestDataRoot = _testDataRoot;
+    }
+    
+    private String getEnvironmentVariable(String name, String defaultValue) {
+        String value = System.getenv(name);
+        if (value == null || value == "") {
+            return defaultValue;
+        }
+        return value;
+    }
+    
+    public void printSummary(java.io.PrintStream output) {
+        output.println("Test Configuration Summary:");
+        output.println("webconfig.ini path: " + _webConfigPath);
+        output.println("Test Data Root: " + _testDataRoot);
+        output.println("Log path: " + _logFilePath);
+        output.println("Admin pass: " + _adminPass);
+    }
+
+    public String getDataPath(String relPath, boolean throwIfNotExists) {
+        Path path = FileSystems.getDefault().getPath(_testDataRoot, relPath);
+        Path absPath = path.toAbsolutePath();
+        File f = absPath.toFile();
+        if (!f.exists() && throwIfNotExists)
+            throw new RuntimeException("File not found: " + absPath.toString());
+        return absPath.toString();
+    }
+    
+    public String getWebConfigPath() { return _webConfigPath; }
+    
+    public String getLogFilePath() { return _logFilePath; }
+    
+    public String getTestDataRoot() { return _testDataRoot; }
+    
+    public String getAdminPass() { return _adminPass; }
+
+    private static String smTestDataRoot;
+
+    public static String resolveTestDataPath(String relPath, boolean nullIfNotFound) {
+        Path path = FileSystems.getDefault().getPath(smTestDataRoot, relPath);
+        Path absPath = path.toAbsolutePath();
+        File f = absPath.toFile();
+        if (!f.exists() && nullIfNotFound)
+            return null;
+        return absPath.toString();
+    }
+}
\ No newline at end of file

Modified: branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/common/CommonUtility.java
===================================================================
--- branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/common/CommonUtility.java	2025-02-07 16:13:25 UTC (rev 10120)
+++ branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/common/CommonUtility.java	2025-02-08 21:27:11 UTC (rev 10121)
@@ -18,11 +18,11 @@
 import org.w3c.dom.Node;
 
 public class CommonUtility
-{
-    public static boolean IsWindows()
-    {
-        return System.getProperty("os.name").toLowerCase().contains("win");
-    }
+{
+    public static boolean IsWindows()
+    {
+        return System.getProperty("os.name").toLowerCase().contains("win");
+    }
 
     public static String DoubleToString(double d)
     {
@@ -699,7 +699,15 @@
                 {
                     if (DebugSettings.Enabled)
                         Console.WriteLine("Read path from current directory");
-                    str = CommonUtility.GetPath(str);
+
+                    //System.out.println("Param (" + paramName+ "): " + str);
+                    String relPath = str.replaceAll("../../TestData", "").replaceAll("..\\\\..\\\\TestData", "");
+                    String resolved = TestEnvConfiguration.resolveTestDataPath(relPath, true);
+                    //System.out.println("Resolves to: " + resolved);
+                    if (resolved != null)
+                        str = resolved;
+                    else
+                        str = "";
                 }
                 result.put(paramName, str);
                 return true;
@@ -706,6 +714,7 @@
             }
             return false;
         } catch(Exception ex) {
+            System.out.println("ERR: " + ex);
             return false;
         }
     }
@@ -753,4 +762,4 @@
             throw new UnitTestException(String.format("Exception from MapGuide:\n%s", ex.getDetails()));
         }
     }
-}
+}

Modified: branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/mapguide/RenderingServiceTest.java
===================================================================
--- branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/mapguide/RenderingServiceTest.java	2025-02-07 16:13:25 UTC (rev 10120)
+++ branches/4.0/MgDev/Bindings/src/Test/Java/src/org/osgeo/mapguide/test/mapguide/RenderingServiceTest.java	2025-02-08 21:27:11 UTC (rev 10121)
@@ -4,10 +4,17 @@
 import java.nio.file.*;
 import java.util.*;
 import org.osgeo.mapguide.*;
+import org.osgeo.mapguide.test.*;
 import org.osgeo.mapguide.test.common.*;
 
 public class RenderingServiceTest implements IExternalTest
 {
+    private TestEnvConfiguration _conf;
+
+    public RenderingServiceTest(TestEnvConfiguration conf) {
+        _conf = conf;
+    }
+
     private static void LoadResource(MgResourceService resSvc, String resIdStr, String path)
     {
         MgResourceIdentifier resId = new MgResourceIdentifier(resIdStr);
@@ -28,21 +35,20 @@
     {
         MgResourceService resSvc = (MgResourceService)factory.createService(MgServiceType.ResourceService);
         MgRenderingService renderSvc = (MgRenderingService)factory.createService(MgServiceType.RenderingService);
-        String root = "../../TestData/TileService/";
 
-        LoadResource(resSvc, "Library://UnitTests/Data/RoadCenterLines.FeatureSource", root + "UT_RoadCenterLines.fs");
-        LoadResourceData(resSvc, "Library://UnitTests/Data/RoadCenterLines.FeatureSource", "UT_RoadCenterLines.sdf", MgResourceDataType.File, root + "UT_RoadCenterLines.sdf");
-        LoadResource(resSvc, "Library://UnitTests/Layers/RoadCenterLines.LayerDefinition", root + "UT_RoadCenterLines.ldf");
+        LoadResource(resSvc, "Library://UnitTests/Data/RoadCenterLines.FeatureSource", _conf.getDataPath("TileService/UT_RoadCenterLines.fs", true));
+        LoadResourceData(resSvc, "Library://UnitTests/Data/RoadCenterLines.FeatureSource", "UT_RoadCenterLines.sdf", MgResourceDataType.File, _conf.getDataPath("TileService/UT_RoadCenterLines.sdf", true));
+        LoadResource(resSvc, "Library://UnitTests/Layers/RoadCenterLines.LayerDefinition", _conf.getDataPath("TileService/UT_RoadCenterLines.ldf", true));
 
-        LoadResource(resSvc, "Library://UnitTests/Data/VotingDistricts.FeatureSource", root + "UT_VotingDistricts.fs");
-        LoadResourceData(resSvc, "Library://UnitTests/Data/VotingDistricts.FeatureSource", "UT_VotingDistricts.sdf", MgResourceDataType.File, root + "UT_VotingDistricts.sdf");
-        LoadResource(resSvc, "Library://UnitTests/Layers/VotingDistricts.LayerDefinition", root + "UT_VotingDistricts.ldf");
+        LoadResource(resSvc, "Library://UnitTests/Data/VotingDistricts.FeatureSource", _conf.getDataPath("TileService/UT_VotingDistricts.fs", true));
+        LoadResourceData(resSvc, "Library://UnitTests/Data/VotingDistricts.FeatureSource", "UT_VotingDistricts.sdf", MgResourceDataType.File, _conf.getDataPath("TileService/UT_VotingDistricts.sdf", true));
+        LoadResource(resSvc, "Library://UnitTests/Layers/VotingDistricts.LayerDefinition", _conf.getDataPath("TileService/UT_VotingDistricts.ldf", true));
 
-        LoadResource(resSvc, "Library://UnitTests/Data/Parcels.FeatureSource", root + "UT_Parcels.fs");
-        LoadResourceData(resSvc, "Library://UnitTests/Data/Parcels.FeatureSource", "UT_Parcels.sdf", MgResourceDataType.File, root + "UT_Parcels.sdf");
-        LoadResource(resSvc, "Library://UnitTests/Layers/Parcels.LayerDefinition", root + "UT_Parcels.ldf");
+        LoadResource(resSvc, "Library://UnitTests/Data/Parcels.FeatureSource", _conf.getDataPath("TileService/UT_Parcels.fs", true));
+        LoadResourceData(resSvc, "Library://UnitTests/Data/Parcels.FeatureSource", "UT_Parcels.sdf", MgResourceDataType.File, _conf.getDataPath("TileService/UT_Parcels.sdf", true));
+        LoadResource(resSvc, "Library://UnitTests/Layers/Parcels.LayerDefinition", _conf.getDataPath("TileService/UT_Parcels.ldf", true));
 
-        LoadResource(resSvc, "Library://UnitTests/Maps/BaseMap.MapDefinition", root + "UT_BaseMap.mdf");
+        LoadResource(resSvc, "Library://UnitTests/Maps/BaseMap.MapDefinition", _conf.getDataPath("TileService/UT_BaseMap.mdf", true));
 
         MgMap map = (MgMap)factory.createMap();
         map.create(new MgResourceIdentifier("Library://UnitTests/Maps/BaseMap.MapDefinition"), "BaseMap");

Index: branches/4.0/MgDev/Bindings/src/Test/Php
===================================================================
--- branches/4.0/MgDev/Bindings/src/Test/Php	2025-02-07 16:13:25 UTC (rev 10120)
+++ branches/4.0/MgDev/Bindings/src/Test/Php	2025-02-08 21:27:11 UTC (rev 10121)

Property changes on: branches/4.0/MgDev/Bindings/src/Test/Php
___________________________________________________________________
Added: svn:ignore
## -0,0 +1 ##
+UnitTests.log
Modified: branches/4.0/MgDev/Bindings/src/Test/Php/ExecuteOperation.php
===================================================================
--- branches/4.0/MgDev/Bindings/src/Test/Php/ExecuteOperation.php	2025-02-07 16:13:25 UTC (rev 10120)
+++ branches/4.0/MgDev/Bindings/src/Test/Php/ExecuteOperation.php	2025-02-08 21:27:11 UTC (rev 10121)
@@ -52,13 +52,15 @@
     private $webLayoutOperation;
     private $wfsOperation;
     private $wmsOperation;
+    private $testContext;
 
-    public function __construct($requestType, $db, $Url)
+    public function __construct($requestType, $db, $Url, $testContext)
     {
         $this->contentType="";
+        $this->testContext = $testContext;
         if (substr_count($requestType, "Http"))
         {
-            $this->resourceServiceOperation = new ResourceServiceHttpRequests($db, $Url);
+            $this->resourceServiceOperation = new ResourceServiceHttpRequests($db, $Url, $this->testContext);
             $this->drawingServiceOperation = new DrawingServiceHttpRequests($db, $Url);
             $this->featureServiceOperation = new FeatureServiceHttpRequests($db, $Url);
             $this->siteServiceOperation = new SiteServiceHttpRequests($db, $Url);
@@ -68,7 +70,7 @@
         }
         elseif (substr_count($requestType,"Api"))
         {
-            $this->resourceServiceOperation = new ResourceServiceAPI($db);
+            $this->resourceServiceOperation = new ResourceServiceAPI($db, $this->testContext);
             $this->drawingServiceOperation = new DrawingServiceAPI($db);
             $this->featureServiceOperation = new FeatureServiceAPI($db);
             $this->siteServiceOperation = new SiteServiceAPI($db);

Modified: branches/4.0/MgDev/Bindings/src/Test/Php/ResourceServiceAPI.php
===================================================================
--- branches/4.0/MgDev/Bindings/src/Test/Php/ResourceServiceAPI.php	2025-02-07 16:13:25 UTC (rev 10120)
+++ branches/4.0/MgDev/Bindings/src/Test/Php/ResourceServiceAPI.php	2025-02-08 21:27:11 UTC (rev 10121)
@@ -33,10 +33,12 @@
     private $site;
     private $resourceSrvc;
     private $mimeType;
+    private $testContext;
 
-    function __construct($db)
+    function __construct($db, $testContext)
     {
         $this->mimeType="text/xml";
+        $this->testContext = $testContext;
         Utils::MapAgentInit(WEBCONFIGINI);
 
         $this->cred = new MgUserInformation();
@@ -74,14 +76,19 @@
 
             $this->unitTestParamVm->Execute("Select ParamValue from Params WHERE ParamSet=$paramSet AND ParamName=\"DEPTH\"");
             $arrayParam["DEPTH"]=$this->unitTestParamVm->GetString("ParamValue");
-            if (is_numeric($arrayParam["DEPTH"]))
-            {
-                $arrayParam["DEPTH"] = intval($arrayParam["DEPTH"]);
+            // Interpret empty string as DEPTH = 0
+            if ($arrayParam["DEPTH"] == "") {
+                $arrayParam["DEPTH"] = 0;
+            } else {
+                if (is_numeric($arrayParam["DEPTH"]))
+                {
+                    $arrayParam["DEPTH"] = intval($arrayParam["DEPTH"]);
+                }
+                else
+                {
+                    $arrayParam["DEPTH"] = -1;
+                }
             }
-            else
-            {
-                $arrayParam["DEPTH"] = -1;
-            }
 
             if (array_key_exists("RESOURCEID", $arrayParam))
             {
@@ -124,8 +131,8 @@
             $this->unitTestParamVm->Execute("Select ParamValue from Params WHERE ParamSet=$paramSet AND ParamName=\"CONTENT\"");
             if ($this->unitTestParamVm->GetString("ParamValue") != "")
             {
-                $arrayParam['CONTENT']=$this->unitTestParamVm->GetString("ParamValue");
-                $arrayParam['CONTENT']=Utils::GetPath($arrayParam['CONTENT']);
+                $contentParam = $this->unitTestParamVm->GetString("ParamValue");
+                $arrayParam['CONTENT']=$this->testContext->resolveDataFilePath($contentParam);
                 if (file_exists($arrayParam['CONTENT']))
                 {
                     //TODO add mime type
@@ -137,8 +144,8 @@
             $this->unitTestParamVm->Execute("Select ParamValue from Params WHERE ParamSet=$paramSet AND ParamName=\"HEADER\"");
             if ($this->unitTestParamVm->GetString("ParamValue") != "")
             {
-                $arrayParam['HEADER']=$this->unitTestParamVm->GetString("ParamValue");
-                $arrayParam['HEADER']=Utils::GetPath($arrayParam['HEADER']);
+                $headerParam = $this->unitTestParamVm->GetString("ParamValue");
+                $arrayParam['HEADER']=$this->testContext->resolveDataFilePath($headerParam);
                 if (file_exists($arrayParam['HEADER']))
                 {
                     $headerSource = new MgByteSource($arrayParam['HEADER']);
@@ -350,9 +357,10 @@
             $arrayParam["DATATYPE"]=$this->unitTestParamVm->GetString("ParamValue");
 
             $this->unitTestParamVm->Execute("Select ParamValue from Params WHERE ParamSet=$paramSet AND ParamName=\"DATA\"");
-            $arrayParam["DATA"]=$this->unitTestParamVm->GetString("ParamValue");
-            $arrayParam["DATA"]=Utils::GetPath($arrayParam["DATA"]);
 
+            $dataParam = $this->unitTestParamVm->GetString("ParamValue");
+            $arrayParam['DATA']=$this->testContext->resolveDataFilePath($dataParam);
+
             $extension = self::GetExtension($arrayParam["DATANAME"]);
             $mimeType = self::GetMimeType($extension);
             $dataSource = new MgByteSource($arrayParam["DATA"]);
@@ -546,8 +554,8 @@
             $this->unitTestParamVm->Execute("Select ParamValue from Params WHERE ParamSet=$paramSet AND ParamName=\"CONTENT\"");
             if ($this->unitTestParamVm->GetString("ParamValue") != "")
             {
-                $arrayParam['CONTENT']=$this->unitTestParamVm->GetString("ParamValue");
-                $arrayParam['CONTENT']=Utils::GetPath($arrayParam['CONTENT']);
+                $contentParam = $this->unitTestParamVm->GetString("ParamValue");
+                $arrayParam['CONTENT']=$this->testContext->resolveDataFilePath($contentParam);
                 if (file_exists($arrayParam['CONTENT']))
                 {
                     //TODO add mime type
@@ -559,8 +567,8 @@
             $this->unitTestParamVm->Execute("Select ParamValue from Params WHERE ParamSet=$paramSet AND ParamName=\"HEADER\"");
             if ($this->unitTestParamVm->GetString("ParamValue") != "")
             {
-                $arrayParam['HEADER']=$this->unitTestParamVm->GetString("ParamValue");
-                $arrayParam['HEADER']=Utils::GetPath($arrayParam['HEADER']);
+                $headerParam = $this->unitTestParamVm->GetString("ParamValue");
+                $arrayParam['HEADER']=$this->testContext->resolveDataFilePath($headerParam);
                 if (file_exists($arrayParam['HEADER']))
                 {
                     $headerSource = new MgByteSource($arrayParam['HEADER']);
@@ -778,7 +786,8 @@
             $packageSource = null;
 
             $this->unitTestParamVm->Execute("Select ParamValue from Params WHERE ParamSet=$paramSet AND ParamName=\"PACKAGE\"");
-            $arrayParam["PACKAGE"]=Utils::GetPath($this->unitTestParamVm->GetString("ParamValue"));
+            $packageParam = $this->unitTestParamVm->GetString("ParamValue");
+            $arrayParam['PACKAGE']=$this->testContext->resolveDataFilePath($packageParam);
 
             if (Utils::IsWindows()) {
                 $packageSource = new MgByteSource($arrayParam["PACKAGE"]);

Modified: branches/4.0/MgDev/Bindings/src/Test/Php/ResourceServiceHttpRequests.php
===================================================================
--- branches/4.0/MgDev/Bindings/src/Test/Php/ResourceServiceHttpRequests.php	2025-02-07 16:13:25 UTC (rev 10120)
+++ branches/4.0/MgDev/Bindings/src/Test/Php/ResourceServiceHttpRequests.php	2025-02-08 21:27:11 UTC (rev 10121)
@@ -33,13 +33,15 @@
     private $httpRequest;
     private $URL;
     private $db;
+    private $testContext;
 
-    function __construct($db, $newURL)
+    function __construct($db, $newURL, $testContext)
     {
         $this->db = $db;
         $this->unitTestParamVm = new SqliteVM($db, true);
         $this->httpRequest = new HttpRequest();
         $this->URL = $newURL;
+        $this->testContext = $testContext;
     }
 
     function __destruct()
@@ -86,7 +88,8 @@
             $this->unitTestParamVm->Execute("Select ParamValue from Params WHERE ParamSet=$paramSet AND ParamName=\"CONTENT\"");
             if ($this->unitTestParamVm->GetString("ParamValue") != "")
             {
-                $arrayParam['CONTENT']=$this->unitTestParamVm->GetString("ParamValue");
+                $contentParam = $this->unitTestParamVm->GetString("ParamValue");
+                $arrayParam['CONTENT']=$this->testContext->resolveDataFilePath($contentParam);
                 $arrayParam['CONTENT']=new CURLFile(Utils::GetPath($arrayParam['CONTENT']));
             }
 
@@ -346,7 +349,8 @@
             $this->unitTestParamVm->Execute("Select ParamValue from Params WHERE ParamSet=$paramSet AND ParamName=\"CONTENT\"");
             if ($this->unitTestParamVm->GetString("ParamValue") != "")
             {
-                $arrayParam['CONTENT']=$this->unitTestParamVm->GetString("ParamValue");
+                $contentParam = $this->unitTestParamVm->GetString("ParamValue");
+                $arrayParam['CONTENT']=$this->testContext->resolveDataFilePath($contentParam);
                 $arrayParam['CONTENT']=new CURLFile(Utils::GetPath($arrayParam['CONTENT']));
             }
 

Modified: branches/4.0/MgDev/Bindings/src/Test/Php/Run.php
===================================================================
--- branches/4.0/MgDev/Bindings/src/Test/Php/Run.php	2025-02-07 16:13:25 UTC (rev 10120)
+++ branches/4.0/MgDev/Bindings/src/Test/Php/Run.php	2025-02-08 21:27:11 UTC (rev 10121)
@@ -45,7 +45,7 @@
     private $validate;
     private $operation;
 
-    public function main(&$testsRun, $file=null)
+    public function main(&$testsRun, $file=null, $testContext)
     {
         $status=-1;
         //Print HTML tags for the result page
@@ -63,7 +63,7 @@
             $file=fopen("UnitTests.log", "w");
         }
         //If initialization is successful then run the test and clean up
-        if (self::Initialize())
+        if (self::Initialize($testContext))
         {
             $status = self::RunTest($testsRun, $file);
             self::CleanUp();
@@ -78,7 +78,7 @@
     }
 
 
-    function Initialize()
+    function Initialize($testContext)
     {
         try
         {
@@ -105,7 +105,7 @@
                 $this->unitTestVm = new SqliteVM($this->unitTestDb);
                 $this->unitTestResultVm = new SqliteVM($this->unitTestDb);
 
-                $this->operation = new ExecuteOperation($_POST['requestType'], $this->unitTestDb, $url);
+                $this->operation = new ExecuteOperation($_POST['requestType'], $this->unitTestDb, $url, $testContext);
                 $this->validate = new Validate($this->unitTestDb);
             }
             else

Modified: branches/4.0/MgDev/Bindings/src/Test/Php/RunTests.php
===================================================================
--- branches/4.0/MgDev/Bindings/src/Test/Php/RunTests.php	2025-02-07 16:13:25 UTC (rev 10120)
+++ branches/4.0/MgDev/Bindings/src/Test/Php/RunTests.php	2025-02-08 21:27:11 UTC (rev 10121)
@@ -20,6 +20,7 @@
 //Command line script that executes all tests in the given database files
 
 define('Run_MAIN_METHOD', true);
+require_once('TestContext.php');
 require_once("sqlite_constants.php");
 require_once("Run.php");
 main();
@@ -30,7 +31,6 @@
     $testsFailed = 0;
     $testsRun = 0;
     $isEnterprise = false;
-    $runApiTestsOnly = false;
     $file = fopen("UnitTests.log", "w");
 
     date_default_timezone_set("GMT-0");
@@ -51,59 +51,46 @@
     {
         $isEnterprise = true;
     }
-    
-    if (($argc>1))
-    {
-        for ($i = 0; $i < count($argv); $i++)
-        {
-            if ($argv[$i] == "-apionly")
-            {
-                $runApiTestsOnly = true;
-            }
-            else if ($argv[$i] == "-config" && $i < count($argv) - 1)
-            {
-                define("WEBCONFIGINI", $argv[$i+1]);
-            }
-        }
-    }
 
+    $context = new TestContext($argc, $argv);
+
     if (!$file)
     {
         echo "Unable to create log file UnitTests.log";
     }
 
-    $testsFailed += ExecuteTest("Api", "../../TestData/ResourceService/ResourceServiceTest.dump", $testsRun, $file, $isEnterprise);
-    if (!$runApiTestsOnly)
-        $testsFailed += ExecuteTest("Http", "../../TestData/ResourceService/ResourceServiceTest.dump", $testsRun, $file, $isEnterprise);
+    $testsFailed += ExecuteTest("Api", $context, "ResourceService/ResourceServiceTest.dump", $testsRun, $file, $isEnterprise);
+    if (!$context->runApiTestsOnly)
+        $testsFailed += ExecuteTest("Http", $context, "ResourceService/ResourceServiceTest.dump", $testsRun, $file, $isEnterprise);
 
-    $testsFailed += ExecuteTest("Api", "../../TestData/DrawingService/DrawingServiceTest.dump", $testsRun, $file, $isEnterprise);
-    if (!$runApiTestsOnly)
-        $testsFailed += ExecuteTest("Http", "../../TestData/DrawingService/DrawingServiceTest.dump", $testsRun, $file, $isEnterprise);
+    $testsFailed += ExecuteTest("Api", $context, "DrawingService/DrawingServiceTest.dump", $testsRun, $file, $isEnterprise);
+    if (!$context->runApiTestsOnly)
+        $testsFailed += ExecuteTest("Http", $context, "DrawingService/DrawingServiceTest.dump", $testsRun, $file, $isEnterprise);
 
-    $testsFailed += ExecuteTest("Api", "../../TestData/FeatureService/FeatureServiceTest.dump", $testsRun, $file, $isEnterprise);
-    if (!$runApiTestsOnly)
-        $testsFailed += ExecuteTest("Http", "../../TestData/FeatureService/FeatureServiceTest.dump", $testsRun, $file, $isEnterprise);
+    $testsFailed += ExecuteTest("Api", $context, "FeatureService/FeatureServiceTest.dump", $testsRun, $file, $isEnterprise);
+    if (!$context->runApiTestsOnly)
+        $testsFailed += ExecuteTest("Http", $context, "FeatureService/FeatureServiceTest.dump", $testsRun, $file, $isEnterprise);
 
-    $testsFailed += ExecuteTest("Api", "../../TestData/SiteService/SiteServiceTest.dump", $testsRun, $file, $isEnterprise);
-    if (!$runApiTestsOnly)
-        $testsFailed += ExecuteTest("Http", "../../TestData/SiteService/SiteServiceTest.dump", $testsRun, $file, $isEnterprise);
+    $testsFailed += ExecuteTest("Api", $context, "SiteService/SiteServiceTest.dump", $testsRun, $file, $isEnterprise);
+    if (!$context->runApiTestsOnly)
+        $testsFailed += ExecuteTest("Http", $context, "SiteService/SiteServiceTest.dump", $testsRun, $file, $isEnterprise);
 
-    $testsFailed += ExecuteTest("Api", "../../TestData/MappingService/MappingServiceTest.dump", $testsRun, $file, $isEnterprise);
-    if (!$runApiTestsOnly)
-        $testsFailed += ExecuteTest("Http", "../../TestData/MappingService/MappingServiceTest.dump", $testsRun, $file, $isEnterprise);
+    $testsFailed += ExecuteTest("Api", $context, "MappingService/MappingServiceTest.dump", $testsRun, $file, $isEnterprise);
+    if (!$context->runApiTestsOnly)
+        $testsFailed += ExecuteTest("Http", $context, "MappingService/MappingServiceTest.dump", $testsRun, $file, $isEnterprise);
 
-    $testsFailed += ExecuteTest("Api", "../../TestData/ServerAdmin/ServerAdminTest.dump", $testsRun, $file, $isEnterprise);
+    $testsFailed += ExecuteTest("Api", $context, "ServerAdmin/ServerAdminTest.dump", $testsRun, $file, $isEnterprise);
 
-    $testsFailed += ExecuteTest("Api", "../../TestData/MapLayer/MapLayerTest.dump", $testsRun, $file, $isEnterprise);
+    $testsFailed += ExecuteTest("Api", $context, "MapLayer/MapLayerTest.dump", $testsRun, $file, $isEnterprise);
 
-    $testsFailed += ExecuteTest("Api", "../../TestData/WebLayout/WebLayoutTest.dump", $testsRun, $file, $isEnterprise);
+    $testsFailed += ExecuteTest("Api", $context, "WebLayout/WebLayoutTest.dump", $testsRun, $file, $isEnterprise);
 
-    if (!$runApiTestsOnly)
+    if (!$context->runApiTestsOnly)
     {
-        $testsFailed += ExecuteTest("Http", "../../TestData/Wfs/WfsTest.dump", $testsRun, $file, $isEnterprise);
-        $testsFailed += ExecuteTest("Http", "../../TestData/Wms/WmsTest.dump", $testsRun, $file, $isEnterprise);
+        $testsFailed += ExecuteTest("Http", $context, "Wfs/WfsTest.dump", $testsRun, $file, $isEnterprise);
+        $testsFailed += ExecuteTest("Http", $context, "Wms/WmsTest.dump", $testsRun, $file, $isEnterprise);
     }
-    $testsFailed += ExecuteTest("Api", "../../TestData/Unicode/UnicodeTest.dump", $testsRun, $file, $isEnterprise);
+    $testsFailed += ExecuteTest("Api", $context, "Unicode/UnicodeTest.dump", $testsRun, $file, $isEnterprise);
 
     $str = sprintf("\n\nTests failed/run: %d/%d\n", $testsFailed, $testsRun);
     $str .=sprintf("Run ended: %s\n\n",date("D M j G:i:s T Y"));
@@ -118,12 +105,13 @@
     exit($testsFailed);
 }
 
-function ExecuteTest($requestType, $dumpFileName, &$testsRun, $file, $ent)
+function ExecuteTest($requestType, $context, $dumpFileRelPath, &$testsRun, $file, $ent)
 {
     try
     {
         $exitStatus=0;
         //Create database objects
+        $dumpFileName = $context->getDataFilePath($dumpFileRelPath);
         $dbPath = Utils::GetDbPath($dumpFileName);
         $dbName = Utils::GetPath($dbPath);
 
@@ -155,7 +143,7 @@
                 $_POST[$testName.':dbPath']=$dbPath;
 
                 $result = new Run($testsRun);
-                $exitStatus += $result->main($testsRun, $file);
+                $exitStatus += $result->main($testsRun, $file, $context);
                 $status = $vm->NextRow();
             }
             unset($vm);

Added: branches/4.0/MgDev/Bindings/src/Test/Php/TestContext.php
===================================================================
--- branches/4.0/MgDev/Bindings/src/Test/Php/TestContext.php	                        (rev 0)
+++ branches/4.0/MgDev/Bindings/src/Test/Php/TestContext.php	2025-02-08 21:27:11 UTC (rev 10121)
@@ -0,0 +1,68 @@
+<?php
+
+class TestContext {
+    private $webConfigPath;
+    private $testDataRootPath;
+    public $runApiTestsOnly;
+    public function __construct($argc, $argv) {
+        $this->runApiTestsOnly = true; // false
+        if (($argc>1))
+        {
+            for ($i = 0; $i < count($argv); $i++)
+            {
+                if ($argv[$i] == "-apionly")
+                {
+                    $this->runApiTestsOnly = true;
+                }
+                else if ($argv[$i] == "-config" && $i < count($argv) - 1)
+                {
+                    $this->webConfigPath = $argv[$i+1];
+                }
+            }
+        }
+        $this->testDataRootPath = "../../../../UnitTest/TestData";
+
+        $wp = getenv("MG_TEST_WEBCONFIG_PATH");
+        $td = getenv("MG_TEST_DATA_PATH");
+
+        if ($wp != null && strlen($wp) > 0) {
+            $this->webConfigPath = $wp;
+        }
+        if ($td != null && strlen($td) > 0) {
+            $this->testDataRootPath = $td;
+        }
+
+        if (!file_exists($this->webConfigPath)) {
+            throw new Exception("webconfig.ini path not found: " . $this->webConfigPath);
+        }
+
+        // Normalize
+        $this->testDataRootPath = self::EnsureEndingSlash(str_replace("\\", "/", $this->testDataRootPath));
+
+        define('WEBCONFIGINI', $this->webConfigPath);
+    }
+    static function EnsureEndingSlash(/*php_string*/ $str) {
+        return self::StringEndsWith($str, "/") ? $str : ($str . "/");
+    }
+    static function StringEndsWith(/*php_string*/ $haystack, /*php_string*/ $needle) {
+        return $needle === "" || substr($haystack, -strlen($needle)) === $needle;
+    }
+    public function resolveDataFilePath($relPath) {
+        if (strlen($relPath) === 0) {
+            return Utils::GetPath($relPath);
+        }
+        $relPathFixed = str_replace("../../TestData", $this->testDataRootPath, $relPath);
+        $relPathFixed = str_replace("..\\..\\TestData", $this->testDataRootPath, $relPathFixed);
+        return $relPathFixed;
+    }
+    public function getDataFilePath($relPath, $throwIfNotFound = true) {
+        $absPath = $this->testDataRootPath;
+        $absPath .= $relPath;
+        if (!file_exists($absPath) && $throwIfNotFound) {
+            throw new Exception("Test data file not found: " . $absPath);
+        }
+        return $absPath;
+    }
+}
+
+?>
\ No newline at end of file

Deleted: branches/4.0/MgDev/UnitTest/prepare.php
===================================================================
--- branches/4.0/MgDev/UnitTest/prepare.php	2025-02-07 16:13:25 UTC (rev 10120)
+++ branches/4.0/MgDev/UnitTest/prepare.php	2025-02-08 21:27:11 UTC (rev 10121)
@@ -1,59 +0,0 @@
-<?php
-
-require_once dirname(__FILE__)."/../Web/src/PhpApi/constants.php";
-
-$file = dirname(__FILE__)."/webconfig.ini";
-if (array_key_exists("MG_WEBCONFIG_INI", $_SERVER))
-    $file = $_SERVER["MG_WEBCONFIG_INI"];
-
-$mgp = dirname(__FILE__)."/TestData/Samples/Sheboygan/Sheboygan.mgp";
-if (array_key_exists("MG_SHEBOYGAN_MGP", $_SERVER))
-    $mgp = $_SERVER["MG_SHEBOYGAN_MGP"];
-
-if (!file_exists($mgp)) {
-    echo "Sheboygan.mgp not found. Please put this file in this directory before running this script\n";
-    exit(255);
-}
-if (!file_exists($file)) {
-    $src = dirname(__FILE__)."/../Web/src/webconfig.ini";
-    $csMapDir = dirname(__FILE__)."/../Oem/CsMap/Dictionaries";
-    $resDir = dirname(__FILE__)."/../Common/MapGuideCommon/Resources";
-    
-    $ini = file($src);
-    $newlines = array();
-    foreach ($ini as $lineNum => $line) {
-        $write = "";
-        $mdp = strpos($line, 'MentorDictionaryPath');
-        $rp = strpos($line, 'ResourcesPath');
-        if ($mdp !== FALSE && $mdp == 0)
-            $write = "MentorDictionaryPath = $csMapDir";
-        else if ($rp !== FALSE && $rp == 0)
-            $write = "ResourcesPath = $resDir";
-        else
-            $write = trim($line);
-
-        if ($write != "")
-            array_push($newlines, $write);
-    }
-    
-    file_put_contents($file, implode("\n", $newlines));
-    echo "Saved: $file\n";
-}
-try {
-    MgInitializeWebTier($file);
-    $siteConn = new MgSiteConnection();
-    $userInfo = new MgUserInformation("Administrator", "admin");
-    $siteConn->Open($userInfo);
-    $src = new MgByteSource($mgp);
-    $rdr = $src->GetReader();
-    $resSvc = $siteConn->CreateService(MgServiceType::ResourceService);
-    echo "Loading Sheboygan.mgp\n";
-    $resSvc->ApplyResourcePackage($rdr);
-    echo "Sheboygan.mgp loaded\n";
-    exit(0);
-} catch (MgException $ex) {
-    echo $ex->GetDetails();
-    exit(255);
-}
-
-?>
\ No newline at end of file

Deleted: branches/4.0/MgDev/UnitTest/run_php_tests.bat
===================================================================
--- branches/4.0/MgDev/UnitTest/run_php_tests.bat	2025-02-07 16:13:25 UTC (rev 10120)
+++ branches/4.0/MgDev/UnitTest/run_php_tests.bat	2025-02-08 21:27:11 UTC (rev 10121)
@@ -1,109 +0,0 @@
- at echo off
-REM Web Tier Test Suite runner script
-REM
-REM Author: Jackie Ng (jumpinjackie at gmail.com)
-REM
-REM About this script:
-REM
-REM This batch script will automatically start the mgserver.exe with a customizable wait period.
-REM Once the wait period has elapsed the Web Tier test suite will be run via the PHP CLI interpreter.
-REM
-REM This script harnesses everything that's available from the MapGuide source tree (under MgDev) to avoid
-REM minimal external setup. 
-REM
-REM The only setup required is to copy a 32-bit ssleay32.dll and libeay32.dll to Oem\php\Release_TS.
-REM If you have the Installer checked out, you can extract a copy of these files from the
-REM binary 32-bit PHP zip under Installer\Support\Web\x86
-REM
-REM By default, http unit tests are skipped because of this. See remarks.
-REM
-REM Instructions:
-REM 
-REM  1. Build the Oem, Server and WebTier in release mode
-REM  2. Run set_test_params.bat. You can change the values in this file beforehand.
-REM  3. Run run_php_tests.bat
-REM
-REM Remarks:
-REM
-REM  1. mapagent http tests are not run by default as this requires one to be already set up under 
-REM     (http://localhost:<port>/mapguide/mapagent/mapagent.fcgi). If you have already set one up
-REM     you can set API_ONLY=0 in set_test_params.bat
-REM
-REM TODO:
-REM  We really need to automate setting up the mapagent in a web server in a zero-configuration manner. Only then can we 
-REM  remove the API_ONLY variable
-REM
-SET WEB_BIN=%CD%\..\Web\bin\release
-SET SERVER_BIN=%CD%\..\Server\bin\release
-SET OEM_PATH=%CD%\..\Oem
-SET OEM_PHP=%OEM_PATH%\php\Release_TS
-REM MENTOR_DICTIONARY_PATH fallback for MgCoordinateSystem still exists, so use it so we don't have to mess around with webconfig.ini
-SET MENTOR_DICTIONARY_PATH=%OEM_PATH%\CsMap\Dictionaries
-SET OEM_SQLITE=%OEM_PATH%\SQLite\bin\release
-SET MAPAGENT=%CD%\..\Web\src\mapagent
-IF "%PLATFORM%" == "64" (
-    SET OEM_PHP=%OEM_PATH%\php\x64\Release_TS
-    SET WEB_BIN=%CD%\..\Web\bin\release64
-    SET SERVER_BIN=%CD%\..\Server\bin\release64
-    SET OEM_SQLITE=%OEM_PATH%\SQLite\bin\release64
-    SET MAPAGENT=%CD%\..\Web\src\mapagent64
-)
-SET OLD_PATH=%PATH%
-SET PATH=%PATH%;%OEM_PHP%;%MAPAGENT%
-
-echo ******************************************************************************
-echo Platform: %PLATFORM%
-echo Auto-start mgserver.exe: %START_MGSERVER%
-echo Time to wait for mgserver.exe: %MGSERVER_WAIT%
-echo Running Web API only: %API_ONLY%
-echo PHP dir: %OEM_PHP%
-echo ******************************************************************************
-
-REM Sanity checks
-IF NOT EXIST "%WEB_BIN%" (
-    echo Could not find required directory %WEB_BIN%
-    goto quit
-)
-IF NOT EXIST "%OEM_SQLITE%" (
-    echo Could not find required directory %OEM_SQLITE%
-    goto quit
-)
-
-REM Copy required php extensions. Copy everything from %WEB_BIN% as PHP MapGuide API requires these
-echo [check]: PHP MapGuide dlls
-IF NOT EXIST "%OEM_PHP%\php_MapGuideApi.dll" copy /Y "%WEB_BIN%\*.dll" "%OEM_PHP%" > NUL
-echo [check]: Checking PHP SQLite dlls
-IF NOT EXIST "%OEM_PHP%\php_SQLitePhpApi.dll" copy /Y "%OEM_SQLITE%\php_SQLitePhpApi.dll" "%OEM_PHP%" > NUL
-
-REM Copy resource files to satisfy new relative path of webconfig.ini
-echo [check]: MapGuide messages (en)
-xcopy /S /Y /I "%MAPAGENT%\Resources" WebTier\php\Resources > NUL
-
-IF "%START_MGSERVER%" == "1" (
-    echo Starting mgserver.exe
-    pushd "%SERVER_BIN%"
-    start mgserver run
-    REM An elegant hack to pause this script allowing mgserver to start up
-    echo Waiting %MGSERVER_WAIT%s for mgserver.exe to start up
-    ping -n %MGSERVER_WAIT% 127.0.0.1 > NUL
-    popd
-)
-
-REM We're ready now. Dive in
-echo Starting unit tests
-pushd WebTier\php
-IF "%API_ONLY%" == "1" (
-    php.exe -n -d display_errors=Off -d extension_dir=%OEM_PHP% -d extension=php_mbstring.dll -d extension=php_curl.dll -d extension=php_MapGuideApi.dll -d extension=php_SQLitePhpApi.dll RunTests.php -apionly
-) ELSE (
-    php.exe -n -d display_errors=Off -d extension_dir=%OEM_PHP% -d extension=php_mbstring.dll -d extension=php_curl.dll -d extension=php_MapGuideApi.dll -d extension=php_SQLitePhpApi.dll RunTests.php
-)
-popd
-
-IF "%START_MGSERVER%" == "1" (
-    REM We're naturally assuming the only mgserver.exe that is running is the one this script started
-    echo Terminating mgserver.exe
-    taskkill /im mgserver.exe
-)
-
-:quit
-SET PATH=%OLD_PATH%
\ No newline at end of file

Added: branches/4.0/MgDev/UnitTest/run_server_tests.bat
===================================================================
--- branches/4.0/MgDev/UnitTest/run_server_tests.bat	                        (rev 0)
+++ branches/4.0/MgDev/UnitTest/run_server_tests.bat	2025-02-08 21:27:11 UTC (rev 10121)
@@ -0,0 +1,101 @@
+ at echo off
+REM 
+REM run_server_tests.bat
+REM 
+REM This batch file helps to execute the MapGuide Server test suite against a given
+REM installation of MapGuide. The mgserver executable must not be running beforehand
+REM
+SET SERVER_TEST_SCOPE=
+SET SERVER_PATH=
+
+:study_params
+if (%1)==()            goto pre_flight_check
+
+if "%1"=="-help"       goto help_show
+if "%1"=="-h"          goto help_show
+if "%1"=="-sts"        goto get_servertestscope
+
+if "%1"=="-s"          goto get_serverpath
+if "%1"=="-serverpath" goto get_serverpath
+
+goto custom_error
+
+:next_param
+shift
+shift
+goto study_params
+
+:get_servertestscope
+SET SERVER_TEST_SCOPE=%2
+goto next_param
+
+:get_serverpath
+SET SERVER_PATH=%2
+SET SERVER_PATH=%SERVER_PATH:"=%
+goto next_param
+
+:pre_flight_check
+echo ******** Test Run Summary **********************
+echo Test Suite to run:  %TEST_SUITE%
+echo Server Path:        %SERVER_PATH%
+echo Server Test Scope:  %SERVER_TEST_SCOPE%
+echo ************************************************
+
+if not exist "%SERVER_PATH%\mgserver.exe" (
+    set ERRORMSG=Could not find the mgserver.exe based on the given server path
+    goto error_check
+)
+
+:prepare_server_files
+echo [prepare]: Test Data Files for Server Test Suite
+if not exist "%SERVER_PATH%\..\UnitTestFiles" mkdir "%SERVER_PATH%\..\UnitTestFiles"
+copy /Y "%TEST_DATA_SRC%\CoordinateSystems\*.*" "%SERVER_PATH%\..\UnitTestFiles" >NUL
+copy /Y "%TEST_DATA_SRC%\DrawingService\*.*" "%SERVER_PATH%\..\UnitTestFiles" >NUL
+copy /Y "%TEST_DATA_SRC%\FeatureService\SDF\*.*" "%SERVER_PATH%\..\UnitTestFiles" >NUL
+copy /Y "%TEST_DATA_SRC%\FeatureService\SHP\*.*" "%SERVER_PATH%\..\UnitTestFiles" >NUL
+copy /Y "%TEST_DATA_SRC%\FeatureService\SQLite\*.*" "%SERVER_PATH%\..\UnitTestFiles" >NUL
+copy /Y "%TEST_DATA_SRC%\KmlService\*.*" "%SERVER_PATH%\..\UnitTestFiles" >NUL
+copy /Y "%TEST_DATA_SRC%\MapLayer\*.*" "%SERVER_PATH%\..\UnitTestFiles" >NUL
+copy /Y "%TEST_DATA_SRC%\MappingService\*.*" "%SERVER_PATH%\..\UnitTestFiles" >NUL
+copy /Y "%TEST_DATA_SRC%\MdfModel\*.*" "%SERVER_PATH%\..\UnitTestFiles" >NUL
+copy /Y "%TEST_DATA_SRC%\PrintLayout\*.*" "%SERVER_PATH%\..\UnitTestFiles" >NUL
+copy /Y "%TEST_DATA_SRC%\ResourceService\*.*" "%SERVER_PATH%\..\UnitTestFiles" >NUL
+copy /Y "%TEST_DATA_SRC%\ResourceService\Shuttle.zip" "%SERVER_PATH%\..\UnitTestFiles\World.mgp" >NUL
+copy /Y "%TEST_DATA_SRC%\ServerAdmin\*.*" "%SERVER_PATH%\..\UnitTestFiles" >NUL
+copy /Y "%TEST_DATA_SRC%\SiteService\*.*" "%SERVER_PATH%\..\UnitTestFiles" >NUL
+copy /Y "%TEST_DATA_SRC%\Symbology\*.*" "%SERVER_PATH%\..\UnitTestFiles" >NUL
+copy /Y "%TEST_DATA_SRC%\TileService\*.*" "%SERVER_PATH%\..\UnitTestFiles" >NUL
+copy /Y "%TEST_DATA_SRC%\Unicode\*.*" "%SERVER_PATH%\..\UnitTestFiles" >NUL
+copy /Y "%TEST_DATA_SRC%\WebLayout\*.*" "%SERVER_PATH%\..\UnitTestFiles" >NUL
+copy /Y "%TEST_DATA_SRC%\Wfs\*.*" "%SERVER_PATH%\..\UnitTestFiles" >NUL
+copy /Y "%TEST_DATA_SRC%\Wms\*.*" "%SERVER_PATH%\..\UnitTestFiles" >NUL
+
+:test_server
+echo [test]: MapGuide Server
+pushd "%SERVER_PATH%"
+mgserver test %SERVER_TEST_SCOPE%
+popd
+goto quit
+
+:error_check
+echo [ERROR]: %ERRORMSG%
+SET ERRORMSG=
+SET PATH=%OLDPATH%
+popd
+exit /B 1
+
+:custom_error
+echo [ERROR]: %ERRORMSG%
+SET ERRORMSG=
+echo Please use the format:
+:help_show
+echo ************************************************************************
+echo run_tests.bat [-h]
+echo               [-s=ServerBinPath]
+echo               [-sts=ServerTestScope]
+echo ServerPath: -s[erverpath]=path to your server bin directory
+echo ServerTestScope: -sts=The server test suite to run
+echo ************************************************************************
+:quit
+SET TYPEACTION=
+popd
\ No newline at end of file

Added: branches/4.0/MgDev/UnitTest/run_web_tests.bat
===================================================================
--- branches/4.0/MgDev/UnitTest/run_web_tests.bat	                        (rev 0)
+++ branches/4.0/MgDev/UnitTest/run_web_tests.bat	2025-02-08 21:27:11 UTC (rev 10121)
@@ -0,0 +1,182 @@
+ at echo off
+REM 
+REM run_web_tests.bat
+REM 
+REM This batch file helps to execute the MapGuide web tier test suite against a given
+REM installation of MapGuide.
+REM
+REM The mgserver.exe must already be running. If running the mapagent test suite, the 
+REM http server hosting the mapagent must also be running.
+REM
+REM Example usage:
+REM 
+REM run_web_tests.bat -td=C:\mg-install\Test\UnitTest\TestData -w=C:\mg-install\Web\www\webconfig.ini -d=C:\mg-install\CS-Map\Dictionaries -php=C:\mg-install\Web\Php
+SET TEST_SUITE=all
+SET MAPAGENT_BASE=localhost:8018
+SET MG_TEST_WEBCONFIG_PATH=
+SET MG_TEST_DATA_PATH=%CD%\UnitTest\TestData
+SET MENTOR_DICTIONARY_PATH=
+SET PHP_DIR=
+
+:study_params
+if (%1)==()            goto pre_flight_check
+
+if "%1"=="-help"       goto help_show
+if "%1"=="-h"          goto help_show
+if "%1"=="-t"          goto get_test_suite
+if "%1"=="-td"          goto get_test_data
+if "%1"=="-m"          goto get_mapagent
+if "%1"=="-w"          goto get_webconfig
+if "%1"=="-d"          goto get_dictionary_path
+if "%1"=="-php"          goto get_php_dir
+
+goto custom_error
+
+:next_param
+shift
+shift
+goto study_params
+
+:get_mapagent
+SET MAPAGENT_BASE=%2
+goto next_param
+
+:get_webconfig
+SET MG_TEST_WEBCONFIG_PATH=%2
+goto next_param
+
+:get_dictionary_path
+SET MENTOR_DICTIONARY_PATH=%2
+goto next_param
+
+:get_php_dir
+SET PHP_DIR=%2
+goto next_param
+
+:get_test_data
+SET MG_TEST_DATA_PATH=%2
+goto next_param
+
+:get_test_suite
+SET TEST_SUITE=%2
+goto next_param
+
+:pre_flight_check
+echo ******** Test Run Summary **********************
+echo Test Suite to run:  %TEST_SUITE%
+echo MapAgent base:      %MAPAGENT_BASE%
+echo Test data path:     %MG_TEST_DATA_PATH%
+echo *** Required paths for non-mapagent tests ******
+echo webconfig.ini path: %MG_TEST_WEBCONFIG_PATH%
+echo CS dictionary path: %MENTOR_DICTIONARY_PATH%
+echo *** Required paths for PHP tests ***************
+echo PHP dir:            %PHP_DIR%
+echo ************************************************
+
+:check_api_prereqs
+if not exist "%MG_TEST_DATA_PATH%\ResourceService\ResourceServiceTest.dump" (
+    set ERRORMSG=Test data path not found or invalid
+    goto error_check
+)
+if "%TEST_SUITE%" == "mapagent" goto test_mapagent
+if not exist "%MENTOR_DICTIONARY_PATH%" (
+    set ERRORMSG=CS dictionary path not found
+    goto error_check
+)
+if not exist "%MG_TEST_WEBCONFIG_PATH%" (
+    set ERRORMSG=webconfig.ini not found
+    goto error_check
+)
+:check_test_suite
+if "%TEST_SUITE%" == "all" goto test_php
+if "%TEST_SUITE%" == "php" goto test_php
+if "%TEST_SUITE%" == "java" goto test_java
+if "%TEST_SUITE%" == "dotnet" goto test_dotnet
+set ERRORMSG=Unknown test suite: %TEST_SUITE%
+goto error_check
+
+:test_php
+echo [test]: PHP API
+if not exist "%PHP_DIR%\php.exe" (
+    set ERRORMSG=PHP interpeter not found
+    goto error_check
+)
+echo [prepare]: Delete intermediate test dbs if present
+if exist Unicode\UnicodeTest.db del /F Unicode\UnicodeTest.db >NUL
+if exist WmsTest\WmsTest.db del /F WmsTest\WmsTest.db >NUL
+if exist WebLayout\WebLayoutTest.db del /F WebLayout\WebLayoutTest.db >NUL
+if exist WfsTest\WfsTest.db del /F WfsTest\WfsTest.db >NUL
+if exist MapLayer\MapLayerTest.db del /F MapLayer\MapLayerTest.db >NUL
+if exist ServerAdmin\ServerAdminTest.db del /F ServerAdmin\ServerAdminTest.db >NUL
+if exist MappingService\MappingServiceTest.db del /F MappingService\MappingServiceTest.db >NUL
+if exist SiteService\SiteServiceTest.db del /F SiteService\SiteServiceTest.db >NUL
+if exist FeatureService\FeatureServiceTest.db del /F FeatureService\FeatureServiceTest.db >NUL
+if exist DrawingService\DrawingServiceTest.db del /F DrawingService\DrawingServiceTest.db >NUL
+if exist ResourceService\ResourceServiceTest.db del /F ResourceService\ResourceServiceTest.db >NUL
+pushd UnitTest\Php
+"%PHP_DIR%\php.exe" RunTests.php
+popd
+if "%TEST_SUITE%" == "all" goto test_java
+if "%TEST_SUITE%" == "php" goto quit
+:test_java
+echo [test]: Java API
+echo [prepare]: Delete intermediate test dbs if present
+if exist Unicode\UnicodeTest.db del /F Unicode\UnicodeTest.db >NUL
+if exist WmsTest\WmsTest.db del /F WmsTest\WmsTest.db >NUL
+if exist WebLayout\WebLayoutTest.db del /F WebLayout\WebLayoutTest.db >NUL
+if exist WfsTest\WfsTest.db del /F WfsTest\WfsTest.db >NUL
+if exist MapLayer\MapLayerTest.db del /F MapLayer\MapLayerTest.db >NUL
+if exist ServerAdmin\ServerAdminTest.db del /F ServerAdmin\ServerAdminTest.db >NUL
+if exist MappingService\MappingServiceTest.db del /F MappingService\MappingServiceTest.db >NUL
+if exist SiteService\SiteServiceTest.db del /F SiteService\SiteServiceTest.db >NUL
+if exist FeatureService\FeatureServiceTest.db del /F FeatureService\FeatureServiceTest.db >NUL
+if exist DrawingService\DrawingServiceTest.db del /F DrawingService\DrawingServiceTest.db >NUL
+if exist ResourceService\ResourceServiceTest.db del /F ResourceService\ResourceServiceTest.db >NUL
+pushd UnitTest\Java
+"%JAVA_HOME%\bin\java.exe" -jar MgUnitTest.jar
+popd
+if "%TEST_SUITE%" == "all" goto test_dotnet
+if "%TEST_SUITE%" == "java" goto quit
+:test_dotnet
+echo [test]: .net API
+echo [prepare]: Delete intermediate test dbs if present
+if exist Unicode\UnicodeTest.db del /F Unicode\UnicodeTest.db >NUL
+if exist WmsTest\WmsTest.db del /F WmsTest\WmsTest.db >NUL
+if exist WebLayout\WebLayoutTest.db del /F WebLayout\WebLayoutTest.db >NUL
+if exist WfsTest\WfsTest.db del /F WfsTest\WfsTest.db >NUL
+if exist MapLayer\MapLayerTest.db del /F MapLayer\MapLayerTest.db >NUL
+if exist ServerAdmin\ServerAdminTest.db del /F ServerAdmin\ServerAdminTest.db >NUL
+if exist MappingService\MappingServiceTest.db del /F MappingService\MappingServiceTest.db >NUL
+if exist SiteService\SiteServiceTest.db del /F SiteService\SiteServiceTest.db >NUL
+if exist FeatureService\FeatureServiceTest.db del /F FeatureService\FeatureServiceTest.db >NUL
+if exist DrawingService\DrawingServiceTest.db del /F DrawingService\DrawingServiceTest.db >NUL
+if exist ResourceService\ResourceServiceTest.db del /F ResourceService\ResourceServiceTest.db >NUL
+pushd UnitTest\DotNet
+TestRunner.exe
+popd
+if "%TEST_SUITE%" == "all" goto test_mapagent
+if "%TEST_SUITE%" == "dotnet" goto quit
+:test_mapagent
+echo [test]: mapagent
+goto quit
+
+:error_check
+echo [ERROR]: %ERRORMSG%
+SET ERRORMSG=
+SET PATH=%OLDPATH%
+popd
+exit /B 1
+
+:custom_error
+echo [ERROR]: %ERRORMSG%
+SET ERRORMSG=
+echo Please use the format:
+:help_show
+echo ************************************************************************
+echo run_web_tests.bat [-h]
+echo                   [-m=MapAgentBase]
+echo MapAgentBase: -m=Base domain/port of mapagent [default: localhost:8018]
+echo ************************************************************************
+:quit
+SET TYPEACTION=
+popd
\ No newline at end of file

Deleted: branches/4.0/MgDev/UnitTest/set_test_params.bat
===================================================================
--- branches/4.0/MgDev/UnitTest/set_test_params.bat	2025-02-07 16:13:25 UTC (rev 10120)
+++ branches/4.0/MgDev/UnitTest/set_test_params.bat	2025-02-08 21:27:11 UTC (rev 10121)
@@ -1,15 +0,0 @@
- at echo off
-REM Bitness of MapGuide we're testing with: 32|64
-SET PLATFORM=64
-REM Auto-start mgserver.exe, set to 0 if testing against a service-installed or already running mgserver.exe: 1|0
-SET START_MGSERVER=0
-REM Time to wait for mgserver.exe to startup in seconds
-SET MGSERVER_WAIT=15
-REM Test only Web Extensions API, set to 0 to also test against the mapagent (must be already setup on a web server): 1|0
-SET API_ONLY=0
-REM Vars to inject into $_SERVER in PHP CLI
-SET SERVER_ADDR=localhost
-REM SET SERVER_PORT=8008
-REM SET WEBCONFIGINI=%CD%\..\Web\src\webconfig.ini
-SET SERVER_PORT=8018
-SET WEBCONFIGINI=D:\mg-trunk-vc10\MgDev\Release64\Web\www\webconfig.ini

Copied: branches/4.0/MgDev/UnitTest/test_readme.txt (from rev 10120, branches/4.0/MgDev/test_readme.txt)
===================================================================
--- branches/4.0/MgDev/UnitTest/test_readme.txt	                        (rev 0)
+++ branches/4.0/MgDev/UnitTest/test_readme.txt	2025-02-08 21:27:11 UTC (rev 10121)
@@ -0,0 +1,86 @@
+MapGuide Test Suite Overview
+============================
+
+The MapGuide Test Suite contains the test data and applications that can be used to validate and verify a given installation of MapGuide
+
+The test data in this suite is required for the MapGuide Server tests to run properly
+
+Usage
+=====
+
+To run the test suite on Windows, run the command as follows:
+
+run_tests.bat [-p=Platform]
+              [-t=TestSuite]
+              [-m=MapAgent]
+              [-w=WebRoot]
+              [-s=ServerPath]
+              [-ws=WebServerName]
+              [-wp=WebServerPort]
+              [-iw]
+
+To run the test suite on Linux, run the command as follows:
+
+run_tests.sh [-p=Platform]
+             [-t=TestSuite]
+             [-m=MapAgent]
+             [-w=WebRoot]
+             [-s=ServerPath]
+
+Where the parameters are:
+
+Use Integrated PHP Web Server: -iw
+
+Platform: -p[latform]=x86 (default)
+                      x64
+
+TestSuite: -t[est]=server (default)
+                   php
+                   phpagent
+                   dotnet
+                   java
+                   all
+                   
+MapAgent:  -m[apagent]=<your mapagent url>
+
+WebRoot:   -w[ebroot]=<path to your web root www>
+
+ServerPath: -s[erverpath]=<path to your server bin directory>
+
+WebServerName: -ws=Host name of web server
+
+WebServerPort: -wp=Port number of web server
+
+Requirements
+============
+ - An installed/pre-configured copy of MapGuide Open Source, this could be installed by the Windows installer, or configured via the InstantSetup utility
+ - Java SDK (if running the Java test suite). It must be the same bitness as your MapGuide Server. If you have a 32-bit MapGuide installed, you must use a 32-bit JDK
+ - Apache Ant (if running the Java test suite)
+ - .net Framework 4.5 (if running the .net test suite)
+
+General Notes (Windows):
+========================
+
+If your MapGuide Server is running as a service, it has to be stopped when running any test suite, as they will start the mgserver executable before
+running their tests, and tear it down when finished.
+
+You must have the following environment variables set:
+ - JAVA_HOME points to an installation of the Java SDK of the same bitness as the installation of MapGuide you are testing against
+ - PATH contains the path to your installation of Apache Ant
+
+You must have a copy of the Sheboygan dataset in the UnitTest/TestData/Samples/Sheboygan directory. You can either download a copy and put it in this
+directory, or if you have 7-zip in the PATH environment variable, you can run the build.bat file in this direcotry to build Sheboygan.mgp from the existing
+data files.
+
+If running on an installation of MapGuide installed with the Windows installer, you will need elevated privileges to run this batch file in order
+to run the server test suite as part of preparation the batch file will have to copy all the required test data to a location under Program Files, an
+area that needs elevated privileges to write files to.
+
+Depending on your installation configuration you may not be able to run certain test suites. For example, if you did not enable Java for your MapGuide
+installation, don't expect the Java test suite to run or pass. As a general rule, the following test suites can be run under the given conditions:
+
+ * server: always (provided you have elevated privileges for a non-InstantSetup installation)
+ * php: always (provided you supply the correct WebRoot path)
+ * dotnet: You must supply the correct WebRoot path and mapviewernet\bin is assumed to exist under this path and contains the required .net assemblies and dlls
+ * java: You must supply the correct WebRoot path and WEB-INF\lib is assumed to exist under this path and contains the required JAR files
+ * all: All of the above conditions must be satisfied
\ No newline at end of file

Modified: branches/4.0/MgDev/build.bat
===================================================================
--- branches/4.0/MgDev/build.bat	2025-02-07 16:13:25 UTC (rev 10120)
+++ branches/4.0/MgDev/build.bat	2025-02-08 21:27:11 UTC (rev 10121)
@@ -463,9 +463,11 @@
 rem Deploy/copy test runners into same destination
 pushd Bindings\src\Test\DotNet\src\TestRunner
 dotnet publish -c Release -f net6.0 -r win-x64 --self-contained true -o "%MG_OUTPUT_TEST%\UnitTest\DotNet"
+if not "%errorlevel%"=="0" goto error
 popd
 pushd Bindings\src\Test\Java
 call %ANT% -Ddist="%MG_OUTPUT_TEST%\UnitTest\Java" -f build.xml
+if not "%errorlevel%"=="0" goto error
 popd
 rem HACK-ish but the default build targets include a prepared webconfig.ini and resource files. We don't need this
 pushd "%MG_OUTPUT_TEST%\UnitTest\Java"
@@ -472,6 +474,12 @@
 rd /S /Q Resources
 del /F webconfig.ini
 popd
+%XCOPY% Bindings\src\Test\Php "%MG_OUTPUT_TEST%\UnitTest\Php"
+pushd Bindings\src\Tools\MgTestAdmin
+dotnet publish -c Release -f net6.0-windows -r win-x64 --self-contained true -o "%MG_OUTPUT_TEST%\UnitTest\Admin"
+popd
+REM We copy to this level so that test data relative path references don't need changing
+%XCOPY% "%MG_UNIT_TEST%\WebTier\MapAgentIntegration" "%MG_OUTPUT_TEST%\UnitTest\MapAgent\Integration"
 rem copy /Y test_readme.txt "%MG_OUTPUT_TEST%"
 rem copy /Y run_tests.bat "%MG_OUTPUT_TEST%"
 rem copy /Y run_tests.sh "%MG_OUTPUT_TEST%"
@@ -479,6 +487,7 @@
 
 :error
 echo [ERROR]: There was an error building the component
+popd
 exit /B 1
 
 :custom_error_no_help
@@ -506,6 +515,7 @@
 echo                                web,
 echo                                doc,
 echo                                bindings,
-echo                                portable
+echo                                portable,
+echo                                test
 echo ************************************************************************
 :quit

Deleted: branches/4.0/MgDev/run_tests.bat
===================================================================
--- branches/4.0/MgDev/run_tests.bat	2025-02-07 16:13:25 UTC (rev 10120)
+++ branches/4.0/MgDev/run_tests.bat	2025-02-08 21:27:11 UTC (rev 10121)
@@ -1,409 +0,0 @@
- at echo off
-REM 
-REM run_tests.bat
-REM 
-REM This batch file helps to execute the MapGuide test suite against a given
-REM installation of MapGuide
-REM
-SET PLATFORM=x86
-SET PHP_WEB_SERVER=0
-SET SERVER_ADDR=localhost
-SET SERVER_PORT=8008
-SET TEST_SUITE=server
-SET WEB_ROOT=%CD%\Release\Web\www
-SET PHP_EXT_DIR=%CD%\Release\Web\Php\ext
-SET SERVER_PATH=%CD%\Server\bin
-SET CS_MAP_PATH=%WEB_ROOT%\..\..\CS-Map\Dictionaries
-SET MAPAGENT=http://localhost:8008/mapguide/mapagent/mapagent.fcgi
-SET CURRENT_DIR=%CD%
-SET OLDPATH=%PATH%
-SET SERVER_TEST_SCOPE=all
-SET TEST_DATA_SRC=%CD%\UnitTest\TestData
-SET MGSERVER_WAIT=15
-
-SET PATH=C:\Windows\Microsoft.NET\Framework\v4.0.30319;%PATH%
-
-:study_params
-if (%1)==()            goto pre_flight_check
-
-if "%1"=="-help"       goto help_show
-if "%1"=="-h"          goto help_show
-
-if "%1"=="-iw"         goto get_phpwebserver
-
-if "%1"=="-ws"         goto get_webservername
-
-if "%1"=="-wp"         goto get_webserverport
-
-if "%1"=="-sts"        goto get_servertestscope
-
-if "%1"=="-p"          goto get_platform
-if "%1"=="-platform"   goto get_platform
-
-if "%1"=="-t"          goto get_test
-if "%1"=="-test"       goto get_test
-
-if "%1"=="-m"          goto get_mapagent
-if "%1"=="-mapagent"   goto get_mapagent
-
-if "%1"=="-w"          goto get_webroot
-if "%1"=="-webroot"    goto get_webroot
-
-if "%1"=="-s"          goto get_serverpath
-if "%1"=="-serverpath" goto get_serverpath
-
-goto custom_error
-
-:next_param
-shift
-shift
-goto study_params
-
-:get_platform
-SET PLATFORM=%2
-if "%2" == "x86" goto next_param
-if "%2" == "x64" goto next_param
-SET ERRORMSG=Unrecognised value: %2
-goto custom_error
-
-:get_phpwebserver
-SET PHP_WEB_SERVER=%2
-if "%2" == "1" goto next_param
-if "%2" == "0" goto next_param
-SET ERRORMSG=Unrecognised value: %2
-goto custom_error
-
-:get_webservername
-SET SERVER_ADDR=%2
-SET SERVER_ADDR=%SERVER_ADDR:"=%
-goto next_param
-
-:get_webserverport
-SET SERVER_PORT=%2
-goto next_param
-
-:get_servertestscope
-SET SERVER_TEST_SCOPE=%2
-goto next_param
-
-:get_test
-SET TEST_SUITE=%2
-if "%2"=="server" goto next_param
-if "%2"=="php" goto next_param
-if "%2"=="dotnet" goto next_param
-if "%2"=="java" goto next_param
-if "%2"=="all" goto next_param
-SET ERRORMSG=Unrecognised action: %2
-goto custom_error
-
-:get_mapagent
-SET MAPAGENT=%2
-SET MAPAGENT=%MAPAGENT:"=%
-goto next_param
-
-:get_webroot
-SET WEB_ROOT=%2
-SET WEB_ROOT=%WEB_ROOT:"=%
-SET CS_MAP_PATH=%WEB_ROOT%\..\..\CS-Map\Dictionaries
-SET PHP_EXT_DIR=%WEB_ROOT%\..\Php\ext
-goto next_param
-
-:get_serverpath
-SET SERVER_PATH=%2
-SET SERVER_PATH=%SERVER_PATH:"=%
-goto next_param
-
-:pre_flight_check
-echo ******** Test Run Summary **********************
-echo Platform:           %PLATFORM%
-echo Use PHP Web Server: %PHP_WEB_SERVER%
-echo Test Suite to run:  %TEST_SUITE%
-echo Map Agent URL:      %MAPAGENT%
-echo Server Path:        %SERVER_PATH%
-echo Web Root Path:      %WEB_ROOT%
-echo CS-Map Path:        %CS_MAP_PATH%
-echo Web Server Name:    %SERVER_ADDR%
-echo Web Server Port:    %SERVER_PORT%
-echo Server Test Scope:  %SERVER_TEST_SCOPE%
-echo ********* Paths to check ***********************
-echo PHP executable      %WEB_ROOT%\..\Php\php.exe
-echo .net Assemblies     %WEB_ROOT%\mapviewernet\bin
-echo Java jars           %WEB_ROOT%\WEB-INF\lib
-echo ************************************************
-SET WEBCONFIGINI=%WEB_ROOT%\webconfig.ini
-SET PATH=%WEB_ROOT%\..\Php;%PATH%
-if "%PHP_WEB_SERVER%" == "1" (
-    echo [prepare]: Starting PHP web server. Waiting %MGSERVER_WAIT%s
-    start php -n -d display_errors=Off -d upload_max_filesize=20M -d extension_dir="%PHP_EXT_DIR%" -d extension=php_mbstring.dll -d extension=php_curl.dll -d extension=php_MapGuideApi.dll -S %SERVER_ADDR%:%SERVER_PORT% -t "%CURRENT_DIR%\UnitTest\WebTier\MapAgent\MapAgentForms" "%CURRENT_DIR%\UnitTest\WebTier\Php\MapAgentShim\index.php"
-    ping -n %MGSERVER_WAIT% 127.0.0.1 > NUL
-)
-:check_dotnet
-echo [check]: .net
-if not exist "%WEB_ROOT%\mapviewernet\bin\*.dll" goto no_dotnet
-goto check_java
-:no_dotnet
-if "%TEST_SUITE%" == "dotnet" (
-    SET ERRORMSG=Could not find .net MapGuide assemblies and unmanaged dlls in this MapGuide installation
-    goto error_check
-)
-if "%TEST_SUITE%" == "all" (
-    SET ERRORMSG=Could not find .net MapGuide assemblies and unmanaged dlls in this MapGuide installation
-    goto error_check
-)
-:check_java
-echo [check]: Java
-if not exist "%WEB_ROOT%\WEB-INF\lib\*.jar" goto no_java
-goto check_php
-:no_java
-if "%TEST_SUITE%" == "java" (
-    SET ERRORMSG=Could not find required jars and unmanaged dlls in this MapGuide installation
-    goto error_check
-)
-if "%TEST_SUITE%" == "all" (
-    SET ERRORMSG=Could not find required jars and unmanaged dlls in this MapGuide installation
-    goto error_check
-)
-:check_php
-echo [check]: PHP
-if not exist "%WEB_ROOT%\..\Php\php.exe" goto no_php
-goto check_server
-:no_php
-if "%TEST_SUITE%" == "php" (
-    SET ERRORMSG=Could not find required PHP executable in this MapGuide installation
-    goto error_check
-)
-if "%TEST_SUITE%" == "all" (
-    SET ERRORMSG=Could not find required PHP executable in this MapGuide installation
-    goto error_check
-)
-:check_server
-if "%TEST_SUITE%" == "server" goto prepare_server_files
-if "%TEST_SUITE%" == "all" goto prepare_server_files
-if "%TEST_SUITE%" == "php" goto test_php
-if "%TEST_SUITE%" == "dotnet" goto test_dotnet
-if "%TEST_SUITE%" == "java" goto test_java
-goto test_php
-:prepare_server_files
-echo [prepare]: Test Data Files for Server Test Suite
-if not exist "%SERVER_PATH%\..\UnitTestFiles" mkdir "%SERVER_PATH%\..\UnitTestFiles"
-copy /Y "%TEST_DATA_SRC%\CoordinateSystems\*.*" "%SERVER_PATH%\..\UnitTestFiles"
-copy /Y "%TEST_DATA_SRC%\DrawingService\*.*" "%SERVER_PATH%\..\UnitTestFiles"
-copy /Y "%TEST_DATA_SRC%\FeatureService\SDF\*.*" "%SERVER_PATH%\..\UnitTestFiles"
-copy /Y "%TEST_DATA_SRC%\FeatureService\SHP\*.*" "%SERVER_PATH%\..\UnitTestFiles"
-copy /Y "%TEST_DATA_SRC%\FeatureService\SQLite\*.*" "%SERVER_PATH%\..\UnitTestFiles"
-copy /Y "%TEST_DATA_SRC%\KmlService\*.*" "%SERVER_PATH%\..\UnitTestFiles"
-copy /Y "%TEST_DATA_SRC%\MapLayer\*.*" "%SERVER_PATH%\..\UnitTestFiles"
-copy /Y "%TEST_DATA_SRC%\MappingService\*.*" "%SERVER_PATH%\..\UnitTestFiles"
-copy /Y "%TEST_DATA_SRC%\MdfModel\*.*" "%SERVER_PATH%\..\UnitTestFiles"
-copy /Y "%TEST_DATA_SRC%\PrintLayout\*.*" "%SERVER_PATH%\..\UnitTestFiles"
-copy /Y "%TEST_DATA_SRC%\ResourceService\*.*" "%SERVER_PATH%\..\UnitTestFiles"
-copy /Y "%TEST_DATA_SRC%\ResourceService\Shuttle.zip" "%SERVER_PATH%\..\UnitTestFiles\World.mgp"
-copy /Y "%TEST_DATA_SRC%\ServerAdmin\*.*" "%SERVER_PATH%\..\UnitTestFiles"
-copy /Y "%TEST_DATA_SRC%\SiteService\*.*" "%SERVER_PATH%\..\UnitTestFiles"
-copy /Y "%TEST_DATA_SRC%\Symbology\*.*" "%SERVER_PATH%\..\UnitTestFiles"
-copy /Y "%TEST_DATA_SRC%\TileService\*.*" "%SERVER_PATH%\..\UnitTestFiles"
-copy /Y "%TEST_DATA_SRC%\Unicode\*.*" "%SERVER_PATH%\..\UnitTestFiles"
-copy /Y "%TEST_DATA_SRC%\WebLayout\*.*" "%SERVER_PATH%\..\UnitTestFiles"
-copy /Y "%TEST_DATA_SRC%\Wfs\*.*" "%SERVER_PATH%\..\UnitTestFiles"
-copy /Y "%TEST_DATA_SRC%\Wms\*.*" "%SERVER_PATH%\..\UnitTestFiles"
-:test_server
-echo [test]: MapGuide Server
-pushd "%SERVER_PATH%"
-mgserver test %SERVER_TEST_SCOPE% UnitTestResults.xml
-move /Y UnitTestResults.xml "%CURRENT_DIR%"
-popd
-if "%TEST_SUITE%" == "server" goto quit
-if "%TEST_SUITE%" == "all" goto test_php
-:test_php
-echo [test]: PHP Binding
-pushd "%CURRENT_DIR%\UnitTest\TestData"
-if exist Unicode\UnicodeTest.db del /F Unicode\UnicodeTest.db
-if exist WmsTest\WmsTest.db del /F WmsTest\WmsTest.db
-if exist WebLayout\WebLayoutTest.db del /F WebLayout\WebLayoutTest.db
-if exist WfsTest\WfsTest.db del /F WfsTest\WfsTest.db
-if exist MapLayer\MapLayerTest.db del /F MapLayer\MapLayerTest.db
-if exist ServerAdmin\ServerAdminTest.db del /F ServerAdmin\ServerAdminTest.db
-if exist MappingService\MappingServiceTest.db del /F MappingService\MappingServiceTest.db
-if exist SiteService\SiteServiceTest.db del /F SiteService\SiteServiceTest.db
-if exist FeatureService\FeatureServiceTest.db del /F FeatureService\FeatureServiceTest.db
-if exist DrawingService\DrawingServiceTest.db del /F DrawingService\DrawingServiceTest.db
-if exist ResourceService\ResourceServiceTest.db del /F ResourceService\ResourceServiceTest.db
-popd
-if exist "%SERVER_PATH%" (
-    REM start mgserver for test
-    pushd "%SERVER_PATH%"
-    start mgserver run
-    REM An elegant hack to pause this script allowing mgserver to start up
-    echo Waiting %MGSERVER_WAIT%s for mgserver.exe to start up
-    ping -n %MGSERVER_WAIT% 127.0.0.1 > NUL
-    popd
-)
-REM Ensure constants.php exists
-if not exist "%CURRENT_DIR%\Web\src\PhpApi" mkdir "%CURRENT_DIR%\Web\src\PhpApi"
-copy /Y "%WEB_ROOT%\mapadmin\constants.php" "%CURRENT_DIR%\Web\src\PhpApi"
-REM Ensure we have the Sheboygan.mgp loaded first
-pushd "%CURRENT_DIR%\UnitTest"
-if exist "%WEB_ROOT%\webconfig.ini" SET MG_WEBCONFIG_INI=%WEB_ROOT%\webconfig.ini
-php -n -d display_errors=Off -d extension_dir="%PHP_EXT_DIR%" -d extension=php_mbstring.dll -d extension=php_curl.dll -d extension=php_MapGuideApi.dll prepare.php
-popd
-REM Now run the test suite
-pushd "%CURRENT_DIR%\UnitTest\WebTier\Php"
-php.exe -n -d display_errors=On -d extension_dir="%PHP_EXT_DIR%" -d extension=php_mbstring.dll -d extension=php_curl.dll -d extension=php_MapGuideApi.dll -d extension=php_pdo_sqlite.dll RunTests.php -config "%WEB_ROOT%\webconfig.ini"
-move /Y UnitTests.log "%CURRENT_DIR%\UnitTests_Php.log"
-popd
-if exist "%SERVER_PATH%" (
-    echo [test]: Terminating mgserver.exe
-    REM We're naturally assuming the only mgserver.exe that is running is the one this script started
-    taskkill /f /im mgserver.exe
-)
-if "%TEST_SUITE%" == "php" goto quit
-:test_dotnet
-echo [test]: .net Binding
-echo [build]: DotNet test runner
-SET TEST_COMPONENT=Build DotNet test runner
-if exist "%CURRENT_DIR%\UnitTest\WebTier\DotNet_x64" rd /S /Q "%CURRENT_DIR%\UnitTest\WebTier\DotNet_x64"
-if exist "%CURRENT_DIR%\UnitTest\WebTier\DotNet_x86" rd /S /Q "%CURRENT_DIR%\UnitTest\WebTier\DotNet_x86"
-pushd "%CURRENT_DIR%\UnitTest\WebTier\DotNet"
-if exist Libs rd /S /Q Libs
-if not exist "%CURRENT_DIR%\Web\bin\release" mkdir "%CURRENT_DIR%\Web\bin\release"
-if not exist "%CURRENT_DIR%\Web\bin\release64" mkdir "%CURRENT_DIR%\Web\bin\release64"
-if "%PLATFORM%" == "x86" copy /y "%WEB_ROOT%\mapviewernet\bin\*.dll" "%CURRENT_DIR%\Web\bin\release"
-if "%PLATFORM%" == "x64" copy /y "%WEB_ROOT%\mapviewernet\bin\*.dll" "%CURRENT_DIR%\Web\bin\release64"
-if not exist "%CURRENT_DIR%\Common\MapGuideCommon\Resources" mkdir "%CURRENT_DIR%\Common\MapGuideCommon\Resources"
-copy /y "%WEB_ROOT%\mapagent\Resources\mapguide_en.res" "%CURRENT_DIR%\Common\MapGuideCommon\Resources"
-msbuild /p:Configuration=Release;Platform=%PLATFORM% /fl /flp:logfile=build.log DotNet.sln
-if "%ERRORLEVEL%" == "1" (
-    set RETURN_CODE=%ERRORLEVEL%
-    goto error_msbuild
-)
-popd
-pushd "%CURRENT_DIR%\UnitTest\TestData"
-if exist Unicode\UnicodeTest.db del /F Unicode\UnicodeTest.db
-if exist WmsTest\WmsTest.db del /F WmsTest\WmsTest.db
-if exist WebLayout\WebLayoutTest.db del /F WebLayout\WebLayoutTest.db
-if exist WfsTest\WfsTest.db del /F WfsTest\WfsTest.db
-if exist MapLayer\MapLayerTest.db del /F MapLayer\MapLayerTest.db
-if exist ServerAdmin\ServerAdminTest.db del /F ServerAdmin\ServerAdminTest.db
-if exist MappingService\MappingServiceTest.db del /F MappingService\MappingServiceTest.db
-if exist SiteService\SiteServiceTest.db del /F SiteService\SiteServiceTest.db
-if exist FeatureService\FeatureServiceTest.db del /F FeatureService\FeatureServiceTest.db
-if exist DrawingService\DrawingServiceTest.db del /F DrawingService\DrawingServiceTest.db
-if exist ResourceService\ResourceServiceTest.db del /F ResourceService\ResourceServiceTest.db
-popd
-if exist "%SERVER_PATH%" (
-    REM start mgserver for test
-    pushd "%SERVER_PATH%"
-    start mgserver run
-    REM An elegant hack to pause this script allowing mgserver to start up
-    echo Waiting %MGSERVER_WAIT%s for mgserver.exe to start up
-    ping -n %MGSERVER_WAIT% 127.0.0.1 > NUL
-    popd
-)
-pushd "%CURRENT_DIR%\UnitTest\WebTier\DotNet_%PLATFORM%"
-MgTestRunner.exe "%WEB_ROOT%\webconfig.ini" "%CS_MAP_PATH%"
-if %ERRORLEVEL% neq 0 echo [test]: .net test runner had one or more test failures. Check log files for more information
-move /Y UnitTests.log "%CURRENT_DIR%\UnitTests_DotNet.log"
-popd
-if exist "%SERVER_PATH%" (
-    echo [test]: Terminating mgserver.exe
-    REM We're naturally assuming the only mgserver.exe that is running is the one this script started
-    taskkill /f /im mgserver.exe
-)
-if "%TEST_SUITE%" == "dotnet" goto quit
-:test_java
-echo [test]: Java Binding
-pushd "%CURRENT_DIR%\UnitTest\TestData"
-if exist Unicode\UnicodeTest.db del /F Unicode\UnicodeTest.db
-if exist WmsTest\WmsTest.db del /F WmsTest\WmsTest.db
-if exist WebLayout\WebLayoutTest.db del /F WebLayout\WebLayoutTest.db
-if exist WfsTest\WfsTest.db del /F WfsTest\WfsTest.db
-if exist MapLayer\MapLayerTest.db del /F MapLayer\MapLayerTest.db
-if exist ServerAdmin\ServerAdminTest.db del /F ServerAdmin\ServerAdminTest.db
-if exist MappingService\MappingServiceTest.db del /F MappingService\MappingServiceTest.db
-if exist SiteService\SiteServiceTest.db del /F SiteService\SiteServiceTest.db
-if exist FeatureService\FeatureServiceTest.db del /F FeatureService\FeatureServiceTest.db
-if exist DrawingService\DrawingServiceTest.db del /F DrawingService\DrawingServiceTest.db
-if exist ResourceService\ResourceServiceTest.db del /F ResourceService\ResourceServiceTest.db
-popd
-if exist "%SERVER_PATH%" (
-    REM start mgserver for test
-    pushd "%SERVER_PATH%"
-    start mgserver run
-    REM An elegant hack to pause this script allowing mgserver to start up
-    echo Waiting %MGSERVER_WAIT%s for mgserver.exe to start up
-    ping -n %MGSERVER_WAIT% 127.0.0.1 > NUL
-    popd
-)
-if not exist "%CURRENT_DIR%\Web\src" mkdir "%CURRENT_DIR%\Web\src"
-xcopy /E /Y /I /Q /H "%WEB_ROOT%\WEB-INF" "%CURRENT_DIR%\Web\src\WEB-INF"
-pushd "%CURRENT_DIR%\UnitTest\WebTier\Java"
-call ant checkwin_external -Dmapguide.dictpath="%CS_MAP_PATH%" -Dbinsrc.web="%WEB_ROOT%\..\Tomcat\bin" -Dmapguide.config.src="%WEB_ROOT%\webconfig.ini"
-if %ERRORLEVEL% neq 0 echo [test]: Java test runner had one or more test failures. Check log files for more information
-popd
-pushd "%CURRENT_DIR%\UnitTest\WebTier\java_dist"
-move /Y unittest.log "%CURRENT_DIR%\UnitTests_Java.log"
-popd
-if exist "%SERVER_PATH%" (
-    echo [test]: Terminating mgserver.exe
-    REM We're naturally assuming the only mgserver.exe that is running is the one this script started
-    taskkill /f /im mgserver.exe
-)
-if "%TEST_SUITE%" == "all" goto quit
-if "%TEST_SUITE%" == "java" goto quit
-
-:error_msbuild
-echo [error]: An error occured with %TEST_COMPONENT% (exit code: %RETURN_CODE%)
-goto quit
-
-:error_check
-echo [ERROR]: %ERRORMSG%
-SET ERRORMSG=
-SET PATH=%OLDPATH%
-popd
-if "%PHP_WEB_SERVER%" == "1" (
-    echo [cleanup]: Terminating PHP web server
-    REM We're naturally assuming the only php.exe that is running is the one this script started
-    taskkill /f /im php.exe
-)
-exit /B 1
-
-:custom_error
-echo [ERROR]: %ERRORMSG%
-SET ERRORMSG=
-echo Please use the format:
-:help_show
-echo ************************************************************************
-echo run_tests.bat [-h]
-echo               [-p=Platform]
-echo               [-t=TestSuite]
-echo               [-m=MapAgent]
-echo               [-w=WebRoot]
-echo               [-s=ServerPath]
-echo               [-sts=ServerTestScope]
-echo               [-ws=WebServerName]
-echo               [-wp=WebServerPort]
-echo               [-iw=UsePHPWebServer]
-echo
-echo UsePHPWebServer: -iw=1 (default),0
-echo Platform: -p[latform]=x86 (default)
-echo                       x64
-echo TestSuite: -t[est]=server (default)
-echo                    php
-echo                    dotnet
-echo                    java
-echo                    all
-echo MapAgent:  -m[apagent]=your mapagent url
-echo WebRoot:   -w[ebroot]=path to your web root www
-echo ServerPath: -s[erverpath]=path to your server bin directory
-echo WebServerName: -ws=your web server name
-echo WebServerPort: -wp=your web server port
-echo ************************************************************************
-:quit
-SET PATH=%OLDPATH%
-SET TYPEACTION=
-if "%PHP_WEB_SERVER%" == "1" (
-    echo [cleanup]: Terminating PHP web server
-    REM We're naturally assuming the only php.exe that is running is the one this script started
-    taskkill /f /im php.exe
-)
-popd
\ No newline at end of file

Deleted: branches/4.0/MgDev/test_readme.txt
===================================================================
--- branches/4.0/MgDev/test_readme.txt	2025-02-07 16:13:25 UTC (rev 10120)
+++ branches/4.0/MgDev/test_readme.txt	2025-02-08 21:27:11 UTC (rev 10121)
@@ -1,86 +0,0 @@
-MapGuide Test Suite Overview
-============================
-
-The MapGuide Test Suite contains the test data and applications that can be used to validate and verify a given installation of MapGuide
-
-The test data in this suite is required for the MapGuide Server tests to run properly
-
-Usage
-=====
-
-To run the test suite on Windows, run the command as follows:
-
-run_tests.bat [-p=Platform]
-              [-t=TestSuite]
-              [-m=MapAgent]
-              [-w=WebRoot]
-              [-s=ServerPath]
-              [-ws=WebServerName]
-              [-wp=WebServerPort]
-              [-iw]
-
-To run the test suite on Linux, run the command as follows:
-
-run_tests.sh [-p=Platform]
-             [-t=TestSuite]
-             [-m=MapAgent]
-             [-w=WebRoot]
-             [-s=ServerPath]
-
-Where the parameters are:
-
-Use Integrated PHP Web Server: -iw
-
-Platform: -p[latform]=x86 (default)
-                      x64
-
-TestSuite: -t[est]=server (default)
-                   php
-                   phpagent
-                   dotnet
-                   java
-                   all
-                   
-MapAgent:  -m[apagent]=<your mapagent url>
-
-WebRoot:   -w[ebroot]=<path to your web root www>
-
-ServerPath: -s[erverpath]=<path to your server bin directory>
-
-WebServerName: -ws=Host name of web server
-
-WebServerPort: -wp=Port number of web server
-
-Requirements
-============
- - An installed/pre-configured copy of MapGuide Open Source, this could be installed by the Windows installer, or configured via the InstantSetup utility
- - Java SDK (if running the Java test suite). It must be the same bitness as your MapGuide Server. If you have a 32-bit MapGuide installed, you must use a 32-bit JDK
- - Apache Ant (if running the Java test suite)
- - .net Framework 4.5 (if running the .net test suite)
-
-General Notes (Windows):
-========================
-
-If your MapGuide Server is running as a service, it has to be stopped when running any test suite, as they will start the mgserver executable before
-running their tests, and tear it down when finished.
-
-You must have the following environment variables set:
- - JAVA_HOME points to an installation of the Java SDK of the same bitness as the installation of MapGuide you are testing against
- - PATH contains the path to your installation of Apache Ant
-
-You must have a copy of the Sheboygan dataset in the UnitTest/TestData/Samples/Sheboygan directory. You can either download a copy and put it in this
-directory, or if you have 7-zip in the PATH environment variable, you can run the build.bat file in this direcotry to build Sheboygan.mgp from the existing
-data files.
-
-If running on an installation of MapGuide installed with the Windows installer, you will need elevated privileges to run this batch file in order
-to run the server test suite as part of preparation the batch file will have to copy all the required test data to a location under Program Files, an
-area that needs elevated privileges to write files to.
-
-Depending on your installation configuration you may not be able to run certain test suites. For example, if you did not enable Java for your MapGuide
-installation, don't expect the Java test suite to run or pass. As a general rule, the following test suites can be run under the given conditions:
-
- * server: always (provided you have elevated privileges for a non-InstantSetup installation)
- * php: always (provided you supply the correct WebRoot path)
- * dotnet: You must supply the correct WebRoot path and mapviewernet\bin is assumed to exist under this path and contains the required .net assemblies and dlls
- * java: You must supply the correct WebRoot path and WEB-INF\lib is assumed to exist under this path and contains the required JAR files
- * all: All of the above conditions must be satisfied
\ No newline at end of file



More information about the mapguide-commits mailing list