Ori Liel has uploaded a new change for review.

Change subject: core: Add Test for FenceValidator
......................................................................

core: Add Test for FenceValidator

Change-Id: I976322361dbc97b0d4588c302e8403e42d0e0bce
Signed-off-by: Ori Liel <ol...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/FenceValidator.java
1 file changed, 11 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/86/37286/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/FenceValidator.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/FenceValidator.java
index de38247..e2858d3 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/FenceValidator.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/FenceValidator.java
@@ -5,6 +5,7 @@
 
 import org.ovirt.engine.core.bll.Backend;
 import org.ovirt.engine.core.bll.FenceProxyLocator;
+import org.ovirt.engine.core.bll.interfaces.BackendInternal;
 import org.ovirt.engine.core.common.businessentities.FenceAgent;
 import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.businessentities.VDSGroup;
@@ -17,7 +18,7 @@
 public class FenceValidator {
 
     public boolean isProxyHostAvailable(VDS vds, List<String> messages) {
-        FenceProxyLocator proxyHostLocator = new FenceProxyLocator(vds);
+        FenceProxyLocator proxyHostLocator = getProxyLocator(vds);
         if (!proxyHostLocator.isProxyHostAvailable()) {
             messages.add(VdcBllMessages.VDS_NO_VDS_PROXY_FOUND.name());
             return false;
@@ -30,8 +31,7 @@
         // check if we are in the interval of X seconds from startup
         // if yes , system is still initializing , ignore fence operations
         Date waitTo =
-                Backend.getInstance()
-                        .getStartedAt()
+                getBackend().getStartedAt()
                         .addSeconds((Integer) 
Config.getValue(ConfigValues.DisableFenceAtStartupInSec));
         Date now = new Date();
         if (!(waitTo.before(now) || waitTo.equals(now))) {
@@ -93,4 +93,12 @@
         }
     }
 
+    protected FenceProxyLocator getProxyLocator(VDS vds) {
+        return new FenceProxyLocator(vds);
+    }
+
+    protected BackendInternal getBackend() {
+        return Backend.getInstance();
+    }
+
 }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I976322361dbc97b0d4588c302e8403e42d0e0bce
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Ori Liel <ol...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to