<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[15339] CalendarServer/trunk/contrib/performance/loadtest</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/15339">15339</a></dd>
<dt>Author</dt> <dd>sagen@apple.com</dd>
<dt>Date</dt> <dd>2015-11-19 14:01:05 -0800 (Thu, 19 Nov 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Change sim profiles to avoid trying to manipulate shared-to-me collections; disable Resetter profile for now.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServertrunkcontribperformanceloadtestclientsplist">CalendarServer/trunk/contrib/performance/loadtest/clients.plist</a></li>
<li><a href="#CalendarServertrunkcontribperformanceloadtesticalpy">CalendarServer/trunk/contrib/performance/loadtest/ical.py</a></li>
<li><a href="#CalendarServertrunkcontribperformanceloadtestprofilespy">CalendarServer/trunk/contrib/performance/loadtest/profiles.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServertrunkcontribperformanceloadtestclientsplist"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/contrib/performance/loadtest/clients.plist (15338 => 15339)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/contrib/performance/loadtest/clients.plist        2015-11-19 21:44:28 UTC (rev 15338)
+++ CalendarServer/trunk/contrib/performance/loadtest/clients.plist        2015-11-19 22:01:05 UTC (rev 15339)
</span><span class="lines">@@ -328,10 +328,10 @@
</span><span class="cx">                                                                 &lt;dict&gt;
</span><span class="cx">                                                                         &lt;!-- mode - peak--&gt;
</span><span class="cx">                                                                         &lt;key&gt;mode&lt;/key&gt;
</span><del>-                                                                        &lt;integer&gt;1024&lt;/integer&gt;
</del><ins>+                                                                        &lt;integer&gt;450&lt;/integer&gt;
</ins><span class="cx">                                                                         &lt;!-- mean - average--&gt;
</span><span class="cx">                                                                         &lt;key&gt;median&lt;/key&gt;
</span><del>-                                                                        &lt;integer&gt;20480&lt;/integer&gt;
</del><ins>+                                                                        &lt;integer&gt;650&lt;/integer&gt;
</ins><span class="cx">                                                                         &lt;!-- maximum --&gt;
</span><span class="cx">                                                                         &lt;key&gt;maximum&lt;/key&gt;
</span><span class="cx">                                                                         &lt;real&gt;1000000&lt;/real&gt;
</span><span class="lines">@@ -689,7 +689,7 @@
</span><span class="cx">                                                 &lt;key&gt;params&lt;/key&gt;
</span><span class="cx">                                                 &lt;dict&gt;
</span><span class="cx">                                                         &lt;key&gt;enabled&lt;/key&gt;
</span><del>-                                                        &lt;true/&gt;
</del><ins>+                                                        &lt;false/&gt;
</ins><span class="cx"> 
</span><span class="cx">                                                         &lt;!-- Define the interval (in seconds) at which this profile will
</span><span class="cx">                                                                 reset its client. --&gt;
</span></span></pre></div>
<a id="CalendarServertrunkcontribperformanceloadtesticalpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/contrib/performance/loadtest/ical.py (15338 => 15339)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/contrib/performance/loadtest/ical.py        2015-11-19 21:44:28 UTC (rev 15338)
+++ CalendarServer/trunk/contrib/performance/loadtest/ical.py        2015-11-19 22:01:05 UTC (rev 15339)
</span><span class="lines">@@ -209,13 +209,18 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> class Calendar(object):
</span><del>-    def __init__(self, resourceType, componentTypes, name, url, changeToken):
</del><ins>+    def __init__(
+        self, resourceType, componentTypes, name, url, changeToken,
+        shared=False, sharedByMe=False
+    ):
</ins><span class="cx">         self.resourceType = resourceType
</span><span class="cx">         self.componentTypes = componentTypes
</span><span class="cx">         self.name = name
</span><span class="cx">         self.url = url
</span><span class="cx">         self.changeToken = changeToken
</span><span class="cx">         self.events = {}
</span><ins>+        self.shared = shared
+        self.sharedByMe = sharedByMe
</ins><span class="cx"> 
</span><span class="cx">         if self.name is None and self.url is not None:
</span><span class="cx">             self.name = self.url.rstrip(&quot;/&quot;).split(&quot;/&quot;)[-1]
</span><span class="lines">@@ -227,7 +232,7 @@
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx"> 
</span><span class="cx">         result = {}
</span><del>-        for attr in (&quot;resourceType&quot;, &quot;name&quot;, &quot;url&quot;, &quot;changeToken&quot;):
</del><ins>+        for attr in (&quot;resourceType&quot;, &quot;name&quot;, &quot;url&quot;, &quot;changeToken&quot;, &quot;shared&quot;, &quot;sharedByMe&quot;):
</ins><span class="cx">             result[attr] = getattr(self, attr)
</span><span class="cx">         result[&quot;componentTypes&quot;] = list(sorted(self.componentTypes))
</span><span class="cx">         result[&quot;events&quot;] = sorted(self.events.keys())
</span><span class="lines">@@ -241,7 +246,7 @@
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx"> 
</span><span class="cx">         calendar = Calendar(None, None, None, None, None)
</span><del>-        for attr in (&quot;resourceType&quot;, &quot;name&quot;, &quot;url&quot;, &quot;changeToken&quot;):
</del><ins>+        for attr in (&quot;resourceType&quot;, &quot;name&quot;, &quot;url&quot;, &quot;changeToken&quot;, &quot;shared&quot;, &quot;sharedByMe&quot;):
</ins><span class="cx">             setattr(calendar, attr, u2str(data[attr]))
</span><span class="cx">         calendar.componentTypes = set(map(u2str, data[&quot;componentTypes&quot;]))
</span><span class="cx"> 
</span><span class="lines">@@ -878,30 +883,45 @@
</span><span class="cx">                         self.xmpp[href] = XMPPPush(server, uri, pushkey)
</span><span class="cx"> 
</span><span class="cx">             nodes = results[href].getNodeProperties()
</span><ins>+            isCalendar = False
+            isNotifications = False
+            isShared = False
+            isSharedByMe = False
</ins><span class="cx">             for nodeType in nodes[davxml.resourcetype]:
</span><span class="cx">                 if nodeType.tag in self._CALENDAR_TYPES:
</span><del>-                    textProps = results[href].getTextProperties()
-                    componentTypes = set()
-                    if nodeType.tag == caldavxml.calendar:
-                        if caldavxml.supported_calendar_component_set in nodes:
-                            for comp in nodes[caldavxml.supported_calendar_component_set]:
-                                componentTypes.add(comp.get(&quot;name&quot;).upper())
-
-                    calendars.append(Calendar(
-                        nodeType.tag,
-                        componentTypes,
-                        textProps.get(davxml.displayname, None),
-                        href,
-                        textProps.get(changeTag, None),
-                    ))
-                    break
</del><ins>+                    isCalendar = True
</ins><span class="cx">                 elif nodeType.tag == csxml.notification:
</span><del>-                    textProps = results[href].getTextProperties()
-                    notificationCollection = NotificationCollection(
-                        href,
-                        textProps.get(changeTag, None)
-                    )
</del><ins>+                    isNotifications = True
+                elif nodeType.tag.startswith(&quot;{http://calendarserver.org/ns/}shared&quot;):
+                    isShared = True
+                    if nodeType.tag == &quot;{http://calendarserver.org/ns/}shared-owner&quot;:
+                        isSharedByMe = True
</ins><span class="cx"> 
</span><ins>+            if isCalendar:
+                textProps = results[href].getTextProperties()
+                componentTypes = set()
+                if nodeType.tag == caldavxml.calendar:
+                    if caldavxml.supported_calendar_component_set in nodes:
+                        for comp in nodes[caldavxml.supported_calendar_component_set]:
+                            componentTypes.add(comp.get(&quot;name&quot;).upper())
+
+                calendars.append(Calendar(
+                    nodeType.tag,
+                    componentTypes,
+                    textProps.get(davxml.displayname, None),
+                    href,
+                    textProps.get(changeTag, None),
+                    shared=isShared,
+                    sharedByMe=isSharedByMe
+                ))
+
+            elif isNotifications:
+                textProps = results[href].getTextProperties()
+                notificationCollection = NotificationCollection(
+                    href,
+                    textProps.get(changeTag, None)
+                )
+
</ins><span class="cx">         return calendars, notificationCollection
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre></div>
<a id="CalendarServertrunkcontribperformanceloadtestprofilespy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/contrib/performance/loadtest/profiles.py (15338 => 15339)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/contrib/performance/loadtest/profiles.py        2015-11-19 21:44:28 UTC (rev 15338)
+++ CalendarServer/trunk/contrib/performance/loadtest/profiles.py        2015-11-19 22:01:05 UTC (rev 15339)
</span><span class="lines">@@ -75,21 +75,26 @@
</span><span class="cx">         return succeed(None)
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-    def _calendarsOfType(self, calendarType, componentType):
-        return [
-            cal
-            for cal
-            in self._client._calendars.itervalues()
-            if cal.resourceType == calendarType and componentType in cal.componentTypes
-        ]
</del><ins>+    def _calendarsOfType(self, calendarType, componentType, justOwned=False):
+        results = []
</ins><span class="cx"> 
</span><ins>+        for cal in self._client._calendars.itervalues():
+            if cal.resourceType == calendarType and componentType in cal.componentTypes:
+                if justOwned:
+                    if (not cal.shared) or cal.sharedByMe:
+                        results.append(cal)
+                else:
+                    results.append(cal)
</ins><span class="cx"> 
</span><del>-    def _getRandomCalendarOfType(self, componentType):
</del><ins>+        return results
+
+
+    def _getRandomCalendarOfType(self, componentType, justOwned=False):
</ins><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Return a random L{Calendar} object from the current user
</span><span class="cx">         or C{None} if there are no calendars to work with
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        calendars = self._calendarsOfType(caldavxml.calendar, componentType)
</del><ins>+        calendars = self._calendarsOfType(caldavxml.calendar, componentType, justOwned=justOwned)
</ins><span class="cx">         if not calendars:
</span><span class="cx">             return None
</span><span class="cx">         # Choose a random calendar
</span><span class="lines">@@ -97,12 +102,12 @@
</span><span class="cx">         return calendar
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-    def _getRandomEventOfType(self, componentType):
</del><ins>+    def _getRandomEventOfType(self, componentType, justOwned=True):
</ins><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Return a random L{Event} object from the current user
</span><span class="cx">         or C{None} if there are no events to work with
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        calendars = self._calendarsOfType(caldavxml.calendar, componentType)
</del><ins>+        calendars = self._calendarsOfType(caldavxml.calendar, componentType, justOwned=justOwned)
</ins><span class="cx">         while calendars:
</span><span class="cx">             calendar = self.random.choice(calendars)
</span><span class="cx">             calendars.remove(calendar)
</span><span class="lines">@@ -610,7 +615,7 @@
</span><span class="cx">         if not self._client.started:
</span><span class="cx">             returnValue(None)
</span><span class="cx"> 
</span><del>-        event = self._getRandomEventOfType('VEVENT')
</del><ins>+        event = self._getRandomEventOfType('VEVENT', justOwned=True)
</ins><span class="cx">         if not event:
</span><span class="cx">             returnValue(None)
</span><span class="cx">         component = event.component
</span><span class="lines">@@ -721,7 +726,7 @@
</span><span class="cx">         if not self._client.started:
</span><span class="cx">             returnValue(None)
</span><span class="cx"> 
</span><del>-        for calendar in self._calendarsOfType(caldavxml.calendar, &quot;VEVENT&quot;):
</del><ins>+        for calendar in self._calendarsOfType(caldavxml.calendar, &quot;VEVENT&quot;, justOwned=True):
</ins><span class="cx">             while len(calendar.events) &gt; self._limit:
</span><span class="cx">                 event = calendar.events[self.random.choice(calendar.events.keys())]
</span><span class="cx">                 yield self._client.deleteEvent(event.url)
</span><span class="lines">@@ -760,7 +765,7 @@
</span><span class="cx">     def shareCalendar(self):
</span><span class="cx"> 
</span><span class="cx">         # pick a calendar
</span><del>-        calendar = self._getRandomCalendarOfType('VEVENT')
</del><ins>+        calendar = self._getRandomCalendarOfType('VEVENT', justOwned=True)
</ins><span class="cx">         if not calendar:
</span><span class="cx">             returnValue(None)
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>