[mapguide-commits] r7691 - in sandbox/jng/http304: Common/MapGuideCommon/Services Server/src/Services/Tile Server/src/UnitTesting

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Jul 18 02:55:09 PDT 2013


Author: jng
Date: 2013-07-18 02:55:09 -0700 (Thu, 18 Jul 2013)
New Revision: 7691

Added:
   sandbox/jng/http304/Server/src/Services/Tile/OpGetTileCreationDate.cpp
   sandbox/jng/http304/Server/src/Services/Tile/OpGetTileCreationDate.h
   sandbox/jng/http304/Server/src/Services/Tile/OpGetTileWithCreationDate.cpp
   sandbox/jng/http304/Server/src/Services/Tile/OpGetTileWithCreationDate.h
Modified:
   sandbox/jng/http304/Common/MapGuideCommon/Services/Tile.cpp
   sandbox/jng/http304/Common/MapGuideCommon/Services/Tile.h
   sandbox/jng/http304/Server/src/Services/Tile/ServerTileService.cpp
   sandbox/jng/http304/Server/src/Services/Tile/TileCache.cpp
   sandbox/jng/http304/Server/src/UnitTesting/TestMisc.cpp
   sandbox/jng/http304/Server/src/UnitTesting/TestMisc.h
Log:
This submission includes the following changes:
 - We left out the operation classes in ServerTileService
 - Fix up MgTile header and use Ptr<> for members
 - Use the time_t value (ToTimeValue() instead of ToNumber()) as the basis for cloning stack allocated MgDateTime objects to heap allocated ones.
 - Add a MgTile serialization/deserialization unit test.

Modified: sandbox/jng/http304/Common/MapGuideCommon/Services/Tile.cpp
===================================================================
--- sandbox/jng/http304/Common/MapGuideCommon/Services/Tile.cpp	2013-07-16 14:14:16 UTC (rev 7690)
+++ sandbox/jng/http304/Common/MapGuideCommon/Services/Tile.cpp	2013-07-18 09:55:09 UTC (rev 7691)
@@ -33,8 +33,8 @@
 
 MgTile::~MgTile()
 {
-    SAFE_RELEASE(m_image);
-    SAFE_RELEASE(m_creationDate);
+    m_image = NULL;
+    m_creationDate = NULL;
 }
 
 void MgTile::SetImage(MgByteReader* image)
@@ -54,12 +54,12 @@
 
 MgByteReader* MgTile::GetImage()
 {
-    return SAFE_ADDREF(m_image);
+    return SAFE_ADDREF((MgByteReader*)m_image);
 }
 
 MgDateTime* MgTile::GetCreationDate()
 {
-    return SAFE_ADDREF(m_creationDate);
+    return SAFE_ADDREF((MgDateTime*)m_creationDate);
 }
 
 void MgTile::Deserialize(MgStream* stream)

Modified: sandbox/jng/http304/Common/MapGuideCommon/Services/Tile.h
===================================================================
--- sandbox/jng/http304/Common/MapGuideCommon/Services/Tile.h	2013-07-16 14:14:16 UTC (rev 7690)
+++ sandbox/jng/http304/Common/MapGuideCommon/Services/Tile.h	2013-07-18 09:55:09 UTC (rev 7691)
@@ -36,6 +36,8 @@
     void SetCreationDate(MgDateTime* creationDate);
 
     virtual INT32 GetClassId();
+    virtual void Deserialize(MgStream* stream);
+    virtual void Serialize(MgStream* stream);
 
 PUBLISHED_API:
     MgByteReader* GetImage();
@@ -48,12 +50,9 @@
         delete this;
     }
 
-    void Deserialize(MgStream* stream);
-    void Serialize(MgStream* stream);
-
 private:
-    MgByteReader* m_image;
-    MgDateTime* m_creationDate;
+    Ptr<MgByteReader> m_image;
+    Ptr<MgDateTime> m_creationDate;
 
 CLASS_ID:
     static const INT32 m_cls_id = MapGuide_TileService_Tile;

