[mapguide-commits] r7227 - in sandbox/adsk/2.5k: Common/CoordinateSystem Common/Geometry/CoordinateSystem Common/MapGuideCommon/System Server/src/Core Server/src/UnitTesting

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Nov 26 06:27:28 PST 2012


Author: baertelchen
Date: 2012-11-26 06:27:27 -0800 (Mon, 26 Nov 2012)
New Revision: 7227

Modified:
   sandbox/adsk/2.5k/Common/CoordinateSystem/CoordSysCatalog.cpp
   sandbox/adsk/2.5k/Common/CoordinateSystem/CoordSysCatalog.h
   sandbox/adsk/2.5k/Common/Geometry/CoordinateSystem/CoordinateSystemCatalog.h
   sandbox/adsk/2.5k/Common/MapGuideCommon/System/ConfigProperties.cpp
   sandbox/adsk/2.5k/Common/MapGuideCommon/System/ConfigProperties.h
   sandbox/adsk/2.5k/Server/src/Core/Server.cpp
   sandbox/adsk/2.5k/Server/src/Core/serverconfig.ini
   sandbox/adsk/2.5k/Server/src/UnitTesting/TestCoordinateSystem.cpp
   sandbox/adsk/2.5k/Server/src/UnitTesting/TestCoordinateSystem.h
Log:
Remove new virtual methods added due to RFC127

Removed the following virtual methods from the CoordinateSystemCatalog.h file:

virtual STRING GetDefaultUserDictionaryDir()=0;
virtual void SetUserDictionaryDir(CREFSTRING sDirPath)=0;
virtual STRING GetUserDictionaryDir()=0;

Made them non-virtual private methods instead.

As the [SetUserDictionaryDir] is now no longer available - in particular for the server - the MgCoordinateSystemCatalog now automatically creates the
directory 'User Geospatial Coordinate Systems' if it does not exist yet.

Also adjusted all callers, incl. unit tests, to these methods.

Modified: sandbox/adsk/2.5k/Common/CoordinateSystem/CoordSysCatalog.cpp
===================================================================
--- sandbox/adsk/2.5k/Common/CoordinateSystem/CoordSysCatalog.cpp	2012-11-26 10:51:17 UTC (rev 7226)
+++ sandbox/adsk/2.5k/Common/CoordinateSystem/CoordSysCatalog.cpp	2012-11-26 14:27:27 UTC (rev 7227)
@@ -610,6 +610,8 @@
             sDefUserDictionaryDir = this->GetDefaultUserDictionaryDir();
             if (!sDefUserDictionaryDir.empty())
             {
+                //if [GetDefaultUserDictionaryDir] did return a folder name, make sure it exists
+                MgFileUtil::CreateDirectory(sDefUserDictionaryDir, false, true);
                 this->SetUserDictionaryDir(sDefUserDictionaryDir);
             }
 

Modified: sandbox/adsk/2.5k/Common/CoordinateSystem/CoordSysCatalog.h
===================================================================
--- sandbox/adsk/2.5k/Common/CoordinateSystem/CoordSysCatalog.h	2012-11-26 10:51:17 UTC (rev 7226)
+++ sandbox/adsk/2.5k/Common/CoordinateSystem/CoordSysCatalog.h	2012-11-26 14:27:27 UTC (rev 7227)
@@ -41,10 +41,6 @@
     virtual bool AreDictionaryFilesWritable();
     virtual STRING GetDictionaryDir();
 
-    virtual STRING GetDefaultUserDictionaryDir();
-    virtual void SetUserDictionaryDir(CREFSTRING sDirPath);
-    virtual STRING GetUserDictionaryDir();
-
     virtual void SetProtectionMode(INT16 nMode);
     virtual INT16 GetProtectionMode();
     virtual MgCoordinateSystemCategoryDictionary* GetCategoryDictionary();
@@ -97,6 +93,10 @@
     CCoordinateSystemCatalog& operator=(const CCoordinateSystemCatalog&);
 
     STRING SetDictionaryDir(CREFSTRING sDirPath, bool dirWriteAccess, int (*CsMapDirFunc)(const char *pszDirectoryPath));
