[CalendarServer-changes] [6695] CalendarServer/trunk/contrib/performance/loadtest

source_changes at macosforge.org source_changes at macosforge.org
Wed Dec 15 11:27:05 PST 2010


Revision: 6695
          http://trac.macosforge.org/projects/calendarserver/changeset/6695
Author:   exarkun at twistedmatrix.com
Date:     2010-12-15 11:26:59 -0800 (Wed, 15 Dec 2010)
Log Message:
-----------
Store a little more information about the calendar home propfind response; also send the SL iCal User-Agent.

Modified Paths:
--------------
    CalendarServer/trunk/contrib/performance/loadtest/ical.py
    CalendarServer/trunk/contrib/performance/loadtest/population.py
    CalendarServer/trunk/contrib/performance/loadtest/test_ical.py

Modified: CalendarServer/trunk/contrib/performance/loadtest/ical.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/ical.py	2010-12-15 04:16:23 UTC (rev 6694)
+++ CalendarServer/trunk/contrib/performance/loadtest/ical.py	2010-12-15 19:26:59 UTC (rev 6695)
@@ -43,13 +43,24 @@
 SUPPORTED_REPORT_SET = '{DAV:}supported-report-set'
 
 
+class Calendar(object):
+    def __init__(self, resourceType, name, url, ctag):
+        self.resourceType = resourceType
+        self.name = name
+        self.url = url
+        self.ctag = ctag
+
+
+
 class SnowLeopard(object):
     """
     Implementation of the SnowLeopard iCal network behavior.
     """
 
-    CALENDAR_HOME_POLL_INTERVAL = 15
+    USER_AGENT = "DAVKit/4.0.3 (732); CalendarStore/4.0.3 (991); iCal/4.0.3 (1388); Mac OS X/10.6.4 (10F569)"
 
+    CALENDAR_HOME_POLL_INTERVAL = 15 * 60
+
     _STARTUP_PRINCIPAL_PROPFIND = loadRequestBody('sl_startup_principal_propfind')
     _STARTUP_PRINCIPALS_REPORT = loadRequestBody('sl_startup_principals_report')
     _STARTUP_CALENDARHOME_PROPFIND = loadRequestBody('sl_startup_calendarhome_propfind')
@@ -65,6 +76,7 @@
 
     def _request(self, method, url, headers, body):
         # XXX Do return code checking here.
+        headers.setRawHeaders('User-Agent', [self.USER_AGENT])
         d = self.agent.request(method, url, headers, body)
         before = self.reactor.seconds()
         def report(passthrough):
@@ -111,9 +123,15 @@
             nodes = principals[principal].getNodeProperties()
             for nodeType in nodes[davxml.resourcetype].getchildren():
                 if nodeType.tag in self._CALENDAR_TYPES:
-                    calendars.append((nodeType.tag, principals[principal]))
+                    textProps = principals[principal].getTextProperties()
+                    calendars.append(Calendar(
+                            nodeType.tag,
+                            textProps.get(davxml.displayname, None),
+                            principal,
+                            textProps.get(csxml.getctag, None),
+                            ))
                     break
-        return sorted(calendars)
+        return calendars
 
 
     def _principalPropfind(self, user):

Modified: CalendarServer/trunk/contrib/performance/loadtest/population.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/population.py	2010-12-15 04:16:23 UTC (rev 6694)
+++ CalendarServer/trunk/contrib/performance/loadtest/population.py	2010-12-15 19:26:59 UTC (rev 6695)
@@ -72,6 +72,7 @@
             yield clientType
 
 
+
 class CalendarClientSimulator(object):
     def __init__(self, populator, parameters, reactor, host, port):
         self.populator = populator

Modified: CalendarServer/trunk/contrib/performance/loadtest/test_ical.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/test_ical.py	2010-12-15 04:16:23 UTC (rev 6694)
+++ CalendarServer/trunk/contrib/performance/loadtest/test_ical.py	2010-12-15 19:26:59 UTC (rev 6695)
@@ -774,11 +774,30 @@
         constructed from the data extracted from the response.
         """
         calendars = self.client._extractCalendars(CALENDAR_HOME_PROPFIND_RESPONSE)
-        resourceTypes = [resourceType for (resourceType, element) in calendars]
-        self.assertEquals(
-            resourceTypes,
-            sorted([csxml.dropbox_home,
-                    csxml.notification,
-                    caldavxml.calendar,
-                    caldavxml.schedule_inbox,
-                    caldavxml.schedule_outbox]))
+        calendars.sort(key=lambda cal: cal.resourceType)
+        dropbox, notification, calendar, inbox, outbox = calendars
+
+        self.assertEquals(dropbox.resourceType, csxml.dropbox_home)
+        self.assertEquals(dropbox.name, None)
+        self.assertEquals(dropbox.url, "/calendars/__uids__/user01/dropbox/")
+        self.assertEquals(dropbox.ctag, None)
+
+        self.assertEquals(notification.resourceType, csxml.notification)
+        self.assertEquals(notification.name, "notification")
+        self.assertEquals(notification.url, "/calendars/__uids__/user01/notification/")
+        self.assertEquals(notification.ctag, None)
+
+        self.assertEquals(calendar.resourceType, caldavxml.calendar)
+        self.assertEquals(calendar.name, "calendar")
+        self.assertEquals(calendar.url, "/calendars/__uids__/user01/calendar/")
+        self.assertEquals(calendar.ctag, "c2696540-4c4c-4a31-adaf-c99630776828#3")
+
+        self.assertEquals(inbox.resourceType, caldavxml.schedule_inbox)
+        self.assertEquals(inbox.name, "inbox")
+        self.assertEquals(inbox.url, "/calendars/__uids__/user01/inbox/")
+        self.assertEquals(inbox.ctag, "a483dab3-1391-445b-b1c3-5ae9dfc81c2f#0")
+
+        self.assertEquals(outbox.resourceType, caldavxml.schedule_outbox)
+        self.assertEquals(outbox.name, None)
+        self.assertEquals(outbox.url, "/calendars/__uids__/user01/outbox/")
+        self.assertEquals(outbox.ctag, None)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20101215/116f234c/attachment.html>


More information about the calendarserver-changes mailing list