@Test public void getVmsEnergyModFromVms() { List<Vm> vms = new ArrayList<>(); vms.add(new Vm("vm1", "image", 1, 1024, 10, "", "")); vms.add(new Vm("vm2", "image", 2, 2048, 20, "", "")); List<VM> convertedVMs = VMMToEMConversor.getVmsEnergyModFromVms(vms); VM firstVm = convertedVMs.get(0); VM secondVm = convertedVMs.get(1); assertTrue(firstVm.getCpus() == 1 && firstVm.getRamMb() == 1024 && firstVm.getDiskGb() == 10); assertTrue(secondVm.getCpus() == 2 && secondVm.getRamMb() == 2048 && secondVm.getDiskGb() == 20); }
public static List<VM> getVmsEnergyModFromVms(List<Vm> vms) { List<VM> result = new ArrayList<>(); for (Vm vm: vms) { VM emVM = EnergyModeller.getVM(vm.getCpus(), vm.getRamMb(), vm.getDiskGb()); emVM.addDiskImage(vm.getImage()); emVM.addApplicationTag(vm.getApplicationId()); result.add(emVM); } return result; }
VMMToEMConversor { public static List<VM> getVmsEnergyModFromVms(List<Vm> vms) { List<VM> result = new ArrayList<>(); for (Vm vm: vms) { VM emVM = EnergyModeller.getVM(vm.getCpus(), vm.getRamMb(), vm.getDiskGb()); emVM.addDiskImage(vm.getImage()); emVM.addApplicationTag(vm.getApplicationId()); result.add(emVM); } return result; } }
VMMToEMConversor { public static List<VM> getVmsEnergyModFromVms(List<Vm> vms) { List<VM> result = new ArrayList<>(); for (Vm vm: vms) { VM emVM = EnergyModeller.getVM(vm.getCpus(), vm.getRamMb(), vm.getDiskGb()); emVM.addDiskImage(vm.getImage()); emVM.addApplicationTag(vm.getApplicationId()); result.add(emVM); } return result; } private  VMMToEMConversor(); }
VMMToEMConversor { public static List<VM> getVmsEnergyModFromVms(List<Vm> vms) { List<VM> result = new ArrayList<>(); for (Vm vm: vms) { VM emVM = EnergyModeller.getVM(vm.getCpus(), vm.getRamMb(), vm.getDiskGb()); emVM.addDiskImage(vm.getImage()); emVM.addApplicationTag(vm.getApplicationId()); result.add(emVM); } return result; } private  VMMToEMConversor(); static List<VM> getVmsEnergyModFromVms(List<Vm> vms); }
VMMToEMConversor { public static List<VM> getVmsEnergyModFromVms(List<Vm> vms) { List<VM> result = new ArrayList<>(); for (Vm vm: vms) { VM emVM = EnergyModeller.getVM(vm.getCpus(), vm.getRamMb(), vm.getDiskGb()); emVM.addDiskImage(vm.getImage()); emVM.addApplicationTag(vm.getApplicationId()); result.add(emVM); } return result; } private  VMMToEMConversor(); static List<VM> getVmsEnergyModFromVms(List<Vm> vms);  }