@Test public void putMergeResult() { MergeDocumentResult mergeDocumentResult = new MergeDocumentResult(null, null, null); assertFalse(mergeDocumentResult.isModified()); assertFalse(mergeDocumentResult.hasConflicts()); assertTrue(mergeDocumentResult.getLog().isEmpty()); assertTrue(mergeDocumentResult.getConflicts().isEmpty()); assertNull(mergeDocumentResult.getConflicts(MergeDocumentResult.DocumentPart.TITLE)); MergeManagerResult mergeManagerResult = new MergeManagerResult(); mergeManagerResult.getLog().info("An information."); mergeDocumentResult.putMergeResult(MergeDocumentResult.DocumentPart.TITLE, mergeManagerResult); assertFalse(mergeDocumentResult.isModified()); assertFalse(mergeDocumentResult.hasConflicts()); assertTrue(mergeDocumentResult.getConflicts().isEmpty()); assertEquals(1, mergeDocumentResult.getLog().size()); assertTrue(mergeDocumentResult.getConflicts(MergeDocumentResult.DocumentPart.TITLE).isEmpty()); assertSame(mergeManagerResult, mergeDocumentResult.getMergeResult(MergeDocumentResult.DocumentPart.TITLE)); mergeManagerResult = new MergeManagerResult(); mergeManagerResult.getLog().error("A conflict."); mergeDocumentResult.putMergeResult(MergeDocumentResult.DocumentPart.CONTENT, mergeManagerResult); assertFalse(mergeDocumentResult.isModified()); assertTrue(mergeDocumentResult.hasConflicts()); assertTrue(mergeDocumentResult.getConflicts().isEmpty()); assertEquals(2, mergeDocumentResult.getLog().size()); assertTrue(mergeDocumentResult.getConflicts(MergeDocumentResult.DocumentPart.CONTENT).isEmpty()); mergeDocumentResult = new MergeDocumentResult(null, null, null); Conflict conflict = mock(Conflict.class); mergeManagerResult = new MergeManagerResult(); mergeManagerResult.addConflicts(Collections.singletonList(conflict)); mergeDocumentResult.putMergeResult(MergeDocumentResult.DocumentPart.ATTACHMENTS, mergeManagerResult); assertFalse(mergeDocumentResult.isModified()); assertTrue(mergeDocumentResult.hasConflicts()); assertEquals(1, mergeDocumentResult.getConflicts().size()); assertTrue(mergeDocumentResult.getLog().isEmpty()); assertEquals(1, mergeDocumentResult.getConflicts(MergeDocumentResult.DocumentPart.ATTACHMENTS).size()); mergeManagerResult = new MergeManagerResult(); mergeManagerResult.getLog().error("A conflict."); mergeDocumentResult.putMergeResult(MergeDocumentResult.DocumentPart.CONTENT, mergeManagerResult); assertFalse(mergeDocumentResult.isModified()); assertTrue(mergeDocumentResult.hasConflicts()); assertEquals(1, mergeDocumentResult.getConflicts().size()); assertEquals(1, mergeDocumentResult.getLog().size()); assertTrue(mergeDocumentResult.getConflicts(MergeDocumentResult.DocumentPart.CONTENT).isEmpty()); assertEquals(1, mergeDocumentResult.getConflicts(MergeDocumentResult.DocumentPart.ATTACHMENTS).size()); mergeManagerResult = new MergeManagerResult(); mergeManagerResult.getLog().info("Something else"); mergeManagerResult.setModified(true); mergeDocumentResult.putMergeResult(MergeDocumentResult.DocumentPart.TITLE, mergeManagerResult); assertTrue(mergeDocumentResult.isModified()); assertTrue(mergeDocumentResult.hasConflicts()); assertEquals(1, mergeDocumentResult.getConflicts().size()); assertEquals(2, mergeDocumentResult.getLog().size()); assertTrue(mergeDocumentResult.getConflicts(MergeDocumentResult.DocumentPart.CONTENT).isEmpty()); assertTrue(mergeDocumentResult.getConflicts(MergeDocumentResult.DocumentPart.TITLE).isEmpty()); assertEquals(1, mergeDocumentResult.getConflicts(MergeDocumentResult.DocumentPart.ATTACHMENTS).size()); mergeManagerResult = new MergeManagerResult(); mergeManagerResult.addConflicts(Arrays.asList(conflict, conflict)); mergeDocumentResult.putMergeResult(MergeDocumentResult.DocumentPart.XOBJECTS, mergeManagerResult); assertTrue(mergeDocumentResult.isModified()); assertTrue(mergeDocumentResult.hasConflicts()); assertEquals(3, mergeDocumentResult.getConflicts().size()); assertEquals(2, mergeDocumentResult.getLog().size()); assertTrue(mergeDocumentResult.getConflicts(MergeDocumentResult.DocumentPart.CONTENT).isEmpty()); assertTrue(mergeDocumentResult.getConflicts(MergeDocumentResult.DocumentPart.TITLE).isEmpty()); assertEquals(1, mergeDocumentResult.getConflicts(MergeDocumentResult.DocumentPart.ATTACHMENTS).size()); assertEquals(2, mergeDocumentResult.getConflicts(MergeDocumentResult.DocumentPart.XOBJECTS).size()); }
public void putMergeResult(DocumentPart documentPart, MergeManagerResult mergeManagerResult) { if (!this.mergeResults.containsKey(documentPart)) { this.mergeResults.put(documentPart, mergeManagerResult); this.getLog().addAll(mergeManagerResult.getLog()); this.getConflicts().addAll(mergeManagerResult.getConflicts()); this.setModified(isModified() || mergeManagerResult.isModified()); } else { throw new IllegalArgumentException( String.format("The merge result of document part [%s] has already been put.", documentPart.name())); } }
MergeDocumentResult extends MergeManagerResult<DocumentModelBridge, Object> { public void putMergeResult(DocumentPart documentPart, MergeManagerResult mergeManagerResult) { if (!this.mergeResults.containsKey(documentPart)) { this.mergeResults.put(documentPart, mergeManagerResult); this.getLog().addAll(mergeManagerResult.getLog()); this.getConflicts().addAll(mergeManagerResult.getConflicts()); this.setModified(isModified() || mergeManagerResult.isModified()); } else { throw new IllegalArgumentException( String.format("The merge result of document part [%s] has already been put.", documentPart.name())); } } }
MergeDocumentResult extends MergeManagerResult<DocumentModelBridge, Object> { public void putMergeResult(DocumentPart documentPart, MergeManagerResult mergeManagerResult) { if (!this.mergeResults.containsKey(documentPart)) { this.mergeResults.put(documentPart, mergeManagerResult); this.getLog().addAll(mergeManagerResult.getLog()); this.getConflicts().addAll(mergeManagerResult.getConflicts()); this.setModified(isModified() || mergeManagerResult.isModified()); } else { throw new IllegalArgumentException( String.format("The merge result of document part [%s] has already been put.", documentPart.name())); } } @Unstable  MergeDocumentResult(DocumentModelBridge currentDocument, DocumentModelBridge previousDocument,
        DocumentModelBridge nextDocument); }
