Change in ovirt-engine[master]: utils: enable UT for EngineLocalConfig

yzaslavs at redhat.com yzaslavs at redhat.com
Wed Jul 3 06:12:10 UTC 2013


Yair Zaslavsky has submitted this change and it was merged.

Change subject: utils: enable UT for EngineLocalConfig
......................................................................


utils: enable UT for EngineLocalConfig

EngineLocalConfig is singleton without initialization method, as such we
cannot mock it nor control who in the chain actually call it.

the solution taken is to allow overriding its instance using pre-defined
configuration, so that the default getInstance() method will return
already constructed instance.

to ease usage, a test watcher class was added.

Change-Id: Ie877a056e11a83badd5675cf24ffa48898b5786d
Signed-off-by: Alon Bar-Lev <alonbl at redhat.com>
---
M backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/EngineLocalConfig.java
M backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/LocalConfig.java
A backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/MockEngineLocalConfigRule.java
M backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/crypt/EngineEncryptionUtilsTest.java
M backend/manager/modules/utils/src/test/resources/localconfig.conf.ref
5 files changed, 120 insertions(+), 17 deletions(-)

Approvals:
  Yair Zaslavsky: Verified; Looks good to me, approved


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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie877a056e11a83badd5675cf24ffa48898b5786d
Gerrit-PatchSet: 4
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <alonbl at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Alon Bar-Lev <alonbl at redhat.com>
Gerrit-Reviewer: Laszlo Hornyak <lhornyak at redhat.com>
Gerrit-Reviewer: Roy Golan <rgolan at redhat.com>
Gerrit-Reviewer: Yair Zaslavsky <yzaslavs at redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server



More information about the Engine-commits mailing list