Package org.jclouds.softlayer.domain

Examples of org.jclouds.softlayer.domain.ProductItem


      Iterable<String> hardwareIds = Splitter.on(",").split(template.getHardware().getId());
      for (String hardwareId : hardwareIds) {
         int id = Integer.parseInt(hardwareId);
         result.add(ProductItemPrice.builder().id(id).build());
      }
      ProductItem uplinkItem = find(productPackageSupplier.get().getItems(),
            and(capacity(portSpeed), categoryCode("port_speed")));
      result.add(get(uplinkItem.getPrices(), 0));
      result.addAll(prices);
      return result.build();
   }
View Full Code Here


   }

   @Override
   public Hardware apply(Iterable<ProductItem> items) {

      ProductItem coresItem = getOnlyElement(filter(items, matches(cpuDescriptionRegex)));
      ProductItem ramItem = getOnlyElement(filter(items, categoryCode(RAM_CATEGORY)));
      ProductItem volumeItem = get(filter(items, categoryCode(FIRST_GUEST_DISK)), 0);

      String hardwareId = hardwareId().apply(ImmutableList.of(coresItem, ramItem, volumeItem));
      double cores = ProductItems.capacity().apply(coresItem).doubleValue();
      Matcher cpuMatcher = cpuDescriptionRegex.matcher(coresItem.getDescription());
      double coreSpeed = (cpuMatcher.matches()) ? Double.parseDouble(cpuMatcher.group(cpuMatcher.groupCount())) : DEFAULT_CORE_SPEED;
View Full Code Here

            return null;
         ProductOrder order = client.getVirtualGuestClient().getOrderTemplate(guest.getId());
         if (order == null)
            return null;
         Iterable<ProductItem> items = Iterables.transform(order.getPrices(), ProductItems.item());
         ProductItem os = Iterables.find(items, ProductItemPredicates.categoryCode("os"));
         return new ProductItemToImage().apply(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

      assertFalse(os.is64Bit());
   }
  
   @Test
   public void test64BitUnknown() {
      ProductItem item = ProductItem.builder()
            .description("This only has the bit-count (64 bit)")
            .prices(ProductItemPrice.builder().id(1234).build())
            .build();
      Image i = new ProductItemToImage().apply(item);
      OperatingSystem os = i.getOperatingSystem();
View Full Code Here

      new ProductItemToImage().apply(null);
   }
  
   @Test(expectedExceptions = NullPointerException.class)
   public void testNoDescription() {
      ProductItem item = ProductItem.builder()
            .prices(ProductItemPrice.builder().id(1234).build())
            .build();
      new ProductItemToImage().apply(item);
   }
View Full Code Here

   }
  
   @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.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.