[CalendarServer-changes] [6348] CalendarServer/branches/users/glyph/more-deferreds-6/txdav/carddav/ datastore/test/test_file.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Sep 22 21:51:37 PDT 2010


Revision: 6348
          http://trac.macosforge.org/projects/calendarserver/changeset/6348
Author:   glyph at apple.com
Date:     2010-09-22 21:51:35 -0700 (Wed, 22 Sep 2010)
Log Message:
-----------
get rid of transaction leaks

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/more-deferreds-6/txdav/carddav/datastore/test/test_file.py

Modified: CalendarServer/branches/users/glyph/more-deferreds-6/txdav/carddav/datastore/test/test_file.py
===================================================================
--- CalendarServer/branches/users/glyph/more-deferreds-6/txdav/carddav/datastore/test/test_file.py	2010-09-23 04:42:13 UTC (rev 6347)
+++ CalendarServer/branches/users/glyph/more-deferreds-6/txdav/carddav/datastore/test/test_file.py	2010-09-23 04:51:35 UTC (rev 6348)
@@ -61,7 +61,7 @@
 
     test.notifierFactory = StubNotifierFactory()
     test.addressbookStore = AddressBookStore(storeRootPath, test.notifierFactory)
-    test.txn = test.addressbookStore.newTransaction()
+    test.txn = test.addressbookStore.newTransaction(test.id() + " (old)")
     assert test.addressbookStore is not None, "No addressbook store?"
 
 
@@ -95,7 +95,8 @@
         implementation, so no UIDs may start with ".".
         """
         self.assertEquals(
-            self.addressbookStore.newTransaction().addressbookHomeWithUID("xyzzy"),
+            self.addressbookStore.newTransaction(self.id()
+                ).addressbookHomeWithUID("xyzzy"),
             None
         )
 
@@ -189,7 +190,7 @@
         self.assertEquals(set(index.addressbookObjects()),
                           set(addressbook.addressbookObjects()))
         self.txn.commit()
-        self.txn = self.addressbookStore.newTransaction()
+        self.txn = self.addressbookStore.newTransaction(self.id())
         self.home1 = self.txn.addressbookHomeWithUID("home1")
         addressbook = self.home1.addressbookWithName("addressbook2")
         # FIXME: we should be curating our own index here, but in order to fix
@@ -287,7 +288,7 @@
         Re-read the (committed) home1 and addressbook1 objects in a new
         transaction.
         """
-        self.txn = self.addressbookStore.newTransaction()
+        self.txn = self.addressbookStore.newTransaction(self.id())
         self.home1 = self.txn.addressbookHomeWithUID("home1")
         self.addressbook1 = self.home1.addressbookWithName("addressbook_1")
 
@@ -305,6 +306,7 @@
             "sample.vcf",
             VComponent.fromString(vcard4_text)
         )
+        self.txn.abort()
         self._refresh()
         self.assertIdentical(
             self.addressbook1.addressbookObjectWithName("sample.vcf"),
@@ -361,6 +363,7 @@
             modifiedComponent,
             self.addressbook1.addressbookObjectWithName("1.vcf").component()
         )
+        self.txn.commit()
 
 
     @featureUnimplemented
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100922/3429ca65/attachment.html>


More information about the calendarserver-changes mailing list