Ejemplo n.º 1
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());
 }
Ejemplo n.º 2
0
 private void attemptToReadPropertiesFile(File file, PageData data, long lastModifiedTime)
     throws Exception {
   InputStream input = null;
   try {
     final WikiPageProperties props = new WikiPageProperties();
     input = new FileInputStream(file);
     props.loadFromXmlStream(input);
     props.setLastModificationTime(new Date(lastModifiedTime));
     data.setProperties(props);
   } finally {
     if (input != null) input.close();
   }
 }