From 42ddb33e133b1325423023d8a2ba33a68b407a3e Mon Sep 17 00:00:00 2001 From: mguessan Date: Mon, 20 Sep 2010 19:39:00 +0000 Subject: [PATCH] Caldav: test principal request git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1461 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- src/test/davmail/caldav/TestCaldav.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/test/davmail/caldav/TestCaldav.java b/src/test/davmail/caldav/TestCaldav.java index e7c40349..6ab9933c 100644 --- a/src/test/davmail/caldav/TestCaldav.java +++ b/src/test/davmail/caldav/TestCaldav.java @@ -34,6 +34,9 @@ import org.apache.jackrabbit.webdav.MultiStatus; import org.apache.jackrabbit.webdav.MultiStatusResponse; import org.apache.jackrabbit.webdav.client.methods.DavMethodBase; import org.apache.jackrabbit.webdav.client.methods.PropFindMethod; +import org.apache.jackrabbit.webdav.property.DavPropertyName; +import org.apache.jackrabbit.webdav.property.DavPropertyNameSet; +import org.apache.jackrabbit.webdav.xml.Namespace; import org.apache.log4j.Level; import java.io.IOException; @@ -245,4 +248,21 @@ public class TestCaldav extends AbstractDavMailTestCase { httpClient.executeMethod(getMethod); assertEquals(HttpStatus.SC_OK, getMethod.getStatusCode()); } + + public void testPropfindPrincipal() throws IOException, DavException { + //Settings.setLoggingLevel("httpclient.wire", Level.DEBUG); + + DavPropertyNameSet davPropertyNameSet = new DavPropertyNameSet(); + davPropertyNameSet.add(DavPropertyName.create("calendar-home-set", Namespace.getNamespace("urn:ietf:params:xml:ns:caldav"))); + davPropertyNameSet.add(DavPropertyName.create("calendar-user-address-set", Namespace.getNamespace("urn:ietf:params:xml:ns:caldav"))); + davPropertyNameSet.add(DavPropertyName.create("schedule-inbox-URL", Namespace.getNamespace("urn:ietf:params:xml:ns:caldav"))); + davPropertyNameSet.add(DavPropertyName.create("schedule-outbox-URL", Namespace.getNamespace("urn:ietf:params:xml:ns:caldav"))); + PropFindMethod method = new PropFindMethod("/principals/users/" + session.getEmail() + "/", davPropertyNameSet, 0); + httpClient.executeMethod(method); + assertEquals(HttpStatus.SC_MULTI_STATUS, method.getStatusCode()); + MultiStatus multiStatus = method.getResponseBodyAsMultiStatus(); + MultiStatusResponse[] responses = multiStatus.getResponses(); + assertEquals(1, responses.length); + } + }