@Test public void testRemoveVmFromPool() { int before = dao.getVmPoolsMapByVmPoolId(existingVmPoolMap.getvm_pool_id()).size(); dao.removeVmFromVmPool(EXISTING_VM_ID); int after = dao.getVmPoolsMapByVmPoolId(existingVmPoolMap.getvm_pool_id()).size(); assertEquals(before - 1, after); vm_pool_map result = dao.getVmPoolMapByVmGuid(EXISTING_VM_ID); assertNull(result); }
@Test public void testAddVmToPool() { int before = dao.getVmPoolsMapByVmPoolId(newVmPoolMap.getvm_pool_id()).size(); dao.addVmToPool(newVmPoolMap); int after = dao.getVmPoolsMapByVmPoolId(newVmPoolMap.getvm_pool_id()).size(); assertEquals(before + 1, after); vm_pool_map result = dao.getVmPoolMapByVmGuid(newVmPoolMap.getvm_guid()); assertNotNull(result); assertEquals(newVmPoolMap, result); }