roller/testdata/roller-custom.properties */
FileContentManager fmgr = WebloggerFactory.getWeblogger().getFileContentManager();
// File should not exist initially
try {
FileContent fileContent = fmgr.getFileContent(testWeblog, "bookmarks-file-id");
assertTrue("Non-existant file retrieved without any exception", false);
} catch (FileNotFoundException e) {
assertTrue("Exception thrown for non-existant file as expected", true);
}
// store a file
InputStream is = getClass().getResourceAsStream("/bookmarks.opml");
fmgr.saveFileContent(testWeblog, "bookmarks-file-id", is);
// make sure file was stored successfully
FileContent fileContent1 = fmgr.getFileContent(testWeblog, "bookmarks-file-id");
assertEquals("bookmarks-file-id", fileContent1.getFileId());
// delete file
fmgr.deleteFile(testWeblog, "bookmarks-file-id");
// File should not exist after delete
try {
FileContent fileContent = fmgr.getFileContent(testWeblog, "bookmarks-file-id");
assertTrue("Non-existant file retrieved without any exception", false);
} catch (FileNotFoundException e) {
assertTrue("Exception thrown for non-existant file as expected", true);
}