This issue was introduced in
To summarize the problem:
- toRCS() will call new Archive() or addRevision() which create new JRCS Node objects (either TrunkNode or BranchNode).
- When a new JRCS Node is created, the date of the node is set to the current date (and time)
- Thus calling toRCS() generates an Archive object that doesn't contain the real dates of the attachment revisions but the date of when toRCS() was called.
This affects the new ListAttachmentArchiveTest#testGetArchiveAsString() test which compares ListAttachmentArchive#getArchive() (which calls toRCS()) with XWikiAttachmentArchive#getArchive(). The later is correct and doesn't change the dates but the former does and thus if the test doesn't execute fast enough, the comparison assert fails with:
One solution is to extend Archive (see XWikiRCSArchive) with a new XWikiAttachmentRCSArchive class for example and have the code get the date from the attachment XML data and after the Node has been created, set the correct date on it.