}
protected void invokeApplication() throws Exception {
assert Conversation.instance().isLongRunning();
DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
assert docHome.getInstance().getId().equals(6l); // Init!
docHome.syncInstanceToEditor(docHome.getParentNode().getId(), docHome.getInstance());
docHome.getTextEditor().setValue("New text");
docHome.syncEditorToInstance(docHome.getParentNode().getId(), docHome.getInstance());
docHome.setMinorRevision(false);
assert invokeMethod("#{documentHome.update}").equals("updated");
}
}.run();
new NonFacesRequest("/wiki.xhtml") {
protected void beforeRequest() {
setParameter("nodeId", "6");
}
protected void renderResponse() throws Exception {
DocumentHome docHome = (DocumentHome)getInstance(DocumentHome.class);
assert docHome.getInstance().getId().equals(6l); // Init!
assert docHome.isHistoricalFilesPresent();
assert docHome.getHistoricalFiles().size() == 4;
// Sorted by revision descending
assert docHome.getHistoricalFiles().get(0).getRevision() == 3;
assert docHome.getHistoricalFiles().get(0).getId().equals(6l);
assert docHome.getHistoricalFiles().get(0).getLastModifiedByUsername().equals("admin");
assert docHome.getHistoricalFiles().get(0).getLastModifiedOn() != null;
assert docHome.getHistoricalFiles().get(1).getRevision() == 2;
assert docHome.getHistoricalFiles().get(0).getId().equals(6l);
assert docHome.getHistoricalFiles().get(1).getLastModifiedByUsername().equals("admin");
assert docHome.getHistoricalFiles().get(1).getLastModifiedOn() != null;
assert docHome.getHistoricalFiles().get(2).getRevision() == 1;
assert docHome.getHistoricalFiles().get(0).getId().equals(6l);
assert docHome.getHistoricalFiles().get(2).getLastModifiedByUsername().equals("guest");
assert docHome.getHistoricalFiles().get(2).getLastModifiedOn() != null;
assert docHome.getHistoricalFiles().get(3).getRevision() == 0;
assert docHome.getHistoricalFiles().get(0).getId().equals(6l);
assert docHome.getHistoricalFiles().get(3).getLastModifiedByUsername().equals("admin");
assert docHome.getHistoricalFiles().get(3).getLastModifiedOn() == null;
}
}.run();
}