try
{
cmisClientSession = getCmisClientSession();
//creating a new folder
Folder root = cmisClientSession.getRootFolder();
ItemIterable<QueryResult> results = cmisClientSession.query(CMIS_TEST_QUERY, false);
for (QueryResult result : results) {
String repositoryId = cmisClientSession.getRepositoryInfo().getId();
String folderId = result.getPropertyById("cmis:objectId").getFirstValue().toString();
cmisClientSession.getBinding().getObjectService().deleteTree(repositoryId, folderId, true, null, false, null);
}
Map<String, Object> folderProperties = new HashMap<String, Object>();
folderProperties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
folderProperties.put(PropertyIds.NAME, "testdata");
Folder newFolder = root.createFolder(folderProperties);
String name = "testdata1.txt";
createNewDocument(newFolder, name);
name = "testdata2.txt";