[CalendarServer-changes] [4989] CalendarServer/trunk/txcaldav

source_changes at macosforge.org source_changes at macosforge.org
Fri Jan 29 16:02:49 PST 2010


Revision: 4989
          http://trac.macosforge.org/projects/calendarserver/changeset/4989
Author:   wsanchez at apple.com
Date:     2010-01-29 16:02:49 -0800 (Fri, 29 Jan 2010)
Log Message:
-----------
Add file calendar store, tests.

Added Paths:
-----------
    CalendarServer/trunk/txcaldav/calendarstore/
    CalendarServer/trunk/txcaldav/calendarstore/__init__.py
    CalendarServer/trunk/txcaldav/calendarstore/file.py
    CalendarServer/trunk/txcaldav/calendarstore/test/
    CalendarServer/trunk/txcaldav/calendarstore/test/__init__.py
    CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/
    CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/
    CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_1/
    CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_1/1b5b7348a80950dcf567e904943949d3.ics
    CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_1/2dc69bdb048b56b81697c87093f4d115.ics
    CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_1/6d9700c01f2f360adb285ce7b4c0dab3.ics
    CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/
    CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/24204e8682b99527cbda64d7423acda7.ics
    CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/61038c41bd02ae5daf9f7fe9d54199fd.ics
    CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/84be58ced1f1bb34057e1bd7e602c9c8.ics
    CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/acc1015b7dc300c1b5665f6833960994.ics
    CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/b0d5785f275c064117ffd1fc20f4ed40.ics
    CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/b495c5dd5aa53392078eb43b1f906a80.ics
    CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/b88dd50941e4a31520ee396fd7894c96.ics
    CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_empty/
    CalendarServer/trunk/txcaldav/calendarstore/test/file.py

