Yair Zaslavsky has uploaded a new change for review.

Change subject: core: Fix compareTo for SRV records
......................................................................

core: Fix compareTo for SRV records

This suggested implemenation is more natural as it is based
on substraction of two values which is commonly used in comparisson

Change-Id: Iff93a85f529633934515015653c517500bf51c6b
Signed-off-by: Yair Zaslavsky <[email protected]>
---
M 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/dns/DnsSRVLocator.java
M 
backend/manager/tools/src/test/java/org/ovirt/engine/core/utils/dns/DnsSRVLocatorTest.java
2 files changed, 3 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/49/17049/1

diff --git 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/dns/DnsSRVLocator.java
 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/dns/DnsSRVLocator.java
index 03efd5e..3496085 100644
--- 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/dns/DnsSRVLocator.java
+++ 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/dns/DnsSRVLocator.java
@@ -141,13 +141,8 @@
             if (priority > other.priority) {
                 return 1;
             }
-            if (weight == 0 && other.weight != 0) {
-                return -1;
-            }
-            if (weight != 0) {
-                return 1;
-            }
-            return 0;
+
+            return weight - other.weight;
 
         }
 
diff --git 
a/backend/manager/tools/src/test/java/org/ovirt/engine/core/utils/dns/DnsSRVLocatorTest.java
 
b/backend/manager/tools/src/test/java/org/ovirt/engine/core/utils/dns/DnsSRVLocatorTest.java
index a3d05ac..d3281ce 100644
--- 
a/backend/manager/tools/src/test/java/org/ovirt/engine/core/utils/dns/DnsSRVLocatorTest.java
+++ 
b/backend/manager/tools/src/test/java/org/ovirt/engine/core/utils/dns/DnsSRVLocatorTest.java
@@ -40,7 +40,7 @@
 
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test
     public void testZeroPriorities() throws Exception {
         DnsSRVLocator locator = mockLocator("example.com",
                 "10 100 389 a.example.com."


-- 
To view, visit http://gerrit.ovirt.org/17049
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iff93a85f529633934515015653c517500bf51c6b
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yair Zaslavsky <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to