Package org.jclouds.softlayer.domain

Examples of org.jclouds.softlayer.domain.ProductItem


      ProductItemCategory category2 = ProductItemCategory.builder()
            .id(12)
            .categoryCode("new category")
            .build();

      ProductItem item1 = item.toBuilder().categories(ImmutableSet.of(category2)).build();

      ProductItemPrice price = ProductItemPrice.builder().id(1)
                                                         .categories(category)
                                                         .item(item1)
                                                         .build();
      ProductItem newItem = item().apply(price);
      assertEquals(newItem.getCategories(), ImmutableSet.of(category2));
   }
View Full Code Here


   }

   @Test
   public void testHardwareId() {
      ProductItem item1 = ProductItem.builder().prices(ProductItemPrice.builder().id(123).build()).build();
      ProductItem item2 = ProductItem.builder().prices(ProductItemPrice.builder().id(456).build()).build();
      ProductItem item3 = ProductItem.builder().prices(ProductItemPrice.builder().id(789).build()).build();

      String id = hardwareId().apply(ImmutableList.of(item1, item2, item3));
      assertEquals("123,456,789", id);
   }
View Full Code Here

     assertEquals(100F, volumes.get(0).getSize());
   }

   @Test
   public void testHardwareWithTwoDisks() {
      ProductItem localVolumeItem = ProductItem.builder().id(4).description("25 GB").capacity(25F).prices(
            ProductItemPrice.builder().id(987).build()).categories(
            ProductItemCategory.builder().categoryCode("guest_disk1").build()).build();

      Hardware hardware = toHardware.apply(ImmutableSet.of(cpuItem, ramItem, volumeItem,localVolumeItem));
View Full Code Here

   @Test
   public void testCategoryCodePresentTwoCategories() {
      ProductItemCategory osCategory = ProductItemCategory.builder().id(2).categoryCode("os").build();

      ProductItem item = ProductItem.builder().categories(ImmutableSet.of(ramCategory, osCategory)).build();

      assert ProductItemPredicates.categoryCode("ram").apply(item);
   }
View Full Code Here

      hasOs(response);
   }

   private void hasOs(ProductOrder order) {
       Iterable<ProductItem> items = Iterables.transform(order.getPrices(), ProductItems.item());
       ProductItem os = Iterables.find(ImmutableSet.copyOf(items), ProductItemPredicates.categoryCode("os"));
       assertNotNull(os);
   }
View Full Code Here

   @Test
   public void testConversion() {
      for ( String description : operatingSystems )
      {
         ProductItem item = ProductItem.builder()
                                       .description(description)
                                       .prices(ProductItemPrice.builder().id(1234).build())
                                       .build();
         Image i = new ProductItemToImage().apply(item);
         OperatingSystem os = i.getOperatingSystem();
View Full Code Here

      }
   }

   @Test
   public void testUbuntu() {
         ProductItem item = ProductItem.builder()
                                       .description("Ubuntu Linux 10.04 LTS Lucid Lynx - Minimal Install (64 bit)")
                                       .prices(ProductItemPrice.builder().id(1234).build())
                                       .build();
         Image i = new ProductItemToImage().apply(item);
         OperatingSystem os = i.getOperatingSystem();
View Full Code Here

         assertTrue(os.is64Bit());
   }

   @Test
   public void testUbuntuNoBitCount() {
      ProductItem item = ProductItem.builder()
            .description("Ubuntu Linux 10.04 LTS Lucid Lynx - Minimal Install")
            .prices(ProductItemPrice.builder().id(1234).build())
            .build();
      Image i = new ProductItemToImage().apply(item);
      OperatingSystem os = i.getOperatingSystem();
View Full Code Here

   }


   @Test
   public void testCompletelyUnknown() {
      ProductItem item = ProductItem.builder()
            .description("This fails to match anything!!!")
            .prices(ProductItemPrice.builder().id(1234).build())
            .build();
      Image i = new ProductItemToImage().apply(item);
      OperatingSystem os = i.getOperatingSystem();
View Full Code Here

   public static Function<ProductItemPrice, ProductItem> item() {
      return new Function<ProductItemPrice, ProductItem>() {
         @Override
         public ProductItem apply(ProductItemPrice productItemPrice) {
            Set<ProductItemCategory> categories = productItemPrice.getCategories();
            ProductItem item = productItemPrice.getItem();
            ProductItem.Builder builder = productItemPrice.getItem().toBuilder();
            if (item.getCategories().size() == 0 && categories.size() != 0) {
               builder.categories(categories);
            }

            return builder.build();
         }
View Full Code Here

TOP

Related Classes of org.jclouds.softlayer.domain.ProductItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.