[CalendarServer-changes] [8056] CalendarServer/trunk/txdav/caldav/datastore

source_changes at macosforge.org source_changes at macosforge.org
Wed Sep 7 18:49:25 PDT 2011


Revision: 8056
          http://trac.macosforge.org/projects/calendarserver/changeset/8056
Author:   cdaboo at apple.com
Date:     2011-09-07 18:49:24 -0700 (Wed, 07 Sep 2011)
Log Message:
-----------
Fix issue preventing unit test from working with attachments.

Modified Paths:
--------------
    CalendarServer/trunk/txdav/caldav/datastore/test/common.py
    CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py
    CalendarServer/trunk/txdav/caldav/datastore/util.py

Added Paths:
-----------
    CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/
    CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/calendar_1/
    CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/calendar_1/1.ics
    CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/calendar_1/2.ics
    CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/calendar_1/3.ics
    CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/dropbox/
    CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/dropbox/uid1.dropbox/
    CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/dropbox/uid1.dropbox/test.txt
    CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/dropbox/uid2.dropbox/
    CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/dropbox/uid2.dropbox/test.txt

Added: CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/calendar_1/1.ics
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/calendar_1/1.ics	                        (rev 0)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/calendar_1/1.ics	2011-09-08 01:49:24 UTC (rev 8056)
@@ -0,0 +1,32 @@
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Apple Inc.//iCal 4.0.1//EN
+CALSCALE:GREGORIAN
+BEGIN:VTIMEZONE
+TZID:US/Pacific
+BEGIN:DAYLIGHT
+TZOFFSETFROM:-0800
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
+DTSTART:20070311T020000
+TZNAME:PDT
+TZOFFSETTO:-0700
+END:DAYLIGHT
+BEGIN:STANDARD
+TZOFFSETFROM:-0700
+RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
+DTSTART:20071104T020000
+TZNAME:PST
+TZOFFSETTO:-0800
+END:STANDARD
+END:VTIMEZONE
+BEGIN:VEVENT
+DTEND;TZID=US/Pacific:20090324T124500
+UID:uid1
+DTSTAMP:20090326T145447Z
+X-APPLE-DROPBOX:/calendars/__uids__/user01/dropbox/uid1.dropbox
+ATTACH;VALUE=URI:/calendars/__uids__/user01/dropbox/uid1.dropbox/test.txt
+SUMMARY:CalDAV protocol updates
+DTSTART;TZID=US/Pacific:20090324T121500
+CREATED:20090326T145440Z
+END:VEVENT
+END:VCALENDAR

Added: CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/calendar_1/2.ics
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/calendar_1/2.ics	                        (rev 0)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/calendar_1/2.ics	2011-09-08 01:49:24 UTC (rev 8056)
@@ -0,0 +1,32 @@
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Apple Inc.//iCal 4.0.1//EN
+CALSCALE:GREGORIAN
+BEGIN:VTIMEZONE
+TZID:US/Pacific
+BEGIN:DAYLIGHT
+TZOFFSETFROM:-0800
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
+DTSTART:20070311T020000
+TZNAME:PDT
+TZOFFSETTO:-0700
+END:DAYLIGHT
+BEGIN:STANDARD
+TZOFFSETFROM:-0700
+RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
+DTSTART:20071104T020000
+TZNAME:PST
+TZOFFSETTO:-0800
+END:STANDARD
+END:VTIMEZONE
+BEGIN:VEVENT
+DTEND;TZID=US/Pacific:20090324T124500
+UID:uid2
+DTSTAMP:20090326T145447Z
+X-APPLE-DROPBOX:/calendars/__uids__/user01/dropbox/uid2.dropbox
+ATTACH;VALUE=URI:/calendars/__uids__/user01/dropbox/uid2.dropbox/test.txt
+SUMMARY:CalDAV protocol updates
+DTSTART;TZID=US/Pacific:20090324T121500
+CREATED:20090326T145440Z
+END:VEVENT
+END:VCALENDAR

