ResourceProvisionerSimple extends ResourceProvisionerAbstract { @Override public boolean isSuitableForVm(final Vm vm, final long newVmTotalAllocatedResource) { final long currentAllocatedResource = getAllocatedResourceForVm(vm); final long allocationDifference = newVmTotalAllocatedResource - currentAllocatedResource; return getResource().getAvailableResource() >= allocationDifference; } ResourceProvisionerSimple(); protected  ResourceProvisionerSimple(final ResourceManageable resource); @Override boolean allocateResourceForVm(final Vm vm, final long newTotalVmResourceCapacity); @Override boolean allocateResourceForVm(final Vm vm, final double newTotalVmResource); @Override boolean deallocateResourceForVm(final Vm vm); @Override boolean isSuitableForVm(final Vm vm, final long newVmTotalAllocatedResource);  }
@Test public void testIsSuitableForVm() { final VmSimple vm0 = createVm(0, HALF_CAPACITY); assertTrue(provisioner.isSuitableForVm(vm0, QUARTER_OF_CAPACITY)); assertTrue(provisioner.isSuitableForVm(vm0, HALF_CAPACITY)); assertTrue(provisioner.isSuitableForVm(vm0, CAPACITY)); assertFalse(provisioner.isSuitableForVm(vm0, CAPACITY*2)); provisioner.allocateResourceForVm(vm0, HALF_CAPACITY); assertTrue(provisioner.isSuitableForVm(vm0, QUARTER_OF_CAPACITY)); }