protected int createFolders(IFolderSyncManager mgr, UserFolder parent, int numFolders, int depth) throws Exception { if (depth == 0) { return 0; } for (int ix = 0; ix < numFolders; ix++) { UserFolder child = new UserFolder(); child.setCustomerId(parent.getCustomerId()); child.setUserId(parent.getUserId()); String name = String.format(FOLDER_NAME_FORMAT, ix, depth); child.setExchangeFolderKey(RandomStringUtils.randomAlphanumeric(40)); child.setExchangeParentFolderKey(parent.getExchangeFolderKey()); child.setMapiFolderKey(RandomStringUtils.randomAlphanumeric(40)); child.setMapiParentFolderKey(parent.getMapiFolderKey()); child.setDeleted(false); child.setDisplayName(name); child.setExchangeSyncState(""); child.setFolderItemsSyncEnabled(ix != 5); // create at least one that is not enabled for sync mgr.createFolder(child); createFolders(mgr, child, numFolders, depth - 1); } return numFolders; }
protected UserFolder addRootFolder() throws FolderSyncException, WebTestException { String name = m_userId + "-root"; UserFolder root = new UserFolder(); root.setCustomerId(getJspTestUtils().getCustId()); root.setUserId(m_userId); root.setExchangeFolderKey(RandomStringUtils.randomAlphanumeric(40)); root.setExchangeParentFolderKey(IUserFolderDAO.ROOT_PARENT_KEY); root.setMapiFolderKey(RandomStringUtils.randomAlphabetic(40)); root.setMapiParentFolderKey(IUserFolderDAO.ROOT_PARENT_KEY); root.setDeleted(false); root.setDisplayName(name); root.setExchangeSyncState("not_available"); return root; }
protected void createWellKnownFolder( IFolderSyncManager mgr, UserFolder parent, String folderName, String wellKnownFolderName) throws Exception { UserFolder child = new UserFolder(); child.setCustomerId(parent.getCustomerId()); child.setUserId(parent.getUserId()); child.setExchangeFolderKey(RandomStringUtils.randomAlphanumeric(40)); child.setExchangeParentFolderKey(parent.getExchangeFolderKey()); child.setMapiFolderKey(RandomStringUtils.randomAlphanumeric(40)); child.setMapiParentFolderKey(parent.getMapiParentFolderKey()); child.setDeleted(false); child.setDisplayName(folderName); child.setExchangeSyncState("not_synced"); child.setFolderItemsSyncEnabled(false); child.setWellKnownName(wellKnownFolderName); mgr.createFolder(child); }