@Test public void testDelTree() throws Exception { WikiPage levelOne = WikiPageUtil.addPage(root, PathParser.parse("LevelOne")); WikiPage levelTwo = WikiPageUtil.addPage(levelOne, PathParser.parse("LevelTwo")); levelOne.commit(levelOne.getData()); levelTwo.commit(levelTwo.getData()); File childOne = new File(defaultPath + "/RooT/LevelOne"); File childTwo = new File(defaultPath + "/RooT/LevelOne/LevelTwo"); assertTrue(childOne.exists()); root.removeChildPage("LevelOne"); assertFalse(childTwo.exists()); assertFalse(childOne.exists()); }
@Test public void testTwoLevel() throws Exception { WikiPage levelA = WikiPageUtil.addPage(root, PathParser.parse("PageA")); WikiPage page = WikiPageUtil.addPage(levelA, PathParser.parse("PageB")); page.commit(page.getData()); assertTrue(new File(defaultPath + "/RooT/PageA/PageB").exists()); }
@Test public void testLastModifiedTime() throws Exception { WikiPage page = WikiPageUtil.addPage(root, PathParser.parse("SomePage"), "some text"); page.commit(page.getData()); long now = Clock.currentTimeInMillis(); Date lastModified = page.getData().getProperties().getLastModificationTime(); assertTrue(now - lastModified.getTime() <= 5000); }
@Test public void testPersistentAttributes() throws Exception { WikiPage createdPage = WikiPageUtil.addPage(root, PathParser.parse("FrontPage")); PageData data = createdPage.getData(); data.setAttribute("Test", "true"); data.setAttribute("Search", "true"); createdPage.commit(data); assertTrue(data.hasAttribute("Test")); assertTrue(data.hasAttribute("Search")); WikiPage page = root.getChildPage("FrontPage"); assertTrue(page.getData().hasAttribute("Test")); assertTrue(page.getData().hasAttribute("Search")); }