Added: sandbox/jng/http304/Server/src/Services/Tile/OpGetTileCreationDate.cpp
===================================================================
--- sandbox/jng/http304/Server/src/Services/Tile/OpGetTileCreationDate.cpp	                        (rev 0)
+++ sandbox/jng/http304/Server/src/Services/Tile/OpGetTileCreationDate.cpp	2013-07-18 09:55:09 UTC (rev 7691)
@@ -0,0 +1,162 @@
+//
+//  Copyright (C) 2004-2013 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#include "OpGetTileCreationDate.h"
+#include "LogManager.h"
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Constructs the object.
+/// </summary>
+///----------------------------------------------------------------------------
+MgOpGetTileCreationDate::MgOpGetTileCreationDate()
+{
+}
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Destructs the object.
+/// </summary>
+///----------------------------------------------------------------------------
+MgOpGetTileCreationDate::~MgOpGetTileCreationDate()
+{
+}
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Executes the operation.
+/// </summary>
+///
+/// <exceptions>
+/// MgException
+/// </exceptions>
+///----------------------------------------------------------------------------
+void MgOpGetTileCreationDate::Execute()
+{
+    ACE_DEBUG((LM_DEBUG, ACE_TEXT("  (%t) MgOpGetTileCreationDate::Execute()\n")));
+
+    MG_LOG_OPERATION_MESSAGE(L"GetTileCreationDate");
+
+    MG_TRY()
+
+    MG_LOG_OPERATION_MESSAGE_INIT(m_packet.m_OperationVersion, m_packet.m_NumArguments);
+
+    ACE_ASSERT(m_stream != NULL);
+
+    if (4 == m_packet.m_NumArguments)
+    {
+        Ptr<MgMap> map = (MgMap*)m_stream->GetObject();
+        map->SetDelayedLoadResourceService(m_resourceService);
+
+        Ptr<MgResourceIdentifier> resource = map->GetResourceId();
+
+        STRING baseMapLayerGroupName;
+        m_stream->GetString(baseMapLayerGroupName);
+
+        INT32 tileCol = 0;
+        m_stream->GetInt32(tileCol);
+
+        INT32 tileRow = 0;
+        m_stream->GetInt32(tileRow);
+
+        BeginExecution();
+
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+        MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_STRING(baseMapLayerGroupName.c_str());
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_INT32(tileCol);
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_INT32(tileRow);
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
+        Validate();
+
+        Ptr<MgByteReader> byteReader =
+            m_service->GetTile(map, baseMapLayerGroupName, tileCol, tileRow);
+
+        EndExecution(byteReader);
+    }
+    else if (5 == m_packet.m_NumArguments)
+    {
+        Ptr<MgResourceIdentifier> mapDefinition = (MgResourceIdentifier*)m_stream->GetObject();
+
+        STRING baseMapLayerGroupName;
+        m_stream->GetString(baseMapLayerGroupName);
+
+        INT32 tileCol = 0;
+        m_stream->GetInt32(tileCol);
+
+        INT32 tileRow = 0;
+        m_stream->GetInt32(tileRow);
+
+        INT32 scale = 0;
+        m_stream->GetInt32(scale);
+
+        BeginExecution();
+
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+        MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == mapDefinition) ? L"MgResourceIdentifier" : mapDefinition->ToString().c_str());
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_STRING(baseMapLayerGroupName.c_str());
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_INT32(tileCol);
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_INT32(tileRow);
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_INT32(scale);
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
+        Validate();
+
+        Ptr<MgByteReader> byteReader =
+            m_service->GetTile(mapDefinition, baseMapLayerGroupName, tileCol, tileRow, scale);
+
+        EndExecution(byteReader);
+    }
+    else
+    {
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+    }
+
+    if (!m_argsRead)
+    {
+        throw new MgOperationProcessingException(L"MgOpGetTileCreationDate.Execute",
+            __LINE__, __WFILE__, NULL, L"", NULL);
+    }
+
+    // Successful operation
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
+
+    MG_CATCH(L"MgOpGetTileCreationDate.Execute")
+
+    if (mgException != NULL)
+    {
+        // Failed operation
+        MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Failure.c_str());
+    }
+
+    // Add access log entry for operation
+    MG_LOG_OPERATION_MESSAGE_ACCESS_ENTRY();
+
+    MG_THROW()
+}

