[mapguide-commits] r8518 - trunk/MgDev/Server/src/UnitTesting

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Jan 27 05:09:03 PST 2015


Author: jng
Date: 2015-01-27 05:09:03 -0800 (Tue, 27 Jan 2015)
New Revision: 8518

Modified:
   trunk/MgDev/Server/src/UnitTesting/TestCoordinateSystem.cpp
Log:
#2531: Fix unit test failures on Coordinate System test suite. The issue is that the MgFileUtil::CreateDirectory() is non-recursive, meaning if any parent part of the path doesn't exist, the whole call fails and derails the test case as a result. The fix is to create this directory recursively.

Modified: trunk/MgDev/Server/src/UnitTesting/TestCoordinateSystem.cpp
===================================================================
--- trunk/MgDev/Server/src/UnitTesting/TestCoordinateSystem.cpp	2015-01-26 11:54:48 UTC (rev 8517)
+++ trunk/MgDev/Server/src/UnitTesting/TestCoordinateSystem.cpp	2015-01-27 13:09:03 UTC (rev 8518)
@@ -470,6 +470,8 @@
 
 bool TestCoordinateSystem::SetDefaultUserDictionaryDir()
 {
+    MG_TRY()
+
     MgCoordinateSystemFactory mgCsFactory;
     Ptr<MgCoordinateSystemCatalog> pCsCatalog = mgCsFactory.GetCatalog();
 
@@ -485,9 +487,18 @@
 
      //create the directory to make sure, [SetUserDictionaryDir]
     //can succeed
-    MgFileUtil::CreateDirectory(defUserDictionaryDir);
+    if (!MgFileUtil::PathnameExists(defUserDictionaryDir))
+        MgFileUtil::CreateDirectory(defUserDictionaryDir, false, true);
     pCsCatalog->SetUserDictionaryDir(defUserDictionaryDir);
 
+    MG_CATCH(L"TestCoordinateSystem.SetDefaultUserDictionaryDir")
+
+    if (NULL != mgException.p)
+    {
+        STRING errDetails = mgException->GetDetails();
+        ACE_DEBUG((LM_INFO, ACE_TEXT("Exception setting user dictionary dir: %W"), errDetails.c_str()));
+        return false;
+    }
     return true;
 }
 



More information about the mapguide-commits mailing list