<!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>[12990] CalendarServer/branches/users/sagen/move2who-4</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/12990">12990</a></dd>
<dt>Author</dt> <dd>sagen@apple.com</dd>
<dt>Date</dt> <dd>2014-03-21 19:55:46 -0700 (Fri, 21 Mar 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Starting to get test_gateway working again</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServerbranchesuserssagenmove2who4calendarservertoolsgatewaypy">CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/gateway.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4calendarservertoolsprincipalspy">CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/principals.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4calendarservertoolstestgatewayaugmentsxml">CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/gateway/augments.xml</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4calendarservertoolstestgatewaycaldavdplist">CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/gateway/caldavd.plist</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4calendarservertoolstestgatewayresourceslocationsxml">CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/gateway/resources-locations.xml</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4calendarservertoolstestgatewayusersgroupsxml">CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/gateway/users-groups.xml</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4calendarservertoolstesttest_gatewaypy">CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/test_gateway.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4twistedcaldavdirectoryaugmentpy">CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/augment.py</a></li>
<li><a href="#CalendarServerbranchesuserssagenmove2who4txdavwhoaugmentpy">CalendarServer/branches/users/sagen/move2who-4/txdav/who/augment.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServerbranchesuserssagenmove2who4calendarservertoolsgatewaypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/gateway.py (12989 => 12990)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/gateway.py        2014-03-21 22:29:24 UTC (rev 12989)
+++ CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/gateway.py        2014-03-22 02:55:46 UTC (rev 12990)
</span><span class="lines">@@ -19,31 +19,53 @@
</span><span class="cx">
</span><span class="cx"> from getopt import getopt, GetoptError
</span><span class="cx"> import os
</span><ins>+from plistlib import readPlistFromString, writePlistToString
</ins><span class="cx"> import sys
</span><span class="cx"> import xml
</span><span class="cx">
</span><del>-from plistlib import readPlistFromString, writePlistToString
-
-from twisted.internet.defer import inlineCallbacks, succeed
-from twistedcaldav.directory.directory import DirectoryError
-from txdav.xml import element as davxml
-
</del><ins>+from calendarserver.tools.cmdline import utilityMain
+from calendarserver.tools.config import WRITABLE_CONFIG_KEYS, setKeyPath, getKeyPath, flattenDictionary, WritableConfig
+from calendarserver.tools.principals import (
+ getProxies, setProxies
+)
+from calendarserver.tools.purge import WorkerService, PurgeOldEventsService, DEFAULT_BATCH_SIZE, DEFAULT_RETAIN_DAYS
</ins><span class="cx"> from calendarserver.tools.util import (
</span><span class="cx"> principalForPrincipalID, proxySubprincipal, addProxy, removeProxy,
</span><span class="cx"> ProxyError, ProxyWarning, autoDisableMemcached
</span><span class="cx"> )
</span><del>-from calendarserver.tools.principals import (
- getProxies, setProxies, updateRecord, attrMap
-)
-from calendarserver.tools.purge import WorkerService, PurgeOldEventsService, DEFAULT_BATCH_SIZE, DEFAULT_RETAIN_DAYS
-from calendarserver.tools.cmdline import utilityMain
-
</del><span class="cx"> from pycalendar.datetime import DateTime
</span><del>-
</del><ins>+from twext.who.directory import DirectoryRecord
+from twisted.internet.defer import inlineCallbacks, succeed
</ins><span class="cx"> from twistedcaldav.config import config, ConfigDict
</span><ins>+from txdav.xml import element as davxml
</ins><span class="cx">
</span><del>-from calendarserver.tools.config import WRITABLE_CONFIG_KEYS, setKeyPath, getKeyPath, flattenDictionary, WritableConfig
</del><ins>+from txdav.who.idirectory import RecordType as CalRecordType
+from twext.who.idirectory import FieldName
</ins><span class="cx">
</span><ins>+
+attrMap = {
+ 'GeneratedUID': {'attr': 'uid', },
+ 'RealName': {'attr': 'fullNames', },
+ 'RecordName': {'attr': 'shortNames', },
+ 'AutoScheduleMode': {'attr': 'autoScheduleMode', },
+ 'AutoAcceptGroup': {'attr': 'autoAcceptGroup', },
+
+ # 'Comment': {'extras': True, 'attr': 'comment', },
+ # 'Description': {'extras': True, 'attr': 'description', },
+ # 'Type': {'extras': True, 'attr': 'type', },
+
+ # For "Locations", i.e. scheduled spaces
+ 'Capacity': {'attr': 'capacity', },
+ 'Floor': {'attr': 'floor', },
+ 'AssociatedAddress': {'attr': 'associatedAddress', },
+
+ # For "Addresses", i.e. nonscheduled areas containing Locations
+ 'AbbreviatedName': {'attr': 'abbreviatedName', },
+ 'StreetAddress': {'attr': 'streetAddress', },
+ 'GeographicLocation': {'attr': 'geographicLocation', },
+}
+
+
</ins><span class="cx"> def usage(e=None):
</span><span class="cx">
</span><span class="cx"> name = os.path.basename(sys.argv[0])
</span><span class="lines">@@ -76,9 +98,7 @@
</span><span class="cx"> """
</span><span class="cx"> Create/run a Runner to execute the commands
</span><span class="cx"> """
</span><del>- rootResource = self.rootResource()
- directory = rootResource.getDirectory()
- runner = Runner(rootResource, directory, self.store, self.commands)
</del><ins>+ runner = Runner(self.store, self.commands)
</ins><span class="cx"> if runner.validate():
</span><span class="cx"> yield runner.run()
</span><span class="cx">
</span><span class="lines">@@ -145,10 +165,9 @@
</span><span class="cx">
</span><span class="cx"> class Runner(object):
</span><span class="cx">
</span><del>- def __init__(self, root, directory, store, commands, output=None):
- self.root = root
- self.dir = directory
</del><ins>+ def __init__(self, store, commands, output=None):
</ins><span class="cx"> self.store = store
</span><ins>+ self.dir = store.directoryService()
</ins><span class="cx"> self.commands = commands
</span><span class="cx"> if output is None:
</span><span class="cx"> output = sys.stdout
</span><span class="lines">@@ -180,12 +199,13 @@
</span><span class="cx"> pool.ClientEnabled = True
</span><span class="cx"> autoDisableMemcached(config)
</span><span class="cx">
</span><del>- from twistedcaldav.directory import calendaruserproxy
- if calendaruserproxy.ProxyDBService is not None:
- # Reset the proxy db memcacher because memcached may have come or
- # gone since the last time through here.
- # TODO: figure out a better way to do this
- calendaruserproxy.ProxyDBService._memcacher._memcacheProtocol = None
</del><ins>+ # FIXME:
+ # from twistedcaldav.directory import calendaruserproxy
+ # if calendaruserproxy.ProxyDBService is not None:
+ # # Reset the proxy db memcacher because memcached may have come or
+ # # gone since the last time through here.
+ # # TODO: figure out a better way to do this
+ # calendaruserproxy.ProxyDBService._memcacher._memcacheProtocol = None
</ins><span class="cx">
</span><span class="cx"> try:
</span><span class="cx"> for command in self.commands:
</span><span class="lines">@@ -203,47 +223,85 @@
</span><span class="cx">
</span><span class="cx"> # Locations
</span><span class="cx">
</span><ins>+ # deferred
</ins><span class="cx"> def command_getLocationList(self, command):
</span><del>- self.respondWithRecordsOfTypes(self.dir, command, ["locations"])
</del><ins>+ return self.respondWithRecordsOfTypes(self.dir, command, ["locations"])
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def command_createLocation(self, command):
</span><del>- kwargs = {}
</del><ins>+
+ fields = {
+ FieldName.recordType: CalRecordType.location
+ }
</ins><span class="cx"> for key, info in attrMap.iteritems():
</span><span class="cx"> if key in command:
</span><del>- kwargs[info['attr']] = command[key]
</del><ins>+ attrName = info['attr']
+ field = self.dir.fieldName.lookupByName(attrName)
+ valueType = self.dir.fieldName.valueType(field)
+ value = command[key]
+ if self.dir.fieldName.isMultiValue(field) and not isinstance(value, list):
+ value = [value]
+ if valueType == int:
+ value = int(value)
+ else:
+ if isinstance(value, list):
+ newList = []
+ for item in value:
+ if isinstance(item, str):
+ newList.append(item.decode("utf-8"))
+ else:
+ newList.append(item)
+ value = newList
+ elif isinstance(value, str):
+ value = value.decode("utf-8")
</ins><span class="cx">
</span><del>- try:
- record = (yield updateRecord(True, self.dir, "locations", **kwargs))
- except DirectoryError, e:
- self.respondWithError(str(e))
- return
</del><ins>+ fields[field] = value
</ins><span class="cx">
</span><ins>+ record = DirectoryRecord(self.dir, fields)
+ yield self.dir.updateRecords([record], create=True)
+
+
</ins><span class="cx"> readProxies = command.get("ReadProxies", None)
</span><ins>+ if readProxies:
+ proxyRecords = []
+ for proxyUID in readProxies:
+ proxyRecord = yield self.dir.recordWithUID(proxyUID)
+ if proxyRecord is not None:
+ proxyRecords.append(proxyRecord)
+ readProxies = proxyRecords
+
</ins><span class="cx"> writeProxies = command.get("WriteProxies", None)
</span><del>- principal = principalForPrincipalID(record.guid, directory=self.dir)
- (yield setProxies(self.store, principal, readProxies, writeProxies, directory=self.dir))
</del><ins>+ if writeProxies:
+ proxyRecords = []
+ for proxyUID in writeProxies:
+ proxyRecord = yield self.dir.recordWithUID(proxyUID)
+ if proxyRecord is not None:
+ proxyRecords.append(proxyRecord)
+ writeProxies = proxyRecords
</ins><span class="cx">
</span><del>- self.respondWithRecordsOfTypes(self.dir, command, ["locations"])
</del><ins>+ yield setProxies(record, readProxies, writeProxies)
</ins><span class="cx">
</span><ins>+ yield self.respondWithRecordsOfTypes(self.dir, command, ["locations"])
</ins><span class="cx">
</span><ins>+
</ins><span class="cx"> @inlineCallbacks
</span><span class="cx"> def command_getLocationAttributes(self, command):
</span><del>- guid = command['GeneratedUID']
- record = self.dir.recordWithGUID(guid)
</del><ins>+ uid = command['GeneratedUID']
+ record = yield self.dir.recordWithUID(uid)
</ins><span class="cx"> if record is None:
</span><del>- self.respondWithError("Principal not found: %s" % (guid,))
</del><ins>+ self.respondWithError("Location not found: %s" % (uid,))
</ins><span class="cx"> return
</span><span class="cx"> recordDict = recordToDict(record)
</span><del>- principal = principalForPrincipalID(guid, directory=self.dir)
- if principal is None:
- self.respondWithError("Principal not found: %s" % (guid,))
- return
- recordDict['AutoSchedule'] = principal.getAutoSchedule()
- recordDict['AutoAcceptGroup'] = principal.getAutoAcceptGroup()
- recordDict['ReadProxies'], recordDict['WriteProxies'] = (yield getProxies(principal,
- directory=self.dir))
</del><ins>+ # recordDict['AutoSchedule'] = principal.getAutoSchedule()
+ try:
+ recordDict['AutoAcceptGroup'] = record.autoAcceptGroup
+ except AttributeError:
+ pass
+
+ readProxies, writeProxies = yield getProxies(record)
+ recordDict['ReadProxies'] = [r.uid for r in readProxies]
+ recordDict['WriteProxies'] = [r.uid for r in writeProxies]
</ins><span class="cx"> self.respond(command, recordDict)
</span><span class="cx">
</span><span class="cx"> command_getResourceAttributes = command_getLocationAttributes
</span><span class="lines">@@ -358,8 +416,9 @@
</span><span class="cx"> self.respondWithRecordsOfTypes(self.dir, command, ["resources"])
</span><span class="cx">
</span><span class="cx">
</span><ins>+ # deferred
</ins><span class="cx"> def command_getLocationAndResourceList(self, command):
</span><del>- self.respondWithRecordsOfTypes(self.dir, command, ["locations", "resources"])
</del><ins>+ return self.respondWithRecordsOfTypes(self.dir, command, ["locations", "resources"])
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> # Addresses
</span><span class="lines">@@ -604,10 +663,12 @@
</span><span class="cx"> })
</span><span class="cx">
</span><span class="cx">
</span><ins>+ @inlineCallbacks
</ins><span class="cx"> def respondWithRecordsOfTypes(self, directory, command, recordTypes):
</span><span class="cx"> result = []
</span><span class="cx"> for recordType in recordTypes:
</span><del>- for record in directory.recordsWithRecordType(recordType):
</del><ins>+ recordType = directory.oldNameToRecordType(recordType)
+ for record in (yield directory.recordsWithRecordType(recordType)):
</ins><span class="cx"> recordDict = recordToDict(record)
</span><span class="cx"> result.append(recordDict)
</span><span class="cx"> self.respond(command, result)
</span><span class="lines">@@ -626,11 +687,10 @@
</span><span class="cx"> recordDict = {}
</span><span class="cx"> for key, info in attrMap.iteritems():
</span><span class="cx"> try:
</span><del>- if info.get('extras', False):
- value = record.extras[info['attr']]
- else:
- value = getattr(record, info['attr'])
- if isinstance(value, str):
</del><ins>+ value = record.fields[record.service.fieldName.lookupByName(info['attr'])]
+ if value is None:
+ continue
+ elif isinstance(value, str):
</ins><span class="cx"> value = value.decode("utf-8")
</span><span class="cx"> recordDict[key] = value
</span><span class="cx"> except KeyError:
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4calendarservertoolsprincipalspy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/principals.py (12989 => 12990)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/principals.py        2014-03-21 22:29:24 UTC (rev 12989)
+++ CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/principals.py        2014-03-22 02:55:46 UTC (rev 12990)
</span><span class="lines">@@ -119,29 +119,7 @@
</span><span class="cx"> yield self.function(self.store, *self.params)
</span><span class="cx">
</span><span class="cx">
</span><del>-attrMap = {
- 'GeneratedUID': {'attr': 'guid', },
- 'RealName': {'attr': 'fullName', },
- 'RecordName': {'attr': 'shortNames', },
- 'AutoSchedule': {'attr': 'autoSchedule', },
- 'AutoAcceptGroup': {'attr': 'autoAcceptGroup', },
</del><span class="cx">
</span><del>- 'Comment': {'extras': True, 'attr': 'comment', },
- 'Description': {'extras': True, 'attr': 'description', },
- 'Type': {'extras': True, 'attr': 'type', },
-
- # For "Locations", i.e. scheduled spaces
- 'Capacity': {'extras': True, 'attr': 'capacity', },
- 'Floor': {'extras': True, 'attr': 'floor', },
- 'AssociatedAddress': {'extras': True, 'attr': 'associatedAddress', },
-
- # For "Addresses", i.e. nonscheduled areas containing Locations
- 'AbbreviatedName': {'extras': True, 'attr': 'abbreviatedName', },
- 'StreetAddress': {'extras': True, 'attr': 'streetAddress', },
- 'Geo': {'extras': True, 'attr': 'geo', },
-}
-
-
</del><span class="cx"> def main():
</span><span class="cx"> try:
</span><span class="cx"> (optargs, args) = getopt(
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4calendarservertoolstestgatewayaugmentsxml"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/gateway/augments.xml (12989 => 12990)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/gateway/augments.xml        2014-03-21 22:29:24 UTC (rev 12989)
+++ CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/gateway/augments.xml        2014-03-22 02:55:46 UTC (rev 12990)
</span><span class="lines">@@ -20,12 +20,6 @@
</span><span class="cx">
</span><span class="cx"> <augments>
</span><span class="cx"> <record>
</span><del>- <uid>Default</uid>
- <enable>true</enable>
- <enable-calendar>true</enable-calendar>
- <enable-addressbook>true</enable-addressbook>
- </record>
- <record>
</del><span class="cx"> <uid>user01</uid>
</span><span class="cx"> <enable>true</enable>
</span><span class="cx"> <enable-calendar>true</enable-calendar>
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4calendarservertoolstestgatewaycaldavdplist"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/gateway/caldavd.plist (12989 => 12990)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/gateway/caldavd.plist        2014-03-21 22:29:24 UTC (rev 12989)
+++ CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/gateway/caldavd.plist        2014-03-22 02:55:46 UTC (rev 12990)
</span><span class="lines">@@ -34,14 +34,6 @@
</span><span class="cx"> <key>ServerHostName</key>
</span><span class="cx"> <string></string> <!-- The hostname clients use when connecting -->
</span><span class="cx">
</span><del>- <!-- Enable Calendars -->
- <key>EnableCalDAV</key>
- <true/>
-
- <!-- Enable AddressBooks -->
- <key>EnableCardDAV</key>
- <true/>
-
</del><span class="cx"> <!-- HTTP port [0 = disable HTTP] -->
</span><span class="cx"> <key>HTTPPort</key>
</span><span class="cx"> <integer>8008</integer>
</span><span class="lines">@@ -85,29 +77,29 @@
</span><span class="cx"> <key>ServerRoot</key>
</span><span class="cx"> <string>%(ServerRoot)s</string>
</span><span class="cx">
</span><ins>+ <!-- Data root -->
+ <key>DataRoot</key>
+ <string>%(DataRoot)s</string>
+
</ins><span class="cx"> <!-- Database root -->
</span><span class="cx"> <key>DatabaseRoot</key>
</span><span class="cx"> <string>%(DatabaseRoot)s</string>
</span><span class="cx">
</span><del>- <!-- Data root -->
- <key>DataRoot</key>
- <string>Data</string>
-
</del><span class="cx"> <!-- Document root -->
</span><span class="cx"> <key>DocumentRoot</key>
</span><del>- <string>Documents</string>
</del><ins>+ <string>%(DocumentRoot)s</string>
</ins><span class="cx">
</span><span class="cx"> <!-- Configuration root -->
</span><span class="cx"> <key>ConfigRoot</key>
</span><del>- <string>config</string>
</del><ins>+ <string>%(ConfigRoot)s</string>
</ins><span class="cx">
</span><span class="cx"> <!-- Log root -->
</span><span class="cx"> <key>LogRoot</key>
</span><del>- <string>Logs</string>
</del><ins>+ <string>%(LogRoot)s</string>
</ins><span class="cx">
</span><span class="cx"> <!-- Run root -->
</span><span class="cx"> <key>RunRoot</key>
</span><del>- <string>Logs/state</string>
</del><ins>+ <string>%(RunRoot)s</string>
</ins><span class="cx">
</span><span class="cx"> <!-- Child aliases -->
</span><span class="cx"> <key>Aliases</key>
</span><span class="lines">@@ -147,7 +139,7 @@
</span><span class="cx"> <dict>
</span><span class="cx"> <key>type</key>
</span><span class="cx"> <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
</span><del>-
</del><ins>+
</ins><span class="cx"> <key>params</key>
</span><span class="cx"> <dict>
</span><span class="cx"> <key>xmlFile</key>
</span><span class="lines">@@ -167,7 +159,7 @@
</span><span class="cx"> <true/>
</span><span class="cx"> <key>type</key>
</span><span class="cx"> <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>
</span><del>-
</del><ins>+
</ins><span class="cx"> <key>params</key>
</span><span class="cx"> <dict>
</span><span class="cx"> <key>xmlFile</key>
</span><span class="lines">@@ -180,14 +172,14 @@
</span><span class="cx"> </array>
</span><span class="cx"> </dict>
</span><span class="cx"> </dict>
</span><del>-
</del><ins>+
</ins><span class="cx"> <!-- Open Directory Service (Mac OS X) -->
</span><span class="cx"> <!--
</span><span class="cx"> <key>DirectoryService</key>
</span><span class="cx"> <dict>
</span><span class="cx"> <key>type</key>
</span><span class="cx"> <string>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</string>
</span><del>-
</del><ins>+
</ins><span class="cx"> <key>params</key>
</span><span class="cx"> <dict>
</span><span class="cx"> <key>node</key>
</span><span class="lines">@@ -211,7 +203,7 @@
</span><span class="cx"> <dict>
</span><span class="cx"> <key>type</key>
</span><span class="cx"> <string>twistedcaldav.directory.augment.AugmentXMLDB</string>
</span><del>-
</del><ins>+
</ins><span class="cx"> <key>params</key>
</span><span class="cx"> <dict>
</span><span class="cx"> <key>xmlFiles</key>
</span><span class="lines">@@ -220,14 +212,14 @@
</span><span class="cx"> </array>
</span><span class="cx"> </dict>
</span><span class="cx"> </dict>
</span><del>-
</del><ins>+
</ins><span class="cx"> <!-- Sqlite Augment Service -->
</span><span class="cx"> <!--
</span><span class="cx"> <key>AugmentService</key>
</span><span class="cx"> <dict>
</span><span class="cx"> <key>type</key>
</span><span class="cx"> <string>twistedcaldav.directory.augment.AugmentSqliteDB</string>
</span><del>-
</del><ins>+
</ins><span class="cx"> <key>params</key>
</span><span class="cx"> <dict>
</span><span class="cx"> <key>dbpath</key>
</span><span class="lines">@@ -242,7 +234,7 @@
</span><span class="cx"> <dict>
</span><span class="cx"> <key>type</key>
</span><span class="cx"> <string>twistedcaldav.directory.augment.AugmentPostgreSQLDB</string>
</span><del>-
</del><ins>+
</ins><span class="cx"> <key>params</key>
</span><span class="cx"> <dict>
</span><span class="cx"> <key>host</key>
</span><span class="lines">@@ -258,7 +250,7 @@
</span><span class="cx"> <dict>
</span><span class="cx"> <key>type</key>
</span><span class="cx"> <string>twistedcaldav.directory.calendaruserproxy.ProxySqliteDB</string>
</span><del>-
</del><ins>+
</ins><span class="cx"> <key>params</key>
</span><span class="cx"> <dict>
</span><span class="cx"> <key>dbpath</key>
</span><span class="lines">@@ -272,7 +264,7 @@
</span><span class="cx"> <dict>
</span><span class="cx"> <key>type</key>
</span><span class="cx"> <string>twistedcaldav.directory.calendaruserproxy.ProxyPostgreSQLDB</string>
</span><del>-
</del><ins>+
</ins><span class="cx"> <key>params</key>
</span><span class="cx"> <dict>
</span><span class="cx"> <key>host</key>
</span><span class="lines">@@ -490,31 +482,65 @@
</span><span class="cx">
</span><span class="cx"> <key>Services</key>
</span><span class="cx"> <dict>
</span><ins>+ <key>SimpleLineNotifier</key>
+ <dict>
+ <!-- Simple line notification service (for testing) -->
+ <key>Service</key>
+ <string>twistedcaldav.notify.SimpleLineNotifierService</string>
+ <key>Enabled</key>
+ <false/>
+ <key>Port</key>
+ <integer>62308</integer>
+ </dict>
</ins><span class="cx">
</span><del>- <key>APNS</key>
</del><ins>+ <key>XMPPNotifier</key>
</ins><span class="cx"> <dict>
</span><ins>+ <!-- XMPP notification service -->
+ <key>Service</key>
+ <string>twistedcaldav.notify.XMPPNotifierService</string>
</ins><span class="cx"> <key>Enabled</key>
</span><span class="cx"> <false/>
</span><del>- <key>EnableStaggering</key>
- <true/>
- <key>StaggerSeconds</key>
- <integer>5</integer>
- <key>CalDAV</key>
</del><ins>+
+ <!-- XMPP host and port to contact -->
+ <key>Host</key>
+ <string>xmpp.host.name</string>
+ <key>Port</key>
+ <integer>5222</integer>
+
+ <!-- Jabber ID and password for the server -->
+ <key>JID</key>
+ <string>jid@xmpp.host.name/resource</string>
+ <key>Password</key>
+ <string>password_goes_here</string>
+
+ <!-- PubSub service address -->
+ <key>ServiceAddress</key>
+ <string>pubsub.xmpp.host.name</string>
+
+ <key>NodeConfiguration</key>
</ins><span class="cx"> <dict>
</span><del>- <key>CertificatePath</key>
- <string>/example/calendar.cer</string>
- <key>PrivateKeyPath</key>
- <string>/example/calendar.pem</string>
</del><ins>+ <key>pubsub#deliver_payloads</key>
+ <string>1</string>
+ <key>pubsub#persist_items</key>
+ <string>1</string>
</ins><span class="cx"> </dict>
</span><del>- <key>CardDAV</key>
- <dict>
- <key>CertificatePath</key>
- <string>/example/contacts.cer</string>
- <key>PrivateKeyPath</key>
- <string>/example/contacts.pem</string>
- </dict>
</del><ins>+
+ <!-- Sends a presence notification to XMPP server at this interval (prevents disconnect) -->
+ <key>KeepAliveSeconds</key>
+ <integer>120</integer>
+
+ <!-- Sends a pubsub publish to a particular heartbeat node at this interval -->
+ <key>HeartbeatMinutes</key>
+ <integer>30</integer>
+
+ <!-- List of glob-like expressions defining which XMPP JIDs can converse with the server (for debugging) -->
+ <key>AllowedJIDs</key>
+ <array>
+ <!--
+ <string>*.example.com</string>
+ -->
+ </array>
</ins><span class="cx"> </dict>
</span><del>-
</del><span class="cx"> </dict>
</span><span class="cx"> </dict>
</span><span class="cx">
</span><span class="lines">@@ -651,6 +677,7 @@
</span><span class="cx">         <key>UsePackageTimezones</key>
</span><span class="cx">         <true/>
</span><span class="cx">
</span><ins>+
</ins><span class="cx"> <!--
</span><span class="cx"> Miscellaneous items
</span><span class="cx"> -->
</span><span class="lines">@@ -666,7 +693,7 @@
</span><span class="cx"> <!-- Support for Content-Encoding compression options as specified in RFC2616 Section 3.5 -->
</span><span class="cx"> <key>ResponseCompression</key>
</span><span class="cx"> <false/>
</span><del>-
</del><ins>+
</ins><span class="cx"> <!-- The retry-after value (in seconds) to return with a 503 error. -->
</span><span class="cx"> <key>HTTPRetryAfter</key>
</span><span class="cx"> <integer>180</integer>
</span><span class="lines">@@ -705,7 +732,6 @@
</span><span class="cx"> <key>ResponseCacheTimeout</key>
</span><span class="cx"> <integer>30</integer> <!-- in minutes -->
</span><span class="cx">
</span><del>-
</del><span class="cx"> <!-- For unit tests, enable SharedConnectionPool so we don't use up shared memory -->
</span><span class="cx"> <key>SharedConnectionPool</key>
</span><span class="cx"> <true/>
</span><span class="lines">@@ -730,12 +756,5 @@
</span><span class="cx"> </dict>
</span><span class="cx">
</span><span class="cx">
</span><del>- <key>Includes</key>
- <array>
- <string>%(WritablePlist)s</string>
- </array>
- <key>WritableConfigFile</key>
- <string>%(WritablePlist)s</string>
-
</del><span class="cx"> </dict>
</span><span class="cx"> </plist>
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4calendarservertoolstestgatewayresourceslocationsxml"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/gateway/resources-locations.xml (12989 => 12990)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/gateway/resources-locations.xml        2014-03-21 22:29:24 UTC (rev 12989)
+++ CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/gateway/resources-locations.xml        2014-03-22 02:55:46 UTC (rev 12990)
</span><span class="lines">@@ -18,7 +18,110 @@
</span><span class="cx">
</span><span class="cx"> <!DOCTYPE accounts SYSTEM "accounts.dtd">
</span><span class="cx">
</span><del>-<accounts realm="Test Realm">
</del><ins>+<directory realm="Test Realm">
+ <record type="location">
+ <short-name>location01</short-name>
+ <uid>location01</uid>
+ <full-name>Room 01</full-name>
+ </record>
+ <record type="location">
+ <short-name>location02</short-name>
+ <uid>location02</uid>
+ <full-name>Room 02</full-name>
+ </record>
+ <record type="location">
+ <short-name>location03</short-name>
+ <uid>location03</uid>
+ <full-name>Room 03</full-name>
+ </record>
+ <record type="location">
+ <short-name>location04</short-name>
+ <uid>location04</uid>
+ <full-name>Room 04</full-name>
+ </record>
+ <record type="location">
+ <short-name>location05</short-name>
+ <uid>location05</uid>
+ <full-name>Room 05</full-name>
+ </record>
+ <record type="location">
+ <short-name>location06</short-name>
+ <uid>location06</uid>
+ <full-name>Room 06</full-name>
+ </record>
+ <record type="location">
+ <short-name>location07</short-name>
+ <uid>location07</uid>
+ <full-name>Room 07</full-name>
+ </record>
+ <record type="location">
+ <short-name>location08</short-name>
+ <uid>location08</uid>
+ <full-name>Room 08</full-name>
+ </record>
+ <record type="location">
+ <short-name>location09</short-name>
+ <uid>location09</uid>
+ <full-name>Room 09</full-name>
+ </record>
+ <record type="location">
+ <short-name>location10</short-name>
+ <uid>location10</uid>
+ <full-name>Room 10</full-name>
+ </record>
+
+ <record type="resource">
+ <short-name>resource01</short-name>
+ <uid>resource01</uid>
+ <full-name>Resource 01</full-name>
+ </record>
+ <record type="resource">
+ <short-name>resource02</short-name>
+ <uid>resource02</uid>
+ <full-name>Resource 02</full-name>
+ </record>
+ <record type="resource">
+ <short-name>resource03</short-name>
+ <uid>resource03</uid>
+ <full-name>Resource 03</full-name>
+ </record>
+ <record type="resource">
+ <short-name>resource04</short-name>
+ <uid>resource04</uid>
+ <full-name>Resource 04</full-name>
+ </record>
+ <record type="resource">
+ <short-name>resource05</short-name>
+ <uid>resource05</uid>
+ <full-name>Resource 05</full-name>
+ </record>
+ <record type="resource">
+ <short-name>resource06</short-name>
+ <uid>resource06</uid>
+ <full-name>Resource 06</full-name>
+ </record>
+ <record type="resource">
+ <short-name>resource07</short-name>
+ <uid>resource07</uid>
+ <full-name>Resource 07</full-name>
+ </record>
+ <record type="resource">
+ <short-name>resource08</short-name>
+ <uid>resource08</uid>
+ <full-name>Resource 08</full-name>
+ </record>
+ <record type="resource">
+ <short-name>resource09</short-name>
+ <uid>resource09</uid>
+ <full-name>Resource 09</full-name>
+ </record>
+ <record type="resource">
+ <short-name>resource10</short-name>
+ <uid>resource10</uid>
+ <full-name>Resource 10</full-name>
+ </record>
+
+ <!--
</ins><span class="cx"> <location repeat="10">
</span><span class="cx"> <uid>location%02d</uid>
</span><span class="cx"> <guid>location%02d</guid>
</span><span class="lines">@@ -31,4 +134,5 @@
</span><span class="cx"> <password>resource%02d</password>
</span><span class="cx"> <name>Resource %02d</name>
</span><span class="cx"> </resource>
</span><del>-</accounts>
</del><ins>+-->
+</directory>
</ins></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4calendarservertoolstestgatewayusersgroupsxml"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/gateway/users-groups.xml (12989 => 12990)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/gateway/users-groups.xml        2014-03-21 22:29:24 UTC (rev 12989)
+++ CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/gateway/users-groups.xml        2014-03-22 02:55:46 UTC (rev 12990)
</span><span class="lines">@@ -18,7 +18,95 @@
</span><span class="cx">
</span><span class="cx"> <!DOCTYPE accounts SYSTEM "accounts.dtd">
</span><span class="cx">
</span><del>-<accounts realm="Test Realm">
</del><ins>+<directory realm="Test Realm">
+ <record type="user">
+ <short-name>user01</short-name>
+ <uid>user01</uid>
+ <password>user01</password>
+ <full-name>User 01</full-name>
+ <email>user01@example.com</email>
+ </record>
+
+ <record type="user">
+ <short-name>user02</short-name>
+ <uid>user02</uid>
+ <password>user02</password>
+ <full-name>User 02</full-name>
+ <email>user02@example.com</email>
+ </record>
+
+ <record type="user">
+ <short-name>user03</short-name>
+ <uid>user03</uid>
+ <password>user03</password>
+ <full-name>User 03</full-name>
+ <email>user03@example.com</email>
+ </record>
+
+ <record type="user">
+ <short-name>user04</short-name>
+ <uid>user04</uid>
+ <password>user04</password>
+ <full-name>User 04</full-name>
+ <email>user04@example.com</email>
+ </record>
+
+ <record type="user">
+ <short-name>user05</short-name>
+ <uid>user05</uid>
+ <password>user05</password>
+ <full-name>User 05</full-name>
+ <email>user05@example.com</email>
+ </record>
+
+ <record type="user">
+ <short-name>user06</short-name>
+ <uid>user06</uid>
+ <password>user06</password>
+ <full-name>User 06</full-name>
+ <email>user06@example.com</email>
+ </record>
+
+ <record type="user">
+ <short-name>user07</short-name>
+ <uid>user07</uid>
+ <password>user07</password>
+ <full-name>User 07</full-name>
+ <email>user07@example.com</email>
+ </record>
+
+ <record type="user">
+ <short-name>user08</short-name>
+ <uid>user08</uid>
+ <password>user08</password>
+ <full-name>User 08</full-name>
+ <email>user08@example.com</email>
+ </record>
+
+ <record type="user">
+ <short-name>user09</short-name>
+ <uid>user09</uid>
+ <password>user09</password>
+ <full-name>User 09</full-name>
+ <email>user09@example.com</email>
+ </record>
+
+ <record type="user">
+ <short-name>user10</short-name>
+ <uid>user10</uid>
+ <password>user10</password>
+ <full-name>User 10</full-name>
+ <email>user10@example.com</email>
+ </record>
+
+ <record type="group">
+ <uid>e5a6142c-4189-4e9e-90b0-9cd0268b314b</uid>
+ <short-name>testgroup1</short-name>
+ <full-name>Group 01</full-name>
+ <member-uid type="users">user01</member-uid>
+ <member-uid type="users">user02</member-uid>
+ </record>
+ <!--
</ins><span class="cx"> <user repeat="10">
</span><span class="cx"> <uid>user%02d</uid>
</span><span class="cx"> <guid>user%02d</guid>
</span><span class="lines">@@ -37,13 +125,5 @@
</span><span class="cx"> <member type="users">user02</member>
</span><span class="cx"> </members>
</span><span class="cx"> </group>
</span><del>- <group>
- <uid>testgroup2</uid>
- <guid>f5a6142c-4189-4e9e-90b0-9cd0268b314b</guid>
- <password>test</password>
- <name>Group 02</name>
- <members>
- <member type="users">user01</member>
- </members>
- </group>
-</accounts>
</del><ins>+ -->
+</directory>
</ins></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4calendarservertoolstesttest_gatewaypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/test_gateway.py (12989 => 12990)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/test_gateway.py        2014-03-21 22:29:24 UTC (rev 12989)
+++ CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/test/test_gateway.py        2014-03-22 02:55:46 UTC (rev 12990)
</span><span class="lines">@@ -25,17 +25,45 @@
</span><span class="cx"> from twisted.internet.defer import inlineCallbacks, Deferred, returnValue
</span><span class="cx">
</span><span class="cx"> from twistedcaldav.config import config
</span><del>-from twistedcaldav.test.util import TestCase, CapturingProcessProtocol
</del><ins>+from twistedcaldav.test.util import StoreTestCase, CapturingProcessProtocol
</ins><span class="cx"> import plistlib
</span><del>-from twisted.trial.unittest import SkipTest
</del><ins>+from twistedcaldav.memcacheclient import ClientFactory
+from twistedcaldav import memcacher
</ins><span class="cx">
</span><span class="cx">
</span><del>-class RunCommandTestCase(TestCase):
</del><ins>+class RunCommandTestCase(StoreTestCase):
</ins><span class="cx">
</span><del>- def setUp(self):
- super(RunCommandTestCase, self).setUp()
- raise SkipTest("Needs porting to twext.who still")
</del><ins>+ def configure(self):
+ """
+ Override the standard StoreTestCase configuration
+ """
+ self.serverRoot = self.mktemp()
+ os.mkdir(self.serverRoot)
+ absoluteServerRoot = os.path.abspath(self.serverRoot)
</ins><span class="cx">
</span><ins>+ configRoot = os.path.join(absoluteServerRoot, "Config")
+ if not os.path.exists(configRoot):
+ os.makedirs(configRoot)
+
+ dataRoot = os.path.join(absoluteServerRoot, "Data")
+ if not os.path.exists(dataRoot):
+ os.makedirs(dataRoot)
+
+ documentRoot = os.path.join(absoluteServerRoot, "Documents")
+ if not os.path.exists(documentRoot):
+ os.makedirs(documentRoot)
+
+ logRoot = os.path.join(absoluteServerRoot, "Logs")
+ if not os.path.exists(logRoot):
+ os.makedirs(logRoot)
+
+ runRoot = os.path.join(absoluteServerRoot, "Run")
+ if not os.path.exists(runRoot):
+ os.makedirs(runRoot)
+
+ config.reset()
+ self.configInit()
+
</ins><span class="cx"> testRoot = os.path.join(os.path.dirname(__file__), "gateway")
</span><span class="cx"> templateName = os.path.join(testRoot, "caldavd.plist")
</span><span class="cx"> templateFile = open(templateName)
</span><span class="lines">@@ -44,41 +72,79 @@
</span><span class="cx">
</span><span class="cx"> databaseRoot = os.path.abspath("_spawned_scripts_db" + str(os.getpid()))
</span><span class="cx"> newConfig = template % {
</span><del>- "ServerRoot" : os.path.abspath(config.ServerRoot),
- "DatabaseRoot" : databaseRoot,
- "WritablePlist" : os.path.join(os.path.abspath(config.ConfigRoot), "caldavd-writable.plist"),
</del><ins>+ "ServerRoot": absoluteServerRoot,
+ "DataRoot": dataRoot,
+ "DatabaseRoot": databaseRoot,
+ "DocumentRoot": documentRoot,
+ "ConfigRoot": configRoot,
+ "LogRoot": logRoot,
+ "RunRoot": runRoot,
+ "WritablePlist": os.path.join(
+ os.path.abspath(configRoot), "caldavd-writable.plist"
+ ),
</ins><span class="cx"> }
</span><del>- configFilePath = FilePath(os.path.join(config.ConfigRoot, "caldavd.plist"))
</del><ins>+ configFilePath = FilePath(
+ os.path.join(configRoot, "caldavd.plist")
+ )
+
</ins><span class="cx"> configFilePath.setContent(newConfig)
</span><span class="cx">
</span><span class="cx"> self.configFileName = configFilePath.path
</span><span class="cx"> config.load(self.configFileName)
</span><span class="cx">
</span><del>- origUsersFile = FilePath(os.path.join(os.path.dirname(__file__),
- "gateway", "users-groups.xml"))
- copyUsersFile = FilePath(os.path.join(config.DataRoot, "accounts.xml"))
</del><ins>+ config.Memcached.Pools.Default.ClientEnabled = False
+ config.Memcached.Pools.Default.ServerEnabled = False
+ ClientFactory.allowTestCache = True
+ memcacher.Memcacher.allowTestCache = True
+ memcacher.Memcacher.memoryCacheInstance = None
+ config.DirectoryAddressBook.Enabled = False
+ config.UsePackageTimezones = True
+
+ origUsersFile = FilePath(
+ os.path.join(
+ os.path.dirname(__file__),
+ "gateway",
+ "users-groups.xml"
+ )
+ )
+ copyUsersFile = FilePath(
+ os.path.join(config.DataRoot, "accounts.xml")
+ )
</ins><span class="cx"> origUsersFile.copyTo(copyUsersFile)
</span><span class="cx">
</span><del>- origResourcesFile = FilePath(os.path.join(os.path.dirname(__file__),
- "gateway", "resources-locations.xml"))
- copyResourcesFile = FilePath(os.path.join(config.DataRoot, "resources.xml"))
</del><ins>+ origResourcesFile = FilePath(
+ os.path.join(
+ os.path.dirname(__file__),
+ "gateway",
+ "resources-locations.xml"
+ )
+ )
+ copyResourcesFile = FilePath(
+ os.path.join(config.DataRoot, "resources.xml")
+ )
</ins><span class="cx"> origResourcesFile.copyTo(copyResourcesFile)
</span><span class="cx">
</span><del>- origAugmentFile = FilePath(os.path.join(os.path.dirname(__file__),
- "gateway", "augments.xml"))
</del><ins>+ origAugmentFile = FilePath(
+ os.path.join(
+ os.path.dirname(__file__),
+ "gateway",
+ "augments.xml"
+ )
+ )
</ins><span class="cx"> copyAugmentFile = FilePath(os.path.join(config.DataRoot, "augments.xml"))
</span><span class="cx"> origAugmentFile.copyTo(copyAugmentFile)
</span><span class="cx">
</span><del>- # Make sure trial puts the reactor in the right state, by letting it
- # run one reactor iteration. (Ignore me, please.)
- d = Deferred()
- reactor.callLater(0, d.callback, True)
- return d
</del><ins>+ # # Make sure trial puts the reactor in the right state, by letting it
+ # # run one reactor iteration. (Ignore me, please.)
+ # d = Deferred()
+ # reactor.callLater(0, d.callback, True)
+ # return d
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><del>- def runCommand(self, command, error=False,
- script="calendarserver_command_gateway"):
</del><ins>+ def runCommand(
+ self, command, error=False, script="calendarserver_command_gateway"
+ ):
</ins><span class="cx"> """
</span><span class="cx"> Run the given command by feeding it as standard input to
</span><span class="cx"> calendarserver_command_gateway in a subprocess.
</span><span class="lines">@@ -87,7 +153,9 @@
</span><span class="cx"> if isinstance(command, unicode):
</span><span class="cx"> command = command.encode("utf-8")
</span><span class="cx">
</span><del>- sourceRoot = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
</del><ins>+ sourceRoot = os.path.dirname(
+ os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
+ )
</ins><span class="cx"> python = sys.executable
</span><span class="cx"> script = os.path.join(sourceRoot, "bin", script)
</span><span class="cx">
</span><span class="lines">@@ -98,7 +166,10 @@
</span><span class="cx"> cwd = sourceRoot
</span><span class="cx">
</span><span class="cx"> deferred = Deferred()
</span><del>- reactor.spawnProcess(CapturingProcessProtocol(deferred, command), python, args, env=os.environ, path=cwd)
</del><ins>+ reactor.spawnProcess(
+ CapturingProcessProtocol(deferred, command),
+ python, args, env=os.environ, path=cwd
+ )
</ins><span class="cx"> output = yield deferred
</span><span class="cx"> try:
</span><span class="cx"> plist = readPlistFromString(output)
</span><span class="lines">@@ -158,15 +229,14 @@
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def test_createAddress(self):
</span><del>- directory = getDirectory()
</del><span class="cx">
</span><del>- record = directory.recordWithUID("C701069D-9CA1-4925-A1A9-5CD94767B74B")
</del><ins>+ record = yield self.directory.recordWithUID("C701069D-9CA1-4925-A1A9-5CD94767B74B")
</ins><span class="cx"> self.assertEquals(record, None)
</span><span class="cx"> yield self.runCommand(command_createAddress)
</span><span class="cx">
</span><del>- directory.flushCaches()
</del><ins>+ # directory.flushCaches()
</ins><span class="cx">
</span><del>- record = directory.recordWithUID("C701069D-9CA1-4925-A1A9-5CD94767B74B")
</del><ins>+ record = yield self.directory.recordWithUID("C701069D-9CA1-4925-A1A9-5CD94767B74B")
</ins><span class="cx"> self.assertEquals(record.fullName.decode("utf-8"),
</span><span class="cx"> "Created Address 01 %s %s" % (unichr(208), u"\ud83d\udca3"))
</span><span class="cx">
</span><span class="lines">@@ -197,29 +267,27 @@
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><span class="cx"> def test_createLocation(self):
</span><del>- directory = getDirectory()
</del><span class="cx">
</span><del>- record = directory.recordWithUID("836B1B66-2E9A-4F46-8B1C-3DD6772C20B2")
</del><ins>+ record = yield self.directory.recordWithUID("836B1B66-2E9A-4F46-8B1C-3DD6772C20B2")
</ins><span class="cx"> self.assertEquals(record, None)
</span><span class="cx"> yield self.runCommand(command_createLocation)
</span><span class="cx">
</span><del>- directory.flushCaches()
</del><ins>+ # directory.flushCaches()
</ins><span class="cx">
</span><span class="cx"> # This appears to be necessary in order for record.autoSchedule to
</span><span class="cx"> # reflect the change prior to the directory record expiration
</span><del>- augmentService = directory.serviceForRecordType(directory.recordType_locations).augmentService
- augmentService.refresh()
</del><ins>+ # augmentService = directory.serviceForRecordType(directory.recordType_locations).augmentService
+ # augmentService.refresh()
</ins><span class="cx">
</span><del>- record = directory.recordWithUID("836B1B66-2E9A-4F46-8B1C-3DD6772C20B2")
- self.assertEquals(record.fullName.decode("utf-8"),
- "Created Location 01 %s %s" % (unichr(208), u"\ud83d\udca3"))
</del><ins>+ record = yield self.directory.recordWithUID("836B1B66-2E9A-4F46-8B1C-3DD6772C20B2")
+ self.assertEquals(record.fullNames[0],
+ u"Created Location 01 %s %s" % (unichr(208), u"\ud83d\udca3"))
</ins><span class="cx">
</span><span class="cx"> self.assertNotEquals(record, None)
</span><del>- self.assertEquals(record.autoSchedule, True)
</del><ins>+ # self.assertEquals(record.autoScheduleMode, "")
</ins><span class="cx">
</span><del>- self.assertEquals(record.extras["comment"], "Test Comment")
- self.assertEquals(record.extras["floor"], "First")
- self.assertEquals(record.extras["capacity"], "40")
</del><ins>+ self.assertEquals(record.floor, u"First")
+ # self.assertEquals(record.extras["capacity"], "40")
</ins><span class="cx">
</span><span class="cx"> results = yield self.runCommand(command_getLocationAttributes)
</span><span class="cx"> self.assertEquals(set(results["result"]["ReadProxies"]), set(['user03', 'user04']))
</span><span class="lines">@@ -437,8 +505,10 @@
</span><span class="cx"> <dict>
</span><span class="cx"> <key>command</key>
</span><span class="cx"> <string>createLocation</string>
</span><del>- <key>AutoSchedule</key>
- <true/>
</del><ins>+ <!--
+ <key>AutoScheduleMode</key>
+ <string></string>
+ -->
</ins><span class="cx"> <key>AutoAcceptGroup</key>
</span><span class="cx"> <string>E5A6142C-4189-4E9E-90B0-9CD0268B314B</string>
</span><span class="cx"> <key>GeneratedUID</key>
</span><span class="lines">@@ -455,19 +525,21 @@
</span><span class="cx"> <string>Test Description</string>
</span><span class="cx"> <key>Floor</key>
</span><span class="cx"> <string>First</string>
</span><ins>+ <!--
</ins><span class="cx"> <key>Capacity</key>
</span><span class="cx"> <string>40</string>
</span><ins>+ -->
</ins><span class="cx"> <key>AssociatedAddress</key>
</span><span class="cx"> <string>C701069D-9CA1-4925-A1A9-5CD94767B74B</string>
</span><span class="cx"> <key>ReadProxies</key>
</span><span class="cx"> <array>
</span><del>- <string>users:user03</string>
- <string>users:user04</string>
</del><ins>+ <string>user03</string>
+ <string>user04</string>
</ins><span class="cx"> </array>
</span><span class="cx"> <key>WriteProxies</key>
</span><span class="cx"> <array>
</span><del>- <string>users:user05</string>
- <string>users:user06</string>
</del><ins>+ <string>user05</string>
+ <string>user06</string>
</ins><span class="cx"> </array>
</span><span class="cx"> </dict>
</span><span class="cx"> </plist>
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4twistedcaldavdirectoryaugmentpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/augment.py (12989 => 12990)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/augment.py        2014-03-21 22:29:24 UTC (rev 12989)
+++ CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/augment.py        2014-03-22 02:55:46 UTC (rev 12990)
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx"> enabledForCalendaring=False,
</span><span class="cx"> autoSchedule=False,
</span><span class="cx"> autoScheduleMode="default",
</span><del>- autoAcceptGroup="",
</del><ins>+ autoAcceptGroup=None,
</ins><span class="cx"> enabledForAddressBooks=False,
</span><span class="cx"> enabledForLogin=True,
</span><span class="cx"> ):
</span></span></pre></div>
<a id="CalendarServerbranchesuserssagenmove2who4txdavwhoaugmentpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/branches/users/sagen/move2who-4/txdav/who/augment.py (12989 => 12990)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/txdav/who/augment.py        2014-03-21 22:29:24 UTC (rev 12989)
+++ CalendarServer/branches/users/sagen/move2who-4/txdav/who/augment.py        2014-03-22 02:55:46 UTC (rev 12990)
</span><span class="lines">@@ -199,15 +199,23 @@
</span><span class="cx"> AutoScheduleMode.declineIfBusy: "decline-if-busy",
</span><span class="cx"> AutoScheduleMode.acceptIfFreeDeclineIfBusy: "automatic",
</span><span class="cx"> }.get(augmentFields.get(FieldName.autoScheduleMode, None), None)
</span><del>- augmentRecord = AugmentRecord(
- uid=record.uid,
- enabledForCalendaring=augmentFields[FieldName.hasCalendars],
- enabledForAddressBooks=augmentFields[FieldName.hasContacts],
- autoScheduleMode=autoScheduleMode,
- enabledForLogin=augmentFields[FieldName.loginAllowed],
- autoAcceptGroup=augmentFields[FieldName.autoAcceptGroup],
- serverID=augmentFields[FieldName.serviceNodeUID],
- )
</del><ins>+
+ kwargs = {
+ "uid": record.uid,
+ "autoScheduleMode": autoScheduleMode,
+ }
+ if FieldName.hasCalendars in augmentFields:
+ kwargs["enabledForCalendaring"] = augmentFields[FieldName.hasCalendars]
+ if FieldName.hasContacts in augmentFields:
+ kwargs["enabledForAddressBooks"] = augmentFields[FieldName.hasContacts]
+ if FieldName.loginAllowed in augmentFields:
+ kwargs["enabledForLogin"] = augmentFields[FieldName.loginAllowed]
+ if FieldName.autoAcceptGroup in augmentFields:
+ kwargs["autoAcceptGroup"] = augmentFields[FieldName.autoAcceptGroup]
+ if FieldName.serviceNodeUID in augmentFields:
+ kwargs["serverID"] = augmentFields[FieldName.serviceNodeUID]
+ augmentRecord = AugmentRecord(**kwargs)
+
</ins><span class="cx"> augmentRecords.append(augmentRecord)
</span><span class="cx">
</span><span class="cx"> # Create new base records:
</span><span class="lines">@@ -301,10 +309,11 @@
</span><span class="cx"> autoScheduleMode
</span><span class="cx"> )
</span><span class="cx">
</span><del>- self._assignToField(
- fields, "autoAcceptGroup",
- augmentRecord.autoAcceptGroup.decode("utf-8")
- )
</del><ins>+ if augmentRecord.autoAcceptGroup is not None:
+ self._assignToField(
+ fields, "autoAcceptGroup",
+ augmentRecord.autoAcceptGroup.decode("utf-8")
+ )
</ins><span class="cx">
</span><span class="cx"> self._assignToField(
</span><span class="cx"> fields, "loginAllowed",
</span></span></pre>
</div>
</div>
</body>
</html>