[commit] r2297 - in trunk: GME/Mga Tests/GPyUnit

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Wed Aug 21 11:28:28 CDT 2013


Author: ksmyth
Date: Wed Aug 21 11:28:27 2013
New Revision: 2297

Log:
Fix dup GUIDs in folder copy

Added:
   trunk/Tests/GPyUnit/test_copy.py
Modified:
   trunk/GME/Mga/MgaComplexOps.cpp
   trunk/Tests/GPyUnit/__init__.py

Modified: trunk/GME/Mga/MgaComplexOps.cpp
==============================================================================
--- trunk/GME/Mga/MgaComplexOps.cpp	Tue Aug 20 17:06:02 2013	(r2296)
+++ trunk/GME/Mga/MgaComplexOps.cpp	Wed Aug 21 11:28:27 2013	(r2297)
@@ -349,6 +349,10 @@
 				// remove library flags from a copy
 				// FIXME this looks wrong
 				if(ai == ATTRID_PERMISSIONS) nobj[ai] = self[ai] & INSTANCE_FLAG;
+				else if( ai == ATTRID_GUID1 // don't copy these
+					|| ai == ATTRID_GUID2
+					|| ai == ATTRID_GUID3 
+					|| ai == ATTRID_GUID4) {}
 				else nobj[ai] = static_cast<CComVariant>(self[ai]);
 			}
 			else {

Modified: trunk/Tests/GPyUnit/__init__.py
==============================================================================
--- trunk/Tests/GPyUnit/__init__.py	Tue Aug 20 17:06:02 2013	(r2296)
+++ trunk/Tests/GPyUnit/__init__.py	Wed Aug 21 11:28:27 2013	(r2297)
@@ -25,6 +25,7 @@
  'test_registrar',
  'test_gmeoleapp',
  'test_parser',
+ 'test_copy',
  'test_registry',
  'test_instances',
  'GME_297.suite',

Added: trunk/Tests/GPyUnit/test_copy.py
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/Tests/GPyUnit/test_copy.py	Wed Aug 21 11:28:27 2013	(r2297)
@@ -0,0 +1,35 @@
+import unittest
+import os
+import GPyUnit.util
+from GPyUnit.util import DispatchEx
+
+def _adjacent_file(file):
+    import os.path
+    return os.path.join(os.path.dirname(os.path.abspath(__file__)), file)
+
+class TestParser(unittest.TestCase):
+    def test_CopyFCODupGUID(self):
+        mga = GPyUnit.util.parse_xme(self.connstr, _adjacent_file(r'..\..\Paradigms\SF\SFDemo.xme'))
+        mga.Save()
+        try:
+            mga.BeginTransactionInNewTerr()
+            try:
+                folder1 = mga.RootFolder.CreateFolder(mga.RootMeta.RootFolder.GetDefinedFolderByNameDisp('Folder', True))
+                folder1.Name = 'folder1'
+                folder1.MoveFCODisp(mga.ObjectByPath('/@System'))
+                folder2 = mga.RootFolder.CopyFolderDisp(folder1)
+                self.assertNotEqual(folder1.ObjectByPath('/@System').GetGuidDisp(), folder2.ObjectByPath('/@System').GetGuidDisp())
+                self.assertNotEqual(folder1.ObjectByPath('/@System/@DBSetup1').GetGuidDisp(), folder2.ObjectByPath('/@System/@DBSetup1').GetGuidDisp())
+            finally:
+                mga.CommitTransaction()
+        finally:
+            mga.Close(False)
+    
+    @property
+    def connstr(self):
+        return "MGA=" + _adjacent_file("copytest.mga")
+
+GPyUnit.util.MUGenerator(globals(), TestParser)
+
+if __name__ == "__main__":
+        unittest.main()


More information about the gme-commit mailing list