use of com.xpn.xwiki.doc.merge.MergeResult in project xwiki-platform by xwiki.
the class XWikiDocumentMergeTest method testMergeAttachmentEqualsModifiedCurrent.
@Test
public void testMergeAttachmentEqualsModifiedCurrent() 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());
attachment = (XWikiAttachment) attachment.clone();
attachment.setContent(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 });
attachment.setLongSize(9);
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 MergeUtilsTest method mergeListAlreadyDone.
@Test
public void mergeListAlreadyDone() {
MergeResult result = new MergeResult();
List<String> current = new ArrayList<String>(Arrays.asList("new1", "new2"));
MergeUtils.mergeList(Arrays.asList("old1", "old2"), Arrays.asList("new1", "new2"), current, result);
assertEquals(Arrays.asList("new1", "new2"), current);
assertEquals(Arrays.asList("new1", "new2"), current);
assertFalse(result.isModified());
}
use of com.xpn.xwiki.doc.merge.MergeResult in project xwiki-platform by xwiki.
the class MergeUtilsTest method mergeObjectWhileModified.
@Test
public void mergeObjectWhileModified() {
MergeResult result = new MergeResult();
assertEquals("old modified", MergeUtils.mergeOject("old", "new", "old modified", result));
assertFalse(result.isModified());
// conflicts are flagged as errors in the log
assertFalse(result.getLog().getLogs(LogLevel.ERROR).isEmpty());
}
use of com.xpn.xwiki.doc.merge.MergeResult in project xwiki-platform by xwiki.
the class MergeUtilsTest method mergeListSimple.
@Test
public void mergeListSimple() {
MergeResult result = new MergeResult();
List<String> current = new ArrayList<String>(Arrays.asList("old1", "old2"));
MergeUtils.mergeList(Arrays.asList("old1", "old2"), Arrays.asList("new1", "new2"), current, result);
assertEquals(Arrays.asList("new1", "new2"), current);
assertTrue(result.isModified());
}
use of com.xpn.xwiki.doc.merge.MergeResult in project xwiki-platform by xwiki.
the class MergeUtilsTest method mergeListWhileModified.
@Test
public void mergeListWhileModified() {
MergeResult result = new MergeResult();
List<String> current = new ArrayList<String>(Arrays.asList("old modified1", "old modified2"));
MergeUtils.mergeList(Arrays.asList("old1", "old2"), Arrays.asList("new1", "new2"), current, result);
assertEquals(Arrays.asList("old modified1", "old modified2"), current);
assertFalse(result.isModified());
// conflicts are flagged as errors in the log
assertFalse(result.getLog().getLogs(LogLevel.ERROR).isEmpty());
}
Aggregations