[CalendarServer-changes] [15143] CalendarServer/trunk/txdav

source_changes at macosforge.org source_changes at macosforge.org
Tue Sep 22 07:17:15 PDT 2015


Revision: 15143
          http://trac.calendarserver.org//changeset/15143
Author:   cdaboo at apple.com
Date:     2015-09-22 07:17:15 -0700 (Tue, 22 Sep 2015)
Log Message:
-----------
Make sure notification collection child object names always have a .xml suffix.

Modified Paths:
--------------
    CalendarServer/trunk/txdav/caldav/datastore/test/test_sql_external.py
    CalendarServer/trunk/txdav/caldav/datastore/test/test_sql_sharing.py
    CalendarServer/trunk/txdav/carddav/datastore/test/test_sql_sharing.py
    CalendarServer/trunk/txdav/common/datastore/sql_notification.py
    CalendarServer/trunk/txdav/who/test/test_group_sharees.py

Modified: CalendarServer/trunk/txdav/caldav/datastore/test/test_sql_external.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/test/test_sql_external.py	2015-09-21 14:34:01 UTC (rev 15142)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/test_sql_external.py	2015-09-22 14:17:15 UTC (rev 15143)
@@ -130,7 +130,7 @@
 
         notifyHome = yield self.theTransactionUnderTest(1).notificationsWithUID("puser02")
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(notifications, [inviteUID, ])
+        self.assertEqual(notifications, [inviteUID + ".xml", ])
         yield self.commitTransaction(1)
 
         # Uninvite
@@ -199,7 +199,7 @@
 
         notifyHome = yield self.theTransactionUnderTest(0).notificationsWithUID("user01")
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(notifications, [inviteUID + "-reply", ])
+        self.assertEqual(notifications, [inviteUID + "-reply.xml", ])
 
         calendar = yield self.calendarUnderTest(txn=self.theTransactionUnderTest(0), home="user01", name="calendar")
         self.assertTrue(calendar.isShared())
@@ -217,7 +217,7 @@
 
         notifyHome = yield self.theTransactionUnderTest(0).notificationsWithUID("user01")
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(notifications, [inviteUID + "-reply", ])
+        self.assertEqual(notifications, [inviteUID + "-reply.xml", ])
 
         calendar = yield self.calendarUnderTest(txn=self.theTransactionUnderTest(0), home="user01", name="calendar")
         self.assertTrue(calendar.isShared())
@@ -266,7 +266,7 @@
 
         notifyHome = yield self.theTransactionUnderTest(0).notificationsWithUID("user01")
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(notifications, [inviteUID + "-reply", ])
+        self.assertEqual(notifications, [inviteUID + "-reply.xml", ])
 
         calendar = yield self.calendarUnderTest(txn=self.theTransactionUnderTest(0), home="user01", name="calendar")
         self.assertTrue(calendar.isShared())
@@ -284,7 +284,7 @@
 
         notifyHome = yield self.theTransactionUnderTest(0).notificationsWithUID("user01")
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(notifications, [inviteUID + "-reply", ])
+        self.assertEqual(notifications, [inviteUID + "-reply.xml", ])
 
         calendar = yield self.calendarUnderTest(txn=self.theTransactionUnderTest(0), home="user01", name="calendar")
         self.assertTrue(calendar.isShared())
@@ -334,7 +334,7 @@
 
         notifyHome = yield self.theTransactionUnderTest(0).notificationsWithUID("user01")
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(notifications, [inviteUID + "-reply", ])
+        self.assertEqual(notifications, [inviteUID + "-reply.xml", ])
 
         calendar = yield self.calendarUnderTest(txn=self.theTransactionUnderTest(0), home="user01", name="calendar")
         self.assertTrue(calendar.isShared())
@@ -352,7 +352,7 @@
 
         notifyHome = yield self.theTransactionUnderTest(0).notificationsWithUID("user01")
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(notifications, [inviteUID + "-reply", ])
+        self.assertEqual(notifications, [inviteUID + "-reply.xml", ])
 
         calendar = yield self.calendarUnderTest(txn=self.theTransactionUnderTest(0), home="user01", name="calendar")
         self.assertTrue(calendar.isShared())
@@ -399,7 +399,7 @@
 
         notifyHome = yield self.theTransactionUnderTest(0).notificationsWithUID("user01")
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(notifications, [inviteUID + "-reply", ])
+        self.assertEqual(notifications, [inviteUID + "-reply.xml", ])
 
         yield self.commitTransaction(0)
 
