[mapguide-commits] r7868 - in branches/2.5/MgDev/Desktop: DesktopTestData MgDesktop/Services/Resource UnitTest
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Sep 23 03:20:49 PDT 2013
Author: jng
Date: 2013-09-23 03:20:48 -0700 (Mon, 23 Sep 2013)
New Revision: 7868
Added:
branches/2.5/MgDev/Desktop/DesktopTestData/PackageTest.mgp
Modified:
branches/2.5/MgDev/Desktop/MgDesktop/Services/Resource/ResourcePackageLoader.cpp
branches/2.5/MgDev/Desktop/UnitTest/TestResourceService.cpp
branches/2.5/MgDev/Desktop/UnitTest/TestResourceService.h
Log:
#2355: No-op UPDATEREPOSITORY operations in a package manifest when loading a package in mg-desktop.
Copied: branches/2.5/MgDev/Desktop/DesktopTestData/PackageTest.mgp (from rev 7867, branches/2.4/MgDev/Desktop/DesktopTestData/PackageTest.mgp)
===================================================================
(Binary files differ)
Modified: branches/2.5/MgDev/Desktop/MgDesktop/Services/Resource/ResourcePackageLoader.cpp
===================================================================
--- branches/2.5/MgDev/Desktop/MgDesktop/Services/Resource/ResourcePackageLoader.cpp 2013-09-23 08:06:48 UTC (rev 7867)
+++ branches/2.5/MgDev/Desktop/MgDesktop/Services/Resource/ResourcePackageLoader.cpp 2013-09-23 10:20:48 UTC (rev 7868)
@@ -219,38 +219,7 @@
void MgdResourcePackageLoader::UpdateRepository(
const MgOperationInfo& opInfo)
{
- MG_RESOURCE_SERVICE_TRY()
-
- const MgdOperationParameter& resourceIdParam = opInfo.GetParameter(
- MgdOperationParameter::ResourceId);
- Ptr<MgResourceIdentifier> resource = CreateResourceIdentifier(resourceIdParam);
-
- const MgdOperationParameter& resourceHeaderParam = opInfo.GetParameter(
- MgdOperationParameter::ResourceHeader, false);
- Ptr<MgByteReader> header = CreateByteReader(resourceHeaderParam, false);
-
- const MgdOperationParameter& resourceContentParam = opInfo.GetParameter(
- MgdOperationParameter::ResourceContent, (header == NULL));
- Ptr<MgByteReader> content = CreateByteReader(resourceContentParam);
-
- /*
- if (m_packageLogWriter != NULL)
- {
- MG_LOG_OPERATION_MESSAGE(L"UpdateRepository");
- MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
- MG_LOG_OPERATION_MESSAGE_ADD_STRING(resourceIdParam.GetValue());
- MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
- MG_LOG_OPERATION_MESSAGE_ADD_STRING(resourceContentParam.GetValue());
- MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
- MG_LOG_OPERATION_MESSAGE_ADD_STRING(resourceHeaderParam.GetValue());
- MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
-
- m_packageLogWriter->AddOperation(operationMessage);
- }*/
-
- m_repositoryManager.UpdateRepository(resource, content, header);
-
- MG_RESOURCE_SERVICE_CATCH_AND_THROW(L"MgdResourcePackageLoader.UpdateRepository")
+ //NOOP. mg-desktop doesn't implement this operation
}
///////////////////////////////////////////////////////////////////////////////
Modified: branches/2.5/MgDev/Desktop/UnitTest/TestResourceService.cpp
===================================================================
--- branches/2.5/MgDev/Desktop/UnitTest/TestResourceService.cpp 2013-09-23 08:06:48 UTC (rev 7867)
+++ branches/2.5/MgDev/Desktop/UnitTest/TestResourceService.cpp 2013-09-23 10:20:48 UTC (rev 7868)
@@ -1181,4 +1181,35 @@
SAFE_RELEASE(e);
CPPUNIT_FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
}
+}
+
+void TestResourceService::TestCase_PackageNoOpUpdateRepository()
+{
+ try
+ {
+ Ptr<MgdServiceFactory> fact = new MgdServiceFactory();
+ Ptr<MgResourceService> pService = dynamic_cast<MgResourceService*>(fact->CreateService(MgServiceType::ResourceService));
+ if (pService == 0)
+ {
+ throw new MgServiceNotAvailableException(L"TestResourceService.TestCase_PackageNoOpUpdateRepository", __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+ MgResourceIdentifier resId(L"Library://UnitTests/Package/LineSymbol.SymbolDefinition");
+ if (pService->ResourceExists(&resId))
+ {
+ pService->DeleteResource(&resId);
+ }
+
+ Ptr<MgByteSource> byteSource = new MgByteSource(L"..\\UnitTestFiles\\PackageTest.mgp");
+ Ptr<MgByteReader> byteReader = byteSource->GetReader();
+
+ //This package contains an UPDATEREPOSITORY directive, which should no-op when loaded by mg-desktop
+ pService->ApplyResourcePackage(byteReader);
+ CPPUNIT_ASSERT(pService->ResourceExists(&resId));
+ }
+ catch(MgException* e)
+ {
+ STRING message = e->GetDetails(TEST_LOCALE);
+ SAFE_RELEASE(e);
+ CPPUNIT_FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+ }
}
\ No newline at end of file
Modified: branches/2.5/MgDev/Desktop/UnitTest/TestResourceService.h
===================================================================
--- branches/2.5/MgDev/Desktop/UnitTest/TestResourceService.h 2013-09-23 08:06:48 UTC (rev 7867)
+++ branches/2.5/MgDev/Desktop/UnitTest/TestResourceService.h 2013-09-23 10:20:48 UTC (rev 7868)
@@ -58,6 +58,7 @@
//CPPUNIT_TEST(TestCase_RepositoryBusy);
CPPUNIT_TEST(TestCase_BenchmarkGetResourceContents);
+ CPPUNIT_TEST(TestCase_PackageNoOpUpdateRepository);
CPPUNIT_TEST(TestEnd); // This must be the very last unit test
CPPUNIT_TEST_SUITE_END();
@@ -103,6 +104,8 @@
void TestCase_EnumerateUnmanagedData();
//void TestCase_RepositoryBusy();
+ void TestCase_PackageNoOpUpdateRepository();
+
// Benchmarking
void TestCase_BenchmarkGetResourceContents();
};
More information about the mapguide-commits
mailing list