Kanagaraj M has posted comments on this change. Change subject: engine: adding vds_gluster table and dao operations ......................................................................
Patch Set 5: (13 inline comments) new patch set to follow. .................................................... File backend/manager/dbscripts/upgrade/03_03_0060_add_vds_gluster_table.sql Line 1: Create or replace FUNCTION fn_add_vds_gluster_table() Line 2: RETURNS void Line 3: AS $function$ Line 4: BEGIN Line 5: CREATE TABLE vds_gluster Done Line 6: ( Line 7: vds_id UUID NOT NULL references vds_static(vds_id) ON DELETE CASCADE, Line 8: gluster_host_uuid UUID NOT NULL, Line 9: CONSTRAINT pk_vds_gluster PRIMARY KEY(vds_id) Line 7: vds_id UUID NOT NULL references vds_static(vds_id) ON DELETE CASCADE, Line 8: gluster_host_uuid UUID NOT NULL, Line 9: CONSTRAINT pk_vds_gluster PRIMARY KEY(vds_id) Line 10: ) WITH OIDS; Line 11: CREATE INDEX IDX_vds_gluster_vds_id ON vds_gluster(vds_id); Done Line 12: CREATE UNIQUE INDEX IDX_vds_gluster_unique ON vds_gluster(vds_id, gluster_host_uuid); Line 13: END; $function$ Line 14: LANGUAGE plpgsql; Line 15: .................................................... File backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/VdsGluster.java Line 7: public class VdsGluster implements BusinessEntity<Guid> { Line 8: Line 9: private static final long serialVersionUID = -1425566208615075937L; Line 10: Line 11: private Guid id; changed to serverId. Line 12: Line 13: private Guid glusterHostUuid; Line 14: Line 15: @Override Line 46: } Line 47: Line 48: VdsGluster entity = (VdsGluster) obj; Line 49: Line 50: if (!(ObjectUtils.objectsEqual(getId(), entity.getId()) Done Line 51: && ObjectUtils.objectsEqual(glusterHostUuid, entity.getGlusterHostUuid()))) { Line 52: return false; Line 53: } Line 54: return true; .................................................... File backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/VdsGlusterDaoDbFacadeImpl.java Line 18: setProcedureNameForGet("GetVdsGlusterByVdsId"); Line 19: } Line 20: Line 21: @Override Line 22: public void save(VdsGluster vdsGluster) { Done Line 23: getCallsHandler().executeModification("InsertVdsGluster", createFullParametersMapper(vdsGluster)); Line 24: } Line 25: Line 26: @Override Line 36: } Line 37: Line 38: @Override Line 39: public void update(Guid vdsId, Guid glusterHostUuid) { Line 40: getCallsHandler().executeModification("UpdateVdsGluster", Done Line 41: getCustomMapSqlParameterSource() Line 42: .addValue("vds_id", vdsId) Line 43: .addValue("gluster_host_uuid", glusterHostUuid)); Line 44: } Line 45: Line 46: @Override Line 47: public void remove(Guid id) { Line 48: getCallsHandler().executeModification("DeleteVdsGlusterByVdsId", Line 49: createIdParameterMapper(id)); Done Line 50: } Line 51: Line 52: @Override Line 53: public void removeByGlusterHostUuid(Guid glusterHostUuid) { .................................................... File backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/VdsGlusterDao.java Line 8: public interface VdsGlusterDao extends DAO, MassOperationsDao<VdsGluster, Guid> { Line 9: Line 10: public void save(VdsGluster vdsGluster); Line 11: Line 12: public VdsGluster getById(Guid id); changed to getByServerId(Guid serverId) to be inline with the table column. Line 13: Line 14: public VdsGluster getByGlusterHostUuid(Guid glusterHostUuid); Line 15: Line 16: public void remove(Guid id); Line 12: public VdsGluster getById(Guid id); Line 13: Line 14: public VdsGluster getByGlusterHostUuid(Guid glusterHostUuid); Line 15: Line 16: public void remove(Guid id); changed to removeByServerId(Guid serverId) to be inline with the table column. Line 17: Line 18: public void removeByGlusterHostUuid(Guid glusterHostUuid); Line 19: Line 20: public void update(Guid vdsId, Guid glusterHostUuid); .................................................... File backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/gluster/VdsGlusterDaoTest.java Line 32: newEntity.setGlusterHostUuid(FixturesTool.GLUSTER_HOST_UUID2); Line 33: Line 34: dao.save(newEntity); Line 35: VdsGluster entity = dao.getById(newEntity.getId()); Line 36: assertTrue(newEntity.equals(entity)); Done Line 37: } Line 38: Line 39: @Test Line 40: public void testGetById() { Line 39: @Test Line 40: public void testGetById() { Line 41: VdsGluster entity = dao.getById(SERVER_ID1); Line 42: assertNotNull(entity); Line 43: assertEquals(SERVER_ID1, entity.getId()); Done Line 44: } Line 45: Line 46: @Test Line 47: public void testGetByGlusterHostUuid() { Line 46: @Test Line 47: public void testGetByGlusterHostUuid() { Line 48: VdsGluster entity = dao.getByGlusterHostUuid(FixturesTool.GLUSTER_HOST_UUID1); Line 49: assertNotNull(entity); Line 50: assertEquals(entity.getGlusterHostUuid(), FixturesTool.GLUSTER_HOST_UUID1); Done Line 51: } Line 52: Line 53: @Test Line 54: public void testRemove() { Line 68: public void testUpdateGlusterHostUuid() { Line 69: dao.update(SERVER_ID1, FixturesTool.GLUSTER_HOST_UUID_NEW); Line 70: VdsGluster entity = dao.getById(SERVER_ID1); Line 71: assertNotNull(entity); Line 72: assertEquals(entity.getGlusterHostUuid(), FixturesTool.GLUSTER_HOST_UUID_NEW); Done Line 73: } -- To view, visit http://gerrit.ovirt.org/14063 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I04ba0a7bf1eaa964db731cdfa24ab6875e0b1513 Gerrit-PatchSet: 5 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Kanagaraj M <kmayi...@redhat.com> Gerrit-Reviewer: Eli Mesika <emes...@redhat.com> Gerrit-Reviewer: Kanagaraj M <kmayi...@redhat.com> Gerrit-Reviewer: Sahina Bose <sab...@redhat.com> Gerrit-Reviewer: Shireesh Anjal <san...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches