@Test public void getVm() { String newImageId = fakeCloudMiddleware.createVmImage(new ImageToUpload("newImage", "fakeUrl")); fakeCloudMiddleware.deploy(new Vm("testVm1", newImageId, 2, 2048, 2, null, null), "host1"); String idDeployedVm = fakeCloudMiddleware.deploy( new Vm("testVm2", newImageId, 1, 1024, 1, null, null), "host2"); VmDeployed vmDeployed = fakeCloudMiddleware.getVM(idDeployedVm); assertEquals(idDeployedVm, vmDeployed.getId()); assertEquals("testVm2", vmDeployed.getName()); assertEquals(newImageId, vmDeployed.getImage()); assertTrue(vmDeployed.getCpus() == 1); assertTrue(vmDeployed.getRamMb() == 1024); assertTrue(vmDeployed.getDiskGb() == 1); }
@Override public VmDeployed getVM(String vmId) { return getVmById(vmId); }
FakeCloudMiddleware implements CloudMiddleware { @Override public VmDeployed getVM(String vmId) { return getVmById(vmId); } }
FakeCloudMiddleware implements CloudMiddleware { @Override public VmDeployed getVM(String vmId) { return getVmById(vmId); } FakeCloudMiddleware(List<HostFake> hosts); }
FakeCloudMiddleware implements CloudMiddleware { @Override public VmDeployed getVM(String vmId) { return getVmById(vmId); } FakeCloudMiddleware(List<HostFake> hosts); @Override String deploy(Vm vm, String hostname); @Override String deployWithVolume(Vm vm, String hostname, String isoPath); @Override void destroy(String vmId); @Override void migrate(String vmId, String destinationNodeHostName); @Override List<String> getAllVMsIds(); @Override List<String> getScheduledNonDeployedVmsIds(); @Override VmDeployed getVM(String vmId); @Override boolean existsVm(String vmId); @Override void rebootHardVm(String vmId); @Override void rebootSoftVm(String vmId); @Override void startVm(String vmId); @Override void stopVm(String vmId); @Override void suspendVm(String vmId); @Override void resumeVm(String vmId); @Override List<ImageUploaded> getVmImages(); @Override String createVmImage(ImageToUpload imageToUpload); @Override ImageUploaded getVmImage(String imageId); @Override void deleteVmImage(String id); @Override void assignFloatingIp(String vmId); void deleteAllVmImages(); HostFake getHost(String hostname); void addHost(HostFake host); }
FakeCloudMiddleware implements CloudMiddleware { @Override public VmDeployed getVM(String vmId) { return getVmById(vmId); } FakeCloudMiddleware(List<HostFake> hosts); @Override String deploy(Vm vm, String hostname); @Override String deployWithVolume(Vm vm, String hostname, String isoPath); @Override void destroy(String vmId); @Override void migrate(String vmId, String destinationNodeHostName); @Override List<String> getAllVMsIds(); @Override List<String> getScheduledNonDeployedVmsIds(); @Override VmDeployed getVM(String vmId); @Override boolean existsVm(String vmId); @Override void rebootHardVm(String vmId); @Override void rebootSoftVm(String vmId); @Override void startVm(String vmId); @Override void stopVm(String vmId); @Override void suspendVm(String vmId); @Override void resumeVm(String vmId); @Override List<ImageUploaded> getVmImages(); @Override String createVmImage(ImageToUpload imageToUpload); @Override ImageUploaded getVmImage(String imageId); @Override void deleteVmImage(String id); @Override void assignFloatingIp(String vmId); void deleteAllVmImages(); HostFake getHost(String hostname); void addHost(HostFake host);  }