MergeDocumentResult extends MergeManagerResult<DocumentModelBridge, Object> { public void putMergeResult(DocumentPart documentPart, MergeManagerResult mergeManagerResult) { if (!this.mergeResults.containsKey(documentPart)) { this.mergeResults.put(documentPart, mergeManagerResult); this.getLog().addAll(mergeManagerResult.getLog()); this.getConflicts().addAll(mergeManagerResult.getConflicts()); this.setModified(isModified() || mergeManagerResult.isModified()); } else { throw new IllegalArgumentException( String.format("The merge result of document part [%s] has already been put.", documentPart.name())); } } @Unstable  MergeDocumentResult(DocumentModelBridge currentDocument, DocumentModelBridge previousDocument,
        DocumentModelBridge nextDocument); DocumentModelBridge getCurrentDocument(); DocumentModelBridge getPreviousDocument(); DocumentModelBridge getNextDocument(); void putMergeResult(DocumentPart documentPart, MergeManagerResult mergeManagerResult); MergeManagerResult getMergeResult(DocumentPart documentPart); List<Conflict<?>> getConflicts(DocumentPart documentPart); }
MergeDocumentResult extends MergeManagerResult<DocumentModelBridge, Object> { public void putMergeResult(DocumentPart documentPart, MergeManagerResult mergeManagerResult) { if (!this.mergeResults.containsKey(documentPart)) { this.mergeResults.put(documentPart, mergeManagerResult); this.getLog().addAll(mergeManagerResult.getLog()); this.getConflicts().addAll(mergeManagerResult.getConflicts()); this.setModified(isModified() || mergeManagerResult.isModified()); } else { throw new IllegalArgumentException( String.format("The merge result of document part [%s] has already been put.", documentPart.name())); } } @Unstable  MergeDocumentResult(DocumentModelBridge currentDocument, DocumentModelBridge previousDocument,
        DocumentModelBridge nextDocument); DocumentModelBridge getCurrentDocument(); DocumentModelBridge getPreviousDocument(); DocumentModelBridge getNextDocument(); void putMergeResult(DocumentPart documentPart, MergeManagerResult mergeManagerResult); MergeManagerResult getMergeResult(DocumentPart documentPart); List<Conflict<?>> getConflicts(DocumentPart documentPart);  }