protected void beforeRequest() {
setParameter("directoryId", "2");
}
protected void invokeApplication() throws Exception {
DirectoryBrowser browser = (DirectoryBrowser)getInstance(DirectoryBrowser.class);
assert browser.getInstance().getId().equals(2l); // Init!
WikiDocument doc = browser.getWikiNodeDAO().findWikiDocument(9l);
WikiUpload upload = browser.getWikiNodeDAO().findWikiUpload(30l);
browser.getSelectedNodes().put(doc, true);
browser.getSelectedNodes().put(upload, true);
browser.cut();
}
}.run();
new FacesRequest("/dirDisplay_d.xhtml") {
protected void beforeRequest() {
setParameter("directoryId", "2");
}
protected void renderResponse() throws Exception {
Clipboard clipboard = (Clipboard)getInstance(Clipboard.class);
assert clipboard.getItems().size() == 2;
assert clipboard.isCut(9l);
assert clipboard.isCut(30l);
}
}.run();
new FacesRequest("/dirDisplay_d.xhtml") {
protected void beforeRequest() {
setParameter("directoryId", "4");
}
protected void renderResponse() throws Exception {
DirectoryBrowser browser = (DirectoryBrowser)getInstance(DirectoryBrowser.class);
assert browser.getInstance().getId().equals(4l); // Init!
browser.paste();
browser.getEntityManager().flush(); // TODO: ?! I think the test phase listener is wrong here not doing that...
}
}.run();
new FacesRequest("/dirDisplay_d.xhtml") {
protected void beforeRequest() {
setParameter("directoryId", "4");
}
protected void renderResponse() throws Exception {
Clipboard clipboard = (Clipboard)getInstance(Clipboard.class);
assert clipboard.getItems().size() == 0;
DirectoryBrowser browser = (DirectoryBrowser)getInstance(DirectoryBrowser.class);
assert browser.getInstance().getId().equals(4l); // Init!
assert browser.getChildNodes().size() == 3;
WikiDocument doc =
browser.getWikiNodeDAO().findWikiDocumentInArea(browser.getInstance().getAreaNumber(), "Four");
assert doc.getAreaNumber().equals(browser.getInstance().getAreaNumber());
List<WikiUpload> uploads = browser.getWikiNodeDAO().findWikiUploads(browser.getInstance(), WikiNode.SortableProperty.createdOn, true);
assert uploads.size() == 1;
assert uploads.get(0).getName().equals("Test Image");
assert uploads.get(0).getAreaNumber().equals(browser.getInstance().getAreaNumber());
WikiDocument docOriginal = browser.getWikiNodeDAO().findWikiDocumentInArea(2l, "Four");
assert docOriginal == null;
WikiDirectory originalDir = browser.getWikiNodeDAO().findWikiDirectory(2l);
List<WikiUpload> originalUploads = browser.getWikiNodeDAO().findWikiUploads(originalDir, WikiNode.SortableProperty.createdOn, true);
assert originalUploads.size() == 1;
}
}.run();
}