System.out.println("Testing [ testTraverse() ]...");
final int iPageSizeHint = 100;
this.sharepointClient.updateGlobalState(this.globalState);
Set<WebState> webStates = this.globalState.getAllWebStateSet();
WebState curr_webState = webStates.iterator().next();
SPDocumentList rs = this.sharepointClient.traverse(this.globalState,
curr_webState, iPageSizeHint, false);
int numDocs = 0;
try {
System.out.println("Documents found - ");
if (rs != null) {
SPDocument pm = (SPDocument) rs.nextDocument();
while (pm != null) {
System.out.println("<document>");
final Property lastModProp = pm.findProperty(SpiConstants.PROPNAME_LASTMODIFIED);
if (lastModProp != null) {
System.out.println("<lastModify>"
+ lastModProp.nextValue().toString() + "</lastModify>");
}
final Property docProp = pm.findProperty(SpiConstants.PROPNAME_DOCID);
if (lastModProp != null) {
System.out.println("<docId>" + docProp.nextValue().toString()
+ "</docId>");
}
final Property searchUrlProp = pm.findProperty(SpiConstants.PROPNAME_SEARCHURL);
if (searchUrlProp != null) {
System.out.println("<searchUrl>"
+ searchUrlProp.nextValue().toString() + "</searchUrl>");
}
final Property listGuidProp = pm.findProperty(SPConstants.LIST_GUID);
if (listGuidProp != null) {
System.out.println("<listGuid>"
+ listGuidProp.nextValue().toString() + "</listguid>");
}
final Property displayUrlProp = pm.findProperty(SpiConstants.PROPNAME_DISPLAYURL);
if (displayUrlProp != null) {
System.out.println("<displayUrl>"
+ displayUrlProp.nextValue().toString() + "</displayUrl>");
}
final Property authorProp = pm.findProperty(SPConstants.AUTHOR);
if (authorProp != null) {
System.out.println("<author>" + authorProp.nextValue().toString()
+ "</author>");
}
final Property objTypeProp = pm.findProperty(SPConstants.OBJECT_TYPE);
if (objTypeProp != null) {
System.out.println("<" + SPConstants.OBJECT_TYPE + ">"
+ objTypeProp.nextValue().toString() + "<"
+ SPConstants.OBJECT_TYPE + ">");
}
final Property isPublicProp = pm.findProperty(SpiConstants.PROPNAME_ISPUBLIC);
if (isPublicProp != null) {
System.out.println("<isPublic>"
+ isPublicProp.nextValue().toString() + "</isPublic>");
}
System.out.println("</document>");
pm.dumpAllAttrs();
// check crawling coverage.. check if paticular document is
// found
numDocs++;
pm = (SPDocument) rs.nextDocument();
}
}
} catch (final RepositoryException e) {
e.printStackTrace();
}