[mapguide-commits] r1087 - trunk/MgDev/Server/src/UnitTesting
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu Feb 1 14:36:44 EST 2007
Author: tonyfang
Date: 2007-02-01 14:36:44 -0500 (Thu, 01 Feb 2007)
New Revision: 1087
Modified:
trunk/MgDev/Server/src/UnitTesting/TestServerAdminService.cpp
Log:
fix server unittest: TestCase_RemoveConfigurationProperties
Modified: trunk/MgDev/Server/src/UnitTesting/TestServerAdminService.cpp
===================================================================
--- trunk/MgDev/Server/src/UnitTesting/TestServerAdminService.cpp 2007-02-01 17:51:45 UTC (rev 1086)
+++ trunk/MgDev/Server/src/UnitTesting/TestServerAdminService.cpp 2007-02-01 19:36:44 UTC (rev 1087)
@@ -243,23 +243,30 @@
throw new MgServiceNotAvailableException(L"TestServerAdminService::TestCase_RemoveConfigurationProperties", __LINE__, __WFILE__, NULL, L"", NULL);
}
- Ptr<MgPropertyCollection> pPropertyCollection1 = pService->GetConfigurationProperties(L"GeneralProperties");
- Ptr<MgStringProperty> pProperty1 = (MgStringProperty*)pPropertyCollection1->GetItem(L"DefaultLocale");
- STRING valueOriginal = pProperty1->GetValue();
+ // add a property to unmanaged data mappings
+ Ptr<MgPropertyCollection> pPropertyCollection1 = pService->GetConfigurationProperties(L"UnmanagedDataMappings");
+ Ptr<MgStringProperty> pProperty1 = new MgStringProperty(L"TestCase_RemoveConfigurationProperties", L"c:\\temp");
+ pPropertyCollection1->Add(pProperty1);
+ pService->SetConfigurationProperties(L"UnmanagedDataMappings", pPropertyCollection1);
+
+ // retrieve newly added property
+ Ptr<MgPropertyCollection> pPropertyCollection2 = pService->GetConfigurationProperties(L"UnmanagedDataMappings");
+ Ptr<MgStringProperty> pProperty2 = (MgStringProperty*)pPropertyCollection2->GetItem(L"TestCase_RemoveConfigurationProperties");
+
+ CPPUNIT_ASSERT(pProperty2->GetValue().compare(L"c:\\temp") == 0);
+
+ // remove newly added property
Ptr<MgPropertyCollection> pPropertyCollectionRemove = new MgPropertyCollection();
- Ptr<MgStringProperty> pPropertyRemove = new MgStringProperty(L"DefaultLocale", L"");
+ Ptr<MgStringProperty> pPropertyRemove = new MgStringProperty(L"TestCase_RemoveConfigurationProperties", L"");
pPropertyCollectionRemove->Add(pPropertyRemove);
- pService->RemoveConfigurationProperties(L"GeneralProperties", pPropertyCollectionRemove);
+ pService->RemoveConfigurationProperties(L"UnmanagedDataMappings", pPropertyCollectionRemove);
- Ptr<MgPropertyCollection> pPropertyCollection2 = pService->GetConfigurationProperties(L"GeneralProperties");
- Ptr<MgStringProperty> pProperty2 = (MgStringProperty*)pPropertyCollection1->GetItem(L"DefaultLocale");
+ // check for the removed property
+ Ptr<MgPropertyCollection> pPropertyCollection3 = pService->GetConfigurationProperties(L"UnmanagedDataMappings");
- CPPUNIT_ASSERT(pProperty2 == NULL);
-
- // Restore original value
- pService->SetConfigurationProperties(L"GeneralProperties", pPropertyCollection1);
+ CPPUNIT_ASSERT(!pPropertyCollection3->Contains(L"TestCase_RemoveConfigurationProperties"));
}
catch(MgException* e)
{
More information about the mapguide-commits
mailing list