@Test public void mergeCharactersSimple() { MergeManagerResult<String, Character> result = mergeManager.mergeCharacters("ab", "aib", "abc", new MergeConfiguration()); assertEquals("aibc", result.getMergeResult()); assertTrue(result.isModified()); assertFalse(result.hasConflicts()); }
@Override public MergeManagerResult<String, Character> mergeCharacters(String previousStr, String newStr, String currentStr, MergeConfiguration configuration) { MergeManagerResult<String, Character> mergeResult = new MergeManagerResult<>(); try { org.xwiki.diff.MergeResult<Character> result = this.diffManager.merge(toCharacters(previousStr), toCharacters(newStr), toCharacters(currentStr), getDefaultConfiguration(configuration)); mergeResult.getLog().addAll(result.getLog()); mergeResult.addConflicts(result.getConflicts()); String resultStr = fromCharacters(result.getMerged()); mergeResult.setMergeResult(resultStr); mergeResult.setModified(!resultStr.equals(currentStr)); } catch (MergeException e) { mergeResult.getLog().error("Failed to execute merge characters", e); } return mergeResult; }
DefaultMergeManager implements MergeManager { @Override public MergeManagerResult<String, Character> mergeCharacters(String previousStr, String newStr, String currentStr, MergeConfiguration configuration) { MergeManagerResult<String, Character> mergeResult = new MergeManagerResult<>(); try { org.xwiki.diff.MergeResult<Character> result = this.diffManager.merge(toCharacters(previousStr), toCharacters(newStr), toCharacters(currentStr), getDefaultConfiguration(configuration)); mergeResult.getLog().addAll(result.getLog()); mergeResult.addConflicts(result.getConflicts()); String resultStr = fromCharacters(result.getMerged()); mergeResult.setMergeResult(resultStr); mergeResult.setModified(!resultStr.equals(currentStr)); } catch (MergeException e) { mergeResult.getLog().error("Failed to execute merge characters", e); } return mergeResult; } }
DefaultMergeManager implements MergeManager { @Override public MergeManagerResult<String, Character> mergeCharacters(String previousStr, String newStr, String currentStr, MergeConfiguration configuration) { MergeManagerResult<String, Character> mergeResult = new MergeManagerResult<>(); try { org.xwiki.diff.MergeResult<Character> result = this.diffManager.merge(toCharacters(previousStr), toCharacters(newStr), toCharacters(currentStr), getDefaultConfiguration(configuration)); mergeResult.getLog().addAll(result.getLog()); mergeResult.addConflicts(result.getConflicts()); String resultStr = fromCharacters(result.getMerged()); mergeResult.setMergeResult(resultStr); mergeResult.setModified(!resultStr.equals(currentStr)); } catch (MergeException e) { mergeResult.getLog().error("Failed to execute merge characters", e); } return mergeResult; }  }
DefaultMergeManager implements MergeManager { @Override public MergeManagerResult<String, Character> mergeCharacters(String previousStr, String newStr, String currentStr, MergeConfiguration configuration) { MergeManagerResult<String, Character> mergeResult = new MergeManagerResult<>(); try { org.xwiki.diff.MergeResult<Character> result = this.diffManager.merge(toCharacters(previousStr), toCharacters(newStr), toCharacters(currentStr), getDefaultConfiguration(configuration)); mergeResult.getLog().addAll(result.getLog()); mergeResult.addConflicts(result.getConflicts()); String resultStr = fromCharacters(result.getMerged()); mergeResult.setMergeResult(resultStr); mergeResult.setModified(!resultStr.equals(currentStr)); } catch (MergeException e) { mergeResult.getLog().error("Failed to execute merge characters", e); } return mergeResult; }  @Override MergeManagerResult<String, String> mergeLines(String previousStr, String newStr, String currentStr,
        MergeConfiguration configuration); @Override MergeManagerResult<T, T> mergeObject(T previousObject, T newObject, T currentObject,
        MergeConfiguration configuration); @Override MergeManagerResult<String, Character> mergeCharacters(String previousStr, String newStr, String currentStr,
        MergeConfiguration configuration); @Override MergeManagerResult<List<T>, T> mergeList(List<T> commonAncestor, List<T> next, List<T> current,
        MergeConfiguration configuration); @Override MergeDocumentResult mergeDocument(DocumentModelBridge previousDocument,
        DocumentModelBridge newDocument, DocumentModelBridge currentDocument, MergeConfiguration configuration); }
DefaultMergeManager implements MergeManager { @Override public MergeManagerResult<String, Character> mergeCharacters(String previousStr, String newStr, String currentStr, MergeConfiguration configuration) { MergeManagerResult<String, Character> mergeResult = new MergeManagerResult<>(); try { org.xwiki.diff.MergeResult<Character> result = this.diffManager.merge(toCharacters(previousStr), toCharacters(newStr), toCharacters(currentStr), getDefaultConfiguration(configuration)); mergeResult.getLog().addAll(result.getLog()); mergeResult.addConflicts(result.getConflicts()); String resultStr = fromCharacters(result.getMerged()); mergeResult.setMergeResult(resultStr); mergeResult.setModified(!resultStr.equals(currentStr)); } catch (MergeException e) { mergeResult.getLog().error("Failed to execute merge characters", e); } return mergeResult; }  @Override MergeManagerResult<String, String> mergeLines(String previousStr, String newStr, String currentStr,
        MergeConfiguration configuration); @Override MergeManagerResult<T, T> mergeObject(T previousObject, T newObject, T currentObject,
        MergeConfiguration configuration); @Override MergeManagerResult<String, Character> mergeCharacters(String previousStr, String newStr, String currentStr,
        MergeConfiguration configuration); @Override MergeManagerResult<List<T>, T> mergeList(List<T> commonAncestor, List<T> next, List<T> current,
        MergeConfiguration configuration); @Override MergeDocumentResult mergeDocument(DocumentModelBridge previousDocument,
        DocumentModelBridge newDocument, DocumentModelBridge currentDocument, MergeConfiguration configuration);  }