protected void beforeRequest() {
setParameter("directoryId", "2");
}
protected void invokeApplication() throws Exception {
DirectoryBrowser browser = (DirectoryBrowser)getInstance(DirectoryBrowser.class);
assert browser.getInstance().getId().equals(2l); // Init!
assert browser.getChildNodes().size() == 3;
boolean found = false;
for (WikiNode node : browser.getChildNodes()) if (node.getId().equals(9l)) found = true;
assert found;
DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
assert docHome.remove(9l).equals("removed");
}
// Feed entries should be gone
protected void renderResponse() throws Exception {
WikiNodeDAO nodeDAO = (WikiNodeDAO)getInstance(WikiNodeDAO.class);
WikiDocument document = nodeDAO.findWikiDocument(9l);
FeedDAO feedDAO = (FeedDAO)getInstance(FeedDAO.class);
List<WikiFeed> feeds = feedDAO.findFeeds(document);
assert feeds.size() == 0;
}
}.run();
loginAdmin();
new NonFacesRequest("/wiki.xhtml") {
protected void beforeRequest() {
setParameter("areaName", "Trash");
}
protected void renderResponse() throws Exception {
DirectoryBrowser browser = (DirectoryBrowser)getInstance(DirectoryBrowser.class);
assert browser.getInstance().getId().equals(17l); // Init!
assert browser.getChildNodes().size() == 1;
assert browser.getChildNodes().get(0).getId().equals(9l);
assert getRenderedViewId().equals("/dirDisplay_d.xhtml");
}
}.run();
new FacesRequest("/dirDisplay_d.xhtml") {
protected void beforeRequest() {
setParameter("directoryId", "17");
}
protected void invokeApplication() throws Exception {
DirectoryBrowser browser = (DirectoryBrowser)getInstance(DirectoryBrowser.class);
assert browser.getInstance().getId().equals(17l); // Init!
browser.emptyTrash();
}
}.run();
new NonFacesRequest("/wiki.xhtml") {
protected void beforeRequest() {
setParameter("areaName", "Trash");
}
protected void renderResponse() throws Exception {
DirectoryBrowser browser = (DirectoryBrowser)getInstance(DirectoryBrowser.class);
assert browser.getInstance().getId().equals(17l); // Init!
assert browser.getChildNodes().size() == 0;
WikiNodeDAO dao = (WikiNodeDAO)getInstance(WikiNodeDAO.class);
assert dao.findWikiNode(9l) == null;
assert getRenderedViewId().equals("/dirDisplay_d.xhtml");