VmSchedulerTimeShared extends VmSchedulerAbstract { @Override public void deallocatePesForAllVms() { super.deallocatePesForAllVms(); getRequestedMipsMap().clear(); } VmSchedulerTimeShared();  VmSchedulerTimeShared(final double vmMigrationCpuOverhead); @Override boolean allocatePesForVmInternal(final Vm vm, final List<Double> requestedMips); @Override void deallocatePesForAllVms();  }
@Test public void testAllocatePesForVm() { final List<Double> mipsShare1 = new ArrayList<>(1); mipsShare1.add(250.0); assertTrue(vmScheduler.allocatePesForVm(vm0, mipsShare1)); assertEquals(1750, vmScheduler.getTotalAvailableMips()); assertEquals(MIPS / 4, vmScheduler.getTotalAllocatedMipsForVm(vm0)); final List<Double> mipsShare2 = new ArrayList<>(2); mipsShare2.add(500.0); mipsShare2.add(125.0); assertTrue(vmScheduler.allocatePesForVm(vm1, mipsShare2)); assertEquals(1125, vmScheduler.getTotalAvailableMips()); assertEquals(625, vmScheduler.getTotalAllocatedMipsForVm(vm1)); vmScheduler.deallocatePesForAllVms(); assertEquals(2000, vmScheduler.getTotalAvailableMips()); assertEquals(0, vmScheduler.getTotalAllocatedMipsForVm(vm1)); }
@Test public void testAllocatePesWhenVmMigrationIn() { vm0.setInMigration(true); vmScheduler.getHost().addMigratingInVm(vm0); assertEquals(1500, vmScheduler.getTotalAvailableMips()); assertEquals(50, vmScheduler.getTotalAllocatedMipsForVm(vm0)); vmScheduler.deallocatePesForAllVms(); assertEquals(2000, vmScheduler.getTotalAvailableMips()); assertEquals(0, vmScheduler.getTotalAllocatedMipsForVm(vm1)); }