Added: CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/calendar_1/3.ics
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/calendar_1/3.ics	                        (rev 0)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/calendar_1/3.ics	2011-09-08 01:49:24 UTC (rev 8056)
@@ -0,0 +1,32 @@
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Apple Inc.//iCal 4.0.1//EN
+CALSCALE:GREGORIAN
+BEGIN:VTIMEZONE
+TZID:US/Pacific
+BEGIN:DAYLIGHT
+TZOFFSETFROM:-0800
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
+DTSTART:20070311T020000
+TZNAME:PDT
+TZOFFSETTO:-0700
+END:DAYLIGHT
+BEGIN:STANDARD
+TZOFFSETFROM:-0700
+RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
+DTSTART:20071104T020000
+TZNAME:PST
+TZOFFSETTO:-0800
+END:STANDARD
+END:VTIMEZONE
+BEGIN:VEVENT
+DTEND;TZID=US/Pacific:20090324T124500
+UID:uid3
+DTSTAMP:20090326T145447Z
+X-APPLE-DROPBOX:/calendars/__uids__/user01/dropbox/uid2.dropbox
+ATTACH;VALUE=URI:/calendars/__uids__/user01/dropbox/uid2.dropbox/test.txt
+SUMMARY:CalDAV protocol updates
+DTSTART;TZID=US/Pacific:20090324T121500
+CREATED:20090326T145440Z
+END:VEVENT
+END:VCALENDAR

Added: CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/dropbox/uid1.dropbox/test.txt
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/dropbox/uid1.dropbox/test.txt	                        (rev 0)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/dropbox/uid1.dropbox/test.txt	2011-09-08 01:49:24 UTC (rev 8056)
@@ -0,0 +1 @@
+Test attachment.

Added: CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/dropbox/uid2.dropbox/test.txt
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/dropbox/uid2.dropbox/test.txt	                        (rev 0)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/calendar_store/ho/me/home_attachments/dropbox/uid2.dropbox/test.txt	2011-09-08 01:49:24 UTC (rev 8056)
@@ -0,0 +1 @@
+Test attachment.

Modified: CalendarServer/trunk/txdav/caldav/datastore/test/common.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/test/common.py	2011-09-07 18:12:18 UTC (rev 8055)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/common.py	2011-09-08 01:49:24 UTC (rev 8056)
@@ -1855,8 +1855,7 @@
             if self.requirements[uid] is not None
         ])
         additionalUIDs.add("home_bad")
+        additionalUIDs.add("home_attachments")
         expectedUIDs = additionalUIDs.union(requiredUIDs)
         self.assertEquals(foundUIDs, expectedUIDs)
 
-
-

Modified: CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py	2011-09-07 18:12:18 UTC (rev 8055)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py	2011-09-08 01:49:24 UTC (rev 8056)
@@ -171,6 +171,22 @@
 
 
     @inlineCallbacks
+    def test_migrateDuplicateAttachmentsCalendarFromFile(self):
+        """
+        C{_migrateCalendar()} can migrate a file-backed calendar to a database-
+        backed calendar. We need to test what happens when migrating attachments.
+        """
+        fromCalendar = yield (yield self.fileTransaction().calendarHomeWithUID(
+            "home_attachments")).calendarWithName("calendar_1")
+        toHome = yield self.transactionUnderTest().calendarHomeWithUID(
+            "home_attachments", create=True)
+        toCalendar = yield toHome.calendarWithName("calendar")
+        ok, bad = (yield _migrateCalendar(fromCalendar, toCalendar,
+                               lambda x: x.component()))
+        self.assertEqual(ok, 3)
+        self.assertEqual(bad, 0)
+
+    @inlineCallbacks
     def test_migrateHomeFromFile(self):
         """
         L{migrateHome} will migrate an L{ICalendarHome} provider from one

Modified: CalendarServer/trunk/txdav/caldav/datastore/util.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/util.py	2011-09-07 18:12:18 UTC (rev 8055)
+++ CalendarServer/trunk/txdav/caldav/datastore/util.py	2011-09-08 01:49:24 UTC (rev 8056)
@@ -249,9 +249,10 @@
     def dataReceived(self, data):
         self.storeTransport.write(data)
 
+    @inlineCallbacks
     def connectionLost(self, reason):
         try:
-            self.storeTransport.loseConnection()
+            yield self.storeTransport.loseConnection()
         except:
             self.done.errback()
         else:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110907/28195f8f/attachment-0001.html>


More information about the calendarserver-changes mailing list