/** Ensures that after an update, the QoS entity is indeed persisted with new values. */ @Test public void testUpdate() { HostNetworkQos updatedQos = new HostNetworkQos(); updatedQos.setId(FixturesTool.HOST_NETWORK_QOS_B); updatedQos.setName("host_network_qos_b"); updatedQos.setStoragePoolId(FixturesTool.STORAGE_POOL_MIXED_TYPES); updatedQos.setOutAverageLinkshare(1000); updatedQos.setOutAverageUpperlimit(2000); updatedQos.setOutAverageRealtime(500); assertNotEquals(updatedQos, dao.get(FixturesTool.HOST_NETWORK_QOS_B)); dao.update(updatedQos); assertEquals(updatedQos, dao.get(FixturesTool.HOST_NETWORK_QOS_B)); }
/** Ensures that a newly-created host network QoS entity is properly persisted. */ @Test public void testSaveNetworkQos() { HostNetworkQos newQos = new HostNetworkQos(); newQos.setId(new Guid("de956031-6be2-43d6-bb90-5191c9253321")); newQos.setName("host_network_qos_d"); newQos.setStoragePoolId(FixturesTool.STORAGE_POOL_NO_DOMAINS); newQos.setOutAverageLinkshare(1000); newQos.setOutAverageUpperlimit(2000); newQos.setOutAverageRealtime(500); assertNull(dao.get(newQos.getId())); dao.save(newQos); assertEquals(newQos, dao.get(newQos.getId())); }
/** Ensures that retrieving host network QoS by ID works as expected. */ @Test public void testGet() { HostNetworkQos persistedQos = dao.get(FixturesTool.HOST_NETWORK_QOS_A); HostNetworkQos referenceQos = new HostNetworkQos(); referenceQos.setId(FixturesTool.HOST_NETWORK_QOS_A); referenceQos.setName("host_network_qos_a"); referenceQos.setStoragePoolId(FixturesTool.STORAGE_POOL_MIXED_TYPES); referenceQos.setOutAverageLinkshare(1000); referenceQos.setOutAverageUpperlimit(2000); referenceQos.setOutAverageRealtime(500); assertNotNull(persistedQos); assertEquals(persistedQos, referenceQos); }