Tal Nisan has uploaded a new change for review. Change subject: core: Remove methods concerning pool types from storage dao ......................................................................
core: Remove methods concerning pool types from storage dao As a part of the effort to remove the type of storage pool the unused methods concerning pool types were removed in StorageDomainStaticDao and their tests Relates-To: https://bugzilla.redhat.com/1038053 Change-Id: Iab29347dd82ea47bf6e0d1d5542db9d6d52c0b08 Signed-off-by: Tal Nisan <[email protected]> --- M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StorageDomainStaticDAO.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StorageDomainStaticDAODbFacadeImpl.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StoragePoolDAO.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StoragePoolDAODbFacadeImpl.java M backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StorageDomainStaticDAOTest.java M backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StoragePoolDAOTest.java M packaging/dbscripts/storages_sp.sql 7 files changed, 0 insertions(+), 164 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/85/23585/1 diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StorageDomainStaticDAO.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StorageDomainStaticDAO.java index 116389b..3e39135 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StorageDomainStaticDAO.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StorageDomainStaticDAO.java @@ -3,7 +3,6 @@ import java.util.List; import org.ovirt.engine.core.common.businessentities.StorageDomainStatus; -import org.ovirt.engine.core.common.businessentities.StorageType; import org.ovirt.engine.core.common.businessentities.StorageDomainStatic; import org.ovirt.engine.core.compat.Guid; @@ -19,18 +18,6 @@ StorageDomainStatic getByName(String name); /** - * Retrieves all domains of the specified type for the specified pool. - * - * @param type - * the domain type - * @param pool - * the storage pool - * @return the list of domains - */ - List<StorageDomainStatic> getAllForStoragePoolOfStorageType( - StorageType type, Guid pool); - - /** * Retrieves all storage domains for the given storage pool. * * @param pool @@ -38,15 +25,6 @@ * @return the list of domains */ List<StorageDomainStatic> getAllForStoragePool(Guid pool); - - /** - * Retrieves all domains for the given type. - * - * @param type - * the domain type - * @return the list of domains - */ - List<StorageDomainStatic> getAllOfStorageType(StorageType type); /** * Return all the domains of the given status which belong to the given pool. diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StorageDomainStaticDAODbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StorageDomainStaticDAODbFacadeImpl.java index 7fc8064..2cc19af 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StorageDomainStaticDAODbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StorageDomainStaticDAODbFacadeImpl.java @@ -30,24 +30,6 @@ } @Override - public List<StorageDomainStatic> getAllOfStorageType( - StorageType type) { - return getCallsHandler().executeReadList("Getstorage_domain_staticBystorage_pool_type", - StorageDomainStaticRowMapper.instance, - getCustomMapSqlParameterSource() - .addValue("storage_pool_type", type)); - } - - @Override - public List<StorageDomainStatic> getAllForStoragePoolOfStorageType( - StorageType type, Guid pool) { - return getCallsHandler().executeReadList("Getstorage_domain_staticBystorage_type_and_storage_pool_id", - StorageDomainStaticRowMapper.instance, - getStoragePoolIdParameterSource(pool) - .addValue("storage_type", type)); - } - - @Override public List<StorageDomainStatic> getAllForStoragePool(Guid id) { return getCallsHandler().executeReadList("Getstorage_domain_staticBystorage_pool_id", StorageDomainStaticRowMapper.instance, diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StoragePoolDAO.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StoragePoolDAO.java index 0f7c92f..9afeb49 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StoragePoolDAO.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StoragePoolDAO.java @@ -4,7 +4,6 @@ import org.ovirt.engine.core.common.businessentities.ActionGroup; import org.ovirt.engine.core.common.businessentities.StoragePoolStatus; -import org.ovirt.engine.core.common.businessentities.StorageType; import org.ovirt.engine.core.common.businessentities.StoragePool; import org.ovirt.engine.core.compat.Guid; @@ -89,15 +88,6 @@ * @return The list of storage pools with the given status */ List<StoragePool> getAllByStatus(StoragePoolStatus status); - - /** - * Retrieves the list of all storage pools of a given type. - * - * @param type - * the storage pool type - * @return the list of storage pool - */ - List<StoragePool> getAllOfType(StorageType type); /** * Retrieves all storage pools for the given storage domain. diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StoragePoolDAODbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StoragePoolDAODbFacadeImpl.java index 281506e..d567acd 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StoragePoolDAODbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StoragePoolDAODbFacadeImpl.java @@ -115,13 +115,6 @@ } @Override - public List<StoragePool> getAllOfType(StorageType type) { - MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource() - .addValue("storage_pool_type", type); - return getCallsHandler().executeReadList("Getstorage_poolsByType", mapper, parameterSource); - } - - @Override public List<StoragePool> getAllForStorageDomain(Guid id) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource() .addValue("storage_domain_id", id); diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StorageDomainStaticDAOTest.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StorageDomainStaticDAOTest.java index b6add69..58d370d 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StorageDomainStaticDAOTest.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StorageDomainStaticDAOTest.java @@ -13,7 +13,6 @@ import org.junit.Test; import org.ovirt.engine.core.common.businessentities.DiskImage; import org.ovirt.engine.core.common.businessentities.StorageDomainStatus; -import org.ovirt.engine.core.common.businessentities.StorageType; import org.ovirt.engine.core.common.businessentities.StorageDomainStatic; import org.ovirt.engine.core.compat.Guid; @@ -117,46 +116,6 @@ assertNotNull(result); assertFalse(result.isEmpty()); - } - - /** - * Ensures the right set is returned. - */ - @Test - public void testGetAllForStoragePoolOfStorageType() { - List<StorageDomainStatic> result = dao.getAllForStoragePoolOfStorageType(StorageType.ISCSI, EXISTING_POOL_ID); - - assertNotNull(result); - assertFalse(result.isEmpty()); - for (StorageDomainStatic domain : result) { - assertEquals(StorageType.ISCSI, domain.getStorageType()); - } - } - - /** - * Ensures that an empty collection is returned when no static domains of the specified type exist. - */ - @Test - public void testGetAllOfStorageTypeWithInvalidType() { - List<StorageDomainStatic> result = dao.getAllOfStorageType(StorageType.FCP); - - assertNotNull(result); - assertTrue(result.isEmpty()); - } - - /** - * Ensures the right collection of domains is returned. - */ - @Test - public void testGetAllOfStorageType() { - List<StorageDomainStatic> result = dao - .getAllOfStorageType(StorageType.ISCSI); - - assertNotNull(result); - assertFalse(result.isEmpty()); - for (StorageDomainStatic domain : result) { - assertEquals(StorageType.ISCSI, domain.getStorageType()); - } } @Test diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StoragePoolDAOTest.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StoragePoolDAOTest.java index e4d713e..6d4f43c 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StoragePoolDAOTest.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StoragePoolDAOTest.java @@ -12,7 +12,6 @@ import org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum; import org.ovirt.engine.core.common.businessentities.StorageFormatType; import org.ovirt.engine.core.common.businessentities.StoragePoolStatus; -import org.ovirt.engine.core.common.businessentities.StorageType; import org.ovirt.engine.core.common.businessentities.StoragePool; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.compat.Version; @@ -199,31 +198,6 @@ assertNotNull(result); assertFalse(result.isEmpty()); - } - - /** - * Ensures that an empty collection is returned for a type that's not in the database. - */ - @Test - public void testGetAllOfTypeForUnrepresentedType() { - List<StoragePool> result = dao.getAllOfType(StorageType.UNKNOWN); - - assertNotNull(result); - assertTrue(result.isEmpty()); - } - - /** - * Ensures that only pools of the given type are returned. - */ - @Test - public void testGetAllOfType() { - List<StoragePool> result = dao.getAllOfType(StorageType.ISCSI); - - assertNotNull(result); - assertFalse(result.isEmpty()); - for (StoragePool pool : result) { - assertEquals(StorageType.ISCSI, pool.getStorageType()); - } } /** diff --git a/packaging/dbscripts/storages_sp.sql b/packaging/dbscripts/storages_sp.sql index 303f8e7..69386dd 100644 --- a/packaging/dbscripts/storages_sp.sql +++ b/packaging/dbscripts/storages_sp.sql @@ -196,20 +196,6 @@ -Create or replace FUNCTION Getstorage_poolsByType(v_storage_pool_type INTEGER) -RETURNS SETOF storage_pool STABLE - AS $procedure$ -BEGIN - RETURN QUERY SELECT * - FROM storage_pool - WHERE storage_pool_type = v_storage_pool_type; -END; $procedure$ -LANGUAGE plpgsql; - - - - - Create or replace FUNCTION Getstorage_poolsByStorageDomainId(v_storage_domain_id UUID) RETURNS SETOF storage_pool STABLE AS $procedure$ @@ -526,32 +512,6 @@ WHERE user_id = v_user_id AND entity_id = id)); END; $procedure$ LANGUAGE plpgsql; - - -Create or replace FUNCTION Getstorage_domain_staticBystorage_pool_type(v_storage_pool_type INTEGER) -RETURNS SETOF storage_domain_static STABLE - AS $procedure$ -BEGIN - RETURN QUERY SELECT * - FROM storage_domain_static - WHERE storage_type = v_storage_pool_type; - -END; $procedure$ -LANGUAGE plpgsql; - - - - -Create or replace FUNCTION Getstorage_domain_staticBystorage_type_and_storage_pool_id(v_storage_type INTEGER, v_storage_pool_id UUID) RETURNS SETOF storage_domains STABLE - AS $procedure$ -BEGIN - RETURN QUERY SELECT * - FROM storage_domains - WHERE storage_pool_id = v_storage_pool_id and storage_type = v_storage_type; - -END; $procedure$ -LANGUAGE plpgsql; - -- To view, visit http://gerrit.ovirt.org/23585 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iab29347dd82ea47bf6e0d1d5542db9d6d52c0b08 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.4 Gerrit-Owner: Tal Nisan <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
