Change in ovirt-engine[master]: userportal, webadmin: WelcomeServletTest improvement

masayag at redhat.com masayag at redhat.com
Tue Jul 30 07:06:48 UTC 2013


Moti Asayag has submitted this change and it was merged.

Change subject: userportal,webadmin: WelcomeServletTest improvement
......................................................................


userportal,webadmin: WelcomeServletTest improvement

This patch applies common pattern for testing servlet classes:

    public class MyServlet extends HttpServlet {

        ...

        private ServletDependency dep;

        @Override
        // Called by servlet container at runtime
        public void init() {
            init(new ServletDependencyImpl());
        }

        // Package-private visibility, method used by MyServletTest
        void init(ServletDependency dep) {
            this.dep = dep;
        }

        ...

    }

In this patch, WelcomeServletTest uses BrandingManager mock instead
of real BrandingManager implementation to ensure WelcomeServlet is
tested properly in isolation, i.e. using mocked dependencies.

Change-Id: I2d654ce7ca57f8bd8962ab668a0c13e1e09d80f3
Signed-off-by: Vojtech Szocs <vszocs at redhat.com>
---
M backend/manager/modules/root/src/main/java/org/ovirt/engine/core/WelcomeServlet.java
M backend/manager/modules/root/src/test/java/org/ovirt/engine/core/WelcomeServletTest.java
2 files changed, 21 insertions(+), 2 deletions(-)

Approvals:
  Moti Asayag: Verified; Looks good to me, approved


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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2d654ce7ca57f8bd8962ab668a0c13e1e09d80f3
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Vojtech Szocs <vszocs at redhat.com>
Gerrit-Reviewer: Alexander Wels <awels at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Daniel Erez <derez at redhat.com>
Gerrit-Reviewer: Einav Cohen <ecohen at redhat.com>
Gerrit-Reviewer: Gilad Chaplik <gchaplik at redhat.com>
Gerrit-Reviewer: Moti Asayag <masayag at redhat.com>
Gerrit-Reviewer: Tomas Jelinek <tjelinek at redhat.com>
Gerrit-Reviewer: Vojtech Szocs <vszocs at redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server



More information about the Engine-commits mailing list