@Test public void detectConflict_shouldReturnFalseIfParentHashcodeNotExist() { SimpleObject currentObj = SimpleObjectMother.createInstance(INVALID_UUID, INVALID_HASHCODE_VALUE); SimpleObject newObj = SimpleObjectMother.createInstance(INVALID_UUID, INVALID_HASHCODE_VALUE); Assert.assertFalse(conflictDetection.detectConflict(currentObj, newObj)); }
@Override public boolean detectConflict(SimpleObject currentObject, SimpleObject newObject) { boolean conflictDetect = false; if (currentObject != null && newObject != null) { String currentHashCode = SyncHashcodeUtils.getHashcode(currentObject); String newHashCode = SyncHashcodeUtils.getHashcode(newObject); String objectUuid = currentObject.get(UUID_KEY); ParentObjectHashcode previousHashCode = parentObjectHashcodeService.getByObjectUuid(objectUuid); if (previousHashCode != null && (!previousHashCode.getHashcode().equalsIgnoreCase(newHashCode) || !previousHashCode.getHashcode().equalsIgnoreCase(currentHashCode))) { conflictDetect = true; } } return conflictDetect; }
ConflictDetectionImpl implements ConflictDetection { @Override public boolean detectConflict(SimpleObject currentObject, SimpleObject newObject) { boolean conflictDetect = false; if (currentObject != null && newObject != null) { String currentHashCode = SyncHashcodeUtils.getHashcode(currentObject); String newHashCode = SyncHashcodeUtils.getHashcode(newObject); String objectUuid = currentObject.get(UUID_KEY); ParentObjectHashcode previousHashCode = parentObjectHashcodeService.getByObjectUuid(objectUuid); if (previousHashCode != null && (!previousHashCode.getHashcode().equalsIgnoreCase(newHashCode) || !previousHashCode.getHashcode().equalsIgnoreCase(currentHashCode))) { conflictDetect = true; } } return conflictDetect; } }
ConflictDetectionImpl implements ConflictDetection { @Override public boolean detectConflict(SimpleObject currentObject, SimpleObject newObject) { boolean conflictDetect = false; if (currentObject != null && newObject != null) { String currentHashCode = SyncHashcodeUtils.getHashcode(currentObject); String newHashCode = SyncHashcodeUtils.getHashcode(newObject); String objectUuid = currentObject.get(UUID_KEY); ParentObjectHashcode previousHashCode = parentObjectHashcodeService.getByObjectUuid(objectUuid); if (previousHashCode != null && (!previousHashCode.getHashcode().equalsIgnoreCase(newHashCode) || !previousHashCode.getHashcode().equalsIgnoreCase(currentHashCode))) { conflictDetect = true; } } return conflictDetect; }  }
ConflictDetectionImpl implements ConflictDetection { @Override public boolean detectConflict(SimpleObject currentObject, SimpleObject newObject) { boolean conflictDetect = false; if (currentObject != null && newObject != null) { String currentHashCode = SyncHashcodeUtils.getHashcode(currentObject); String newHashCode = SyncHashcodeUtils.getHashcode(newObject); String objectUuid = currentObject.get(UUID_KEY); ParentObjectHashcode previousHashCode = parentObjectHashcodeService.getByObjectUuid(objectUuid); if (previousHashCode != null && (!previousHashCode.getHashcode().equalsIgnoreCase(newHashCode) || !previousHashCode.getHashcode().equalsIgnoreCase(currentHashCode))) { conflictDetect = true; } } return conflictDetect; }  @Override boolean detectConflict(SimpleObject currentObject, SimpleObject newObject); }
ConflictDetectionImpl implements ConflictDetection { @Override public boolean detectConflict(SimpleObject currentObject, SimpleObject newObject) { boolean conflictDetect = false; if (currentObject != null && newObject != null) { String currentHashCode = SyncHashcodeUtils.getHashcode(currentObject); String newHashCode = SyncHashcodeUtils.getHashcode(newObject); String objectUuid = currentObject.get(UUID_KEY); ParentObjectHashcode previousHashCode = parentObjectHashcodeService.getByObjectUuid(objectUuid); if (previousHashCode != null && (!previousHashCode.getHashcode().equalsIgnoreCase(newHashCode) || !previousHashCode.getHashcode().equalsIgnoreCase(currentHashCode))) { conflictDetect = true; } } return conflictDetect; }  @Override boolean detectConflict(SimpleObject currentObject, SimpleObject newObject);  }