+
+    STRING GetDefaultUserDictionaryDir();
+    void SetUserDictionaryDir(CREFSTRING sDirPath);
+    STRING GetUserDictionaryDir();
 };
 
 } // End of namespace

Modified: sandbox/adsk/2.5k/Common/Geometry/CoordinateSystem/CoordinateSystemCatalog.h
===================================================================
--- sandbox/adsk/2.5k/Common/Geometry/CoordinateSystem/CoordinateSystemCatalog.h	2012-11-26 10:51:17 UTC (rev 7226)
+++ sandbox/adsk/2.5k/Common/Geometry/CoordinateSystem/CoordinateSystemCatalog.h	2012-11-26 14:27:27 UTC (rev 7227)
@@ -48,39 +48,6 @@
     virtual void SetDictionaryDir(CREFSTRING sDirPath)=0;
     virtual STRING GetDictionaryDir()=0;
 
-    ///////////////////////////////////////////////////////////////////////////
-    /// \brief
-    /// Returns the default directory path where user defined coordinate system
-    /// definitions can be found or can be written into, respectively.
-    /// If set, this method returns the value of the MENTOR_USER_DICTIONARY_PATH
-    /// environment variable. Returns 'CSIDL_LOCAL_APPDATA\Autodesk\User Geospatial Coordinate Systems'
-    /// on Windows systems or an empty string on non-Windows systems, otherwise.
-    ///
-    /// \remarks
-    /// The directory returned by this function is not guaranteed to exist. If it does, however,
-    /// and is writable, too, the value returned by this function will be used to initialize this catalog of definitions
-    /// on the first initialization.
-    ///
-    virtual STRING GetDefaultUserDictionaryDir()=0;
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// \brief
-    /// Sets the actual directory where user defined coordinate system
-    /// definitions can be found or can be written into. The directory set through this method must exist
-    /// and writeable. If set to an empty string, the catalog's 'user defined coordinate system' directory
-    /// will be unset and any updates will again happen only inside the directory
-    /// as returned by GetDictionaryDir().
-    ///
-    virtual void SetUserDictionaryDir(CREFSTRING sDirPath)=0;
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// \brief
-    /// Returns the current directory where user defined coordinate system
-    /// definitions is obtained from or is written into. Returns an empty string
-    /// if no such directory is currently configured for this catalog.
-    ///
-    virtual STRING GetUserDictionaryDir()=0;
-
     virtual void SetProtectionMode(INT16 nMode)=0;
     virtual INT16 GetProtectionMode()=0;
 

Modified: sandbox/adsk/2.5k/Common/MapGuideCommon/System/ConfigProperties.cpp
===================================================================
--- sandbox/adsk/2.5k/Common/MapGuideCommon/System/ConfigProperties.cpp	2012-11-26 10:51:17 UTC (rev 7226)
+++ sandbox/adsk/2.5k/Common/MapGuideCommon/System/ConfigProperties.cpp	2012-11-26 14:27:27 UTC (rev 7227)
@@ -134,8 +134,6 @@
 const STRING MgConfigProperties::DefaultGeneralPropertyFdoPath                              = L"";
 const STRING MgConfigProperties::GeneralPropertyMentorDictionaryPath                        = L"MentorDictionaryPath";
 const STRING MgConfigProperties::DefaultGeneralPropertyMentorDictionaryPath                 = L"";
-const STRING MgConfigProperties::GeneralPropertyMentorUserDictionaryPath                    = L"MentorUserDictionaryPath";
-const STRING MgConfigProperties::DefaultGeneralPropertyMentorUserDictionaryPath             = L"";
 const STRING MgConfigProperties::GeneralPropertyLicenseServerPath                           = L"LicenseServerPath";
 const STRING MgConfigProperties::DefaultGeneralPropertyLicenseServerPath                    = L"";
 const STRING MgConfigProperties::GeneralPropertyLinuxMemDebug                               = L"LinuxMemDebug";
