<!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>[11988] CalendarServer/branches/release/CalendarServer-5.2-dev</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/11988">11988</a></dd>
<dt>Author</dt> <dd>wsanchez@apple.com</dd>
<dt>Date</dt> <dd>2013-11-20 17:25:20 -0800 (Wed, 20 Nov 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Pulled up <a href="http://trac.calendarserver.org//changeset/11898">r11898</a> from trunk.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServerbranchesreleaseCalendarServer52devtwextenterprisefixturespy">CalendarServer/branches/release/CalendarServer-5.2-dev/twext/enterprise/fixtures.py</a></li>
<li><a href="#CalendarServerbranchesreleaseCalendarServer52devtwextenterprisequeuepy">CalendarServer/branches/release/CalendarServer-5.2-dev/twext/enterprise/queue.py</a></li>
<li><a href="#CalendarServerbranchesreleaseCalendarServer52devtwextenterprisetesttest_queuepy">CalendarServer/branches/release/CalendarServer-5.2-dev/twext/enterprise/test/test_queue.py</a></li>
</ul>

<h3>Property Changed</h3>
<ul>
<li><a href="#CalendarServerbranchesreleaseCalendarServer52dev">CalendarServer/branches/release/CalendarServer-5.2-dev/</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServerbranchesreleaseCalendarServer52dev"></a>
<div class="propset"><h4>Property changes: CalendarServer/branches/release/CalendarServer-5.2-dev</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4>Modified: svn:mergeinfo</h4></div>
<span class="cx">/CalendarServer/branches/config-separation:4379-4443
</span><span class="cx">/CalendarServer/branches/egg-info-351:4589-4625
</span><span class="cx">/CalendarServer/branches/generic-sqlstore:6167-6191
</span><span class="cx">/CalendarServer/branches/new-store:5594-5934
</span><span class="cx">/CalendarServer/branches/new-store-no-caldavfile:5911-5935
</span><span class="cx">/CalendarServer/branches/new-store-no-caldavfile-2:5936-5981
</span><span class="cx">/CalendarServer/branches/release/CalendarServer-4.3-dev:10180-10190,10192
</span><span class="cx">/CalendarServer/branches/release/CalendarServer-5.1-dev:11846
</span><span class="cx">/CalendarServer/branches/users/cdaboo/batchupload-6699:6700-7198
</span><span class="cx">/CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692:5693-5702
</span><span class="cx">/CalendarServer/branches/users/cdaboo/component-set-fixes:8130-8346
</span><span class="cx">/CalendarServer/branches/users/cdaboo/directory-cache-on-demand-3627:3628-3644
</span><span class="cx">/CalendarServer/branches/users/cdaboo/fix-no-ischedule:11607-11871
</span><span class="cx">/CalendarServer/branches/users/cdaboo/implicituidrace:8137-8141
</span><span class="cx">/CalendarServer/branches/users/cdaboo/ischedule-dkim:9747-9979
</span><span class="cx">/CalendarServer/branches/users/cdaboo/managed-attachments:9985-10145
</span><span class="cx">/CalendarServer/branches/users/cdaboo/more-sharing-5591:5592-5601
</span><span class="cx">/CalendarServer/branches/users/cdaboo/partition-4464:4465-4957
</span><span class="cx">/CalendarServer/branches/users/cdaboo/performance-tweaks:11824-11836
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pods:7297-7377
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pycalendar:7085-7206
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pycard:7227-7237
</span><span class="cx">/CalendarServer/branches/users/cdaboo/queued-attendee-refreshes:7740-8287
</span><span class="cx">/CalendarServer/branches/users/cdaboo/relative-config-paths-5070:5071-5105
</span><span class="cx">/CalendarServer/branches/users/cdaboo/shared-calendars-5187:5188-5440
</span><span class="cx">/CalendarServer/branches/users/cdaboo/store-scheduling:10876-11129
</span><span class="cx">/CalendarServer/branches/users/cdaboo/timezones:7443-7699
</span><span class="cx">/CalendarServer/branches/users/cdaboo/txn-debugging:8730-8743
</span><span class="cx">/CalendarServer/branches/users/gaya/sharedgroups-3:11088-11204
</span><span class="cx">/CalendarServer/branches/users/glyph/always-abort-txn-on-error:9958-9969
</span><span class="cx">/CalendarServer/branches/users/glyph/case-insensitive-uid:8772-8805
</span><span class="cx">/CalendarServer/branches/users/glyph/conn-limit:6574-6577
</span><span class="cx">/CalendarServer/branches/users/glyph/contacts-server-merge:4971-5080
</span><span class="cx">/CalendarServer/branches/users/glyph/dalify:6932-7023
</span><span class="cx">/CalendarServer/branches/users/glyph/db-reconnect:6824-6876
</span><span class="cx">/CalendarServer/branches/users/glyph/deploybuild:7563-7572
</span><span class="cx">/CalendarServer/branches/users/glyph/digest-auth-redux:10624-10635
</span><span class="cx">/CalendarServer/branches/users/glyph/disable-quota:7718-7727
</span><span class="cx">/CalendarServer/branches/users/glyph/dont-start-postgres:6592-6614
</span><span class="cx">/CalendarServer/branches/users/glyph/enforce-max-requests:11640-11643
</span><span class="cx">/CalendarServer/branches/users/glyph/hang-fix:11465-11491
</span><span class="cx">/CalendarServer/branches/users/glyph/imip-and-admin-html:7866-7984
</span><span class="cx">/CalendarServer/branches/users/glyph/ipv6-client:9054-9105
</span><span class="cx">/CalendarServer/branches/users/glyph/launchd-wrapper-bis:11413-11436
</span><span class="cx">/CalendarServer/branches/users/glyph/linux-tests:6893-6900
</span><span class="cx">/CalendarServer/branches/users/glyph/log-cleanups:11691-11731
</span><span class="cx">/CalendarServer/branches/users/glyph/migrate-merge:8690-8713
</span><span class="cx">/CalendarServer/branches/users/glyph/misc-portability-fixes:7365-7374
</span><span class="cx">/CalendarServer/branches/users/glyph/more-deferreds-6:6322-6368
</span><span class="cx">/CalendarServer/branches/users/glyph/more-deferreds-7:6369-6445
</span><span class="cx">/CalendarServer/branches/users/glyph/multiget-delete:8321-8330
</span><span class="cx">/CalendarServer/branches/users/glyph/new-export:7444-7485
</span><span class="cx">/CalendarServer/branches/users/glyph/one-home-list-api:10048-10073
</span><span class="cx">/CalendarServer/branches/users/glyph/oracle:7106-7155
</span><span class="cx">/CalendarServer/branches/users/glyph/oracle-nulls:7340-7351
</span><span class="cx">/CalendarServer/branches/users/glyph/other-html:8062-8091
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-sim:8240-8251
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-upgrade:8376-8400
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-upgrade_to_1:8571-8583
</span><span class="cx">/CalendarServer/branches/users/glyph/q:9560-9688
</span><span class="cx">/CalendarServer/branches/users/glyph/queue-locking-and-timing:10204-10289
</span><span class="cx">/CalendarServer/branches/users/glyph/quota:7604-7637
</span><span class="cx">/CalendarServer/branches/users/glyph/sendfdport:5388-5424
</span><span class="cx">/CalendarServer/branches/users/glyph/shared-pool-fixes:8436-8443
</span><span class="cx">/CalendarServer/branches/users/glyph/shared-pool-take2:8155-8174
</span><span class="cx">/CalendarServer/branches/users/glyph/sharedpool:6490-6550
</span><span class="cx">/CalendarServer/branches/users/glyph/sharing-api:9192-9205
</span><span class="cx">/CalendarServer/branches/users/glyph/skip-lonely-vtimezones:8524-8535
</span><span class="cx">/CalendarServer/branches/users/glyph/sql-store:5929-6073
</span><span class="cx">/CalendarServer/branches/users/glyph/start-service-start-loop:11060-11065
</span><span class="cx">/CalendarServer/branches/users/glyph/subtransactions:7248-7258
</span><span class="cx">/CalendarServer/branches/users/glyph/table-alias:8651-8664
</span><span class="cx">/CalendarServer/branches/users/glyph/uidexport:7673-7676
</span><span class="cx">/CalendarServer/branches/users/glyph/unshare-when-access-revoked:10562-10595
</span><span class="cx">/CalendarServer/branches/users/glyph/use-system-twisted:5084-5149
</span><span class="cx">/CalendarServer/branches/users/glyph/uuid-normalize:9268-9296
</span><span class="cx">/CalendarServer/branches/users/glyph/warning-cleanups:11347-11357
</span><span class="cx">/CalendarServer/branches/users/glyph/xattrs-from-files:7757-7769
</span><span class="cx">/CalendarServer/branches/users/sagen/applepush:8126-8184
</span><span class="cx">/CalendarServer/branches/users/sagen/inboxitems:7380-7381
</span><span class="cx">/CalendarServer/branches/users/sagen/locations-resources:5032-5051
</span><span class="cx">/CalendarServer/branches/users/sagen/locations-resources-2:5052-5061
</span><span class="cx">/CalendarServer/branches/users/sagen/purge_old_events:6735-6746
</span><span class="cx">/CalendarServer/branches/users/sagen/resource-delegates-4038:4040-4067
</span><span class="cx">/CalendarServer/branches/users/sagen/resource-delegates-4066:4068-4075
</span><span class="cx">/CalendarServer/branches/users/sagen/resources-2:5084-5093
</span><span class="cx">/CalendarServer/branches/users/sagen/testing:10827-10851,10853-10855
</span><span class="cx">/CalendarServer/branches/users/wsanchez/transations:5515-5593
</span><span class="cx">   + /CalDAVTester/trunk:11193-11198
</span><span class="cx">/CalendarServer/branches/config-separation:4379-4443
</span><span class="cx">/CalendarServer/branches/egg-info-351:4589-4625
</span><span class="cx">/CalendarServer/branches/generic-sqlstore:6167-6191
</span><span class="cx">/CalendarServer/branches/new-store:5594-5934
</span><span class="cx">/CalendarServer/branches/new-store-no-caldavfile:5911-5935
</span><span class="cx">/CalendarServer/branches/new-store-no-caldavfile-2:5936-5981
</span><span class="cx">/CalendarServer/branches/release/CalendarServer-4.3-dev:10180-10190,10192
</span><span class="cx">/CalendarServer/branches/release/CalendarServer-5.1-dev:11846
</span><span class="cx">/CalendarServer/branches/users/cdaboo/batchupload-6699:6700-7198
</span><span class="cx">/CalendarServer/branches/users/cdaboo/cached-subscription-calendars-5692:5693-5702
</span><span class="cx">/CalendarServer/branches/users/cdaboo/component-set-fixes:8130-8346
</span><span class="cx">/CalendarServer/branches/users/cdaboo/directory-cache-on-demand-3627:3628-3644
</span><span class="cx">/CalendarServer/branches/users/cdaboo/fix-no-ischedule:11607-11871
</span><span class="cx">/CalendarServer/branches/users/cdaboo/implicituidrace:8137-8141
</span><span class="cx">/CalendarServer/branches/users/cdaboo/ischedule-dkim:9747-9979
</span><span class="cx">/CalendarServer/branches/users/cdaboo/managed-attachments:9985-10145
</span><span class="cx">/CalendarServer/branches/users/cdaboo/more-sharing-5591:5592-5601
</span><span class="cx">/CalendarServer/branches/users/cdaboo/partition-4464:4465-4957
</span><span class="cx">/CalendarServer/branches/users/cdaboo/performance-tweaks:11824-11836
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pods:7297-7377
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pycalendar:7085-7206
</span><span class="cx">/CalendarServer/branches/users/cdaboo/pycard:7227-7237
</span><span class="cx">/CalendarServer/branches/users/cdaboo/queued-attendee-refreshes:7740-8287
</span><span class="cx">/CalendarServer/branches/users/cdaboo/relative-config-paths-5070:5071-5105
</span><span class="cx">/CalendarServer/branches/users/cdaboo/shared-calendars-5187:5188-5440
</span><span class="cx">/CalendarServer/branches/users/cdaboo/store-scheduling:10876-11129
</span><span class="cx">/CalendarServer/branches/users/cdaboo/timezones:7443-7699
</span><span class="cx">/CalendarServer/branches/users/cdaboo/txn-debugging:8730-8743
</span><span class="cx">/CalendarServer/branches/users/gaya/sharedgroups-3:11088-11204
</span><span class="cx">/CalendarServer/branches/users/glyph/always-abort-txn-on-error:9958-9969
</span><span class="cx">/CalendarServer/branches/users/glyph/case-insensitive-uid:8772-8805
</span><span class="cx">/CalendarServer/branches/users/glyph/conn-limit:6574-6577
</span><span class="cx">/CalendarServer/branches/users/glyph/contacts-server-merge:4971-5080
</span><span class="cx">/CalendarServer/branches/users/glyph/dalify:6932-7023
</span><span class="cx">/CalendarServer/branches/users/glyph/db-reconnect:6824-6876
</span><span class="cx">/CalendarServer/branches/users/glyph/deploybuild:7563-7572
</span><span class="cx">/CalendarServer/branches/users/glyph/digest-auth-redux:10624-10635
</span><span class="cx">/CalendarServer/branches/users/glyph/disable-quota:7718-7727
</span><span class="cx">/CalendarServer/branches/users/glyph/dont-start-postgres:6592-6614
</span><span class="cx">/CalendarServer/branches/users/glyph/enforce-max-requests:11640-11643
</span><span class="cx">/CalendarServer/branches/users/glyph/hang-fix:11465-11491
</span><span class="cx">/CalendarServer/branches/users/glyph/imip-and-admin-html:7866-7984
</span><span class="cx">/CalendarServer/branches/users/glyph/ipv6-client:9054-9105
</span><span class="cx">/CalendarServer/branches/users/glyph/launchd-wrapper-bis:11413-11436
</span><span class="cx">/CalendarServer/branches/users/glyph/linux-tests:6893-6900
</span><span class="cx">/CalendarServer/branches/users/glyph/log-cleanups:11691-11731
</span><span class="cx">/CalendarServer/branches/users/glyph/migrate-merge:8690-8713
</span><span class="cx">/CalendarServer/branches/users/glyph/misc-portability-fixes:7365-7374
</span><span class="cx">/CalendarServer/branches/users/glyph/more-deferreds-6:6322-6368
</span><span class="cx">/CalendarServer/branches/users/glyph/more-deferreds-7:6369-6445
</span><span class="cx">/CalendarServer/branches/users/glyph/multiget-delete:8321-8330
</span><span class="cx">/CalendarServer/branches/users/glyph/new-export:7444-7485
</span><span class="cx">/CalendarServer/branches/users/glyph/one-home-list-api:10048-10073
</span><span class="cx">/CalendarServer/branches/users/glyph/oracle:7106-7155
</span><span class="cx">/CalendarServer/branches/users/glyph/oracle-nulls:7340-7351
</span><span class="cx">/CalendarServer/branches/users/glyph/other-html:8062-8091
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-sim:8240-8251
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-upgrade:8376-8400
</span><span class="cx">/CalendarServer/branches/users/glyph/parallel-upgrade_to_1:8571-8583
</span><span class="cx">/CalendarServer/branches/users/glyph/q:9560-9688
</span><span class="cx">/CalendarServer/branches/users/glyph/queue-locking-and-timing:10204-10289
</span><span class="cx">/CalendarServer/branches/users/glyph/quota:7604-7637
</span><span class="cx">/CalendarServer/branches/users/glyph/sendfdport:5388-5424
</span><span class="cx">/CalendarServer/branches/users/glyph/shared-pool-fixes:8436-8443
</span><span class="cx">/CalendarServer/branches/users/glyph/shared-pool-take2:8155-8174
</span><span class="cx">/CalendarServer/branches/users/glyph/sharedpool:6490-6550
</span><span class="cx">/CalendarServer/branches/users/glyph/sharing-api:9192-9205
</span><span class="cx">/CalendarServer/branches/users/glyph/skip-lonely-vtimezones:8524-8535
</span><span class="cx">/CalendarServer/branches/users/glyph/sql-store:5929-6073
</span><span class="cx">/CalendarServer/branches/users/glyph/start-service-start-loop:11060-11065
</span><span class="cx">/CalendarServer/branches/users/glyph/subtransactions:7248-7258
</span><span class="cx">/CalendarServer/branches/users/glyph/table-alias:8651-8664
</span><span class="cx">/CalendarServer/branches/users/glyph/uidexport:7673-7676
</span><span class="cx">/CalendarServer/branches/users/glyph/unshare-when-access-revoked:10562-10595
</span><span class="cx">/CalendarServer/branches/users/glyph/use-system-twisted:5084-5149
</span><span class="cx">/CalendarServer/branches/users/glyph/uuid-normalize:9268-9296
</span><span class="cx">/CalendarServer/branches/users/glyph/warning-cleanups:11347-11357
</span><span class="cx">/CalendarServer/branches/users/glyph/whenNotProposed:11881-11897
</span><span class="cx">/CalendarServer/branches/users/glyph/xattrs-from-files:7757-7769
</span><span class="cx">/CalendarServer/branches/users/sagen/applepush:8126-8184
</span><span class="cx">/CalendarServer/branches/users/sagen/inboxitems:7380-7381
</span><span class="cx">/CalendarServer/branches/users/sagen/locations-resources:5032-5051
</span><span class="cx">/CalendarServer/branches/users/sagen/locations-resources-2:5052-5061
</span><span class="cx">/CalendarServer/branches/users/sagen/purge_old_events:6735-6746
</span><span class="cx">/CalendarServer/branches/users/sagen/resource-delegates-4038:4040-4067
</span><span class="cx">/CalendarServer/branches/users/sagen/resource-delegates-4066:4068-4075
</span><span class="cx">/CalendarServer/branches/users/sagen/resources-2:5084-5093
</span><span class="cx">/CalendarServer/branches/users/sagen/testing:10827-10851,10853-10855
</span><span class="cx">/CalendarServer/branches/users/wsanchez/transations:5515-5593
</span><span class="cx">/CalendarServer/trunk:11898
</span><a id="CalendarServerbranchesreleaseCalendarServer52devtwextenterprisefixturespy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.2-dev/twext/enterprise/fixtures.py (11987 => 11988)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/release/CalendarServer-5.2-dev/twext/enterprise/fixtures.py        2013-11-20 20:57:12 UTC (rev 11987)
+++ CalendarServer/branches/release/CalendarServer-5.2-dev/twext/enterprise/fixtures.py        2013-11-21 01:25:20 UTC (rev 11988)
</span><span class="lines">@@ -76,8 +76,8 @@
</span><span class="cx"> 
</span><span class="cx"> def resultOf(deferred, propagate=False):
</span><span class="cx">     &quot;&quot;&quot;
</span><del>-    Add a callback and errback which will capture the result of a L{Deferred} in
-    a list, and return that list.  If 'propagate' is True, pass through the
</del><ins>+    Add a callback and errback which will capture the result of a L{Deferred}
+    in a list, and return that list.  If 'propagate' is True, pass through the
</ins><span class="cx">     results.
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx">     results = []
</span><span class="lines">@@ -551,6 +551,21 @@
</span><span class="cx">         self._connectResultQueue.append(thunk)
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+    def willConnectTo(self):
+        &quot;&quot;&quot;
+        Queue a successful result for connect() and immediately add it as a
+        child to this L{ConnectionFactory}.
+
+        @return: a connection object
+        @rtype: L{FakeConnection}
+        &quot;&quot;&quot;
+        aConnection = FakeConnection(self)
+        def thunk():
+            return aConnection
+        self._connectResultQueue.append(thunk)
+        return aConnection
+
+
</ins><span class="cx">     def willFail(self):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Used by tests to queue a successful result for connect().
</span></span></pre></div>
<a id="CalendarServerbranchesreleaseCalendarServer52devtwextenterprisequeuepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.2-dev/twext/enterprise/queue.py (11987 => 11988)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/release/CalendarServer-5.2-dev/twext/enterprise/queue.py        2013-11-20 20:57:12 UTC (rev 11987)
+++ CalendarServer/branches/release/CalendarServer-5.2-dev/twext/enterprise/queue.py        2013-11-21 01:25:20 UTC (rev 11988)
</span><span class="lines">@@ -149,7 +149,8 @@
</span><span class="cx">     NodeTable.addColumn(&quot;PORT&quot;, SQLType(&quot;integer&quot;, None))
</span><span class="cx">     NodeTable.addColumn(&quot;TIME&quot;, SQLType(&quot;timestamp&quot;, None)).setDefaultValue(
</span><span class="cx">         # Note: in the real data structure, this is actually a not-cleaned-up
</span><del>-        # sqlparse internal data structure, but it *should* look closer to this.
</del><ins>+        # sqlparse internal data structure, but it *should* look closer to
+        # this.
</ins><span class="cx">         ProcedureCall(&quot;timezone&quot;, [&quot;UTC&quot;, NamedValue('CURRENT_TIMESTAMP')])
</span><span class="cx">     )
</span><span class="cx">     for column in NodeTable.columns:
</span><span class="lines">@@ -677,8 +678,8 @@
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx"> 
</span><span class="cx">     def __init__(self, peerPool, boxReceiver=None, locator=None):
</span><del>-        super(ConnectionFromWorker, self).__init__(peerPool.schema, boxReceiver,
-                                                   locator)
</del><ins>+        super(ConnectionFromWorker, self).__init__(peerPool.schema,
+                                                   boxReceiver, locator)
</ins><span class="cx">         self.peerPool = peerPool
</span><span class="cx">         self._load = 0
</span><span class="cx"> 
</span><span class="lines">@@ -830,9 +831,9 @@
</span><span class="cx">             workItem = yield workItemClass.load(txn, workID)
</span><span class="cx">             if workItem.group is not None:
</span><span class="cx">                 yield NamedLock.acquire(txn, workItem.group)
</span><del>-            # TODO: what if we fail?  error-handling should be recorded someplace,
-            # the row should probably be marked, re-tries should be triggerable
-            # administratively.
</del><ins>+            # TODO: what if we fail?  error-handling should be recorded
+            # someplace, the row should probably be marked, re-tries should be
+            # triggerable administratively.
</ins><span class="cx">             yield workItem.delete()
</span><span class="cx">             # TODO: verify that workID is the primary key someplace.
</span><span class="cx">             yield workItem.doWork()
</span><span class="lines">@@ -865,9 +866,6 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-
-
-
</del><span class="cx"> class WorkerFactory(Factory, object):
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx">     Factory, to be used as the client to connect from the worker to the
</span><span class="lines">@@ -950,7 +948,7 @@
</span><span class="cx">         waiting for the transaction where that addition was completed to
</span><span class="cx">         commit, and asking the local node controller process to do the work.
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        @passthru(self.workItemType.create(self.txn, **self.kw).addCallback)
</del><ins>+        created = self.workItemType.create(self.txn, **self.kw)
</ins><span class="cx">         def whenCreated(item):
</span><span class="cx">             self._whenProposed.callback(self)
</span><span class="cx">             @self.txn.postCommit
</span><span class="lines">@@ -967,12 +965,15 @@
</span><span class="cx">                         self._whenExecuted.errback(why)
</span><span class="cx">                 reactor = self._chooser.reactor
</span><span class="cx">                 when = max(0, astimestamp(item.notBefore) - reactor.seconds())
</span><del>-                # TODO: Track the returned DelayedCall so it can be stopped when
-                # the service stops.
</del><ins>+                # TODO: Track the returned DelayedCall so it can be stopped
+                # when the service stops.
</ins><span class="cx">                 self._chooser.reactor.callLater(when, maybeLater)
</span><span class="cx">             @self.txn.postAbort
</span><span class="cx">             def whenFailed():
</span><span class="cx">                 self._whenCommitted.errback(TransactionFailed)
</span><ins>+        def whenNotCreated(failure):
+            self._whenProposed.errback(failure)
+        created.addCallbacks(whenCreated, whenNotCreated)
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     def whenExecuted(self):
</span><span class="lines">@@ -1023,6 +1024,8 @@
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         return _cloneDeferred(self._whenCommitted)
</span><span class="cx"> 
</span><ins>+
+
</ins><span class="cx"> class _BaseQueuer(object):
</span><span class="cx">     implements(IQueuer)
</span><span class="cx"> 
</span><span class="lines">@@ -1030,13 +1033,16 @@
</span><span class="cx">         super(_BaseQueuer, self).__init__()
</span><span class="cx">         self.proposalCallbacks = set()
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx">     def callWithNewProposals(self, callback):
</span><del>-        self.proposalCallbacks.add(callback);
</del><ins>+        self.proposalCallbacks.add(callback)
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx">     def transferProposalCallbacks(self, newQueuer):
</span><span class="cx">         newQueuer.proposalCallbacks = self.proposalCallbacks
</span><span class="cx">         return newQueuer
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx">     def enqueueWork(self, txn, workItemType, **kw):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         There is some work to do.  Do it, someplace else, ideally in parallel.
</span><span class="lines">@@ -1061,6 +1067,7 @@
</span><span class="cx">         return wp
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> class PeerConnectionPool(_BaseQueuer, MultiService, object):
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx">     Each node has a L{PeerConnectionPool} connecting it to all the other nodes
</span><span class="lines">@@ -1140,7 +1147,7 @@
</span><span class="cx">         self.mappedPeers = {}
</span><span class="cx">         self.schema = schema
</span><span class="cx">         self._startingUp = None
</span><del>-        self._listeningPortObject = None
</del><ins>+        self._listeningPort = None
</ins><span class="cx">         self._lastSeenTotalNodes = 1
</span><span class="cx">         self._lastSeenNodeIndex = 1
</span><span class="cx"> 
</span><span class="lines">@@ -1197,7 +1204,8 @@
</span><span class="cx">         A peer has requested us to perform some work; choose a work performer
</span><span class="cx">         local to this node, and then execute it.
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        return self.choosePerformer(onlyLocally=True).performWork(table, workID)
</del><ins>+        performer = self.choosePerformer(onlyLocally=True)
+        return performer.performWork(table, workID)
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     def allWorkItemTypes(self):
</span><span class="lines">@@ -1225,8 +1233,8 @@
</span><span class="cx"> 
</span><span class="cx">         @return: the maximum number of other L{PeerConnectionPool} instances
</span><span class="cx">             that may be connected to the database described by
</span><del>-            C{self.transactionFactory}.  Note that this is not the current count
-            by connectivity, but the count according to the database.
</del><ins>+            C{self.transactionFactory}.  Note that this is not the current
+            count by connectivity, but the count according to the database.
</ins><span class="cx">         @rtype: L{int}
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         # TODO
</span><span class="lines">@@ -1277,7 +1285,6 @@
</span><span class="cx">                                            overdueItem.workID)
</span><span class="cx">         return inTransaction(self.transactionFactory, workCheck)
</span><span class="cx"> 
</span><del>-
</del><span class="cx">     _currentWorkDeferred = None
</span><span class="cx">     _lostWorkCheckCall = None
</span><span class="cx"> 
</span><span class="lines">@@ -1315,10 +1322,10 @@
</span><span class="cx">         @inlineCallbacks
</span><span class="cx">         def startup(txn):
</span><span class="cx">             endpoint = TCP4ServerEndpoint(self.reactor, self.ampPort)
</span><del>-            # If this fails, the failure mode is going to be ugly, just like all
-            # conflicted-port failures.  But, at least it won't proceed.
-            self._listeningPortObject = yield endpoint.listen(self.peerFactory())
-            self.ampPort = self._listeningPortObject.getHost().port
</del><ins>+            # If this fails, the failure mode is going to be ugly, just like
+            # all conflicted-port failures.  But, at least it won't proceed.
+            self._listeningPort = yield endpoint.listen(self.peerFactory())
+            self.ampPort = self._listeningPort.getHost().port
</ins><span class="cx">             yield Lock.exclusive(NodeInfo.table).on(txn)
</span><span class="cx">             nodes = yield self.activeNodes(txn)
</span><span class="cx">             selves = [node for node in nodes
</span><span class="lines">@@ -1354,8 +1361,8 @@
</span><span class="cx">         yield super(PeerConnectionPool, self).stopService()
</span><span class="cx">         if self._startingUp is not None:
</span><span class="cx">             yield self._startingUp
</span><del>-        if self._listeningPortObject is not None:
-            yield self._listeningPortObject.stopListening()
</del><ins>+        if self._listeningPort is not None:
+            yield self._listeningPort.stopListening()
</ins><span class="cx">         if self._lostWorkCheckCall is not None:
</span><span class="cx">             self._lostWorkCheckCall.cancel()
</span><span class="cx">         if self._currentWorkDeferred is not None:
</span><span class="lines">@@ -1430,8 +1437,6 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-
-
</del><span class="cx"> class LocalQueuer(_BaseQueuer):
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx">     When work is enqueued with this queuer, it is just executed locally.
</span><span class="lines">@@ -1458,7 +1463,8 @@
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx">     Implementor of C{performWork} that doesn't actual perform any work.  This
</span><span class="cx">     is used in the case where you want to be able to enqueue work for someone
</span><del>-    else to do, but not take on any work yourself (such as a command line tool).
</del><ins>+    else to do, but not take on any work yourself (such as a command line
+    tool).
</ins><span class="cx">     &quot;&quot;&quot;
</span><span class="cx">     implements(_IWorkPerformer)
</span><span class="cx"> 
</span><span class="lines">@@ -1469,6 +1475,7 @@
</span><span class="cx">         return succeed(None)
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> class NonPerformingQueuer(_BaseQueuer):
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx">     When work is enqueued with this queuer, it is never executed locally.
</span><span class="lines">@@ -1487,4 +1494,4 @@
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Choose to perform the work locally.
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        return NonPerformer()
</del><span class="cx">\ No newline at end of file
</span><ins>+        return NonPerformer()
</ins></span></pre></div>
<a id="CalendarServerbranchesreleaseCalendarServer52devtwextenterprisetesttest_queuepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/release/CalendarServer-5.2-dev/twext/enterprise/test/test_queue.py (11987 => 11988)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/release/CalendarServer-5.2-dev/twext/enterprise/test/test_queue.py        2013-11-20 20:57:12 UTC (rev 11987)
+++ CalendarServer/branches/release/CalendarServer-5.2-dev/twext/enterprise/test/test_queue.py        2013-11-21 01:25:20 UTC (rev 11988)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> )
</span><span class="cx"> 
</span><span class="cx"> from twisted.trial.unittest import TestCase
</span><ins>+from twisted.python.failure import Failure
</ins><span class="cx"> from twisted.internet.defer import (
</span><span class="cx">     Deferred, inlineCallbacks, gatherResults, passthru#, returnValue
</span><span class="cx"> )
</span><span class="lines">@@ -55,6 +56,8 @@
</span><span class="cx"> from twisted.test.proto_helpers import StringTransport, MemoryReactor
</span><span class="cx"> from twext.enterprise.fixtures import SteppablePoolHelper
</span><span class="cx"> from twisted.internet.defer import returnValue
</span><ins>+from twext.enterprise.queue import LocalQueuer
+from twext.enterprise.fixtures import ConnectionPoolHelper
</ins><span class="cx"> 
</span><span class="cx"> from twext.enterprise.queue import _BaseQueuer, NonPerformingQueuer
</span><span class="cx"> import twext.enterprise.queue
</span><span class="lines">@@ -67,7 +70,7 @@
</span><span class="cx"> 
</span><span class="cx">     def callLater(self, _seconds, _f, *args, **kw):
</span><span class="cx">         if _seconds &lt; 0:
</span><del>-            raise ValueError(&quot;%s&lt;0: &quot;%(_seconds,))
</del><ins>+            raise ValueError(&quot;%s&lt;0: &quot; % (_seconds,))
</ins><span class="cx">         return super(Clock, self).callLater(_seconds, _f, *args, **kw)
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -267,6 +270,56 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+class WorkProposalTests(TestCase):
+    &quot;&quot;&quot;
+    Tests for L{WorkProposal}.
+    &quot;&quot;&quot;
+
+    def test_whenProposedSuccess(self):
+        &quot;&quot;&quot;
+        The L{Deferred} returned by L{WorkProposal.whenProposed} fires when the
+        SQL sent to the database has completed.
+        &quot;&quot;&quot;
+        cph = ConnectionPoolHelper()
+        cph.setUp(test=self)
+        cph.pauseHolders()
+        lq = LocalQueuer(cph.createTransaction)
+        enqTxn = cph.createTransaction()
+        wp = lq.enqueueWork(enqTxn, DummyWorkItem, a=3, b=4)
+        d = wp.whenProposed()
+        r = cph.resultOf(d)
+        self.assertEquals(r, [])
+        cph.flushHolders()
+        self.assertEquals(len(r), 1)
+
+
+    def test_whenProposedFailure(self):
+        &quot;&quot;&quot;
+        The L{Deferred} returned by L{WorkProposal.whenProposed} fails with an
+        errback when the SQL executed to create the WorkItem row fails.
+        &quot;&quot;&quot;
+        cph = ConnectionPoolHelper()
+        cph.setUp(self)
+        cph.pauseHolders()
+        firstConnection = cph.factory.willConnectTo()
+        enqTxn = cph.createTransaction()
+        # Execute some SQL on the connection before enqueueing the work-item so
+        # that we don't get the initial-statement.
+        enqTxn.execSQL(&quot;some sql&quot;)
+        lq = LocalQueuer(cph.createTransaction)
+        cph.flushHolders()
+        cph.pauseHolders()
+        wp = lq.enqueueWork(enqTxn, DummyWorkItem, a=3, b=4)
+        firstConnection.executeWillFail(lambda: RuntimeError(&quot;foo&quot;))
+        d = wp.whenProposed()
+        r = cph.resultOf(d)
+        self.assertEquals(r, [])
+        cph.flushHolders()
+        self.assertEquals(len(r), 1)
+        self.assertIsInstance(r[0], Failure)
+
+
+
</ins><span class="cx"> class PeerConnectionPoolUnitTests(TestCase):
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx">     L{PeerConnectionPool} has many internal components.
</span><span class="lines">@@ -393,7 +446,8 @@
</span><span class="cx">             # Next, create one that's actually far enough into the past to run.
</span><span class="cx">             yield DummyWorkItem.create(
</span><span class="cx">                 txn, a=3, b=4, notBefore=(
</span><del>-                    # Schedule it in the past so that it should have already run.
</del><ins>+                    # Schedule it in the past so that it should have already
+                    # run.
</ins><span class="cx">                     fakeNow - datetime.timedelta(
</span><span class="cx">                         seconds=qpool.queueProcessTimeout + 20
</span><span class="cx">                     )
</span><span class="lines">@@ -619,6 +673,7 @@
</span><span class="cx">         self.receiver, self.sender = self.sender, self.receiver
</span><span class="cx">         return result
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx">     def flush(self, turns=10):
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         Keep relaying data until there's no more.
</span><span class="lines">@@ -718,7 +773,7 @@
</span><span class="cx">         def op2(txn):
</span><span class="cx">             return Select([schema.DUMMY_WORK_DONE.WORK_ID,
</span><span class="cx">                            schema.DUMMY_WORK_DONE.A_PLUS_B],
</span><del>-                           From=schema.DUMMY_WORK_DONE).on(txn)
</del><ins>+                          From=schema.DUMMY_WORK_DONE).on(txn)
</ins><span class="cx">         rows = yield inTransaction(self.store.newTransaction, op2)
</span><span class="cx">         self.assertEquals(rows, [[4321, 7]])
</span><span class="cx"> 
</span><span class="lines">@@ -729,7 +784,7 @@
</span><span class="cx">         When a L{WorkItem} is concurrently deleted by another transaction, it
</span><span class="cx">         should I{not} perform its work.
</span><span class="cx">         &quot;&quot;&quot;
</span><del>-        # Provide access to a method called 'concurrently' everything using 
</del><ins>+        # Provide access to a method called 'concurrently' everything using
</ins><span class="cx">         original = self.store.newTransaction
</span><span class="cx">         def decorate(*a, **k):
</span><span class="cx">             result = original(*a, **k)
</span><span class="lines">@@ -746,13 +801,13 @@
</span><span class="cx">         # Sanity check on the concurrent deletion.
</span><span class="cx">         def op2(txn):
</span><span class="cx">             return Select([schema.DUMMY_WORK_ITEM.WORK_ID],
</span><del>-                           From=schema.DUMMY_WORK_ITEM).on(txn)
</del><ins>+                          From=schema.DUMMY_WORK_ITEM).on(txn)
</ins><span class="cx">         rows = yield inTransaction(self.store.newTransaction, op2)
</span><span class="cx">         self.assertEquals(rows, [])
</span><span class="cx">         def op3(txn):
</span><span class="cx">             return Select([schema.DUMMY_WORK_DONE.WORK_ID,
</span><span class="cx">                            schema.DUMMY_WORK_DONE.A_PLUS_B],
</span><del>-                           From=schema.DUMMY_WORK_DONE).on(txn)
</del><ins>+                          From=schema.DUMMY_WORK_DONE).on(txn)
</ins><span class="cx">         rows = yield inTransaction(self.store.newTransaction, op3)
</span><span class="cx">         self.assertEquals(rows, [])
</span><span class="cx"> 
</span><span class="lines">@@ -763,18 +818,23 @@
</span><span class="cx">     def __init__(self, *ignored):
</span><span class="cx">         pass
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx">     def _start(self):
</span><span class="cx">         pass
</span><span class="cx"> 
</span><ins>+
+
</ins><span class="cx"> class BaseQueuerTests(TestCase):
</span><span class="cx"> 
</span><span class="cx">     def setUp(self):
</span><span class="cx">         self.proposal = None
</span><span class="cx">         self.patch(twext.enterprise.queue, &quot;WorkProposal&quot;, DummyProposal)
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx">     def _proposalCallback(self, proposal):
</span><span class="cx">         self.proposal = proposal
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx">     def test_proposalCallbacks(self):
</span><span class="cx">         queuer = _BaseQueuer()
</span><span class="cx">         queuer.callWithNewProposals(self._proposalCallback)
</span><span class="lines">@@ -783,6 +843,7 @@
</span><span class="cx">         self.assertNotEqual(self.proposal, None)
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> class NonPerformingQueuerTests(TestCase):
</span><span class="cx"> 
</span><span class="cx">     @inlineCallbacks
</span><span class="lines">@@ -791,5 +852,3 @@
</span><span class="cx">         performer = queuer.choosePerformer()
</span><span class="cx">         result = (yield performer.performWork(None, None))
</span><span class="cx">         self.assertEquals(result, None)
</span><del>-
-
</del></span></pre>
</div>
</div>

</body>
</html>