@Test public void iCanGetLatestUploadsPageProvider() throws Exception { DocumentModel site = createSite(); PageClasseur classeur = new PageClasseurAdapter.Model( session, site.getPathAsString() + "/" + LabsSiteConstants.Docs.TREE.docName(), "ma page classeur") .desc("desc page classeur") .create(); assertThat(classeur.getFolders().size(), is(0)); classeur.addFolder("My Folder", null); session.save(); PageClasseurFolder folder = classeur.getFolders().get(0); assertThat(folder.getFiles().size(), is(0)); folder.addFile(getTestBlob(), "Pomodoro cheat sheet", "title"); session.save(); assertThat(folder.getFiles().size(), is(1)); session.save(); Tools.getAdapter(LabsPublisher.class, classeur.getDocument(), null).publish(); PageProvider<DocumentModel> latestUploadsPageProvider = LabsSiteWebAppUtils.getLatestUploadsPageProvider(site, 0, session); assertNotNull(latestUploadsPageProvider); List<DocumentModel> lastUploadedDoc = latestUploadsPageProvider.getCurrentPage(); assertNotNull(lastUploadedDoc); assertEquals(1, lastUploadedDoc.size()); }
@Test public void iCanGetFoldersUnderFolder() { String directoryPath = FileUtils.getResourcePathFromContext("onpackage/testFoldersInFolder/"); assertThat(LabsSiteWebAppUtils.getFoldersUnderFolder(directoryPath).size(), is(3)); }