Пример #1
0
 @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);
 }
Пример #2
0
 public Date getLastModificationTime() {
   String dateStr = get(PageData.PropertyLAST_MODIFIED);
   if (dateStr == null) return Clock.currentDate();
   else
     try {
       return getTimeFormat().parse(dateStr);
     } catch (ParseException e) {
       throw new IllegalStateException("Unable to parse date '" + dateStr + "'", e);
     }
 }
Пример #3
0
 @Test
 public void testLastModificationTime() throws Exception {
   DateFormat format = WikiPageProperty.getTimeFormat();
   WikiPageProperties props = new WikiPageProperties();
   assertEquals(
       format.format(Clock.currentDate()), format.format(props.getLastModificationTime()));
   Date date = format.parse("20040101000001");
   props.setLastModificationTime(date);
   assertEquals("20040101000001", props.get(PageData.PropertyLAST_MODIFIED));
   assertEquals(date, props.getLastModificationTime());
 }