@@ -567,7 +565,6 @@
     { MgConfigProperties::GeneralPropertyDisplayName                                , MgPropertyType::String    , MG_CONFIG_MIN_OPTIONAL_STRING_LENGTH  , MG_CONFIG_MAX_OPTIONAL_STRING_LENGTH  , MG_CONFIG_FILE_NAME_RESERVED_CHARACTERS   },
     { MgConfigProperties::GeneralPropertyFdoPath                                    , MgPropertyType::String    , MG_CONFIG_MIN_PATH_LENGTH             , MG_CONFIG_MAX_PATH_LENGTH             , MG_CONFIG_PATH_RESERVED_CHARACTERS        },
     { MgConfigProperties::GeneralPropertyMentorDictionaryPath                       , MgPropertyType::String    , MG_CONFIG_MIN_PATH_LENGTH             , MG_CONFIG_MAX_PATH_LENGTH             , MG_CONFIG_PATH_RESERVED_CHARACTERS        },
-    { MgConfigProperties::GeneralPropertyMentorUserDictionaryPath                   , MgPropertyType::String    , MG_CONFIG_MIN_PATH_LENGTH             , MG_CONFIG_MAX_PATH_LENGTH             , MG_CONFIG_PATH_RESERVED_CHARACTERS        },
     { MgConfigProperties::GeneralPropertyLicenseServerPath                          , MgPropertyType::String    , MG_CONFIG_MIN_OPTIONAL_STRING_LENGTH  , MG_CONFIG_MAX_OPTIONAL_STRING_LENGTH  , L""                                       },
     { MgConfigProperties::GeneralPropertyLinuxMemDebug                              , MgPropertyType::Boolean   , 0                                     , 1                                     , L""                                       },
     { MgConfigProperties::GeneralPropertyLogsDelimiter                              , MgPropertyType::String    , 1                                     , 128                                   , L""                                       },

Modified: sandbox/adsk/2.5k/Common/MapGuideCommon/System/ConfigProperties.h
===================================================================
--- sandbox/adsk/2.5k/Common/MapGuideCommon/System/ConfigProperties.h	2012-11-26 10:51:17 UTC (rev 7226)
+++ sandbox/adsk/2.5k/Common/MapGuideCommon/System/ConfigProperties.h	2012-11-26 14:27:27 UTC (rev 7227)
@@ -74,10 +74,6 @@
     static const STRING GeneralPropertyMentorDictionaryPath;            /// value("MentorDictionaryPath")
     static const STRING DefaultGeneralPropertyMentorDictionaryPath;     /// value("")
 
-    /// Mentor User Dictionary Path
-    static const STRING GeneralPropertyMentorUserDictionaryPath;        /// value("MentorUserDictionaryPath")
-    static const STRING DefaultGeneralPropertyMentorUserDictionaryPath; /// value("")
-
     /// Path of the license server
     static const STRING GeneralPropertyLicenseServerPath;               /// value("LicenseServerPath")
     static const STRING DefaultGeneralPropertyLicenseServerPath;        /// value("");

Modified: sandbox/adsk/2.5k/Server/src/Core/Server.cpp
===================================================================
--- sandbox/adsk/2.5k/Server/src/Core/Server.cpp	2012-11-26 10:51:17 UTC (rev 7226)
+++ sandbox/adsk/2.5k/Server/src/Core/Server.cpp	2012-11-26 14:27:27 UTC (rev 7227)
@@ -721,7 +721,6 @@
     ACE_UNUSED_ARG(args);
     int nResult = 0;
     STRING mentorDictPath;
