use of org.apache.jackrabbit.webdav.property.DavProperty in project jackrabbit by apache.
the class BindTest method getResourceId.
// utility methods
// see http://greenbytes.de/tech/webdav/rfc5842.html#rfc.section.3.1
private URI getResourceId(String uri) throws IOException, DavException, URISyntaxException {
DavPropertyNameSet names = new DavPropertyNameSet();
names.add(BindConstants.RESOURCEID);
HttpPropfind propfind = new HttpPropfind(uri, names, 0);
HttpResponse response = this.client.execute(propfind, this.context);
int status = response.getStatusLine().getStatusCode();
assertEquals(207, status);
MultiStatus multistatus = propfind.getResponseBodyAsMultiStatus(response);
MultiStatusResponse[] responses = multistatus.getResponses();
assertEquals(1, responses.length);
DavProperty resourceId = responses[0].getProperties(200).get(BindConstants.RESOURCEID);
assertNotNull(resourceId);
assertTrue(resourceId.getValue() instanceof Element);
Element href = (Element) resourceId.getValue();
assertEquals("href", href.getLocalName());
String text = getUri(href);
URI resid = new URI(text);
return resid;
}
Aggregations