diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-11-23 13:53:57 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-11-25 21:14:15 +0100 |
commit | d28390a6499135dfd30c925d2d0735cb15eced34 (patch) | |
tree | 651344d86fd3672d32281ac16b97435c7c0c33e1 /apps/dav | |
parent | 906aea4252c2ee6a33f7ba47388e3b290677b2df (diff) | |
download | nextcloud-server-d28390a6499135dfd30c925d2d0735cb15eced34.tar.gz nextcloud-server-d28390a6499135dfd30c925d2d0735cb15eced34.zip |
Adding sync support - including dav tests
Diffstat (limited to 'apps/dav')
-rw-r--r-- | apps/dav/lib/server.php | 1 | ||||
-rw-r--r-- | apps/dav/tests/travis/caldavtest/config/serverinfo.xml | 2 | ||||
-rw-r--r-- | apps/dav/tests/travis/caldavtest/tests/CardDAV/sync-report.xml | 1602 | ||||
-rw-r--r-- | apps/dav/tests/travis/carddavtester.sh | 5 |
4 files changed, 1608 insertions, 2 deletions
diff --git a/apps/dav/lib/server.php b/apps/dav/lib/server.php index 44afcf23df6..587c0091e23 100644 --- a/apps/dav/lib/server.php +++ b/apps/dav/lib/server.php @@ -39,6 +39,7 @@ class Server { $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $logger)); $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin()); $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\ListenerPlugin($dispatcher)); + $this->server->addPlugin(new \Sabre\DAV\Sync\Plugin()); // calendar plugins $this->server->addPlugin(new \Sabre\CalDAV\Plugin()); diff --git a/apps/dav/tests/travis/caldavtest/config/serverinfo.xml b/apps/dav/tests/travis/caldavtest/config/serverinfo.xml index b85a8639e4e..24d63d4a3ae 100644 --- a/apps/dav/tests/travis/caldavtest/config/serverinfo.xml +++ b/apps/dav/tests/travis/caldavtest/config/serverinfo.xml @@ -569,7 +569,7 @@ <!-- relative path to user addressbook home--> <substitution> <key>$addressbookhome%d:</key> - <value>$addressbooks_uids:$userguid%d:</value> + <value>$addressbooks:$userid%d:</value> </substitution> <!-- relative path to user addressbook--> <substitution> diff --git a/apps/dav/tests/travis/caldavtest/tests/CardDAV/sync-report.xml b/apps/dav/tests/travis/caldavtest/tests/CardDAV/sync-report.xml new file mode 100644 index 00000000000..0321e61edbc --- /dev/null +++ b/apps/dav/tests/travis/caldavtest/tests/CardDAV/sync-report.xml @@ -0,0 +1,1602 @@ +<?xml version="1.0" standalone="no"?> + +<!DOCTYPE caldavtest SYSTEM "caldavtest.dtd"> + +<!-- + Copyright (c) 2006-2015 Apple Inc. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> + +<caldavtest> + <require-feature> + <feature>carddav</feature> + <feature>sync-report</feature> + </require-feature> + + <start> + <request> + <method>PUT</method> + <ruri>$addressbookpath1:/1.vcf</ruri> + <data> + <content-type>text/vcard; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/put/1.vcf</filepath> + </data> + </request> + <request> + <method>PUT</method> + <ruri>$addressbookpath1:/2.vcf</ruri> + <data> + <content-type>text/vcard; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/put/2.vcf</filepath> + </data> + </request> + </start> + + <test-suite name='support-report-set'> + <test name='1'> + <description>Not on addressbooks</description> + <request> + <method>PROPFIND</method> + <ruri>$addressbooks:/</ruri> + <header> + <name>Depth</name> + <value>0</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/1.xml</filepath> + </data> + <verify> + <callback>xmlElementMatch</callback> + <arg> + <name>notexists</name> + <value>$verify-property-prefix:/{DAV:}supported-report-set/{DAV:}supported-report/{DAV:}report/{DAV:}sync-collection</value> + </arg> + </verify> + <verify> + <callback>propfindItems</callback> + <arg> + <name>okprops</name> + <value>{DAV:}supported-report-set</value> + </arg> + <arg> + <name>badprops</name> + <value>{DAV:}sync-token</value> + </arg> + </verify> + </request> + </test> + <!-- + original test2 has been removed since we do not support sync support on addressbooks home + --> + <test name='3'> + <description>On addressbook</description> + <request> + <method>PROPFIND</method> + <ruri>$addressbookpath1:/</ruri> + <header> + <name>Depth</name> + <value>0</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/1.xml</filepath> + </data> + <verify> + <callback>xmlElementMatch</callback> + <arg> + <name>exists</name> + <value>$verify-property-prefix:/{DAV:}supported-report-set/{DAV:}supported-report/{DAV:}report/{DAV:}sync-collection</value> + <!-- verification below does not match --> + <!-- value>$verify-property-prefix:/{DAV:}sync-token[+data:,]</value --> + </arg> + </verify> + <verify> + <callback>propfindItems</callback> + <arg> + <name>okprops</name> + <value>{DAV:}supported-report-set</value> + <value>{DAV:}sync-token</value> + </arg> + </verify> + </request> + </test> + </test-suite> + + <test-suite name='simple reports - empty token - no props'> + <test name='1'> + <description>initial query - addressbook depth:1</description> + <request> + <method>REPORT</method> + <ruri>$addressbookpath1:/</ruri> + <header> + <name>Depth</name> + <value>1</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/2.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <!-- no sync on addressbook level --> + <!-- value>$calendar_sync_extra_items:</value --> + <value>1.vcf</value> + <value>2.vcf</value> + </arg> + </verify> + </request> + </test> + <!-- test 2 and 3 require sync support on addressbook collection --> + <test name='4'> + <description>add new resource</description> + <request> + <method>PUT</method> + <ruri>$addressbookpath1:/3.vcf</ruri> + <data> + <content-type>text/vcard; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/put/3.vcf</filepath> + </data> + <verify> + <callback>statusCode</callback> + </verify> + </request> + </test> + <test name='5'> + <description>new resource - addressbook depth:1</description> + <request> + <method>REPORT</method> + <ruri>$addressbookpath1:/</ruri> + <header> + <name>Depth</name> + <value>1</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/2.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <!-- no sync on addressbook level --> + <!-- value>$calendar_sync_extra_items:</value --> + <value>1.vcf</value> + <value>2.vcf</value> + <value>3.vcf</value> + </arg> + </verify> + </request> + </test> + <!-- + <test name='6'> + <require-feature> + <feature>sync-report-home</feature> + </require-feature> + <description>new resource - home depth:1</description> + <request> + <method>REPORT</method> + <ruri>$addressbookhome1:/</ruri> + <header> + <name>Depth</name> + <value>1</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/2.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$calendar_sync_extra_items:</value> + <value>$addressbook:/</value> + </arg> + </verify> + </request> + </test> + <test name='7'> + <require-feature> + <feature>sync-report-home</feature> + </require-feature> + <description>new resource - home depth:infinity</description> + <request> + <method>REPORT</method> + <ruri>$addressbookhome1:/</ruri> + <header> + <name>Depth</name> + <value>infinity</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/2.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$calendar_sync_extra_items:</value> + <value>$addressbook:/</value> + <value>$addressbook:/1.vcf</value> + <value>$addressbook:/2.vcf</value> + <value>$addressbook:/3.vcf</value> + </arg> + </verify> + </request> + </test> + <test name='8'> + <description>remove new resource</description> + <request> + <method>DELETE</method> + <ruri>$addressbookpath1:/3.vcf</ruri> + <verify> + <callback>statusCode</callback> + </verify> + </request> + </test> + <test name='9'> + <description>remove new resource - addressbook depth:1</description> + <request> + <method>REPORT</method> + <ruri>$addressbookpath1:/</ruri> + <header> + <name>Depth</name> + <value>1</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/2.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$calendar_sync_extra_items:</value> + <value>1.vcf</value> + <value>2.vcf</value> + </arg> + </verify> + </request> + </test> + <test name='10'> + <require-feature> + <feature>sync-report-home</feature> + </require-feature> + <description>remove new resource - home depth:1</description> + <request> + <method>REPORT</method> + <ruri>$addressbookhome1:/</ruri> + <header> + <name>Depth</name> + <value>1</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/2.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$calendar_sync_extra_items:</value> + <value>$addressbook:/</value> + </arg> + </verify> + </request> + </test> + <test name='11'> + <require-feature> + <feature>sync-report-home</feature> + </require-feature> + <description>remove new resource - home depth:infinity</description> + <request> + <method>REPORT</method> + <ruri>$addressbookhome1:/</ruri> + <header> + <name>Depth</name> + <value>infinity</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/2.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$calendar_sync_extra_items:</value> + <value>$addressbook:/</value> + <value>$addressbook:/1.vcf</value> + <value>$addressbook:/2.vcf</value> + </arg> + </verify> + </request> + </test> + <test name='12'> + <description>changed resource</description> + <request> + <method>PUT</method> + <ruri>$addressbookpath1:/1.vcf</ruri> + <data> + <content-type>text/vcard; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/put/1.vcf</filepath> + </data> + <verify> + <callback>statusCode</callback> + </verify> + </request> + </test> + <test name='13'> + <description>changed resource - addressbook depth:1</description> + <request> + <method>REPORT</method> + <ruri>$addressbookpath1:/</ruri> + <header> + <name>Depth</name> + <value>1</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/2.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$calendar_sync_extra_items:</value> + <value>1.vcf</value> + <value>2.vcf</value> + </arg> + </verify> + </request> + </test> + <test name='14'> + <require-feature> + <feature>sync-report-home</feature> + </require-feature> + <description>changed resource - home depth:1</description> + <request> + <method>REPORT</method> + <ruri>$addressbookhome1:/</ruri> + <header> + <name>Depth</name> + <value>1</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/2.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$calendar_sync_extra_items:</value> + <value>$addressbook:/</value> + </arg> + </verify> + </request> + </test> + <test name='15'> + <require-feature> + <feature>sync-report-home</feature> + </require-feature> + <description>changed resource - home depth:infinity</description> + <request> + <method>REPORT</method> + <ruri>$addressbookhome1:/</ruri> + <header> + <name>Depth</name> + <value>infinity</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/2.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$calendar_sync_extra_items:</value> + <value>$addressbook:/</value> + <value>$addressbook:/1.vcf</value> + <value>$addressbook:/2.vcf</value> + </arg> + </verify> + </request> + </test> + --> + </test-suite> + + <!-- + <test-suite name='simple reports - diff token - no props'> + <test name='1'> + <description>initial query - grab token</description> + <request> + <method>REPORT</method> + <ruri>$addressbookpath1:/</ruri> + <header> + <name>Depth</name> + <value>1</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/2.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$calendar_sync_extra_items:</value> + <value>1.vcf</value> + <value>2.vcf</value> + </arg> + </verify> + <grabelement> + <name>/{DAV:}multistatus/{DAV:}sync-token</name> + <variable>$synctoken1:</variable> + </grabelement> + </request> + </test> + <test name='2'> + <description>new resource</description> + <request> + <method>PUT</method> + <ruri>$addressbookpath1:/3.vcf</ruri> + <data> + <content-type>text/vcard; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/put/3.vcf</filepath> + </data> + <verify> + <callback>statusCode</callback> + </verify> + </request> + <request> + <method>REPORT</method> + <ruri>$addressbookpath1:/</ruri> + <header> + <name>Depth</name> + <value>1</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/3.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>3.vcf</value> + </arg> + </verify> + <grabelement> + <name>/{DAV:}multistatus/{DAV:}sync-token</name> + <variable>$synctoken2:</variable> + </grabelement> + </request> + </test> + <test name='3'> + <description>remove resource (treated as new)</description> + <request> + <method>DELETE</method> + <ruri>$addressbookpath1:/3.vcf</ruri> + <verify> + <callback>statusCode</callback> + </verify> + </request> + <request> + <method>REPORT</method> + <ruri>$addressbookpath1:/</ruri> + <header> + <name>Depth</name> + <value>1</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/3.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>badhrefs</name> + <value>3.vcf</value> + </arg> + </verify> + </request> + </test> + <test name='4'> + <description>remove resource (treated as old)</description> + <request> + <method>REPORT</method> + <ruri>$addressbookpath1:/</ruri> + <header> + <name>Depth</name> + <value>1</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/4.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>badhrefs</name> + <value>3.vcf</value> + </arg> + </verify> + <grabelement> + <name>/{DAV:}multistatus/{DAV:}sync-token</name> + <variable>$synctoken1:</variable> + </grabelement> + </request> + </test> + <test name='5'> + <description>changed resource</description> + <request> + <method>PUT</method> + <ruri>$addressbookpath1:/1.vcf</ruri> + <data> + <content-type>text/vcard; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/put/1.vcf</filepath> + </data> + <verify> + <callback>statusCode</callback> + </verify> + </request> + <request> + <method>REPORT</method> + <ruri>$addressbookpath1:/</ruri> + <header> + <name>Depth</name> + <value>1</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/3.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>1.vcf</value> + </arg> + </verify> + <grabelement> + <name>/{DAV:}multistatus/{DAV:}sync-token</name> + <variable>$synctoken1:</variable> + </grabelement> + </request> + </test> + <test name='6'> + <description>no change</description> + <request> + <method>REPORT</method> + <ruri>$addressbookpath1:/</ruri> + <header> + <name>Depth</name> + <value>1</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/3.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + </verify> + <grabelement> + <name>/{DAV:}multistatus/{DAV:}sync-token</name> + <variable>$synctoken1:</variable> + </grabelement> + </request> + </test> + </test-suite> + + <test-suite name='simple reports - empty token - props'> + <test name='1'> + <description>initial query</description> + <request> + <method>REPORT</method> + <ruri>$addressbookpath1:/</ruri> + <header> + <name>Depth</name> + <value>1</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/5.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$calendar_sync_extra_items:</value> + <value>1.vcf</value> + <value>2.vcf</value> + </arg> + </verify> + <verify> + <callback>propfindItems</callback> + <arg> + <name>okprops</name> + <value>{DAV:}getcontenttype</value> + <value>{DAV:}getetag</value> + </arg> + </verify> + </request> + </test> + <test name='2'> + <description>new resource</description> + <request> + <method>PUT</method> + <ruri>$addressbookpath1:/3.vcf</ruri> + <data> + <content-type>text/vcard; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/put/3.vcf</filepath> + </data> + <verify> + <callback>statusCode</callback> + </verify> + </request> + <request> + <method>REPORT</method> + <ruri>$addressbookpath1:/</ruri> + <header> + <name>Depth</name> + <value>1</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/5.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$calendar_sync_extra_items:</value> + <value>1.vcf</value> + <value>2.vcf</value> + <value>3.vcf</value> + </arg> + </verify> + <verify> + <callback>propfindItems</callback> + <arg> + <name>okprops</name> + <value>{DAV:}getcontenttype</value> + <value>{DAV:}getetag</value> + </arg> + </verify> + </request> + </test> + <test name='3'> + <description>remove resource new resource</description> + <request> + <method>DELETE</method> + <ruri>$addressbookpath1:/3.vcf</ruri> + <verify> + <callback>statusCode</callback> + </verify> + </request> + <request> + <method>REPORT</method> + <ruri>$addressbookpath1:/</ruri> + <header> + <name>Depth</name> + <value>1</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/5.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$calendar_sync_extra_items:</value> + <value>1.vcf</value> + <value>2.vcf</value> + </arg> + </verify> + <verify> + <callback>propfindItems</callback> + <arg> + <name>okprops</name> + <value>{DAV:}getcontenttype</value> + <value>{DAV:}getetag</value> + </arg> + </verify> + </request> + </test> + <test name='4'> + <description>changed resource</description> + <request> + <method>PUT</method> + <ruri>$addressbookpath1:/1.vcf</ruri> + <data> + <content-type>text/vcard; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/put/1.vcf</filepath> + </data> + <verify> + <callback>statusCode</callback> + </verify> + </request> + <request> + <method>REPORT</method> + <ruri>$addressbookpath1:/</ruri> + <header> + <name>Depth</name> + <value>1</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/5.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$calendar_sync_extra_items:</value> + <value>1.vcf</value> + <value>2.vcf</value> + </arg> + </verify> + <verify> + <callback>propfindItems</callback> + <arg> + <name>okprops</name> + <value>{DAV:}getcontenttype</value> + <value>{DAV:}getetag</value> + </arg> + </verify> + </request> + </test> + </test-suite> + + <test-suite name='simple reports - diff token - props'> + <test name='1'> + <description>initial query - grab token</description> + <request> + <method>REPORT</method> + <ruri>$addressbookpath1:/</ruri> + <header> + <name>Depth</name> + <value>1</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/5.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$calendar_sync_extra_items:</value> + <value>1.vcf</value> + <value>2.vcf</value> + </arg> + </verify> + <verify> + <callback>propfindItems</callback> + <arg> + <name>okprops</name> + <value>{DAV:}getcontenttype</value> + <value>{DAV:}getetag</value> + </arg> + </verify> + <grabelement> + <name>/{DAV:}multistatus/{DAV:}sync-token</name> + <variable>$synctoken1:</variable> + </grabelement> + </request> + </test> + <test name='2'> + <description>new resource</description> + <request> + <method>PUT</method> + <ruri>$addressbookpath1:/3.vcf</ruri> + <data> + <content-type>text/vcard; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/put/3.vcf</filepath> + </data> + <verify> + <callback>statusCode</callback> + </verify> + </request> + <request> + <method>REPORT</method> + <ruri>$addressbookpath1:/</ruri> + <header> + <name>Depth</name> + <value>1</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/6.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>3.vcf</value> + </arg> + </verify> + <verify> + <callback>propfindItems</callback> + <arg> + <name>okprops</name> + <value>{DAV:}getcontenttype</value> + <value>{DAV:}getetag</value> + </arg> + </verify> + <grabelement> + <name>/{DAV:}multistatus/{DAV:}sync-token</name> + <variable>$synctoken2:</variable> + </grabelement> + </request> + </test> + <test name='3'> + <description>remove resource (treated as new)</description> + <request> + <method>DELETE</method> + <ruri>$addressbookpath1:/3.vcf</ruri> + <verify> + <callback>statusCode</callback> + </verify> + </request> + <request> + <method>REPORT</method> + <ruri>$addressbookpath1:/</ruri> + <header> + <name>Depth</name> + <value>1</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/6.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>badhrefs</name> + <value>3.vcf</value> + </arg> + </verify> + </request> + </test> + <test name='4'> + <description>remove resource (treated as old)</description> + <request> + <method>REPORT</method> + <ruri>$addressbookpath1:/</ruri> + <header> + <name>Depth</name> + <value>1</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/7.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>badhrefs</name> + <value>3.vcf</value> + </arg> + </verify> + <verify> + <callback>propfindItems</callback> + </verify> + <grabelement> + <name>/{DAV:}multistatus/{DAV:}sync-token</name> + <variable>$synctoken1:</variable> + </grabelement> + </request> + </test> + <test name='5'> + <description>changed resource</description> + <request> + <method>PUT</method> + <ruri>$addressbookpath1:/1.vcf</ruri> + <data> + <content-type>text/vcard; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/put/1.vcf</filepath> + </data> + <verify> + <callback>statusCode</callback> + </verify> + </request> + <request> + <method>REPORT</method> + <ruri>$addressbookpath1:/</ruri> + <header> + <name>Depth</name> + <value>1</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/6.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>1.vcf</value> + </arg> + </verify> + <verify> + <callback>propfindItems</callback> + <arg> + <name>okprops</name> + <value>{DAV:}getcontenttype</value> + <value>{DAV:}getetag</value> + </arg> + </verify> + <grabelement> + <name>/{DAV:}multistatus/{DAV:}sync-token</name> + <variable>$synctoken1:</variable> + </grabelement> + </request> + </test> + <test name='6'> + <description>no change</description> + <request> + <method>REPORT</method> + <ruri>$addressbookpath1:/</ruri> + <header> + <name>Depth</name> + <value>1</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/6.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + </verify> + <verify> + <callback>propfindItems</callback> + <arg> + <name>okprops</name> + <value>{DAV:}getcontenttype</value> + <value>{DAV:}getetag</value> + </arg> + </verify> + <grabelement> + <name>/{DAV:}multistatus/{DAV:}sync-token</name> + <variable>$synctoken1:</variable> + </grabelement> + </request> + </test> + </test-suite> + + <test-suite name='simple reports - diff token - no props - home depth:infinity'> + <require-feature> + <feature>sync-report-home</feature> + </require-feature> + <test name='1'> + <description>Initialize</description> + <request> + <method>DELETE</method> + <ruri>$addressbookpath1:/</ruri> + </request> + <request> + <method>PUT</method> + <ruri>$addressbookpath1:/1.vcf</ruri> + <data> + <content-type>text/vcard; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/put/1.vcf</filepath> + </data> + </request> + <request> + <method>PUT</method> + <ruri>$addressbookpath1:/2.vcf</ruri> + <data> + <content-type>text/vcard; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/put/2.vcf</filepath> + </data> + </request> + </test> + <test name='2'> + <description>initial query - grab token</description> + <request> + <method>REPORT</method> + <ruri>$addressbookhome1:/</ruri> + <header> + <name>Depth</name> + <value>infinity</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/2.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$calendar_sync_extra_items:</value> + <value>$addressbook:/</value> + <value>$addressbook:/1.vcf</value> + <value>$addressbook:/2.vcf</value> + </arg> + </verify> + <grabelement> + <name>/{DAV:}multistatus/{DAV:}sync-token</name> + <variable>$synctoken1:</variable> + </grabelement> + </request> + </test> + <test name='3'> + <description>new resource</description> + <request> + <method>PUT</method> + <ruri>$addressbookpath1:/3.vcf</ruri> + <data> + <content-type>text/vcard; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/put/3.vcf</filepath> + </data> + <verify> + <callback>statusCode</callback> + </verify> + </request> + <request> + <method>REPORT</method> + <ruri>$addressbookhome1:/</ruri> + <header> + <name>Depth</name> + <value>infinity</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/3.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$addressbook:/</value> + <value>$addressbook:/3.vcf</value> + </arg> + </verify> + <grabelement> + <name>/{DAV:}multistatus/{DAV:}sync-token</name> + <variable>$synctoken2:</variable> + </grabelement> + </request> + </test> + <test name='4'> + <description>remove resource (treated as new)</description> + <request> + <method>DELETE</method> + <ruri>$addressbookpath1:/3.vcf</ruri> + <verify> + <callback>statusCode</callback> + </verify> + </request> + <request> + <method>REPORT</method> + <ruri>$addressbookhome1:/</ruri> + <header> + <name>Depth</name> + <value>infinity</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/3.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$addressbook:/</value> + </arg> + <arg> + <name>badhrefs</name> + <value>$addressbook:/3.vcf</value> + </arg> + </verify> + </request> + </test> + <test name='5'> + <description>remove resource (treated as old)</description> + <request> + <method>REPORT</method> + <ruri>$addressbookhome1:/</ruri> + <header> + <name>Depth</name> + <value>infinity</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/4.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$addressbook:/</value> + </arg> + <arg> + <name>badhrefs</name> + <value>$addressbook:/3.vcf</value> + </arg> + </verify> + <grabelement> + <name>/{DAV:}multistatus/{DAV:}sync-token</name> + <variable>$synctoken1:</variable> + </grabelement> + </request> + </test> + <test name='6'> + <description>changed resource</description> + <request> + <method>PUT</method> + <ruri>$addressbookpath1:/1.vcf</ruri> + <data> + <content-type>text/vcard; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/put/1.vcf</filepath> + </data> + <verify> + <callback>statusCode</callback> + </verify> + </request> + <request> + <method>REPORT</method> + <ruri>$addressbookhome1:/</ruri> + <header> + <name>Depth</name> + <value>infinity</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/3.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$addressbook:/</value> + <value>$addressbook:/1.vcf</value> + </arg> + </verify> + <grabelement> + <name>/{DAV:}multistatus/{DAV:}sync-token</name> + <variable>$synctoken1:</variable> + </grabelement> + </request> + </test> + <test name='7'> + <description>no change</description> + <request> + <method>REPORT</method> + <ruri>$addressbookhome1:/</ruri> + <header> + <name>Depth</name> + <value>infinity</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/3.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + </verify> + <grabelement> + <name>/{DAV:}multistatus/{DAV:}sync-token</name> + <variable>$synctoken1:</variable> + </grabelement> + </request> + </test> + </test-suite> + + <test-suite name='simple reports - diff token - props - home depth:infinity'> + <require-feature> + <feature>sync-report-home</feature> + </require-feature> + <test name='1'> + <description>initial query - grab token</description> + <request> + <method>REPORT</method> + <ruri>$addressbookhome1:/</ruri> + <header> + <name>Depth</name> + <value>infinity</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/5.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$calendar_sync_extra_items:</value> + <value>$addressbook:/</value> + <value>$addressbook:/1.vcf</value> + <value>$addressbook:/2.vcf</value> + </arg> + </verify> + <verify> + <callback>propfindItems</callback> + <arg> + <name>okprops</name> + <value>{DAV:}getcontenttype</value> + <value>{DAV:}getetag</value> + </arg> + </verify> + <grabelement> + <name>/{DAV:}multistatus/{DAV:}sync-token</name> + <variable>$synctoken1:</variable> + </grabelement> + </request> + </test> + <test name='2'> + <description>new resource</description> + <request> + <method>PUT</method> + <ruri>$addressbookpath1:/3.vcf</ruri> + <data> + <content-type>text/vcard; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/put/3.vcf</filepath> + </data> + <verify> + <callback>statusCode</callback> + </verify> + </request> + <request> + <method>REPORT</method> + <ruri>$addressbookhome1:/</ruri> + <header> + <name>Depth</name> + <value>infinity</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/6.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$addressbook:/</value> + <value>$addressbook:/3.vcf</value> + </arg> + </verify> + <verify> + <callback>propfindItems</callback> + <arg> + <name>okprops</name> + <value>{DAV:}getcontenttype</value> + <value>{DAV:}getetag</value> + </arg> + </verify> + <grabelement> + <name>/{DAV:}multistatus/{DAV:}sync-token</name> + <variable>$synctoken2:</variable> + </grabelement> + </request> + </test> + <test name='3'> + <description>remove resource (treated as new)</description> + <request> + <method>DELETE</method> + <ruri>$addressbookpath1:/3.vcf</ruri> + <verify> + <callback>statusCode</callback> + </verify> + </request> + <request> + <method>REPORT</method> + <ruri>$addressbookhome1:/</ruri> + <header> + <name>Depth</name> + <value>infinity</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/6.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$addressbook:/</value> + </arg> + <arg> + <name>badhrefs</name> + <value>$addressbook:/3.vcf</value> + </arg> + </verify> + <verify> + <callback>propfindItems</callback> + <arg> + <name>ignore</name> + <value>$addressbookpath1:/</value> + </arg> + </verify> + <verify> + <callback>propfindItems</callback> + <arg> + <name>ignore</name> + <value>$addressbookpath1:/3.vcf</value> + </arg> + <arg> + <name>okprops</name> + <value>{DAV:}getcontenttype</value> + <value>{DAV:}getetag</value> + </arg> + </verify> + </request> + </test> + <test name='4'> + <description>remove resource (treated as old)</description> + <request> + <method>REPORT</method> + <ruri>$addressbookhome1:/</ruri> + <header> + <name>Depth</name> + <value>infinity</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/7.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$addressbook:/</value> + </arg> + <arg> + <name>badhrefs</name> + <value>$addressbook:/3.vcf</value> + </arg> + </verify> + <verify> + <callback>propfindItems</callback> + <arg> + <name>count</name> + <value>2</value> + </arg> + </verify> + <grabelement> + <name>/{DAV:}multistatus/{DAV:}sync-token</name> + <variable>$synctoken1:</variable> + </grabelement> + </request> + </test> + <test name='5'> + <description>changed resource</description> + <request> + <method>PUT</method> + <ruri>$addressbookpath1:/1.vcf</ruri> + <data> + <content-type>text/vcard; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/put/1.vcf</filepath> + </data> + <verify> + <callback>statusCode</callback> + </verify> + </request> + <request> + <method>REPORT</method> + <ruri>$addressbookhome1:/</ruri> + <header> + <name>Depth</name> + <value>infinity</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/6.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$addressbook:/</value> + <value>$addressbook:/1.vcf</value> + </arg> + </verify> + <verify> + <callback>propfindItems</callback> + <arg> + <name>okprops</name> + <value>{DAV:}getcontenttype</value> + <value>{DAV:}getetag</value> + </arg> + </verify> + <grabelement> + <name>/{DAV:}multistatus/{DAV:}sync-token</name> + <variable>$synctoken1:</variable> + </grabelement> + </request> + </test> + <test name='6'> + <description>no change</description> + <request> + <method>REPORT</method> + <ruri>$addressbookhome1:/</ruri> + <header> + <name>Depth</name> + <value>infinity</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/6.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + </verify> + <verify> + <callback>propfindItems</callback> + <arg> + <name>okprops</name> + <value>{DAV:}getcontenttype</value> + <value>{DAV:}getetag</value> + </arg> + </verify> + <grabelement> + <name>/{DAV:}multistatus/{DAV:}sync-token</name> + <variable>$synctoken1:</variable> + </grabelement> + </request> + </test> + </test-suite> + + <test-suite name='simple reports - diff token - delete/create addressbook - home depth:infinity' ignore='yes'> + <require-feature> + <feature>sync-report-home</feature> + </require-feature> + <test name='1'> + <description>initial query - grab token</description> + <request> + <method>REPORT</method> + <ruri>$addressbookhome1:/</ruri> + <header> + <name>Depth</name> + <value>infinity</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/2.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>$addressbook:/</value> + <value>syncaddressbook3/</value> + <value>syncaddressbook3/1.vcf</value> + <value>syncaddressbook3/2.vcf</value> + <value>syncaddressbook4/</value> + <value>syncaddressbook4/1.vcf</value> + <value>syncaddressbook4/2.vcf</value> + </arg> + </verify> + <grabelement> + <name>/{DAV:}multistatus/{DAV:}sync-token</name> + <variable>$synctoken1:</variable> + </grabelement> + </request> + </test> + <test name='2'> + <description>remove resource then addressbook</description> + <request> + <method>DELETE</method> + <ruri>$addressbookhome1:/syncaddressbook3/1.vcf</ruri> + <verify> + <callback>statusCode</callback> + </verify> + </request> + <request> + <method>DELETE</method> + <ruri>$addressbookhome1:/syncaddressbook3/</ruri> + <verify> + <callback>statusCode</callback> + </verify> + </request> + <request> + <method>REPORT</method> + <ruri>$addressbookhome1:/</ruri> + <header> + <name>Depth</name> + <value>infinity</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/3.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>badhrefs</name> + <value>syncaddressbook3/</value> + </arg> + </verify> + <grabelement> + <name>/{DAV:}multistatus/{DAV:}sync-token</name> + <variable>$synctoken2:</variable> + </grabelement> + </request> + </test> + <test name='3'> + <description>add addressbook - test last sync</description> + <request end-delete="yes"> + <method>MKCOL</method> + <ruri>$addressbookhome1:/syncaddressbook3/</ruri> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/Common/MKCOL/addressbook.xml</filepath> + </data> + </request> + <request> + <method>REPORT</method> + <ruri>$addressbookhome1:/</ruri> + <header> + <name>Depth</name> + <value>infinity</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/4.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>syncaddressbook3/</value> + </arg> + </verify> + </request> + </test> + <test name='4'> + <description>add addressbook - test previous sync</description> + <request> + <method>REPORT</method> + <ruri>$addressbookhome1:/</ruri> + <header> + <name>Depth</name> + <value>infinity</value> + </header> + <data> + <content-type>text/xml; charset=utf-8</content-type> + <filepath>Resource/CardDAV/vreports/sync/3.xml</filepath> + </data> + <verify> + <callback>multistatusItems</callback> + <arg> + <name>okhrefs</name> + <value>syncaddressbook3/</value> + </arg> + </verify> + <grabelement> + <name>/{DAV:}multistatus/{DAV:}sync-token</name> + <variable>$synctoken1:</variable> + </grabelement> + </request> + </test> + </test-suite> +--> + + <end> + <request user="$useradmin:" pswd="$pswdadmin:"> + <method>DELETEALL</method> + <ruri>$addressbookhome1:/</ruri> + <ruri>$addressbookhome2:/</ruri> + <ruri>$notificationpath1:/</ruri> + <ruri>$notificationpath2:/</ruri> + </request> + </end> + +</caldavtest> diff --git a/apps/dav/tests/travis/carddavtester.sh b/apps/dav/tests/travis/carddavtester.sh index a128872f42a..fee4d0d74af 100644 --- a/apps/dav/tests/travis/carddavtester.sh +++ b/apps/dav/tests/travis/carddavtester.sh @@ -18,11 +18,14 @@ fi # create test user cd "$SCRIPTPATH/../../../../" OC_PASS=user01 php occ user:add --password-from-env user01 +php occ dav:create-addressbook user01 addressbook OC_PASS=user02 php occ user:add --password-from-env user02 +php occ dav:create-addressbook user02 addressbook cd "$SCRIPTPATH/../../../../" # run the tests cd "$SCRIPTPATH/CalDAVTester" PYTHONPATH="$SCRIPTPATH/pycalendar/src" python testcaldav.py --print-details-onfail -s "$SCRIPTPATH/caldavtest/config/serverinfo.xml" -o cdt.txt \ - "$SCRIPTPATH/caldavtest/tests/CardDAV/current-user-principal.xml" + "$SCRIPTPATH/caldavtest/tests/CardDAV/current-user-principal.xml" \ + "$SCRIPTPATH/caldavtest/tests/CardDAV/sync-report.xml" |