diff options
-rw-r--r-- | .travis.yml | 4 | ||||
m--------- | 3rdparty | 0 | ||||
-rw-r--r-- | apps/dav/appinfo/register_command.php | 4 | ||||
-rw-r--r-- | apps/dav/command/createaddressbook.php | 31 | ||||
-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 | 9 |
8 files changed, 1639 insertions, 14 deletions
diff --git a/.travis.yml b/.travis.yml index 49a9e07e3fd..c599a0c192b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,7 +37,9 @@ matrix: - php: 5.4 env: DB=pgsql;TC=litmus-v1 - php: 5.4 - env: DB=pgsql;TC=carddavtester + env: DB=sqlite;TC=carddavtester +# - php: 5.4 +# env: DB=pgsql;TC=carddavtester # - php: 5.4 # env: DB=mysql;TC=caldavtester diff --git a/3rdparty b/3rdparty -Subproject 3215390b01ab3e76f15825ff126961bbb5a8632 +Subproject e5d7aad94652f3fd5c440472d0cf7303ca79643 diff --git a/apps/dav/appinfo/register_command.php b/apps/dav/appinfo/register_command.php index 7d57b944fb2..1f0df054110 100644 --- a/apps/dav/appinfo/register_command.php +++ b/apps/dav/appinfo/register_command.php @@ -5,6 +5,8 @@ use OCA\DAV\Command\CreateCalendar; $dbConnection = \OC::$server->getDatabaseConnection(); $userManager = OC::$server->getUserManager(); +$config = \OC::$server->getConfig(); + /** @var Symfony\Component\Console\Application $application */ -$application->add(new CreateAddressBook($userManager, $dbConnection)); +$application->add(new CreateAddressBook($userManager, $dbConnection, $config)); $application->add(new CreateCalendar($userManager, $dbConnection)); diff --git a/apps/dav/command/createaddressbook.php b/apps/dav/command/createaddressbook.php index 286871b39e2..371ea44121d 100644 --- a/apps/dav/command/createaddressbook.php +++ b/apps/dav/command/createaddressbook.php @@ -3,6 +3,8 @@ namespace OCA\DAV\Command; use OCA\DAV\CardDAV\CardDavBackend; +use OCA\DAV\Connector\Sabre\Principal; +use OCP\IConfig; use OCP\IDBConnection; use OCP\IUserManager; use Symfony\Component\Console\Command\Command; @@ -18,26 +20,30 @@ class CreateAddressBook extends Command { /** @var \OCP\IDBConnection */ protected $dbConnection; + /** @var IConfig */ + private $config; + /** * @param IUserManager $userManager * @param IDBConnection $dbConnection */ - function __construct(IUserManager $userManager, IDBConnection $dbConnection) { + function __construct(IUserManager $userManager, IDBConnection $dbConnection, IConfig $config) { parent::__construct(); $this->userManager = $userManager; $this->dbConnection = $dbConnection; + $this->config = $config; } protected function configure() { $this - ->setName('dav:create-addressbook') - ->setDescription('Create a dav addressbook') - ->addArgument('user', - InputArgument::REQUIRED, - 'User for whom the addressbook will be created') - ->addArgument('name', - InputArgument::REQUIRED, - 'Name of the addressbook'); + ->setName('dav:create-addressbook') + ->setDescription('Create a dav addressbook') + ->addArgument('user', + InputArgument::REQUIRED, + 'User for whom the addressbook will be created') + ->addArgument('name', + InputArgument::REQUIRED, + 'Name of the addressbook'); } protected function execute(InputInterface $input, OutputInterface $output) { @@ -45,8 +51,13 @@ class CreateAddressBook extends Command { if (!$this->userManager->userExists($user)) { throw new \InvalidArgumentException("User <$user> in unknown."); } + $principalBackend = new Principal( + $this->config, + $this->userManager + ); + $name = $input->getArgument('name'); - $carddav = new CardDavBackend($this->dbConnection); + $carddav = new CardDavBackend($this->dbConnection, $principalBackend); $carddav->createAddressBook("principals/$user", $name, []); } } 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..17f7e8eb4a8 100644 --- a/apps/dav/tests/travis/carddavtester.sh +++ b/apps/dav/tests/travis/carddavtester.sh @@ -18,11 +18,18 @@ 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" +RESULT=$? +tail "$SCRIPTPATH/../../../../data-autotest/owncloud.log" + +exit $RESULT |