Added: sandbox/jng/http304/Server/src/Services/Tile/OpGetTileCreationDate.h
===================================================================
--- sandbox/jng/http304/Server/src/Services/Tile/OpGetTileCreationDate.h	                        (rev 0)
+++ sandbox/jng/http304/Server/src/Services/Tile/OpGetTileCreationDate.h	2013-07-18 09:55:09 UTC (rev 7691)
@@ -0,0 +1,33 @@
+//
+//  Copyright (C) 2004-2013 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#ifndef MG_OP_GET_TILE_CREATION_DATE_H
+#define MG_OP_GET_TILE_CREATION_DATE_H
+
+#include "TileOperation.h"
+
+class MgOpGetTileCreationDate : public MgTileOperation
+{
+    public:
+        MgOpGetTileCreationDate();
+        virtual ~MgOpGetTileCreationDate();
+
+    public:
+        virtual void Execute();
+};
+
+#endif

Added: sandbox/jng/http304/Server/src/Services/Tile/OpGetTileWithCreationDate.cpp
===================================================================
--- sandbox/jng/http304/Server/src/Services/Tile/OpGetTileWithCreationDate.cpp	                        (rev 0)
+++ sandbox/jng/http304/Server/src/Services/Tile/OpGetTileWithCreationDate.cpp	2013-07-18 09:55:09 UTC (rev 7691)
@@ -0,0 +1,162 @@
+//
+//  Copyright (C) 2004-2013 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#include "OpGetTileWithCreationDate.h"
+#include "LogManager.h"
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Constructs the object.
+/// </summary>
+///----------------------------------------------------------------------------
+MgOpGetTileWithCreationDate::MgOpGetTileWithCreationDate()
+{
+}
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Destructs the object.
+/// </summary>
+///----------------------------------------------------------------------------
+MgOpGetTileWithCreationDate::~MgOpGetTileWithCreationDate()
+{
+}
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Executes the operation.
+/// </summary>
+///
+/// <exceptions>
+/// MgException
+/// </exceptions>
+///----------------------------------------------------------------------------
+void MgOpGetTileWithCreationDate::Execute()
+{
+    ACE_DEBUG((LM_DEBUG, ACE_TEXT("  (%t) MgOpGetTileWithCreationDate::Execute()\n")));
+
+    MG_LOG_OPERATION_MESSAGE(L"GetTileWithCreationDate");
+
+    MG_TRY()
+
+    MG_LOG_OPERATION_MESSAGE_INIT(m_packet.m_OperationVersion, m_packet.m_NumArguments);
+
+    ACE_ASSERT(m_stream != NULL);
+
+    if (4 == m_packet.m_NumArguments)
+    {
+        Ptr<MgMap> map = (MgMap*)m_stream->GetObject();
+        map->SetDelayedLoadResourceService(m_resourceService);
+
+        Ptr<MgResourceIdentifier> resource = map->GetResourceId();
+
+        STRING baseMapLayerGroupName;
+        m_stream->GetString(baseMapLayerGroupName);
+
+        INT32 tileCol = 0;
+        m_stream->GetInt32(tileCol);
+
+        INT32 tileRow = 0;
+        m_stream->GetInt32(tileRow);
+
+        BeginExecution();
+
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+        MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == resource) ? L"MgResourceIdentifier" : resource->ToString().c_str());
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_STRING(baseMapLayerGroupName.c_str());
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_INT32(tileCol);
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_INT32(tileRow);
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
+        Validate();
+
+        Ptr<MgTile> tile =
+            m_service->GetTileWithCreationDate(map, baseMapLayerGroupName, tileCol, tileRow);
+
+        EndExecution(tile);
+    }
+    else if (5 == m_packet.m_NumArguments)
+    {
+        Ptr<MgResourceIdentifier> mapDefinition = (MgResourceIdentifier*)m_stream->GetObject();
+
+        STRING baseMapLayerGroupName;
+        m_stream->GetString(baseMapLayerGroupName);
+
+        INT32 tileCol = 0;
+        m_stream->GetInt32(tileCol);
+
+        INT32 tileRow = 0;
+        m_stream->GetInt32(tileRow);
+
+        INT32 scale = 0;
+        m_stream->GetInt32(scale);
+
+        BeginExecution();
+
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+        MG_LOG_OPERATION_MESSAGE_ADD_STRING((NULL == mapDefinition) ? L"MgResourceIdentifier" : mapDefinition->ToString().c_str());
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_STRING(baseMapLayerGroupName.c_str());
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_INT32(tileCol);
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_INT32(tileRow);
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_INT32(scale);
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
+        Validate();
+
+        Ptr<MgTile> tile =
+            m_service->GetTileWithCreationDate(mapDefinition, baseMapLayerGroupName, tileCol, tileRow, scale);
+
+        EndExecution(tile);
+    }
+    else
+    {
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+    }
+
+    if (!m_argsRead)
+    {
+        throw new MgOperationProcessingException(L"MgOpGetTileWithCreationDate.Execute",
+            __LINE__, __WFILE__, NULL, L"", NULL);
+    }
+
+    // Successful operation
+    MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
+
+    MG_CATCH(L"MgOpGetTileWithCreationDate.Execute")
+
+    if (mgException != NULL)
+    {
+        // Failed operation
+        MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Failure.c_str());
+    }
+
+    // Add access log entry for operation
+    MG_LOG_OPERATION_MESSAGE_ACCESS_ENTRY();
+
+    MG_THROW()
+}

