Allon Mureinik has uploaded a new change for review. Change subject: core: Remove DiskImage ctor only used in tests ......................................................................
core: Remove DiskImage ctor only used in tests Removed the ctor that isn't used anywhere in production code. This in fact also makes the tests easier to understand, as now the test DiskImages instances only have the relevant field values and not all the values demanded by this useless constructor. Change-Id: Id7a4e16f2fd993ac2b6018cf0569830c0feeff1a Signed-off-by: Allon Mureinik <[email protected]> --- M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/GetAllDisksByVmIdQueryTest.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/DiskImage.java 2 files changed, 14 insertions(+), 71 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/26/18126/1 diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/GetAllDisksByVmIdQueryTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/GetAllDisksByVmIdQueryTest.java index 3fa8507..f182b5a 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/GetAllDisksByVmIdQueryTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/GetAllDisksByVmIdQueryTest.java @@ -8,7 +8,6 @@ import java.util.ArrayList; import java.util.Collections; -import java.util.Date; import java.util.List; import org.junit.Before; @@ -16,18 +15,15 @@ import org.ovirt.engine.core.common.businessentities.Disk; import org.ovirt.engine.core.common.businessentities.DiskImage; import org.ovirt.engine.core.common.businessentities.ImageStatus; -import org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum; import org.ovirt.engine.core.common.businessentities.VmDevice; import org.ovirt.engine.core.common.businessentities.VmDeviceGeneralType; import org.ovirt.engine.core.common.businessentities.VmDeviceId; -import org.ovirt.engine.core.common.businessentities.VmEntityType; import org.ovirt.engine.core.common.queries.IdQueryParameters; import org.ovirt.engine.core.common.utils.VmDeviceType; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.dal.dbbroker.DbFacade; import org.ovirt.engine.core.dao.DiskDao; import org.ovirt.engine.core.dao.VmDeviceDAO; -import org.ovirt.engine.core.utils.RandomUtils; /** * A test case for {@link GetAllDisksByVmIdQuery}. @@ -108,37 +104,23 @@ } private DiskImage createDiskImage() { - return new DiskImage( - true, - new Date(), - new Date(), - 1L, - "1", - Guid.newGuid(), - "2", - Guid.newGuid(), - 1L, - Guid.newGuid(), - ImageStatus.OK, - new Date(), - "", VmEntityType.VM, 1, null, null, QuotaEnforcementTypeEnum.DISABLED, false); + DiskImage di = new DiskImage(); + di.setActive(true); + di.setId(Guid.newGuid()); + di.setImageId(Guid.newGuid()); + di.setParentId(Guid.newGuid()); + di.setImageStatus(ImageStatus.OK); + return di; } private DiskImage createDiskSnapshot(Guid diskId) { - return new DiskImage( - RandomUtils.instance().nextBoolean(), - new Date(), - new Date(), - 1L, - "1", - Guid.newGuid(), - "2", - Guid.newGuid(), - 1L, - diskId, - ImageStatus.OK, - new Date(), - "", VmEntityType.VM, 1, null, null, QuotaEnforcementTypeEnum.DISABLED, false); + DiskImage di = new DiskImage(); + di.setActive(false); + di.setId(diskId); + di.setImageId(Guid.newGuid()); + di.setParentId(Guid.newGuid()); + di.setImageStatus(ImageStatus.OK); + return di; } @Test diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/DiskImage.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/DiskImage.java index 5aad0a5..7fd450c 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/DiskImage.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/DiskImage.java @@ -52,45 +52,6 @@ setIsQuotaDefault(diskImageBase.isQuotaDefault()); } - public DiskImage(Boolean active, - Date creation_date, - Date last_modified_date, - long actual_size, - String description, - Guid image_guid, - String internal_drive_mapping, - Guid it_guid, - long size, - Guid parentId, - ImageStatus imageStatus, - Date lastModified, - String appList, - VmEntityType vmEntityType, - int numberOfVms, - Guid quotaId, - String quotaName, - QuotaEnforcementTypeEnum quotaEnforcementType, - boolean isQuotaDefault) { - setActive(active); - setCreationDate(creation_date); - setLastModifiedDate(last_modified_date); - actualSizeInBytes = actual_size; - setDescription(description); - setImageId(image_guid); - setImageTemplateId(it_guid); - setSize(size); - setParentId(parentId); - setImageStatus(imageStatus); - setLastModified(lastModified); - setAppList(appList); - setVmEntityType(vmEntityType); - setNumberOfVms(numberOfVms); - setQuotaId(quotaId); - setQuotaName(quotaName); - setQuotaEnforcementType(quotaEnforcementType); - setIsQuotaDefault(isQuotaDefault); - } - public Guid getImageId() { return getImage().getId(); } -- To view, visit http://gerrit.ovirt.org/18126 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id7a4e16f2fd993ac2b6018cf0569830c0feeff1a Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Allon Mureinik <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
