@Test public void listProductsShouldReturnDefaultTemplateProduct() throws CloudException, InternalException { new ListProductsRequestExecutorMockUp(); List<VirtualMachineProduct> products = IteratorUtils.toList( azurePackVirtualMachineSupport .listProducts(TPL_1_ID, VirtualMachineProductFilterOptions.getInstance()) .iterator()); assertEquals("listProducts doesn't return correct result", 1, products.size()); VirtualMachineProduct virtualMachineProduct = products.get(0); assertEquals( "listProducts doesn't return correct result", "Default", virtualMachineProduct.getName()); assertEquals( "listProducts doesn't return correct result", "default", virtualMachineProduct.getProviderProductId()); assertEquals( "listProducts doesn't return correct result", Integer.parseInt(TPL_CPU_COUNT), virtualMachineProduct.getCpuCount()); assertEquals( "listProducts doesn't return correct result", Double.parseDouble(TPL_MEMORY), virtualMachineProduct.getRamSize().getQuantity()); assertEquals( "listProducts doesn't return correct result", Storage.MEGABYTE, virtualMachineProduct.getRamSize().getUnitOfMeasure()); }
@Test(expected = InternalException.class) public void listProductsShouldThrowExceptionIfImageIsNotExist() throws CloudException, InternalException { new ListProductsRequestExecutorMockUp(); azurePackVirtualMachineSupport.listProducts( "not-exist-image-id", VirtualMachineProductFilterOptions.getInstance()); }
@Test public void listProductsShouldReturnCorrectHardwareProfileProducts() throws CloudException, InternalException { new ListProductsRequestExecutorMockUp(); List<VirtualMachineProduct> products = IteratorUtils.toList( azurePackVirtualMachineSupport .listProducts(VHD_1_ID, VirtualMachineProductFilterOptions.getInstance()) .iterator()); assertHardwareProfileProducts(products); }