Package org.jclouds.softlayer.domain

Examples of org.jclouds.softlayer.domain.ProductItemPrice$ConcreteBuilder


      new ProductItemToImage().apply(item);
   }
  
   @Test
   public void testId() {
      ProductItemPrice price = ProductItemPrice.builder().id(1234).build();
      ProductItem item = ProductItem.builder().id(5678).prices(price).build();
      assertEquals(imageId().apply(item), "1234", "Expected the ID of the ProductItemPrice to be returned");
   }
View Full Code Here


      assertEquals(imageId().apply(item), "1234", "Expected the ID of the ProductItemPrice to be returned");
   }

   @Test
   public void testIdManyPrices() {
      ProductItemPrice price1 = ProductItemPrice.builder().id(1234).build();
      ProductItemPrice price2 = ProductItemPrice.builder().id(5678).build();
      ProductItem item = ProductItem.builder().id(9012).prices(ImmutableSet.of(price1,price2)).build();
      assertEquals(imageId().apply(item), "1234", "Expected the ID of the ProductItemPrice to be returned");
   }
View Full Code Here

   public static Function<ProductItem, String> imageId() {
      return new Function<ProductItem, String>() {
         @Override
         public String apply(ProductItem productItem) {
            checkNotNull(productItem, "productItem");
            ProductItemPrice price = ProductItems.price().apply(productItem);
            return String.valueOf(checkNotNull(price, "price").getId());
         }
      };
   }
View Full Code Here

      Iterable<ProductItem> ramItems = Iterables.filter(productPackage.getItems(), Predicates.and(categoryCode("ram"),
               capacity(2.0f)));

      Map<Float, ProductItem> ramToProductItem = Maps.uniqueIndex(ramItems, ProductItems.capacity());

      ProductItemPrice ramPrice = ProductItems.price().apply(ramToProductItem.get(2.0f));

      Iterable<ProductItem> cpuItems = Iterables.filter(productPackage.getItems(), Predicates.and(
               units("PRIVATE_CORE"), capacity(2.0f)));
      Map<Float, ProductItem> coresToProductItem = Maps.uniqueIndex(cpuItems, ProductItems.capacity());

      ProductItemPrice cpuPrice = ProductItems.price().apply(coresToProductItem.get(2.0f));

      Iterable<ProductItem> operatingSystems = Iterables.filter(productPackage.getItems(), categoryCode("os"));
      Map<String, ProductItem> osToProductItem = Maps.uniqueIndex(operatingSystems, ProductItems.description());
      ProductItemPrice osPrice = ProductItems.price().apply(
               osToProductItem.get("Ubuntu Linux 8 LTS Hardy Heron - Minimal Install (64 bit)"));

      Builder<ProductItemPrice> prices = ImmutableSet.builder();
      prices.addAll(defaultPrices);
      prices.add(ramPrice);
View Full Code Here

            Predicates.and(categoryCode("ram"), capacity(1.0f)));

      // capacity is key in GB (1Gb = 1.0f)
      Map<Float, ProductItem> ramToProductItem = Maps.uniqueIndex(ramItems, ProductItems.capacity());

      ProductItemPrice price = ProductItems.price().apply(ramToProductItem.get(1.0f));
      assert Integer.valueOf(1644).equals(price.getId());
   }
View Full Code Here

            Predicates.and(units("PRIVATE_CORE"), capacity(2.0f)));

      // number of cores is the key
      Map<Float, ProductItem> coresToProductItem = Maps.uniqueIndex(cpuItems, ProductItems.capacity());

      ProductItemPrice price = ProductItems.price().apply(coresToProductItem.get(2.0f));
      assert Integer.valueOf(1963).equals(price.getId());
   }
View Full Code Here

      Iterable<ProductItem> operatingSystems = Iterables.filter(cloudServerProductPackage.getItems(),
            categoryCode("os"));

      Map<String, ProductItem> osToProductItem = Maps.uniqueIndex(operatingSystems, ProductItems.description());

      ProductItemPrice price = ProductItems.price().apply(
            osToProductItem.get("Ubuntu Linux 8 LTS Hardy Heron - Minimal Install (64 bit)"));
      assert Integer.valueOf(1693).equals(price.getId());
   }
View Full Code Here

      return new Function<List<ProductItem>, String>() {
         @Override
         public String apply(List<ProductItem> productItems) {
            StringBuilder builder = new StringBuilder();
            for (ProductItem item : productItems) {
               ProductItemPrice price = ProductItems.price().apply(item);
               builder.append(price.getId()).append(",");
            }
            return builder.toString().substring(0, builder.lastIndexOf(","));
         }
      };
   }
View Full Code Here

   public static Function<ProductItem, String> imageId() {
      return new Function<ProductItem, String>() {
         @Override
         public String apply(ProductItem productItem) {
            checkNotNull(productItem, "productItem");
            ProductItemPrice price = ProductItems.price().apply(productItem);
            return "" + price.getId();
         }
      };
   }
View Full Code Here

      new ProductItemToImage().apply(item);
   }
  
   @Test
   public void testId() {
      ProductItemPrice price = ProductItemPrice.builder().id(1234).build();
      ProductItem item = ProductItem.builder().prices(price).build();
      assertEquals("1234",imageId().apply(item));
   }
View Full Code Here

TOP

Related Classes of org.jclouds.softlayer.domain.ProductItemPrice$ConcreteBuilder

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.