Maor Lipchuk has uploaded a new change for review. Change subject: dal: Unregistered entities fixups in DAO and fixtures ......................................................................
dal: Unregistered entities fixups in DAO and fixtures 1. Add unregistered Template entity to fixtures file 2. Use FixturesTool with the new entities 3. Fix UnregisteredOVFDataDAOTest accordingly 4. Fix typos found in the UnregisteredOVFDataDAOTest Change-Id: I3b8663eec50968c0553c8fc6e841b3244ffd418b Related to Bug-Url: https://bugzilla.redhat.com/1138114 Signed-off-by: Maor Lipchuk <mlipc...@redhat.com> --- M backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/FixturesTool.java M backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/UnregisteredOVFDataDAOTest.java M backend/manager/modules/dal/src/test/resources/fixtures.xml 3 files changed, 31 insertions(+), 10 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/34/32934/1 diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/FixturesTool.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/FixturesTool.java index 981372d..3732bca 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/FixturesTool.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/FixturesTool.java @@ -264,6 +264,17 @@ public static final Guid VM_TEMPLATE_RHEL5_V2 = new Guid("1b85420c-b84c-4f29-997e-0eb674b40b83"); /** + * Predefined unregistered Template related to Storage Domain STORAGE_DOAMIN_NFS2_1 + * (d9ede37f-e6c3-4bf9-a984-19174070aa31) + */ + protected static final Guid UNREGISTERED_TEMPLATE = new Guid("1b85420c-b84c-4f29-997e-0eb674b40b94"); + + /** + * Predefined unregistered VM related to Storage Domain STORAGE_DOAMIN_NFS2_1 (d9ede37f-e6c3-4bf9-a984-19174070aa31) + */ + public static final Guid UNREGISTERED_VM = new Guid("77296e00-0cad-4e5a-9299-008a7b6f4359"); + + /** * Predefined vm job for testing with the following properties : * <ul> * <li>vm_id: VM_RHEL5_POOL_57 (77296e00-0cad-4e5a-9299-008a7b6f4355)</li> diff --git a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/UnregisteredOVFDataDAOTest.java b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/UnregisteredOVFDataDAOTest.java index 1535095..e892cc1 100644 --- a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/UnregisteredOVFDataDAOTest.java +++ b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/UnregisteredOVFDataDAOTest.java @@ -24,7 +24,7 @@ @Test public void testGetWithEntityId() { OvfEntityData ovfEntityData = - dao.getByEntityIdAndStorageDomain(FixturesTool.VM_RHEL5_POOL_50, FixturesTool.STORAGE_DOAMIN_NFS2_1); + dao.getByEntityIdAndStorageDomain(FixturesTool.UNREGISTERED_VM, FixturesTool.STORAGE_DOAMIN_NFS2_1); assertNotNull("VM should exists in the UnregisteredOVFData", ovfEntityData); } @@ -38,7 +38,7 @@ @Test public void testGetWithVMOnWrongStorageDomainId() { OvfEntityData ovfEntityData = - dao.getByEntityIdAndStorageDomain(FixturesTool.VM_RHEL5_POOL_50, FixturesTool.STORAGE_DOAMIN_NFS2_2); + dao.getByEntityIdAndStorageDomain(FixturesTool.UNREGISTERED_VM, FixturesTool.STORAGE_DOAMIN_NFS2_2); assertNull("VM should not exists in the UnregisteredOVFData for the specific Storage Domain", ovfEntityData); } @@ -50,14 +50,14 @@ } @Test - public void testGetTempaltesForStorageDomain() { + public void testGetTemplatesForStorageDomain() { List<OvfEntityData> ovfEntityDataList = dao.getAllForStorageDomainByEntityType(FixturesTool.STORAGE_DOAMIN_NFS2_1, VmEntityType.TEMPLATE); - assertTrue("A Tempalte should not be fetched for the specified storage domain", ovfEntityDataList.isEmpty()); + assertTrue("A Template should be fetched for the specified storage domain", !ovfEntityDataList.isEmpty()); } @Test - public void testGetEntitysForNotRelatedStorageDomain() { + public void testGetEntitiesForNotRelatedStorageDomain() { List<OvfEntityData> ovfEntityDataList = dao.getAllForStorageDomainByEntityType(FixturesTool.STORAGE_DOAMIN_NFS2_2, VmEntityType.VM); assertTrue("No VM should be fetched for the specified storage domain", ovfEntityDataList.isEmpty()); @@ -95,11 +95,11 @@ @Test public void testDeleteUnregisteredEntity() { OvfEntityData ovfEntityData = - dao.getByEntityIdAndStorageDomain(FixturesTool.VM_RHEL5_POOL_50, FixturesTool.STORAGE_DOAMIN_NFS2_1); + dao.getByEntityIdAndStorageDomain(FixturesTool.UNREGISTERED_VM, FixturesTool.STORAGE_DOAMIN_NFS2_1); assertNotNull(ovfEntityData); - dao.removeEntity(FixturesTool.VM_RHEL5_POOL_50, FixturesTool.STORAGE_DOAMIN_NFS2_1); + dao.removeEntity(FixturesTool.UNREGISTERED_VM, FixturesTool.STORAGE_DOAMIN_NFS2_1); ovfEntityData = - dao.getByEntityIdAndStorageDomain(FixturesTool.VM_RHEL5_POOL_50, FixturesTool.STORAGE_DOAMIN_NFS2_1); + dao.getByEntityIdAndStorageDomain(FixturesTool.UNREGISTERED_VM, FixturesTool.STORAGE_DOAMIN_NFS2_1); assertNull(ovfEntityData); } } diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml b/backend/manager/modules/dal/src/test/resources/fixtures.xml index d74f046..79b6e98 100644 --- a/backend/manager/modules/dal/src/test/resources/fixtures.xml +++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml @@ -4136,8 +4136,8 @@ <column>ovf_data</column> <column>ovf_extra_data</column> <row> - <value>77296e00-0cad-4e5a-9299-008a7b6f4354</value> - <value>rhel5-pool-50</value> + <value>77296e00-0cad-4e5a-9299-008a7b6f4359</value> + <value>UnregisteredVM</value> <value>VM</value> <value>1</value> <value>3.4</value> @@ -4145,6 +4145,16 @@ <value>null</value> <value>null</value> </row> + <row> + <value>1b85420c-b84c-4f29-997e-0eb674b40b94</value> + <value>UnregisteredTemplate</value> + <value>TEMPLATE</value> + <value>1</value> + <value>3.4</value> + <value>d9ede37f-e6c3-4bf9-a984-19174070aa31</value> + <value>null</value> + <value>null</value> + </row> </table> <table name="storage_pool_iso_map"> -- To view, visit http://gerrit.ovirt.org/32934 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3b8663eec50968c0553c8fc6e841b3244ffd418b Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Maor Lipchuk <mlipc...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches