1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 19:22:22 -05:00

Caldav: test principal request

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1461 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-09-20 19:39:00 +00:00
parent 60ad472264
commit 42ddb33e13

View File

@ -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);
}
}