Martin Mucha has posted comments on this change.

Change subject: core: MacPool related Commands
......................................................................


Patch Set 27:

(1 comment)

http://gerrit.ovirt.org/#/c/28705/27/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/MacPoolValidatorTest.java
File 
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/MacPoolValidatorTest.java:

Line 25:     @Before
Line 26:     public void setUp() throws Exception {
Line 27:         macPool = new MacPool();
Line 28: 
Line 29:         final DbFacade dbFacadeMock = mock(DbFacade.class);
> Since DAO mocking seems to be returning in your tests, you can extract this
This would work, BUT this is kinda retro-futurism solution (agelong things 
driven by modern technologies; like levitating locomotive)

proper way is to use DI. I don't want to make using DbFacade any easier, since 
that way I'm prolonging it's life. If I write that rule (which could be fun), 
people would use it, but I don't want anyone using this.

rgolan introduced CDI to BLL. If one can contact him and he'd reply, we can 
easily (I think) move his Injector to broader context, add cdi dependency to 
dal module and let container manage DAOs. That's the proper way we should 
invest in. (If your car has oil leakage, you shouldn't invent super-clever 
system, which catch the oil and return it back to engine through world famous 
oil slide.)
Line 30:         DbFacadeLocator.setDbFacade(dbFacadeMock);
Line 31:         macPoolDaoMock = mock(MacPoolDao.class);
Line 32: 
Line 33:         when(dbFacadeMock.getMacPoolDao()).thenReturn(macPoolDaoMock);


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I9c0c3657e3e53699bcafa375befdce848b01a2f3
Gerrit-PatchSet: 27
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Martin Mucha <mmu...@redhat.com>
Gerrit-Reviewer: Lior Vernia <lver...@redhat.com>
Gerrit-Reviewer: Martin Mucha <mmu...@redhat.com>
Gerrit-Reviewer: Mike Kolesnik <mkole...@redhat.com>
Gerrit-Reviewer: Moti Asayag <masa...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to