[CalendarServer-changes] [3734] CalendarServer/branches/users/sagen/migration-3709/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Tue Feb 24 17:05:53 PST 2009
Revision: 3734
http://trac.macosforge.org/projects/calendarserver/changeset/3734
Author: sagen at apple.com
Date: 2009-02-24 17:05:53 -0800 (Tue, 24 Feb 2009)
Log Message:
-----------
Verify upgrades work in the case where the calendar homes are already in __uids__/XX/YY/GUID form; plus ignore directories within calendar homes
Modified Paths:
--------------
CalendarServer/branches/users/sagen/migration-3709/twistedcaldav/test/test_upgrade.py
CalendarServer/branches/users/sagen/migration-3709/twistedcaldav/upgrade.py
Modified: CalendarServer/branches/users/sagen/migration-3709/twistedcaldav/test/test_upgrade.py
===================================================================
--- CalendarServer/branches/users/sagen/migration-3709/twistedcaldav/test/test_upgrade.py 2009-02-25 00:37:35 UTC (rev 3733)
+++ CalendarServer/branches/users/sagen/migration-3709/twistedcaldav/test/test_upgrade.py 2009-02-25 01:05:53 UTC (rev 3734)
@@ -491,7 +491,112 @@
upgradeData(config)
self.assertTrue(self.verifyHierarchy(root, after))
+ def test_calendarsUpgradeWithUIDsMultilevel(self):
+ """
+ Verify that calendar homes in the /calendars/__uids__/XX/YY/<guid>/
+ form are upgraded correctly in place
+ """
+ self.setUpXMLDirectory()
+ directory = getDirectory()
+
+ before = {
+ "calendars" :
+ {
+ "__uids__" :
+ {
+ "64" :
+ {
+ "23" :
+ {
+ "6423F94A-6B76-4A3A-815B-D52CFD77935D" :
+ {
+ "calendar" :
+ {
+ "1E238CA1-3C95-4468-B8CD-C8A399F78C72.ics" :
+ {
+ "@contents" : event01_before,
+ "@xattrs" :
+ {
+ md5Attr : "12345",
+ },
+ },
+ "@xattrs" :
+ {
+ cTagAttr : "12345",
+ },
+ },
+ "inbox" :
+ {
+ "@xattrs" :
+ {
+ freeBusyAttr : cPickle.dumps(davxml.WebDAVDocument.fromString("<?xml version='1.0' encoding='UTF-8'?>\r\n<calendar-free-busy-set xmlns='urn:ietf:params:xml:ns:caldav'>\r\n <href xmlns='DAV:'>/calendars/users/wsanchez/calendar</href>\r\n</calendar-free-busy-set>\r\n").root_element),
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ CalendarUserProxyDatabase.dbFilename :
+ {
+ "@contents" : "",
+ }
+ }
+
+ after = {
+ ".calendarserver_version" :
+ {
+ "@contents" : "1",
+ },
+ "calendars" :
+ {
+ "__uids__" :
+ {
+ "64" :
+ {
+ "23" :
+ {
+ "6423F94A-6B76-4A3A-815B-D52CFD77935D" :
+ {
+ "calendar" :
+ {
+ "1E238CA1-3C95-4468-B8CD-C8A399F78C72.ics" :
+ {
+ "@contents" : event01_after,
+ },
+ },
+ "inbox" :
+ {
+ "@xattrs" :
+ {
+ freeBusyAttr : zlib.compress("<?xml version='1.0' encoding='UTF-8'?>\r\n<calendar-free-busy-set xmlns='urn:ietf:params:xml:ns:caldav'>\r\n <href xmlns='DAV:'>/calendars/__uids__/6423F94A-6B76-4A3A-815B-D52CFD77935D/calendar/</href>\r\n</calendar-free-busy-set>\r\n"),
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ CalendarUserProxyDatabase.dbFilename :
+ {
+ "@contents" : "",
+ }
+ }
+
+ root = self.createHierarchy(before)
+
+ config.DocumentRoot = root
+ config.DataRoot = root
+
+ upgradeData(config)
+ self.assertTrue(self.verifyHierarchy(root, after))
+
+ # Ensure that repeating the process doesn't change anything
+ upgradeData(config)
+ self.assertTrue(self.verifyHierarchy(root, after))
+
+
event01_before = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Apple Inc.//iCal 3.0//EN
Modified: CalendarServer/branches/users/sagen/migration-3709/twistedcaldav/upgrade.py
===================================================================
--- CalendarServer/branches/users/sagen/migration-3709/twistedcaldav/upgrade.py 2009-02-25 00:37:35 UTC (rev 3733)
+++ CalendarServer/branches/users/sagen/migration-3709/twistedcaldav/upgrade.py 2009-02-25 01:05:53 UTC (rev 3734)
@@ -94,6 +94,11 @@
continue
resPath = os.path.join(calPath, resource)
+
+ if os.path.isdir(resPath):
+ # Skip directories
+ continue
+
resPathTmp = "%s.tmp" % resPath
log.info("Processing: %s" % (resPath,))
@@ -284,9 +289,6 @@
def upgradeData(config):
- # MOR: Temporary:
- # config.DocumentRoot = "/Users/morgen/Migration/CalendarServer/Documents"
- # config.DataRoot = "/Users/morgen/Migration/CalendarServer/Data"
docRoot = config.DocumentRoot
versionFilePath = os.path.join(docRoot, ".calendarserver_version")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090224/2367d9ab/attachment-0001.html>
More information about the calendarserver-changes
mailing list