Added: sandbox/jng/http304/Server/src/Services/Tile/OpGetTileWithCreationDate.h
===================================================================
--- sandbox/jng/http304/Server/src/Services/Tile/OpGetTileWithCreationDate.h	                        (rev 0)
+++ sandbox/jng/http304/Server/src/Services/Tile/OpGetTileWithCreationDate.h	2013-07-18 09:55:09 UTC (rev 7691)
@@ -0,0 +1,33 @@
+//
+//  Copyright (C) 2004-2013 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#ifndef MG_OP_GET_TILE_WITH_CREATION_DATE_H
+#define MG_OP_GET_TILE_WITH_CREATION_DATE_H
+
+#include "TileOperation.h"
+
+class MgOpGetTileWithCreationDate : public MgTileOperation
+{
+    public:
+        MgOpGetTileWithCreationDate();
+        virtual ~MgOpGetTileWithCreationDate();
+
+    public:
+        virtual void Execute();
+};
+
+#endif

Modified: sandbox/jng/http304/Server/src/Services/Tile/ServerTileService.cpp
===================================================================
--- sandbox/jng/http304/Server/src/Services/Tile/ServerTileService.cpp	2013-07-16 14:14:16 UTC (rev 7690)
+++ sandbox/jng/http304/Server/src/Services/Tile/ServerTileService.cpp	2013-07-18 09:55:09 UTC (rev 7691)
@@ -184,7 +184,7 @@
     if (MgFileUtil::IsFile(tilePathname))
     {
         MgDateTime cdate = MgFileUtil::GetFileCreationTime(tilePathname);
-        ret = new MgDateTime(cdate.ToNumber());
+        ret = new MgDateTime(cdate.ToTimeValue());
     }
 
     MG_CATCH_AND_THROW(L"MgServerTileService.GetTileCreationDate")
@@ -231,7 +231,7 @@
     if (MgFileUtil::IsFile(tilePathname))
     {
         MgDateTime cdate = MgFileUtil::GetFileCreationTime(tilePathname);
-        ret = new MgDateTime(cdate.ToNumber());
+        ret = new MgDateTime(cdate.ToTimeValue());
     }
 
     MG_CATCH_AND_THROW(L"MgServerTileService.GetTileCreationDate")
@@ -526,7 +526,7 @@
             {
                 img->Rewind();
             }
-            Ptr<MgDateTime> creationDate = new MgDateTime(cdate.ToNumber());
+            Ptr<MgDateTime> creationDate = new MgDateTime(cdate.ToTimeValue());
 
             tile = new MgTile(img, creationDate);
         }