Added: CalendarServer/trunk/txcaldav/calendarstore/__init__.py
===================================================================
--- CalendarServer/trunk/txcaldav/calendarstore/__init__.py	                        (rev 0)
+++ CalendarServer/trunk/txcaldav/calendarstore/__init__.py	2010-01-30 00:02:49 UTC (rev 4989)
@@ -0,0 +1,19 @@
+##
+# Copyright (c) 2010 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+"""
+Calendar stores.
+"""

Added: CalendarServer/trunk/txcaldav/calendarstore/file.py
===================================================================
--- CalendarServer/trunk/txcaldav/calendarstore/file.py	                        (rev 0)
+++ CalendarServer/trunk/txcaldav/calendarstore/file.py	2010-01-30 00:02:49 UTC (rev 4989)
@@ -0,0 +1,190 @@
+##
+# Copyright (c) 2010 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+"""
+File calendar store.
+"""
+
+__all__ = [
+    "CalendarStore",
+    "CalendarHome",
+    "Calendar",
+    "CalendarObject",
+]
+
+from zope.interface import implements
+
+from twisted.python.filepath import FilePath
+
+from twext.log import LoggingMixIn
+
+from txcaldav.icalendarstore import ICalendarHome, ICalendar, ICalendarObject
+#from txcaldav.icalendarstore import CalendarStoreError
+#from txcaldav.icalendarstore import AlreadyExistsError
+#from txcaldav.icalendarstore import CalendarAlreadyExistsError
+#from txcaldav.icalendarstore import CalendarObjectNameAlreadyExistsError
+#from txcaldav.icalendarstore import CalendarObjectUIDAlreadyExistsError
+from txcaldav.icalendarstore import NotFoundError
+#from txcaldav.icalendarstore import NoSuchCalendarError
+#from txcaldav.icalendarstore import NoSuchCalendarObjectError
+#from txcaldav.icalendarstore import InvalidCalendarComponentError
+
+
+class CalendarStore(LoggingMixIn):
+    # FIXME: Do we need an interface?
+
+    calendarHomeClass = property(lambda _: CalendarHome)
+
+    def __init__(self, path):
+        """
+        @param path: a L{FilePath}
+        """
+        self.path = path
+
+        if not path.isdir():
+            # FIXME: If we add a CalendarStore interface, this should
+            # be CalendarStoreNotFoundError.
+            raise NotFoundError("No such calendar store")
+
+    def __str__(self):
+        return "<%s: %s>" % (self.__class__, self.path)
+
+    def calendarHomeWithUID(self, uid):
+        return CalendarHome(self.path.child(uid), self)
+
+
+class CalendarHome(LoggingMixIn):
+    implements(ICalendarHome)
+
+    calendarClass = property(lambda _: Calendar)
+
+    def __init__(self, path, calendarStore):
+        self.path = path
+        self.calendarStore = calendarStore
+
+    def __str__(self):
+        return "<%s: %s>" % (self.__class__, self.path)
+
+    def uid(self):
+        return self.path.basename()
+
+    def calendars(self):
+        return (
+            self.calendarWithName(name)
+            for name in self.path.listdir()
+            if not name.startswith(".")
+        )
+
+    def calendarWithName(self, name):
+        return Calendar(self.path.child(name), self)
+
+    def createCalendarWithName(self, name):
+        raise NotImplementedError()
+
+    def removeCalendarWithName(self, name):
+        raise NotImplementedError()
+
+    def properties(self):
+        raise NotImplementedError()
+
+
+class Calendar(LoggingMixIn):
+    implements(ICalendar)
+
+    calendarObjectClass = property(lambda _: CalendarObject)
+
+    def __init__(self, path, calendarHome):
+        self.path = path
+        self.calendarHome = calendarHome
+
+    def __str__(self):
+        return "<%s: %s>" % (self.__class__, self.path)
+
+    def name(self):
+        return self.path.basename()
+
+    def ownerCalendarHome(self):
+        return self.calendarHome
+
+    def calendarObjects(self):
+        return (
+            self.calendarObjectWithName(name)
+            for name in self.path.listdir()
+            if not name.startswith(".")
+        )
+
+    def calendarObjectWithName(self, name):
+        return CalendarObject(self.path.child(name), self)
+
+    def calendarObjectWithUID(self, uid):
+        raise NotImplementedError()
+
+    def createCalendarObjectWithName(self, name, component):
+        raise NotImplementedError()
+
+    def removeCalendarComponentWithName(self, name):
+        raise NotImplementedError()
+
+    def removeCalendarComponentWithUID(self, uid):
+        raise NotImplementedError()
+
+    def syncToken(self):
+        raise NotImplementedError()
+
+    def calendarObjectsInTimeRange(self, start, end, timeZone):
+        raise NotImplementedError()
+
+    def calendarObjectsSinceToken(self, token):
+        raise NotImplementedError()
+
+    def properties(self):
+        raise NotImplementedError()
+
+
+class CalendarObject(LoggingMixIn):
+    implements(ICalendarObject)
+
+    def __init__(self, path, calendar):
+        self.path = path
+        self.calendar = calendar
+
+    def __str__(self):
+        return "<%s: %s>" % (self.__class__, self.path)
+
+    def name(self):
+        return self.path.basename()
+
+    def setComponent(self, component):
+        raise NotImplementedError()
+
+    def component(self):
+        raise NotImplementedError()
+
+    def iCalendarText(self):
+        raise NotImplementedError()
+
+    def uid(self):
+        raise NotImplementedError()
+
+    def componentType(self):
+        raise NotImplementedError()
+
+    def organizer(self):
+        # FIXME: Ideally should return a URI object
+        raise NotImplementedError()
+
+    def properties(self):
+        raise NotImplementedError()

Added: CalendarServer/trunk/txcaldav/calendarstore/test/__init__.py
===================================================================
--- CalendarServer/trunk/txcaldav/calendarstore/test/__init__.py	                        (rev 0)
+++ CalendarServer/trunk/txcaldav/calendarstore/test/__init__.py	2010-01-30 00:02:49 UTC (rev 4989)
@@ -0,0 +1,19 @@
+##
+# Copyright (c) 2010 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+"""
+Calendar store tests.
+"""

Added: CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_1/1b5b7348a80950dcf567e904943949d3.ics
===================================================================
--- CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_1/1b5b7348a80950dcf567e904943949d3.ics	                        (rev 0)
+++ CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_1/1b5b7348a80950dcf567e904943949d3.ics	2010-01-30 00:02:49 UTC (rev 4989)
@@ -0,0 +1,48 @@
+BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Cyrusoft International\, Inc.//Mulberry v4.0//EN
+BEGIN:VTIMEZONE
+TZID:US/Eastern
+LAST-MODIFIED:20040110T032845Z
+BEGIN:STANDARD
+DTSTART:20001026T020000
+RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
+TZNAME:EST
+TZOFFSETFROM:-0400
+TZOFFSETTO:-0500
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:20000404T020000
+RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
+TZNAME:EDT
+TZOFFSETFROM:-0500
+TZOFFSETTO:-0400
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:F5B811E00073B22BA6B87562-%ctr at ninevah.local
+DTSTART;TZID=US/Eastern:20060102T180000
+DURATION:PT1H
+CREATED:20060102T230000Z
+DTSTAMP:20051222T210507Z
+RRULE:FREQ=DAILY;COUNT=5
+SUMMARY:event 7-%ctr
+BEGIN:VALARM
+ACTION:AUDIO
+TRIGGER;RELATED=START:-PT10M
+X-MULBERRY-ALARM-STATUS:PENDING
+X-MULBERRY-SPEAK-TEXT:
+END:VALARM
+END:VEVENT
+BEGIN:VEVENT
+UID:F5B811E00073B22BA6B87562-%ctr at ninevah.local
+RECURRENCE-ID;TZID=US/Eastern;RANGE=THISANDFUTURE:20060104T180000
+DTSTART;TZID=US/Eastern:20060104T200000
+DURATION:PT1H
+CREATED:20060102T230000Z
+DESCRIPTION:Some notes
+DTSTAMP:20051222T210507Z
+SUMMARY:event 7-%ctr changed
+END:VEVENT
+END:VCALENDAR

Added: CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_1/2dc69bdb048b56b81697c87093f4d115.ics
===================================================================
--- CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_1/2dc69bdb048b56b81697c87093f4d115.ics	                        (rev 0)
+++ CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_1/2dc69bdb048b56b81697c87093f4d115.ics	2010-01-30 00:02:49 UTC (rev 4989)
@@ -0,0 +1,48 @@
+BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Cyrusoft International\, Inc.//Mulberry v4.0//EN
+BEGIN:VTIMEZONE
+TZID:US/Eastern
+LAST-MODIFIED:20040110T032845Z
+BEGIN:STANDARD
+DTSTART:20001026T020000
+RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
+TZNAME:EST
+TZOFFSETFROM:-0400
+TZOFFSETTO:-0500
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:20000404T020000
+RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
+TZNAME:EDT
+TZOFFSETFROM:-0500
+TZOFFSETTO:-0400
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:F5B811E00073B22BA6B87551-%ctr at ninevah.local
+DTSTART;TZID=US/Eastern:20060102T140000
+DURATION:PT1H
+CREATED:20060102T190000Z
+DTSTAMP:20051222T210507Z
+RRULE:FREQ=DAILY;COUNT=5
+SUMMARY:event 6-%ctr
+END:VEVENT
+BEGIN:VEVENT
+UID:F5B811E00073B22BA6B87551-%ctr at ninevah.local
+RECURRENCE-ID;TZID=US/Eastern:20060104T140000
+DTSTART;TZID=US/Eastern:20060104T160000
+DURATION:PT1H
+CREATED:20060102T190000Z
+DESCRIPTION:Some notes
+DTSTAMP:20051222T210507Z
+SUMMARY:event 6-%ctr changed
+BEGIN:VALARM
+ACTION:AUDIO
+TRIGGER;RELATED=START:-PT10M
+X-MULBERRY-ALARM-STATUS:PENDING
+X-MULBERRY-SPEAK-TEXT:
+END:VALARM
+END:VEVENT
+END:VCALENDAR

Added: CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_1/6d9700c01f2f360adb285ce7b4c0dab3.ics
===================================================================
--- CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_1/6d9700c01f2f360adb285ce7b4c0dab3.ics	                        (rev 0)
+++ CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_1/6d9700c01f2f360adb285ce7b4c0dab3.ics	2010-01-30 00:02:49 UTC (rev 4989)
@@ -0,0 +1,33 @@
+BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Cyrusoft International\, Inc.//Mulberry v4.0//EN
+BEGIN:VTIMEZONE
+TZID:US/Pacific
+LAST-MODIFIED:20040110T032845Z
+BEGIN:STANDARD
+DTSTART:20001026T020000
+RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
+TZNAME:PST
+TZOFFSETFROM:-0700
+TZOFFSETTO:-0800
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:20000404T020000
+RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
+TZNAME:PDT
+TZOFFSETFROM:-0800
+TZOFFSETTO:-0700
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:DB3F97EF10A051730E2F752E-%ctr at ninevah.local
+DTSTART;TZID=US/Pacific:20060101T130000
+DURATION:PT1H
+CREATED:20060101T210000Z
+DTSTAMP:20051222T210146Z
+LAST-MODIFIED:20051222T210203Z
+SEQUENCE:1
+SUMMARY:event 3-%ctr
+END:VEVENT
+END:VCALENDAR

Added: CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/24204e8682b99527cbda64d7423acda7.ics
===================================================================
--- CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/24204e8682b99527cbda64d7423acda7.ics	                        (rev 0)
+++ CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/24204e8682b99527cbda64d7423acda7.ics	2010-01-30 00:02:49 UTC (rev 4989)
@@ -0,0 +1,32 @@
+BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Cyrusoft International\, Inc.//Mulberry v4.0//EN
+BEGIN:VTIMEZONE
+TZID:US/Mountain
+LAST-MODIFIED:20040110T032845Z
+BEGIN:STANDARD
+DTSTART:20001026T020000
+RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
+TZNAME:MST
+TZOFFSETFROM:-0600
+TZOFFSETTO:-0700
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:20000404T020000
+RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
+TZNAME:MDT
+TZOFFSETFROM:-0700
+TZOFFSETTO:-0600
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:9A6519F71822CD45840C3440-%ctr at ninevah.local
+DTSTART;TZID=US/Mountain:20060101T110000
+DURATION:PT1H
+CREATED:20060101T160000Z
+DESCRIPTION:Some notes
+DTSTAMP:20051222T210052Z
+SUMMARY:event 2-%ctr
+END:VEVENT
+END:VCALENDAR

Added: CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/61038c41bd02ae5daf9f7fe9d54199fd.ics
===================================================================
--- CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/61038c41bd02ae5daf9f7fe9d54199fd.ics	                        (rev 0)
+++ CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/61038c41bd02ae5daf9f7fe9d54199fd.ics	2010-01-30 00:02:49 UTC (rev 4989)
@@ -0,0 +1,31 @@
+BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Cyrusoft International\, Inc.//Mulberry v4.0//EN
+BEGIN:VTIMEZONE
+TZID:US/Eastern
+LAST-MODIFIED:20040110T032845Z
+BEGIN:STANDARD
+DTSTART:20001026T020000
+RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
+TZNAME:EST
+TZOFFSETFROM:-0400
+TZOFFSETTO:-0500
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:20000404T020000
+RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
+TZNAME:EDT
+TZOFFSETFROM:-0500
+TZOFFSETTO:-0400
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:54E181BC7CCC373042B28842-%ctr at ninevah.local
+DTSTART;TZID=US/Eastern:20060101T100000
+DURATION:PT1H
+CREATED:20060101T150000Z
+DTSTAMP:20051222T205953Z
+SUMMARY:event 1-%ctr
+END:VEVENT
+END:VCALENDAR

Added: CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/84be58ced1f1bb34057e1bd7e602c9c8.ics
===================================================================
--- CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/84be58ced1f1bb34057e1bd7e602c9c8.ics	                        (rev 0)
+++ CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/84be58ced1f1bb34057e1bd7e602c9c8.ics	2010-01-30 00:02:49 UTC (rev 4989)
@@ -0,0 +1,31 @@
+BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Cyrusoft International\, Inc.//Mulberry v4.0//EN
+BEGIN:VTIMEZONE
+TZID:US/Eastern
+LAST-MODIFIED:20040110T032845Z
+BEGIN:STANDARD
+DTSTART:20001026T020000
+RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
+TZNAME:EST
+TZOFFSETFROM:-0400
+TZOFFSETTO:-0500
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:20000404T020000
+RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
+TZNAME:EDT
+TZOFFSETFROM:-0500
+TZOFFSETTO:-0400
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:54E181BC7CCC373042B28842-8-%ctr at ninevah.local
+DTSTART;TZID=US/Eastern:20060107T100000
+DURATION:PT1H
+CREATED:20060101T150000Z
+DTSTAMP:20051222T205953Z
+SUMMARY:event 8-%ctr
+END:VEVENT
+END:VCALENDAR

Added: CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/acc1015b7dc300c1b5665f6833960994.ics
===================================================================
--- CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/acc1015b7dc300c1b5665f6833960994.ics	                        (rev 0)
+++ CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/acc1015b7dc300c1b5665f6833960994.ics	2010-01-30 00:02:49 UTC (rev 4989)
@@ -0,0 +1,31 @@
+BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Cyrusoft International\, Inc.//Mulberry v4.0//EN
+BEGIN:VTIMEZONE
+TZID:US/Eastern
+LAST-MODIFIED:20040110T032845Z
+BEGIN:STANDARD
+DTSTART:20001026T020000
+RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
+TZNAME:EST
+TZOFFSETFROM:-0400
+TZOFFSETTO:-0500
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:20000404T020000
+RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
+TZNAME:EDT
+TZOFFSETFROM:-0500
+TZOFFSETTO:-0400
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:54E181BC7CCC373042B28842-9-%ctr at ninevah.local
+DTSTART;TZID=US/Eastern:20060107T103000
+DURATION:PT1H
+CREATED:20060101T150000Z
+DTSTAMP:20051222T205953Z
+SUMMARY:event 9-%ctr
+END:VEVENT
+END:VCALENDAR

Added: CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/b0d5785f275c064117ffd1fc20f4ed40.ics
===================================================================
--- CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/b0d5785f275c064117ffd1fc20f4ed40.ics	                        (rev 0)
+++ CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/b0d5785f275c064117ffd1fc20f4ed40.ics	2010-01-30 00:02:49 UTC (rev 4989)
@@ -0,0 +1,39 @@
+BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Cyrusoft International\, Inc.//Mulberry v4.0//EN
+BEGIN:VTIMEZONE
+TZID:US/Eastern
+LAST-MODIFIED:20040110T032845Z
+BEGIN:STANDARD
+DTSTART:20001026T020000
+RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
+TZNAME:EST
+TZOFFSETFROM:-0400
+TZOFFSETTO:-0500
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:20000404T020000
+RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
+TZNAME:EDT
+TZOFFSETFROM:-0500
+TZOFFSETTO:-0400
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:A3217B429B4D2FF2DC2EEE66-%ctr at ninevah.local
+DTSTART;TZID=US/Eastern:20060101T180000
+DURATION:PT1H
+CREATED:20060101T230000Z
+DTSTAMP:20051222T210310Z
+SUMMARY:event 4-%ctr
+BEGIN:VALARM
+ACTION:AUDIO
+DURATION:PT10M
+REPEAT:5
+TRIGGER;RELATED=START:-PT1H
+X-MULBERRY-ALARM-STATUS:PENDING
+X-MULBERRY-SPEAK-TEXT:
+END:VALARM
+END:VEVENT
+END:VCALENDAR

Added: CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/b495c5dd5aa53392078eb43b1f906a80.ics
===================================================================
--- CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/b495c5dd5aa53392078eb43b1f906a80.ics	                        (rev 0)
+++ CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/b495c5dd5aa53392078eb43b1f906a80.ics	2010-01-30 00:02:49 UTC (rev 4989)
@@ -0,0 +1,38 @@
+BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Cyrusoft International\, Inc.//Mulberry v4.0//EN
+BEGIN:VTIMEZONE
+TZID:US/Eastern
+LAST-MODIFIED:20040110T032845Z
+BEGIN:STANDARD
+DTSTART:20001026T020000
+RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
+TZNAME:EST
+TZOFFSETFROM:-0400
+TZOFFSETTO:-0500
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:20000404T020000
+RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
+TZNAME:EDT
+TZOFFSETFROM:-0500
+TZOFFSETTO:-0400
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:945113826375CBB89184DC36-%ctr at ninevah.local
+DTSTART;TZID=US/Eastern:20060102T100000
+DURATION:PT1H
+CREATED:20060102T150000Z
+DTSTAMP:20051222T210412Z
+RRULE:FREQ=DAILY;COUNT=5
+SUMMARY:event 5-%ctr
+BEGIN:VALARM
+ACTION:AUDIO
+TRIGGER;RELATED=START:-PT10M
+X-MULBERRY-ALARM-STATUS:PENDING
+X-MULBERRY-SPEAK-TEXT:
+END:VALARM
+END:VEVENT
+END:VCALENDAR

Added: CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/b88dd50941e4a31520ee396fd7894c96.ics
===================================================================
--- CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/b88dd50941e4a31520ee396fd7894c96.ics	                        (rev 0)
+++ CalendarServer/trunk/txcaldav/calendarstore/test/calendar_store/home1/calendar_2/b88dd50941e4a31520ee396fd7894c96.ics	2010-01-30 00:02:49 UTC (rev 4989)
@@ -0,0 +1,31 @@
+BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Cyrusoft International\, Inc.//Mulberry v4.0//EN
+BEGIN:VTIMEZONE
+TZID:US/Eastern
+LAST-MODIFIED:20040110T032845Z
+BEGIN:STANDARD
+DTSTART:20001026T020000
+RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
+TZNAME:EST
+TZOFFSETFROM:-0400
+TZOFFSETTO:-0500
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:20000404T020000
+RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
+TZNAME:EDT
+TZOFFSETFROM:-0500
+TZOFFSETTO:-0400
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:54E181BC7CCC373042B28842-10-%ctr at ninevah.local
+DTSTART;TZID=US/Eastern:20060108T100000
+DURATION:PT1H
+CREATED:20060101T150000Z
+DTSTAMP:20051222T205953Z
+SUMMARY:event 10-%ctr
+END:VEVENT
+END:VCALENDAR

Added: CalendarServer/trunk/txcaldav/calendarstore/test/file.py
===================================================================
--- CalendarServer/trunk/txcaldav/calendarstore/test/file.py	                        (rev 0)
+++ CalendarServer/trunk/txcaldav/calendarstore/test/file.py	2010-01-30 00:02:49 UTC (rev 4989)
@@ -0,0 +1,209 @@
+##
+# Copyright (c) 2010 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+"""
+File calendar store tests.
+"""
+
+import os
+
+from zope.interface.verify import verifyObject, BrokenMethodImplementation
+
+from twisted.python.filepath import FilePath
+from twisted.trial import unittest
+
+from txdav.idav import IPropertyStore
+
+from txcaldav.icalendarstore import ICalendarHome
+from txcaldav.icalendarstore import ICalendar
+from txcaldav.icalendarstore import ICalendarObject
+
+from txcaldav.calendarstore.file import CalendarStore
+from txcaldav.calendarstore.file import CalendarHome
+from txcaldav.calendarstore.file import Calendar
+from txcaldav.calendarstore.file import CalendarObject
+
+storePath = FilePath(__file__).parent().child("calendar_store")
+
+home1_calendarNames = (
+    "calendar_1",
+    "calendar_2",
+    "calendar_empty",
+)
+
+calendar1_objectNames = (
+    "1b5b7348a80950dcf567e904943949d3.ics",
+    "2dc69bdb048b56b81697c87093f4d115.ics",
+    "6d9700c01f2f360adb285ce7b4c0dab3.ics",
+)
+
+class CalendarStoreTest(unittest.TestCase):
+    def setUp(self):
+        self.calendarStore = CalendarStore(storePath)
+
+    # FIXME: If we define an interface
+    #def test_interface(self):
+    #    try:
+    #        verifyObject(ICalendarStore, self.calendarstore)
+    #    except BrokenMethodImplementation, e:
+    #        self.fail(e)
+
+    def test_init(self):
+        assert isinstance(self.calendarStore.path, FilePath), self.calendarStore.path
+
+    def test_calendarHomeWithUID(self):
+        calendarHome = self.calendarStore.calendarHomeWithUID("home1")
+
+        assert isinstance(calendarHome, CalendarHome)
+
+
+class CalendarHomeTest(unittest.TestCase):
+    def setUp(self):
+        self.calendarStore = CalendarStore(storePath)
+        self.home1 = self.calendarStore.calendarHomeWithUID("home1")
+
+    def test_interface(self):
+        try:
+            verifyObject(ICalendarHome, self.home1)
+        except BrokenMethodImplementation, e:
+            self.fail(e)
+
+    def test_init(self):
+        self.failUnless(
+            isinstance(self.home1.path, FilePath),
+            self.home1.path
+        )
+        self.assertEquals(
+            self.home1.calendarStore,
+            self.calendarStore
+        )
+
+    def test_uid(self):
+        self.assertEquals(self.home1.uid(), "home1")
+
+    def test_calendars(self):
+        calendars = tuple(self.home1.calendars())
+
+        for calendar in calendars:
+            self.failUnless(isinstance(calendar, Calendar))
+
+        self.assertEquals(
+            tuple(c.name() for c in calendars),
+            home1_calendarNames
+        )
+
+    def test_calendarWithName(self):
+        for name in home1_calendarNames:
+            calendar = self.home1.calendarWithName(name)
+            self.failUnless(isinstance(calendar, Calendar))
+            self.assertEquals(calendar.name(), name)
+
+    def test_createCalendarWithName(self):
+        raise NotImplementedError()
+    test_createCalendarWithName.todo = "Unimplemented"
+
+    def test_removeCalendarWithName(self):
+        raise NotImplementedError()
+    test_removeCalendarWithName.todo = "Unimplemented"
+
+    def test_properties(self):
+        properties = self.home1.properties()
+
+        # FIXME: check specific class later?
+        self.failUnless(IPropertyStore.providedBy(properties))
+    test_properties.todo = "Unimplemented"
+
+
+class CalendarTest(unittest.TestCase):
+    def setUp(self):
+        self.calendarStore = CalendarStore(storePath)
+        self.home1 = self.calendarStore.calendarHomeWithUID("home1")
+        self.calendar1 = self.home1.calendarWithName("calendar_1")
+
+    def test_interface(self):
+        try:
+            verifyObject(ICalendar, self.calendar1)
+        except BrokenMethodImplementation, e:
+            self.fail(e)
+
+    def test_init(self):
+        self.failUnless(
+            isinstance(self.calendar1.path, FilePath),
+            self.calendar1
+        )
+        self.failUnless(
+            isinstance(self.calendar1.calendarHome, CalendarHome),
+            self.calendar1.calendarHome
+        )
+
+    def test_name(self):
+        self.assertEquals(self.calendar1.name(), "calendar_1")
+
+    def test_ownerCalendarHome(self):
+        # Note that here we know that home1 owns calendar1
+        self.assertEquals(
+            self.calendar1.ownerCalendarHome().uid(),
+            self.home1.uid()
+        )
+
+    def test_calendarObjects(self):
+        calendarObjects = tuple(self.calendar1.calendarObjects())
+
+        for calendarObject in calendarObjects:
+            self.failUnless(isinstance(calendarObject, CalendarObject))
+
+        self.assertEquals(
+            tuple(o.name() for o in calendarObjects),
+            calendar1_objectNames
+        )
+
+    def test_calendarObjectWithName(self):
+        for name in calendar1_objectNames:
+            calendarObject = self.calendar1.calendarObjectWithName(name)
+            self.failUnless(isinstance(calendarObject, CalendarObject))
+            self.assertEquals(calendarObject.name(), name)
+
+    def test_calendarObjectWithUID(self):
+        raise NotImplementedError()
+    test_calendarObjectWithUID.todo = "Unimplemented"
+
+    def test_createCalendarObjectWithName(self):
+        raise NotImplementedError()
+    test_createCalendarObjectWithName.todo = "Unimplemented"
+
+    def test_removeCalendarComponentWithName(self):
+        raise NotImplementedError()
+    test_removeCalendarComponentWithName.todo = "Unimplemented"
+
+    def test_removeCalendarComponentWithUID(self):
+        raise NotImplementedError()
+    test_removeCalendarComponentWithUID.todo = "Unimplemented"
+
+    def test_syncToken(self):
+        raise NotImplementedError()
+    test_syncToken.todo = "Unimplemented"
+
+    def test_calendarObjectsInTimeRange(self):
+        raise NotImplementedError()
+    test_calendarObjectsInTimeRange.todo = "Unimplemented"
+
+    def test_calendarObjectsSinceToken(self):
+        raise NotImplementedError()
+    test_calendarObjectsSinceToken.todo = "Unimplemented"
+
+    def test_properties(self):
+        raise NotImplementedError()
+    test_properties.todo = "Unimplemented"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100129/d3c4e803/attachment-0001.html>


More information about the calendarserver-changes mailing list