@Test public void mergeObjectAlreadyDone() { MergeManagerResult<String, String> result = mergeManager.mergeObject("old", "new", "new", new MergeConfiguration()); assertEquals("new", result.getMergeResult()); assertFalse(result.isModified()); assertFalse(result.hasConflicts()); }
@Override public <T> MergeManagerResult<T, T> mergeObject(T previousObject, T newObject, T currentObject, MergeConfiguration configuration) { MergeManagerResult<T, T> mergeResult = new MergeManagerResult<>(); if (ObjectUtils.notEqual(previousObject, newObject)) { if (ObjectUtils.equals(previousObject, currentObject)) { mergeResult.setMergeResult(newObject); mergeResult.setModified(true); } else if (ObjectUtils.equals(newObject, currentObject)) { mergeResult.setMergeResult(currentObject); } else { mergeResult.setMergeResult(currentObject); mergeResult.getLog() .error("Failed to merge objects: previous=[{}] new=[{}] current=[{}]", previousObject, newObject, currentObject); } } else { mergeResult.setMergeResult(currentObject); } return mergeResult; }
DefaultMergeManager implements MergeManager { @Override public <T> MergeManagerResult<T, T> mergeObject(T previousObject, T newObject, T currentObject, MergeConfiguration configuration) { MergeManagerResult<T, T> mergeResult = new MergeManagerResult<>(); if (ObjectUtils.notEqual(previousObject, newObject)) { if (ObjectUtils.equals(previousObject, currentObject)) { mergeResult.setMergeResult(newObject); mergeResult.setModified(true); } else if (ObjectUtils.equals(newObject, currentObject)) { mergeResult.setMergeResult(currentObject); } else { mergeResult.setMergeResult(currentObject); mergeResult.getLog() .error("Failed to merge objects: previous=[{}] new=[{}] current=[{}]", previousObject, newObject, currentObject); } } else { mergeResult.setMergeResult(currentObject); } return mergeResult; } }
DefaultMergeManager implements MergeManager { @Override public <T> MergeManagerResult<T, T> mergeObject(T previousObject, T newObject, T currentObject, MergeConfiguration configuration) { MergeManagerResult<T, T> mergeResult = new MergeManagerResult<>(); if (ObjectUtils.notEqual(previousObject, newObject)) { if (ObjectUtils.equals(previousObject, currentObject)) { mergeResult.setMergeResult(newObject); mergeResult.setModified(true); } else if (ObjectUtils.equals(newObject, currentObject)) { mergeResult.setMergeResult(currentObject); } else { mergeResult.setMergeResult(currentObject); mergeResult.getLog() .error("Failed to merge objects: previous=[{}] new=[{}] current=[{}]", previousObject, newObject, currentObject); } } else { mergeResult.setMergeResult(currentObject); } return mergeResult; }  }
DefaultMergeManager implements MergeManager { @Override public <T> MergeManagerResult<T, T> mergeObject(T previousObject, T newObject, T currentObject, MergeConfiguration configuration) { MergeManagerResult<T, T> mergeResult = new MergeManagerResult<>(); if (ObjectUtils.notEqual(previousObject, newObject)) { if (ObjectUtils.equals(previousObject, currentObject)) { mergeResult.setMergeResult(newObject); mergeResult.setModified(true); } else if (ObjectUtils.equals(newObject, currentObject)) { mergeResult.setMergeResult(currentObject); } else { mergeResult.setMergeResult(currentObject); mergeResult.getLog() .error("Failed to merge objects: previous=[{}] new=[{}] current=[{}]", previousObject, newObject, currentObject); } } else { mergeResult.setMergeResult(currentObject); } 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 <T> MergeManagerResult<T, T> mergeObject(T previousObject, T newObject, T currentObject, MergeConfiguration configuration) { MergeManagerResult<T, T> mergeResult = new MergeManagerResult<>(); if (ObjectUtils.notEqual(previousObject, newObject)) { if (ObjectUtils.equals(previousObject, currentObject)) { mergeResult.setMergeResult(newObject); mergeResult.setModified(true); } else if (ObjectUtils.equals(newObject, currentObject)) { mergeResult.setMergeResult(currentObject); } else { mergeResult.setMergeResult(currentObject); mergeResult.getLog() .error("Failed to merge objects: previous=[{}] new=[{}] current=[{}]", previousObject, newObject, currentObject); } } else { mergeResult.setMergeResult(currentObject); } 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);  }