-    STRING mentorUserDictPath;
 
     MG_TRY()
     {
@@ -884,7 +883,7 @@
                 // Check if path ends with a '/' if not, add one if needed
                 MgFileUtil::AppendSlashToEndOfPath(mentorDictPath);
                 MG_TRY()
-                    csCatalog->SetDictionaryDir(mentorDictPath);
+                	csCatalog->SetDictionaryDir(mentorDictPath);
                 MG_CATCH_AND_RELEASE()
                 if (NULL != mgException)
                 {
@@ -897,35 +896,6 @@
                 ACE_DEBUG((LM_INFO, ACE_TEXT("(%t) MgServer::open() - No configured dictionary path found. Defaulting to [%W].\n"), csCatalog->GetDictionaryDir().c_str()));
             }
 
-            // Update the user dictionary path with our configured value
-            pConfiguration->GetStringValue(MgConfigProperties::GeneralPropertiesSection, MgConfigProperties::GeneralPropertyMentorUserDictionaryPath, mentorUserDictPath, MgConfigProperties::DefaultGeneralPropertyMentorUserDictionaryPath);
-            if (!mentorUserDictPath.empty())
-            {
-                // Check if path ends with a '/' if not, add one if needed
-                MgFileUtil::AppendSlashToEndOfPath(mentorUserDictPath);
-                MG_TRY()
-                    csCatalog->SetUserDictionaryDir(mentorUserDictPath);
-                MG_CATCH_AND_RELEASE()
-                if (NULL != mgException)
-                {
-                    //not being able to initialize the user dictionary path doesn't result in the server not starting up
-                    ACE_DEBUG((LM_WARNING, ACE_TEXT("(%t) MgServer::open() - The MentorUserDictionaryPath setting is invalid. The user dictionary path setting will not be applied.\n")));
-                }
-            }
-            else
-            {
-                mentorUserDictPath = L"";
-                STRING defaultUserPath = csCatalog->GetUserDictionaryDir();
-                if (defaultUserPath.empty())
-                {
-                    ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t) MgServer::open() - No configured user dictionary path found.\n")));
-                }
-                else
-                {
-                    ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t) MgServer::open() - No configured user dictionary path found. Defaulting to directory [%W].\n"), defaultUserPath.c_str()));
-                }
-            }
-
             // Did we successfully initialize the coordinate system library?
             LibraryStatus status = csCatalog->GetLibraryStatus();
             if(lsInitialized != status)

Modified: sandbox/adsk/2.5k/Server/src/Core/serverconfig.ini
===================================================================
--- sandbox/adsk/2.5k/Server/src/Core/serverconfig.ini	2012-11-26 10:51:17 UTC (rev 7226)
+++ sandbox/adsk/2.5k/Server/src/Core/serverconfig.ini	2012-11-26 14:27:27 UTC (rev 7227)
@@ -70,7 +70,6 @@
 #                                       0 < Value <= 2000000
 # MaxLogFileSizeEnabled            0 = max size disabled, 1 = max size enabled
 # MentorDictionaryPath             The path where the CS-Map Coordinate System Dictionaries are installed
-# MentorUserDictionaryPath         The path where user defined CS-Map Coordinate System Dictionaries are stored
 # PreCacheMaps                     The list of maps to precache at server startup.
 #                                       Value = Map resource name(s) separated by ","
 #                                       Example: Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition
@@ -98,7 +97,6 @@
 MaxLogFileSize                     = 1024
 MaxLogFileSizeEnabled              = 0
 MentorDictionaryPath               = ../../../Oem/CsMap/Dictionaries/
-MentorUserDictionaryPath           =
 PreCacheMaps                       =
 Renderer                           = AGG
 ResourcesPath                      = Resources/

Modified: sandbox/adsk/2.5k/Server/src/UnitTesting/TestCoordinateSystem.cpp
===================================================================
--- sandbox/adsk/2.5k/Server/src/UnitTesting/TestCoordinateSystem.cpp	2012-11-26 10:51:17 UTC (rev 7226)
+++ sandbox/adsk/2.5k/Server/src/UnitTesting/TestCoordinateSystem.cpp	2012-11-26 14:27:27 UTC (rev 7227)
@@ -27,8 +27,12 @@
 #endif
 
 #ifdef _WIN32
+
+#include <Shlobj.h>
+
 const char OgcWktTestFile[] = "..\\UnitTestFiles\\ogcwkts.txt";
 const char EpsgTestFile[] = "..\\UnitTestFiles\\epsgcodes.txt";
+
 #else
 const char OgcWktTestFile[] = "../UnitTestFiles/ogcwkts.txt";
 const char EpsgTestFile[] = "../UnitTestFiles/epsgcodes.txt";
@@ -240,7 +244,6 @@
 
 template<
     bool TAutoRemove,
-    bool TWithUserDefDir,
     class MgCsType, class MgCsDictionaryType,
     STRING (MgCsType::*GetCode)(),
     void (MgCsType::*SetCode)(CREFSTRING),
@@ -254,16 +257,6 @@
     MgCoordinateSystemFactory csFactory;
     Ptr<MgCoordinateSystemCatalog> pMgCsCatalog = csFactory.GetCatalog();
 
