use of com.xpn.xwiki.doc.merge.MergeResult in project xwiki-platform by xwiki.
the class XWikiDocumentMergeTest method testMergeAttachmentEqualsDeletedCurrent.
@Test
public void testMergeAttachmentEqualsDeletedCurrent() throws Exception {
XWikiAttachment attachment = new XWikiAttachment();
attachment.setContent(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 });
attachment.setLongSize(10);
attachment.setFilename("file");
this.previousDocument.addAttachment(attachment);
this.nextDocument.addAttachment((XWikiAttachment) attachment.clone());
MergeResult result = merge();
Assert.assertFalse(result.isModified());
}
use of com.xpn.xwiki.doc.merge.MergeResult in project xwiki-platform by xwiki.
the class XWikiDocumentMergeTest method testMergeAttachmentEqualsAddedCurrent.
@Test
public void testMergeAttachmentEqualsAddedCurrent() throws Exception {
XWikiAttachment attachment = new XWikiAttachment();
attachment.setContent(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 });
attachment.setLongSize(10);
attachment.setFilename("file");
this.currentDocument.addAttachment(attachment);
MergeResult result = merge();
Assert.assertFalse(result.isModified());
}
use of com.xpn.xwiki.doc.merge.MergeResult in project xwiki-platform by xwiki.
the class XWikiDocumentMergeTest method merge.
private MergeResult merge() throws Exception {
MergeResult result = this.currentDocument.merge(this.previousDocument, this.nextDocument, this.configuration, this.oldcore.getXWikiContext());
List<LogEvent> exception = result.getLog().getLogs(LogLevel.ERROR);
if (!exception.isEmpty()) {
throw new MergeException(exception.get(0).getFormattedMessage(), exception.get(0).getThrowable());
}
return result;
}
use of com.xpn.xwiki.doc.merge.MergeResult in project xwiki-platform by xwiki.
the class MergeUtilsTest method mergeObjectSimple.
@Test
public void mergeObjectSimple() {
MergeResult result = new MergeResult();
assertEquals("new", MergeUtils.mergeOject("old", "new", "old", result));
assertTrue(result.isModified());
}
use of com.xpn.xwiki.doc.merge.MergeResult in project xwiki-platform by xwiki.
the class MergeUtilsTest method mergeWhenCurrentStringDoesntEndWithNewLine.
@Test
public void mergeWhenCurrentStringDoesntEndWithNewLine() {
MergeResult result = new MergeResult();
assertEquals("content", MergeUtils.mergeLines("content", "content", "content", result));
assertFalse(result.isModified());
}
Aggregations