@@ -416,7 +416,7 @@
 
         notifyHome = yield self.theTransactionUnderTest(0).notificationsWithUID("user01")
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(notifications, [inviteUID + "-reply", ])
+        self.assertEqual(notifications, [inviteUID + "-reply.xml", ])
 
 
     @inlineCallbacks

Modified: CalendarServer/trunk/txdav/caldav/datastore/test/test_sql_sharing.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/test/test_sql_sharing.py	2015-09-21 14:34:01 UTC (rev 15142)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/test_sql_sharing.py	2015-09-22 14:17:15 UTC (rev 15143)
@@ -164,7 +164,7 @@
 
         notifyHome = yield self.transactionUnderTest().notificationsWithUID("user02")
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(notifications, [inviteUID, ])
+        self.assertEqual(notifications, [inviteUID + ".xml", ])
 
         self.assertTrue(calendar.isShared())
 
@@ -216,7 +216,7 @@
 
         notifyHome = yield self.transactionUnderTest().notificationsWithUID("user02")
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(len(notifications), 1)
+        self.assertEqual(notifications, [inviteUID + ".xml", ])
 
         self.assertTrue(calendar.isShared())
 
@@ -231,7 +231,7 @@
 
         notifyHome = yield self.transactionUnderTest().notificationsWithUID("user01")
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(notifications, [inviteUID + "-reply", ])
+        self.assertEqual(notifications, [inviteUID + "-reply.xml", ])
 
         calendar = yield self.calendarUnderTest(home="user01", name="calendar")
         self.assertTrue(calendar.isShared())
@@ -247,7 +247,7 @@
 
         notifyHome = yield self.transactionUnderTest().notificationsWithUID("user01")
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(notifications, [inviteUID + "-reply", ])
+        self.assertEqual(notifications, [inviteUID + "-reply.xml", ])
 
         calendar = yield self.calendarUnderTest(home="user01", name="calendar")
         self.assertTrue(calendar.isShared())
@@ -276,7 +276,7 @@
 
         notifyHome = yield self.transactionUnderTest().notificationsWithUID("user02")
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(len(notifications), 1)
+        self.assertEqual(notifications, [inviteUID + ".xml", ])
 
         self.assertTrue(calendar.isShared())
 
@@ -291,7 +291,7 @@
 
         notifyHome = yield self.transactionUnderTest().notificationsWithUID("user01")
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(notifications, [inviteUID + "-reply", ])
+        self.assertEqual(notifications, [inviteUID + "-reply.xml", ])
 
         calendar = yield self.calendarUnderTest(home="user01", name="calendar")
         self.assertTrue(calendar.isShared())
@@ -307,7 +307,7 @@
 
         notifyHome = yield self.transactionUnderTest().notificationsWithUID("user01")
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(notifications, [inviteUID + "-reply", ])
+        self.assertEqual(notifications, [inviteUID + "-reply.xml", ])
 
         calendar = yield self.calendarUnderTest(home="user01", name="calendar")
         self.assertTrue(calendar.isShared())
@@ -337,7 +337,7 @@
 
         notifyHome = yield self.transactionUnderTest().notificationsWithUID("user02")
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(len(notifications), 1)
+        self.assertEqual(notifications, [inviteUID + ".xml", ])
 
         self.assertTrue(calendar.isShared())
 
@@ -352,7 +352,7 @@
 
         notifyHome = yield self.transactionUnderTest().notificationsWithUID("user01")
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(notifications, [inviteUID + "-reply", ])
+        self.assertEqual(notifications, [inviteUID + "-reply.xml", ])
 
         calendar = yield self.calendarUnderTest(home="user01", name="calendar")
         self.assertTrue(calendar.isShared())
@@ -368,7 +368,7 @@
 
         notifyHome = yield self.transactionUnderTest().notificationsWithUID("user01")
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(notifications, [inviteUID + "-reply", ])
+        self.assertEqual(notifications, [inviteUID + "-reply.xml", ])
 
         calendar = yield self.calendarUnderTest(home="user01", name="calendar")
         self.assertTrue(calendar.isShared())
@@ -397,7 +397,7 @@
 
         notifyHome = yield self.transactionUnderTest().notificationsWithUID("user02")
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(len(notifications), 1)
+        self.assertEqual(notifications, [inviteUID + ".xml", ])
 
         yield self.commit()
 