-    if (TWithUserDefDir)
-    {
-        TestCoordinateSystem::SetDefaultUserDictionaryDir();
-    }
-    else
-    {
-        if (!pMgCsCatalog->GetUserDictionaryDir().empty())
-            pMgCsCatalog->SetUserDictionaryDir(L"");
-    }
-
     Ptr<MgCsDictionaryType> pCsDictionary = CALL_MEMBER_FN(pMgCsCatalog, MgGetDictionaryFunc)();
     Ptr<MgCoordinateSystemEnum> pCsEnum = pCsDictionary->GetEnum();
     UINT32 size = pCsDictionary->GetSize();
@@ -328,12 +321,59 @@
     return newCode;
 }
 
+STRING
+TestCoordinateSystem::GetDefaultUserDictionaryDir()
+{
+    STRING defaultUserDir;
+
+#ifdef _WIN32
+
+    //let the [MENTOR_USER_DICTIONARY_PATH] environment variable override the
+    //the default path - which on Windows systems is the "(user-)Local app data path\Autodesk\User Geospatial Coordinate Systems"
+
+    // Check to see if the environment variable is set
+    const TCHAR* szPathVar = _wgetenv (L"MENTOR_USER_DICTIONARY_PATH");
+    bool variableDefined = (szPathVar && L'\0' != *szPathVar);
+
+    if(!variableDefined)
+    {
+        TCHAR szPath[MAX_PATH] = { L'\0' };
+        if(TRUE == SHGetSpecialFolderPath(NULL, szPath, CSIDL_LOCAL_APPDATA, FALSE))
+        {
+            defaultUserDir = szPath;
+            defaultUserDir += L"\\Autodesk\\User Geospatial Coordinate Systems"; //NOXLATE
+        }
+    }
+
+    if (!defaultUserDir.empty() && L'\\' != defaultUserDir[defaultUserDir.length() - 1])
+        defaultUserDir.append(L"\\");
+
+#else
+
+    char* szPath = getenv(MENTOR_USER_DICTIONARY_PATH);
+    bool variableDefined = (szPath && L'\0' != *szPath);
+
+    if (variableDefined)
+    {
+        MgUtil::MultiByteToWideChar(string(szPath), defaultUserDir);
+        if(L'/' != defaultUserDir[defaultUserDir.length() - 1])
+            defaultUserDir.append(L"/");
+    }
+
+#endif
+
+    if (defaultUserDir.empty())
+        return L"";
+
+
+    return defaultUserDir.c_str();
+}
+
 /// (1) Update a coordinate system
 void TestCoordinateSystem::TestCase_UpdateCoordinateSystems()
 {
     TestUpdateDefinition<
         true, /* compile as 'auto-remove function' */
-        false, /* compile as 'no-user-def-dir'*/
         MgCoordinateSystem, MgCoordinateSystemDictionary,
         &MgCoordinateSystem::GetCsCode,
         &MgCoordinateSystem::SetCsCode,
@@ -345,7 +385,6 @@
 {
     TestUpdateDefinition<
         true, /* compile as 'auto-remove function' */
-        false, /* compile as 'no-user-def-dir'*/
         MgCoordinateSystemDatum, MgCoordinateSystemDatumDictionary,
         &MgCoordinateSystemDatum::GetDtCode,
         &MgCoordinateSystemDatum::SetDtCode,
@@ -357,7 +396,6 @@
 {
     TestUpdateDefinition<
         true, /* compile as 'auto-remove function' */
-        false, /* compile as 'no-user-def-dir'*/
         MgCoordinateSystemEllipsoid, MgCoordinateSystemEllipsoidDictionary,
         &MgCoordinateSystemEllipsoid::GetElCode,
         &MgCoordinateSystemEllipsoid::SetElCode,
@@ -369,7 +407,6 @@
 {
     TestUpdateDefinition<
         true, /* compile as 'auto-remove function' */
-        false, /* compile as 'no-user-def-dir'*/
         MgCoordinateSystemCategory, MgCoordinateSystemCategoryDictionary,
         &MgCoordinateSystemCategory::GetName,
         &MgCoordinateSystemCategory::SetName,
@@ -381,7 +418,6 @@
 {
     TestUpdateDefinition<
         true, /* compile as 'auto-remove function' */
-        false, /* compile as 'no-user-def-dir'*/
         MgCoordinateSystemGeodeticTransformDef, MgCoordinateSystemGeodeticTransformDefDictionary,
         &MgCoordinateSystemGeodeticTransformDef::GetTransformName,
         &MgCoordinateSystemGeodeticTransformDef::SetTransformName,
@@ -393,104 +429,12 @@
 {
     TestUpdateDefinition<
         true, /* compile as 'auto-remove function' */
-        false, /* compile as 'no-user-def-dir'*/
         MgCoordinateSystemGeodeticPath, MgCoordinateSystemGeodeticPathDictionary,
         &MgCoordinateSystemGeodeticPath::GetPathName,
         &MgCoordinateSystemGeodeticPath::SetPathName,
         &MgCoordinateSystemCatalog::GetGeodeticPathDictionary>(L"Geodetic Path", NULL, CloneDefinition);
 }
 
-///----------------------------------------------------------------------------
-/// Test Case Description:
-///
-/// Tries setting a user dictionary path where to store CS user information into
-///----------------------------------------------------------------------------
-void TestCoordinateSystem::TestCase_InitializeValidUserDictionaryDir()
-{
-    MgCoordinateSystemFactory mgCsFactory;
-    Ptr<MgCoordinateSystemCatalog> pCsCatalog = mgCsFactory.GetCatalog();
-
-    STRING userDictionaryDir = pCsCatalog->GetDefaultUserDictionaryDir();
-    if (userDictionaryDir.empty())
-        return;
-
-    //create the directory to make sure, [SetUserDictionaryDir]
-    //can succeed
-    MgFileUtil::CreateDirectory(userDictionaryDir);
-
-    pCsCatalog->SetUserDictionaryDir(userDictionaryDir);
-    STRING setUserDictionaryDir = pCsCatalog->GetUserDictionaryDir();
-    CPPUNIT_ASSERT(setUserDictionaryDir == userDictionaryDir);
-
-    pCsCatalog->SetUserDictionaryDir(L"");
-    setUserDictionaryDir = pCsCatalog->GetUserDictionaryDir();
-    CPPUNIT_ASSERT(setUserDictionaryDir.empty());
-}
-
-///----------------------------------------------------------------------------
-/// Test Case Description:
-///
-/// Tries setting an invalid user dictionary path where to store CS user information into
-///----------------------------------------------------------------------------
-void TestCoordinateSystem::TestCase_InitializeInvalidUserDictionaryDir()
-{
-    MgCoordinateSystemFactory mgCsFactory;
-    Ptr<MgCoordinateSystemCatalog> pCsCatalog = mgCsFactory.GetCatalog();
-
-    STRING userDictionaryDir = pCsCatalog->GetDefaultUserDictionaryDir();
-    if (userDictionaryDir.empty())
-        return;
-
-    pCsCatalog->SetUserDictionaryDir(userDictionaryDir);
-    STRING setUserDictionaryDir = pCsCatalog->GetUserDictionaryDir();
-
-    MG_TRY()
-
-#ifdef _WIN32
-        pCsCatalog->SetUserDictionaryDir(L"X:\\I am a hopefully not existing path - if I do, changeme");
-#else
-        pCsCatalog->SetUserDictionaryDir(L"/I am a hopefully not existing path - if I do, changeme");
-#endif
-
-    MG_CATCH_AND_RELEASE()
-
-    CPPUNIT_ASSERT(NULL != mgException); //this *must* result in an exception
-
-    STRING currentUserDictionaryDir = pCsCatalog->GetUserDictionaryDir();
-    CPPUNIT_ASSERT(setUserDictionaryDir == currentUserDictionaryDir); //the current user dictionary path must not have changed
-}
-
-///----------------------------------------------------------------------------
-/// Test Case Description:
-///
-/// The following test cases try updating all types of definitions in the current catalog
-/// with a user dictionary path being set
-///----------------------------------------------------------------------------
-///
-
-bool TestCoordinateSystem::SetDefaultUserDictionaryDir()
-{
-    MgCoordinateSystemFactory mgCsFactory;
-    Ptr<MgCoordinateSystemCatalog> pCsCatalog = mgCsFactory.GetCatalog();
-
-    STRING defUserDictionaryDir = pCsCatalog->GetDefaultUserDictionaryDir();
-    if (defUserDictionaryDir.empty())
-    {
-        defUserDictionaryDir = MgFileUtil::GetTempPath();
-        if (defUserDictionaryDir.empty())
-            return false;
-
-        defUserDictionaryDir += L"User Geospatial Coordinate Systems/";
-    }
-
-     //create the directory to make sure, [SetUserDictionaryDir]
-    //can succeed
-    MgFileUtil::CreateDirectory(defUserDictionaryDir);
-    pCsCatalog->SetUserDictionaryDir(defUserDictionaryDir);
-
-    return true;
-}
-
 template<
     class MgCsType, class MgCsDictionaryType,
     STRING (MgCsType::*GetCode)(),
@@ -502,13 +446,6 @@
 {
     ACE_DEBUG((LM_INFO, ACE_TEXT("\nTrying to set the default user dictionary path ...\n")));
 
-    bool userDirSet = TestCoordinateSystem::SetDefaultUserDictionaryDir();
-    if (!userDirSet)
-    {
-        ACE_DEBUG((LM_WARNING, ACE_TEXT("\nCould not set the default user dictionary path. Current test will be skipped\n")));
-        return;
-    }
-
     MgCoordinateSystemFactory mgCsFactory;
     Ptr<MgCoordinateSystemCatalog> pCsCatalog = mgCsFactory.GetCatalog();
     Ptr<MgCsDictionaryType> pCsDictionary = CALL_MEMBER_FN(pCsCatalog, MgGetDictionaryFunc)();
@@ -521,7 +458,7 @@
 
     const INT64 csdFileSize = MgFileUtil::GetFileSize(csCsdFile);
 
-    STRING userDir = pCsCatalog->GetUserDictionaryDir();
+    STRING userDir = TestCoordinateSystem::GetDefaultUserDictionaryDir();
     STRING csCsdUserFile = userDir + csCsdFilename;
 
     STRING addedCode;
@@ -531,7 +468,6 @@
 
         addedCode = TestUpdateDefinition<
             false /* compile as 'no-auto-remove' */,
-            true /* compile as 'with-user-def-dir' */,
             MgCsType, MgCsDictionaryType,
             GetCode,
             SetCode,

Modified: sandbox/adsk/2.5k/Server/src/UnitTesting/TestCoordinateSystem.h
===================================================================
--- sandbox/adsk/2.5k/Server/src/UnitTesting/TestCoordinateSystem.h	2012-11-26 10:51:17 UTC (rev 7226)
+++ sandbox/adsk/2.5k/Server/src/UnitTesting/TestCoordinateSystem.h	2012-11-26 14:27:27 UTC (rev 7227)
@@ -39,9 +39,6 @@
     CPPUNIT_TEST(TestCase_UpdateGeodeticTransformations);
     CPPUNIT_TEST(TestCase_UpdateGeodeticPaths);
 
-    CPPUNIT_TEST(TestCase_InitializeInvalidUserDictionaryDir);
-    CPPUNIT_TEST(TestCase_InitializeValidUserDictionaryDir);
-
     CPPUNIT_TEST(TestCase_UpdateUserCoordinateSystems);
     CPPUNIT_TEST(TestCase_UpdateUserDatums);
     CPPUNIT_TEST(TestCase_UpdateUserEllipsoids);
@@ -274,9 +271,6 @@
     void TestCase_UpdateGeodeticTransformations();
     void TestCase_UpdateGeodeticPaths();
 
-    void TestCase_InitializeInvalidUserDictionaryDir();
-    void TestCase_InitializeValidUserDictionaryDir();
-
     void TestCase_UpdateUserCoordinateSystems();
     void TestCase_UpdateUserDatums();
     void TestCase_UpdateUserEllipsoids();
@@ -487,7 +481,7 @@
     // Performance
     void TestCase_Benchmark_Transformation();
 
-    static bool SetDefaultUserDictionaryDir();
+    static STRING GetDefaultUserDictionaryDir();
 
     class FileAutoBackup
     {



More information about the mapguide-commits mailing list