Allon Mureinik has uploaded a new change for review. Change subject: core: Remove VdsDynamic ctor only used in tests ......................................................................
core: Remove VdsDynamic ctor only used in tests Removed the ctor that isn't used anywhere in production code. Change-Id: I22f4244e5c6cedcf2f36be7d10d078254b0a4bb3 Signed-off-by: Allon Mureinik <amure...@redhat.com> --- M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java M backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/serialization/json/JsonObjectSerializationEntitiesTest.java 2 files changed, 38 insertions(+), 75 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/12/18112/1 diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java index bbf9d84..96a405d 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VdsDynamic.java @@ -162,48 +162,6 @@ guest_overhead = 0; } - public VdsDynamic(Integer cpu_cores, Integer cpuThreads, String cpu_model, Double cpu_speed_mh, String if_total_speed, - Boolean kvm_enabled, Integer mem_commited, Integer physical_mem_mb, int status, Guid vds_id, - Integer vm_active, int vm_count, Integer vm_migrating, Integer reserved_mem, Integer guest_overhead, - VDSStatus previous_status, String software_version, String version_name, String build_name, - Date cpu_over_commit_time_stamp, Integer pending_vcpus_count, - Integer pending_vmem_sizeField, Boolean net_config_dirty, String hwManufacturer, - String hwProductName, String hwVersion, String hwSerialNumber, - String hwUUID, String hwFamily, Map<String, List<Map<String, String>>> HBAs) { - libvirt_version = new RpmVersion(); - rpmVersion = new RpmVersion(); - this.cpu_cores = cpu_cores; - this.cpuThreads = cpuThreads; - this.cpu_model = cpu_model; - this.cpu_speed_mh = BigDecimal.valueOf(cpu_speed_mh); - this.if_total_speed = if_total_speed; - this.kvm_enabled = kvm_enabled; - this.mem_commited = mem_commited; - this.physical_mem_mb = physical_mem_mb; - this.status = VDSStatus.forValue(status); - this.id = vds_id; - this.vm_active = vm_active; - this.vm_count = vm_count; - this.vm_migrating = vm_migrating; - this.reserved_mem = reserved_mem; - this.guest_overhead = guest_overhead; - this.previous_status = previous_status; - this.setsoftware_version(software_version); - this.setversion_name(version_name); - this.setcpu_over_commit_time_stamp(cpu_over_commit_time_stamp); - this.pending_vcpus_count = pending_vcpus_count; - this.pending_vmem_size = pending_vmem_sizeField; - this.net_config_dirty = net_config_dirty; - this.transparentHugePagesState = VdsTransparentHugePagesState.Never; - this.hwUUID = hwUUID; - this.hwFamily = hwFamily; - this.hwSerialNumber = hwSerialNumber; - this.hwVersion = hwVersion; - this.hwProductName = hwProductName; - this.hwManufacturer = hwManufacturer; - this.HBAs = HBAs; - } - public Integer getcpu_cores() { return this.cpu_cores; } diff --git a/backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/serialization/json/JsonObjectSerializationEntitiesTest.java b/backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/serialization/json/JsonObjectSerializationEntitiesTest.java index d741bd5..7494dec 100644 --- a/backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/serialization/json/JsonObjectSerializationEntitiesTest.java +++ b/backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/serialization/json/JsonObjectSerializationEntitiesTest.java @@ -7,9 +7,6 @@ import java.util.Arrays; import java.util.Collection; import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; import org.junit.Test; import org.junit.runner.RunWith; @@ -30,6 +27,7 @@ import org.ovirt.engine.core.common.businessentities.VdsDynamic; import org.ovirt.engine.core.common.businessentities.VdsStatic; import org.ovirt.engine.core.common.businessentities.VdsStatistics; +import org.ovirt.engine.core.common.businessentities.VdsTransparentHugePagesState; import org.ovirt.engine.core.common.businessentities.vds_spm_id_map; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.utils.RandomUtils; @@ -63,36 +61,7 @@ Object[][] data = new Object[][] { { vdsStatic }, - { new VdsDynamic(random.nextInt(), - random.nextInt(), - random.nextString(10), - random.nextDouble(), - random.nextString(10), - random.nextBoolean(), - random.nextInt(), - random.nextInt(), - random.nextInt(), - Guid.newGuid(), - random.nextInt(), - random.nextInt(), - random.nextInt(), - random.nextInt(), - random.nextInt(), - random.nextEnum(VDSStatus.class), - random.nextNumericString(5) + "." + random.nextNumericString(5), - random.nextString(10), - random.nextString(10), - new Date(random.nextLong()), - random.nextInt(), - random.nextInt(), - random.nextBoolean(), - random.nextString(10), - random.nextString(10), - random.nextString(10), - random.nextString(10), - random.nextString(10), - random.nextString(10), - new HashMap<String, List<Map<String,String>>>()) }, + { randomVdsDynamic() }, { new VdsStatistics(random.nextDouble(), random.nextDouble(), random.nextDouble(), @@ -135,6 +104,42 @@ return sp; } + private static VdsDynamic randomVdsDynamic() { + RandomUtils random = RandomUtils.instance(); + VdsDynamic vdsDynamic = new VdsDynamic(); + vdsDynamic.setcpu_cores(random.nextInt()); + vdsDynamic.setCpuThreads(random.nextInt()); + vdsDynamic.setcpu_model(random.nextString(10)); + vdsDynamic.setcpu_speed_mh(random.nextDouble()); + vdsDynamic.setif_total_speed(random.nextString(10)); + vdsDynamic.setkvm_enabled(random.nextBoolean()); + vdsDynamic.setmem_commited(random.nextInt()); + vdsDynamic.setphysical_mem_mb(random.nextInt()); + vdsDynamic.setstatus(random.nextEnum(VDSStatus.class)); + vdsDynamic.setId(Guid.newGuid()); + vdsDynamic.setvm_active(random.nextInt()); + vdsDynamic.setvm_count(random.nextInt()); + vdsDynamic.setvm_migrating(random.nextInt()); + vdsDynamic.setreserved_mem(random.nextInt()); + vdsDynamic.setguest_overhead(random.nextInt()); + vdsDynamic.setprevious_status(random.nextEnum(VDSStatus.class)); + vdsDynamic.setsoftware_version(random.nextNumericString(5) + '.' + random.nextNumericString(5)); + vdsDynamic.setversion_name(random.nextString(10)); + vdsDynamic.setcpu_over_commit_time_stamp(new Date(random.nextLong())); + vdsDynamic.setpending_vcpus_count(random.nextInt()); + vdsDynamic.setpending_vmem_size(random.nextInt()); + vdsDynamic.setnet_config_dirty(random.nextBoolean()); + vdsDynamic.setTransparentHugePagesState(random.nextEnum(VdsTransparentHugePagesState.class)); + vdsDynamic.setHardwareUUID(Guid.newGuid().toString()); + vdsDynamic.setHardwareFamily(random.nextString(10)); + vdsDynamic.setHardwareSerialNumber(random.nextString(10)); + vdsDynamic.setHardwareVersion(random.nextString(10)); + vdsDynamic.setHardwareProductName(random.nextString(10)); + vdsDynamic.setHardwareManufacturer(random.nextString(10)); + + return vdsDynamic; + } + @Test public void serializeAndDesrializeEntity() throws Exception { String serializedEntity = new JsonObjectSerializer().serialize(entity); -- To view, visit http://gerrit.ovirt.org/18112 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I22f4244e5c6cedcf2f36be7d10d078254b0a4bb3 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Allon Mureinik <amure...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches