From d28390a6499135dfd30c925d2d0735cb15eced34 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20M=C3=BCller?= Date: Mon, 23 Nov 2015 13:53:57 +0100 Subject: [PATCH] Adding sync support - including dav tests --- apps/dav/lib/server.php | 1 + .../travis/caldavtest/config/serverinfo.xml | 2 +- .../caldavtest/tests/CardDAV/sync-report.xml | 1602 +++++++++++++++++ apps/dav/tests/travis/carddavtester.sh | 5 +- 4 files changed, 1608 insertions(+), 2 deletions(-) create mode 100644 apps/dav/tests/travis/caldavtest/tests/CardDAV/sync-report.xml 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 @@ $addressbookhome%d: - $addressbooks_uids:$userguid%d: + $addressbooks:$userid%d: 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 @@ + + + + + + + + + carddav + sync-report + + + + + PUT + $addressbookpath1:/1.vcf + + text/vcard; charset=utf-8 + Resource/CardDAV/vreports/put/1.vcf + + + + PUT + $addressbookpath1:/2.vcf + + text/vcard; charset=utf-8 + Resource/CardDAV/vreports/put/2.vcf + + + + + + + Not on addressbooks + + PROPFIND + $addressbooks:/ +
+ Depth + 0 +
+ + text/xml; charset=utf-8 + Resource/CardDAV/vreports/sync/1.xml + + + xmlElementMatch + + notexists + $verify-property-prefix:/{DAV:}supported-report-set/{DAV:}supported-report/{DAV:}report/{DAV:}sync-collection + + + + propfindItems + + okprops + {DAV:}supported-report-set + + + badprops + {DAV:}sync-token + + +
+
+ + + On addressbook + + PROPFIND + $addressbookpath1:/ +
+ Depth + 0 +
+ + text/xml; charset=utf-8 + Resource/CardDAV/vreports/sync/1.xml + + + xmlElementMatch + + exists + $verify-property-prefix:/{DAV:}supported-report-set/{DAV:}supported-report/{DAV:}report/{DAV:}sync-collection + + + + + + propfindItems + + okprops + {DAV:}supported-report-set + {DAV:}sync-token + + +
+
+
+ + + + initial query - addressbook depth:1 + + REPORT + $addressbookpath1:/ +
+ Depth + 1 +
+ + text/xml; charset=utf-8 + Resource/CardDAV/vreports/sync/2.xml + + + multistatusItems + + okhrefs + + + 1.vcf + 2.vcf + + +
+
+ + + add new resource + + PUT + $addressbookpath1:/3.vcf + + text/vcard; charset=utf-8 + Resource/CardDAV/vreports/put/3.vcf + + + statusCode + + + + + new resource - addressbook depth:1 + + REPORT + $addressbookpath1:/ +
+ Depth + 1 +
+ + text/xml; charset=utf-8 + Resource/CardDAV/vreports/sync/2.xml + + + multistatusItems + + okhrefs + + + 1.vcf + 2.vcf + 3.vcf + + +
+
+ +
+ + + + + + DELETEALL + $addressbookhome1:/ + $addressbookhome2:/ + $notificationpath1:/ + $notificationpath2:/ + + + +
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" -- 2.39.5