@@ -410,7 +410,7 @@
 
         notifyHome = yield self.transactionUnderTest().notificationsWithUID("user01")
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(notifications, [inviteUID + "-reply", ])
+        self.assertEqual(notifications, [inviteUID + "-reply.xml", ])
 
         yield self.commit()
 
@@ -423,7 +423,7 @@
 
         notifyHome = yield self.transactionUnderTest().notificationsWithUID("user01")
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(notifications, [inviteUID + "-reply", ])
+        self.assertEqual(notifications, [inviteUID + "-reply.xml", ])
 
 
     @inlineCallbacks
@@ -706,7 +706,7 @@
     def _check_notifications(self, uid, items):
         notifyHome = yield self.transactionUnderTest().notificationsWithUID(uid, create=True)
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(set(notifications), set(items))
+        self.assertEqual(set(notifications), set([item + ".xml" for item in items]))
 
 
 

Modified: CalendarServer/trunk/txdav/carddav/datastore/test/test_sql_sharing.py
===================================================================
--- CalendarServer/trunk/txdav/carddav/datastore/test/test_sql_sharing.py	2015-09-21 14:34:01 UTC (rev 15142)
+++ CalendarServer/trunk/txdav/carddav/datastore/test/test_sql_sharing.py	2015-09-22 14:17:15 UTC (rev 15143)
@@ -200,7 +200,7 @@
     def _check_notifications(self, home, items):
         notifyHome = yield self.transactionUnderTest().notificationsWithUID(home, create=True)
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(set(notifications), set(items))
+        self.assertEqual(set(notifications), set([item + ".xml" for item in items]))
 
 
     @inlineCallbacks

Modified: CalendarServer/trunk/txdav/common/datastore/sql_notification.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_notification.py	2015-09-21 14:34:01 UTC (rev 15142)
+++ CalendarServer/trunk/txdav/common/datastore/sql_notification.py	2015-09-22 14:17:15 UTC (rev 15143)
@@ -386,10 +386,14 @@
 
     @inlineCallbacks
     def listNotificationObjects(self):
+        """
+        List the names of all notification objects in this collection. Note that the name
+        is actually the UID value with ".xml" appended, as per L{NotificationObject.name}.
+        """
         if self._notificationNames is None:
             rows = yield self._notificationUIDsForHomeQuery.on(
                 self._txn, resourceID=self._resourceID)
-            self._notificationNames = sorted([row[0] for row in rows])
+            self._notificationNames = sorted([row[0] + ".xml" for row in rows])
         returnValue(self._notificationNames)
 
 
@@ -432,18 +436,18 @@
             inserting = True
         yield notificationObject.setData(uid, notificationtype, notificationdata, inserting=inserting)
         if inserting:
-            yield self._insertRevision("%s.xml" % (uid,))
+            yield self._insertRevision(notificationObject.name())
             if self._notificationNames is not None:
-                self._notificationNames.append(notificationObject.uid())
+                self._notificationNames.append(notificationObject.name())
         else:
-            yield self._updateRevision("%s.xml" % (uid,))
+            yield self._updateRevision(notificationObject.name())
         yield self.notifyChanged()
         returnValue(notificationObject)
 
 
     def removeNotificationObjectWithName(self, name):
         if self._notificationNames is not None:
-            self._notificationNames.remove(self._nameToUID(name))
+            self._notificationNames.remove(name)
         return self.removeNotificationObjectWithUID(self._nameToUID(name))
 
     _removeByUIDQuery = Delete(

Modified: CalendarServer/trunk/txdav/who/test/test_group_sharees.py
===================================================================
--- CalendarServer/trunk/txdav/who/test/test_group_sharees.py	2015-09-21 14:34:01 UTC (rev 15142)
+++ CalendarServer/trunk/txdav/who/test/test_group_sharees.py	2015-09-22 14:17:15 UTC (rev 15143)
@@ -88,7 +88,7 @@
     def _check_notifications(self, uid, items):
         notifyHome = yield self.transactionUnderTest().notificationsWithUID(uid, create=True)
         notifications = yield notifyHome.listNotificationObjects()
-        self.assertEqual(set(notifications), set(items))
+        self.assertEqual(set(notifications), set([item + ".xml" for item in items]))
 
 
     @inlineCallbacks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150922/96d20cfc/attachment-0001.html>


More information about the calendarserver-changes mailing list