Yair Zaslavsky has uploaded a new change for review.

Change subject: core: refactor DnsSrvLocator to allow mocking
......................................................................

core: refactor DnsSrvLocator to allow mocking

This patch refactors DnsSrvLocator in order to allow
a mocking in a way that a list of SRV records can be
passed to the mock.

Change-Id: Ic1f04c62ff4206aed0ef5b40ff14163be7b145f3
Signed-off-by: Yair Zaslavsky <[email protected]>
---
M 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/dns/DnsSRVLocator.java
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/47/17047/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 3ccccf3..03efd5e 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
@@ -148,6 +148,7 @@
                 return 1;
             }
             return 0;
+
         }
 
         @Override
@@ -235,7 +236,7 @@
         }
     }
 
-    private DnsSRVResult getService(String domainName, String dnsUrl) throws 
NamingException {
+    protected String[] getSrvRecords(String dnsUrl) throws NamingException {
         Context ctx = NamingManager.getURLContext("dns", new Hashtable(0));
 
         if (!(ctx instanceof DirContext)) {
@@ -260,7 +261,11 @@
         for (int counter = 0; counter < numOfRecords; counter++) {
             records[counter] = (String) attr.get(counter);
         }
+        return records;
+    }
 
+    private DnsSRVResult getService(String domainName, String dnsUrl) throws 
NamingException {
+        String[] records = getSrvRecords(dnsUrl);
         return getSRVResult(domainName, records);
     }
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic1f04c62ff4206aed0ef5b40ff14163be7b145f3
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