Modified: sandbox/jng/http304/Server/src/Services/Tile/TileCache.cpp
===================================================================
--- sandbox/jng/http304/Server/src/Services/Tile/TileCache.cpp	2013-07-16 14:14:16 UTC (rev 7690)
+++ sandbox/jng/http304/Server/src/Services/Tile/TileCache.cpp	2013-07-18 09:55:09 UTC (rev 7691)
@@ -170,7 +170,7 @@
 
         Ptr<MgByteReader> image = byteSource->GetReader();
         MgDateTime cdate = MgFileUtil::GetFileCreationTime(tilePathname);
-        Ptr<MgDateTime> createDate = new MgDateTime(cdate.ToNumber());
+        Ptr<MgDateTime> createDate = new MgDateTime(cdate.ToTimeValue());
         
         ret = new MgTile(image, createDate);
     }

Modified: sandbox/jng/http304/Server/src/UnitTesting/TestMisc.cpp
===================================================================
--- sandbox/jng/http304/Server/src/UnitTesting/TestMisc.cpp	2013-07-16 14:14:16 UTC (rev 7690)
+++ sandbox/jng/http304/Server/src/UnitTesting/TestMisc.cpp	2013-07-18 09:55:09 UTC (rev 7691)
@@ -573,4 +573,47 @@
     {
         throw;
     }
+}
+
+void TestMisc::TestCase_MgTileSerializable()
+{
+    try
+    {
+        std::string str = "Test Image";
+        Ptr<MgByteReader> image;
+        Ptr<MgByteSource> source = new MgByteSource((BYTE_ARRAY_IN)str.c_str(), (INT32)str.length());
+        //MgTile is just a container for a MgByteReader, it doesn't care about the underlying content.
+        image = source->GetReader();
+        Ptr<MgDateTime> createDate = new MgDateTime();
+        Ptr<MgTile> tile = new MgTile(image, createDate);
+        Ptr<MgMemoryStreamHelper> helper = new MgMemoryStreamHelper();
+        Ptr<MgStream> stream = new MgStream(helper);
+        tile->Serialize(stream);
+
+        Ptr<MgTile> tile2 = new MgTile();
+        tile2->Deserialize(stream);
+        
+        Ptr<MgDateTime> dt1 = tile->GetCreationDate();
+        Ptr<MgDateTime> dt2 = tile2->GetCreationDate();
+        CPPUNIT_ASSERT(NULL != dt1.p);
+        CPPUNIT_ASSERT(NULL != dt2.p);
+        CPPUNIT_ASSERT(*(dt1.p) == *(dt2.p));
+
+        Ptr<MgByteReader> br1 = tile->GetImage();
+        STRING str1 = br1->ToString();
+        Ptr<MgByteReader> br2 = tile2->GetImage();
+        STRING str2 = br2->ToString();
+
+        CPPUNIT_ASSERT(str1 == str2);
+    }
+    catch (MgException* e)
+    {
+        STRING message = e->GetDetails(TEST_LOCALE);
+        SAFE_RELEASE(e);
+        CPPUNIT_FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+    }
+    catch (...)
+    {
+        throw;
+    }
 }
\ No newline at end of file

Modified: sandbox/jng/http304/Server/src/UnitTesting/TestMisc.h
===================================================================
--- sandbox/jng/http304/Server/src/UnitTesting/TestMisc.h	2013-07-16 14:14:16 UTC (rev 7690)
+++ sandbox/jng/http304/Server/src/UnitTesting/TestMisc.h	2013-07-18 09:55:09 UTC (rev 7691)
@@ -30,6 +30,7 @@
     CPPUNIT_TEST(TestCase_1304);
     CPPUNIT_TEST(TestCase_MapLayerCollections);
     CPPUNIT_TEST(TestCase_Rfc1123Dates);
+    CPPUNIT_TEST(TestCase_MgTileSerializable);
 
     CPPUNIT_TEST(TestEnd); // This must be the very last unit test
     CPPUNIT_TEST_SUITE_END();
@@ -48,6 +49,7 @@
     void TestCase_1304();
     void TestCase_MapLayerCollections();
     void TestCase_Rfc1123Dates();
+    void TestCase_MgTileSerializable();
 
 private:
     Ptr<MgSiteConnection> m_siteConnection;



More information about the mapguide-commits mailing list