ConsolidationAlgorithmBase extends ClusterManagementDummyAlgorithm { protected float getHostAvailableCpu(HostResources host) { return (host.getCpuOverprovisioning() * host.getSpeed() * host.getCpus()) - host.getUsedCpu(); }  @Override int getClusterIntervalBetweenConsolidation(); @Override Map<Long, HostResources> mapVMsToHost(List<HostResources> rankedHosts); boolean canMigrateVmToHost(VmResources vm, HostResources host); void updateHostUsedResources(VmResources vm, HostResources host); @Override final boolean canPowerOffHost(HostResources hostToPowerOff, CloudResources cloudResources); @Override final boolean canPowerOffAnotherHostInCloud(CloudResources cloudResources); @Override boolean canHeuristicShutdownHosts();  }
@Test public void getHostAvailableCpuTest() { HostResources host = createHost(1, 1000l, 500l, 0l, 0l); Assert.assertEquals(500l, spyAlgorithm.getHostAvailableCpu(host), 0.0); }
@Test public void getHostAvailableCpu2CoresTest() { HostResources host = createHost(2, 1000l, 500l, 0l, 0l); Assert.assertEquals(1500l, spyAlgorithm.getHostAvailableCpu(host), 0.0); }