[Zope-CVS] CVS: Products/AdaptableStorage/tests - testASStorage.py:1.8 testZope2FS.py:1.15

Shane Hathaway shane@zope.com
Fri, 10 Jan 2003 14:02:49 -0500


Update of /cvs-repository/Products/AdaptableStorage/tests
In directory cvs.zope.org:/tmp/cvs-serv8857/tests

Modified Files:
	testASStorage.py testZope2FS.py 
Log Message:
Made it safe to re-use OIDs that are no longer in use.  OID reuse happens
when using Zope2FS and the user removes an object and later replaces it
with an object by the same name.  ASConnection has an easy way to deal with
this: it just minimizes the cache and tries to cache it again.


=== Products/AdaptableStorage/tests/testASStorage.py 1.7 => 1.8 ===
--- Products/AdaptableStorage/tests/testASStorage.py:1.7	Thu Jan  9 09:34:07 2003
+++ Products/AdaptableStorage/tests/testASStorage.py	Fri Jan 10 14:02:16 2003
@@ -42,6 +42,7 @@
 
 
 class ASStorageTests (SerialTestBase, unittest.TestCase):
+    # Tests of ASStorage, not including ASConnection.
 
     def setUp(self):
         SerialTestBase.setUp(self)


=== Products/AdaptableStorage/tests/testZope2FS.py 1.14 => 1.15 ===
--- Products/AdaptableStorage/tests/testZope2FS.py:1.14	Fri Jan 10 13:31:13 2003
+++ Products/AdaptableStorage/tests/testZope2FS.py	Fri Jan 10 14:02:16 2003
@@ -102,6 +102,29 @@
             conn.close()
 
 
+    def testReuseId(self):
+        # Verifies that ASConnection doesn't trip over reusing an OID that's
+        # no longer in use.
+        conn = self.db.open()
+        try:
+            app = conn.root()['Application']
+            f = Folder()
+            f.id = 'Holidays'
+            app._setObject(f.id, f, set_owner=0)
+            get_transaction().commit()
+
+            f = None  # Forget the reference to folder
+            app._delObject('Holidays')
+            get_transaction().commit()
+
+            f = Folder()
+            f.id = 'Holidays'
+            app._setObject(f.id, f, set_owner=0)
+            get_transaction().commit()
+        finally:
+            conn.close()
+
+
 
 class Zope2FSUnderscoreTests (Zope2FSTests):