コード例 #1
0
    def setUp(self):
        """
        Set up two stores to migrate between.
        """

        yield super(HomeMigrationTests, self).setUp()
        yield self.buildStoreAndDirectory(extraUids=(
            u"home1",
            u"home2",
            u"home3",
            u"home_defaults",
            u"home_no_splits",
            u"home_splits",
            u"home_splits_shared",
        ))
        self.sqlStore = self.store

        # Add some files to the file store.

        self.filesPath = CachingFilePath(self.mktemp())
        self.filesPath.createDirectory()
        fileStore = self.fileStore = CommonDataStore(
            self.filesPath, {"push": StubNotifierFactory()}, self.directory,
            True, True)
        self.upgrader = UpgradeToDatabaseStep(self.fileStore, self.sqlStore)

        requirements = CommonTests.requirements
        extras = deriveValue(self, "extraRequirements", lambda t: {})
        requirements = self.mergeRequirements(requirements, extras)

        yield populateCalendarsFrom(requirements, fileStore)
        md5s = CommonTests.md5s
        yield resetCalendarMD5s(md5s, fileStore)
        self.filesPath.child("calendars").child("__uids__").child("ho").child(
            "me").child("home1").child(".some-extra-data").setContent(
                "some extra data")

        requirements = ABCommonTests.requirements
        yield populateAddressBooksFrom(requirements, fileStore)
        md5s = ABCommonTests.md5s
        yield resetAddressBookMD5s(md5s, fileStore)
        self.filesPath.child("addressbooks").child("__uids__").child(
            "ho").child("me").child("home1").child(
                ".some-extra-data").setContent("some extra data")

        # Add some properties we want to check get migrated over
        txn = self.fileStore.newTransaction()
        home = yield txn.calendarHomeWithUID("home_defaults")

        cal = yield home.calendarWithName("calendar_1")
        props = cal.properties()
        props[PropertyName.fromElement(
            caldavxml.SupportedCalendarComponentSet
        )] = caldavxml.SupportedCalendarComponentSet(
            caldavxml.CalendarComponent(name="VEVENT"),
            caldavxml.CalendarComponent(name="VTODO"),
        )
        props[PropertyName.fromElement(
            element.ResourceType)] = element.ResourceType(
                element.Collection(),
                caldavxml.Calendar(),
            )
        props[PropertyName.fromElement(
            customxml.GETCTag)] = customxml.GETCTag.fromString("foobar")

        inbox = yield home.calendarWithName("inbox")
        props = inbox.properties()
        props[PropertyName.fromElement(
            customxml.CalendarAvailability
        )] = customxml.CalendarAvailability.fromString(str(self.av1))
        props[PropertyName.fromElement(
            caldavxml.ScheduleDefaultCalendarURL
        )] = caldavxml.ScheduleDefaultCalendarURL(
            element.HRef.fromString(
                "/calendars/__uids__/home_defaults/calendar_1"), )

        yield txn.commit()
コード例 #2
0
ResourceType.calendarproxywrite = ResourceType(Principal(), Collection(),
                                               CalendarProxyWrite())
ResourceType.calendarproxyreadfor = ResourceType(Principal(), Collection(),
                                                 CalendarProxyReadFor())
ResourceType.calendarproxywritefor = ResourceType(Principal(), Collection(),
                                                  CalendarProxyWriteFor())

ResourceType.timezones = ResourceType(Timezones())

ResourceType.ischeduleinbox = ResourceType(IScheduleInbox())

ResourceType.freebusyurl = ResourceType(FreeBusyURL())

ResourceType.notification = ResourceType(Collection(), Notification())

ResourceType.sharedownercalendar = ResourceType(Collection(),
                                                caldavxml.Calendar(),
                                                SharedOwner())
ResourceType.sharedcalendar = ResourceType(Collection(), caldavxml.Calendar(),
                                           Shared())
ResourceType.sharedowneraddressbook = ResourceType(Collection(),
                                                   carddavxml.AddressBook(),
                                                   SharedOwner())
ResourceType.sharedaddressbook = ResourceType(Collection(),
                                              carddavxml.AddressBook(),
                                              Shared())
ResourceType.sharedownergroup = ResourceType(SharedOwner())
ResourceType.sharedgroup = ResourceType(Shared())

ResourceType.link = ResourceType(Link())
コード例 #3
0
    allowed_attributes = {"context": False}

##
# Extensions to ResourceType
##

ResourceType.dropboxhome = ResourceType(Collection(), DropBoxHome())
ResourceType.dropbox = ResourceType(Collection(), DropBox())

ResourceType.calendarproxyread = ResourceType(Principal(), Collection(), CalendarProxyRead())
ResourceType.calendarproxywrite = ResourceType(Principal(), Collection(), CalendarProxyWrite())
ResourceType.calendarproxyreadfor = ResourceType(Principal(), Collection(), CalendarProxyReadFor())
ResourceType.calendarproxywritefor = ResourceType(Principal(), Collection(), CalendarProxyWriteFor())

ResourceType.timezones = ResourceType(Timezones())

ResourceType.ischeduleinbox = ResourceType(IScheduleInbox())

ResourceType.freebusyurl = ResourceType(FreeBusyURL())

ResourceType.notification = ResourceType(Collection(), Notification())

ResourceType.sharedownercalendar = ResourceType(Collection(), caldavxml.Calendar(), SharedOwner())
ResourceType.sharedcalendar = ResourceType(Collection(), caldavxml.Calendar(), Shared())
ResourceType.sharedowneraddressbook = ResourceType(Collection(), carddavxml.AddressBook(), SharedOwner())
ResourceType.sharedaddressbook = ResourceType(Collection(), carddavxml.AddressBook(), Shared())
ResourceType.sharedownergroup = ResourceType(SharedOwner())
ResourceType.sharedgroup = ResourceType(Shared())

ResourceType.link = ResourceType(Link())