@Test public void getVmImage() { fakeCloudMiddleware.createVmImage(new ImageToUpload("newImage1", "fakeUrl1")); String newImageId2 = fakeCloudMiddleware.createVmImage(new ImageToUpload("newImage2", "fakeUrl2")); ImageUploaded imageUploaded = fakeCloudMiddleware.getVmImage(newImageId2); assertNotNull(imageUploaded.getId()); assertEquals("newImage2", imageUploaded.getName()); assertNotNull(imageUploaded.getStatus()); }
@Override public ImageUploaded getVmImage(String imageId) { for (ImageUploaded image: images) { if (imageId.equals(image.getId())) { return image; } } return null; }
FakeCloudMiddleware implements CloudMiddleware { @Override public ImageUploaded getVmImage(String imageId) { for (ImageUploaded image: images) { if (imageId.equals(image.getId())) { return image; } } return null; } }
FakeCloudMiddleware implements CloudMiddleware { @Override public ImageUploaded getVmImage(String imageId) { for (ImageUploaded image: images) { if (imageId.equals(image.getId())) { return image; } } return null; } FakeCloudMiddleware(List<HostFake> hosts); }
FakeCloudMiddleware implements CloudMiddleware { @Override public ImageUploaded getVmImage(String imageId) { for (ImageUploaded image: images) { if (imageId.equals(image.getId())) { return image; } } return null; } 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 ImageUploaded getVmImage(String imageId) { for (ImageUploaded image: images) { if (imageId.equals(image.getId())) { return image; } } return null; } 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);  }