public void testChildPageAdded() throws Exception { importer.enterChildPage(pageOne, Clock.currentDate()); importer.enterChildPage(childPageOne, Clock.currentDate()); PageData data = childPageOne.getData(); assertEquals("child one", data.getContent()); }
public void testExiting() throws Exception { importer.enterChildPage(pageOne, Clock.currentDate()); importer.enterChildPage(childPageOne, Clock.currentDate()); importer.exitPage(); importer.exitPage(); importer.enterChildPage(pageTwo, Clock.currentDate()); PageData data = pageTwo.getData(); assertEquals("page two", data.getContent()); }
@Test public void testLastModifiedTime() throws Exception { WikiPage page = crawler.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); }
public void testAutoUpdate_NewPage() throws Exception { importer.setAutoUpdateSetting(true); importer.enterChildPage(pageOne, Clock.currentDate()); WikiImportProperty importProps = WikiImportProperty.createFrom(pageOne.getData().getProperties()); assertTrue(importProps.isAutoUpdate()); }
public void testEnterChildPageWhenRemotePageNotModified() throws Exception { importer.enterChildPage(pageOne, Clock.currentDate()); importer.exitPage(); PageData data = pageOne.getData(); data.setContent("new content"); pageOne.commit(data); importer.enterChildPage(pageOne, new Date(0)); assertEquals("new content", pageOne.getData().getContent()); }
public void testAutoUpdateWhenRemotePageNotModified() throws Exception { importer.enterChildPage(pageOne, Clock.currentDate()); importer.exitPage(); PageData data = pageOne.getData(); data.setContent("new content"); pageOne.commit(data); importer.setAutoUpdateSetting(true); importer.enterChildPage(pageOne, new Date(0)); WikiImportProperty importProps = WikiImportProperty.createFrom(pageOne.getData().getProperties()); assertTrue(importProps.isAutoUpdate()); }
private String makeRightColumn() throws Exception { HtmlTag form = HtmlUtil.makeFormTag("post", resource); form.add(HtmlUtil.makeInputTag("hidden", "responder", "saveData")); form.add( HtmlUtil.makeInputTag( "hidden", EditResponder.TIME_STAMP, String.valueOf(clock.currentClockTimeInMillis()))); form.add( HtmlUtil.makeInputTag( "hidden", EditResponder.TICKET_ID, String.valueOf(SaveRecorder.newTicket()))); HtmlTag title = HtmlUtil.makeDivTag("centered"); title.use( "This page has been recently modified. You may want to merge existing page content into your changes."); form.add(title); form.add(makeMergeNewDivTag()); form.add(makeMergeOldDivTag()); form.add(addHiddenAttributes()); return form.html(); }
@After public void tearDown() { Clock.restoreDefaultClock(); }
protected VersionInfo makeVersion() { return new VersionInfo("abc", "Jon", Clock.currentDate()); }
@After public void restoreDefaultClock() { Clock.restoreDefaultClock(); }