* if setup of the index fails
*/
@Before
public void setUp() throws Exception {
// Prepare the pages
PageReader pageReader = new PageReader();
InputStream is = null;
Calendar date = Calendar.getInstance();
Date today = date.getTime();
date.add(Calendar.YEAR, -1);
Date lastYear = date.getTime();
// Add the live page
try {
is = this.getClass().getResourceAsStream(pageFile);
livePage = pageReader.read(is, site);
livePage.setIdentifier(livePageId);
livePage.setCreated(livePage.getCreator(), lastYear);
livePage.setModified(livePage.getModifier(), lastYear);
pagelet = livePage.getPagelets()[0];
// Duplicate the content to gain higher ranking
String elementId = "textid";
content = pagelet.getContent(elementId, german);
pagelet.setContent(elementId, content + " " + content, german);
idx.add(livePage);
} finally {
IOUtils.closeQuietly(is);
}
// Add the second live page
try {
is = this.getClass().getResourceAsStream(pageFile);
otherLivePage = pageReader.read(is, site);
otherLivePage.setIdentifier(otherLivePageId);
otherLivePage.setCreated(otherLivePage.getCreator(), today);
otherLivePage.setModified(otherLivePage.getModifier(), today);
idx.add(otherLivePage);
} finally {