Mike Kolesnik has posted comments on this change.
Change subject: engine: Introduce VmNicDao
......................................................................
Patch Set 21: (7 inline comments)
....................................................
File
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/network/VmNicDaoDbFacadeImpl.java
Line 57: }
Line 58:
Line 59: @Override
Line 60: protected MapSqlParameterSource createFullParametersMapper(VmNic
entity) {
Line 61: MapSqlParameterSource parameterSource =
getCustomMapSqlParameterSource()
You could simply call createIdParameterMapper(id) and not map the id field here
explicitly
Line 62: .addValue("id", entity.getId())
Line 63: .addValue("mac_addr", entity.getMacAddress())
Line 64: .addValue("name", entity.getName())
Line 65: .addValue("speed", entity.getSpeed())
....................................................
File
backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/network/VmNicDaoTest.java
Line 14: import org.ovirt.engine.core.compat.Guid;
Line 15: import org.ovirt.engine.core.dao.BaseDAOTestCase;
Line 16: import org.ovirt.engine.core.dao.FixturesTool;
Line 17:
Line 18: public class VmNicDaoTest extends BaseDAOTestCase {
You could've extended BaseGenericDaoTestCase to save some trouble..
Line 19: private static final Guid TEMPLATE_ID = new
Guid("1b85420c-b84c-4f29-997e-0eb674b40b79");
Line 20: private static final Guid VM_ID = new
Guid("77296e00-0cad-4e5a-9299-008a7b6f4355");
Line 21:
Line 22: private VmNicDao dao;
Line 16: import org.ovirt.engine.core.dao.FixturesTool;
Line 17:
Line 18: public class VmNicDaoTest extends BaseDAOTestCase {
Line 19: private static final Guid TEMPLATE_ID = new
Guid("1b85420c-b84c-4f29-997e-0eb674b40b79");
Line 20: private static final Guid VM_ID = new
Guid("77296e00-0cad-4e5a-9299-008a7b6f4355");
Don't you have these values in the FixturesTool class?
Line 21:
Line 22: private VmNicDao dao;
Line 23:
Line 24: private VmNic existingVmNic;
Line 32: dao = dbFacade.getVmNicDao();
Line 33: existingVmNic = dao.get(FixturesTool.VM_NETWORK_INTERFACE);
Line 34: existingTemplateNic =
dao.get(FixturesTool.TEMPLATE_NETWORK_INTERFACE);
Line 35:
Line 36: newVmNic = new VmNetworkInterface();
Why not just a new VmNic instance?
Line 37: newVmNic.setId(Guid.newGuid());
Line 38:
newVmNic.setVnicProfileId(FixturesTool.VM_NETWORK_INTERFACE_PROFILE);
Line 39: newVmNic.setName("eth77");
Line 40: newVmNic.setLinked(true);
Line 183: assertEquals(FixturesTool.MAC_ADDRESS,
vmNetworkInterface.getMacAddress());
Line 184: }
Line 185: }
Line 186:
Line 187: private void assertCorrectResultForTemplate(List<VmNic> result) {
Not really sure why you extracted this to separate method since it's only used
in one test...
Line 188: assertNotNull(result);
Line 189: assertFalse(result.isEmpty());
Line 190: for (VmNic iface : result) {
Line 191: assertEquals(TEMPLATE_ID, iface.getVmTemplateId());
....................................................
File packaging/dbscripts/network_sp.sql
Line 501: END; $procedure$
Line 502: LANGUAGE plpgsql;
Line 503:
Line 504:
Line 505: Create or replace FUNCTION GetVmInterfaceByVmInterfaceId(v_id UUID)
RETURNS SETOF vm_interface
Can you please separate to it's own SP.sql file?
Line 506: AS $procedure$
Line 507: BEGIN
Line 508: RETURN QUERY SELECT *
Line 509: FROM vm_interface
Line 572: ----------------------------------------------------------------
Line 573: -- VM Interface View
Line 574: ----------------------------------------------------------------
Line 575:
Line 576: Create or replace FUNCTION GetAllFromvm_interface() RETURNS SETOF
vm_interface_view
Why is this duplicated?
I'm guessing by mistake?
Line 577: AS $procedure$
Line 578: BEGIN
Line 579: RETURN QUERY SELECT *
Line 580: FROM vm_interface_view;
--
To view, visit http://gerrit.ovirt.org/17178
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib3d1ff6dfc415915244367c153ffc064ddd0d0df
Gerrit-PatchSet: 21
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Moti Asayag <[email protected]>
Gerrit-Reviewer: Alona Kaplan <[email protected]>
Gerrit-Reviewer: Mike Kolesnik <[email protected]>
Gerrit-Reviewer: Moti Asayag <[email protected]>
Gerrit-Reviewer: Shubhendu Tripathi <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches