changed the vm/hardware identifier to the name instead of the id since the id will change over time!

This commit is contained in:
David Ribeiro Alves 2012-03-12 14:38:37 +00:00
parent 91a0980537
commit 3370dd819d
2 changed files with 8 additions and 8 deletions

View File

@ -48,10 +48,10 @@ public class IMachineToHardware implements Function<IMachine, Hardware> {
IGuestOSType guestOSType = virtualBoxManager.get().getVBox().getGuestOSType(osTypeId); IGuestOSType guestOSType = virtualBoxManager.get().getVBox().getGuestOSType(osTypeId);
Boolean is64Bit = guestOSType.getIs64Bit(); Boolean is64Bit = guestOSType.getIs64Bit();
HardwareBuilder hardwareBuilder = new HardwareBuilder(); HardwareBuilder hardwareBuilder = new HardwareBuilder();
hardwareBuilder.ids(vm.getId()); hardwareBuilder.ids(vm.getName());
hardwareBuilder.supportsImage(ImagePredicates.idEquals(vm.getId())); hardwareBuilder.supportsImage(ImagePredicates.idEquals(vm.getName()));
hardwareBuilder.is64Bit(is64Bit); hardwareBuilder.is64Bit(is64Bit);
hardwareBuilder.supportsImage(ImagePredicates.idEquals(vm.getId())); hardwareBuilder.supportsImage(ImagePredicates.idEquals(vm.getName()));
hardwareBuilder.hypervisor("VirtualBox"); hardwareBuilder.hypervisor("VirtualBox");
return hardwareBuilder.build(); return hardwareBuilder.build();
} }

View File

@ -46,10 +46,10 @@ public class IMachineToHardwareTest {
IGuestOSType guestOsType = createNiceMock(IGuestOSType.class); IGuestOSType guestOsType = createNiceMock(IGuestOSType.class);
String linuxDescription = "Ubuntu Linux 10.04"; String linuxDescription = "Ubuntu Linux 10.04";
String machineId = "hw-machineId"; String machineName = "hw-machineId";
expect(vm.getOSTypeId()).andReturn("os-type").anyTimes(); expect(vm.getOSTypeId()).andReturn("os-type").anyTimes();
expect(vm.getId()).andReturn(machineId).anyTimes(); expect(vm.getName()).andReturn(machineName).anyTimes();
expect(vm.getDescription()).andReturn(linuxDescription).anyTimes(); expect(vm.getDescription()).andReturn(linuxDescription).anyTimes();
@ -61,11 +61,11 @@ public class IMachineToHardwareTest {
Hardware hardware = new IMachineToHardware(Suppliers.ofInstance(vbm)).apply(vm); Hardware hardware = new IMachineToHardware(Suppliers.ofInstance(vbm)).apply(vm);
assertEquals(hardware.getId(), machineId); assertEquals(hardware.getId(), machineName);
assertEquals(hardware.getProviderId(), machineId); assertEquals(hardware.getProviderId(), machineName);
// for starters assume 1-to-1 relationship hardware to image (which // for starters assume 1-to-1 relationship hardware to image (which
// correlate to a single source IMachine) // correlate to a single source IMachine)
assertEquals(hardware.supportsImage().toString(), ImagePredicates.idEquals(machineId).toString()); assertEquals(hardware.supportsImage().toString(), ImagePredicates.idEquals(machineName).toString());
} }