Package org.jclouds.softlayer.domain

Examples of org.jclouds.softlayer.domain.ProductPackage$Builder


         }
      }

      int pkgId = Iterables.find(api.getAccountApi().getActivePackages(),
               named(ProductPackageApiLiveTest.CLOUD_SERVER_PACKAGE_NAME)).getId();
      ProductPackage productPackage = api.getProductPackageApi().getProductPackage(pkgId);

      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();
View Full Code Here


   private ProductPackage cloudServerProductPackage;

   @Test
   public void testGetProductPackage() {
      for (ProductPackage productPackage : accountApi.getActivePackages()) {
         ProductPackage response = client.getProductPackage(productPackage.getId());

         assert null != response;
         assert response.getId() > 0 : response;
         assert response.getName() != null : response;
         assert response.getDescription() != null : response;

         assertTrue(response.getItems().size() >= 0);
         for (ProductItem item : response.getItems()) {
            // ProductItem newDetails = client.getProductItem(item.getId());
            // assertEquals(item.getId(), newDetails.getId());
            checkProductItem(item);
         }

         assertTrue(response.getDatacenters().size() > 0);
         for (Datacenter datacenter : response.getDatacenters()) {
            checkDatacenter(datacenter);
         }
      }
   }
View Full Code Here

@Test(sequential = true,groups = "unit")
public class ProductPackagePredicatesTest {

   @Test
   public void testMatches() {
      ProductPackage productPackage = ProductPackage.builder().name("foo").build();
      assertTrue(ProductPackagePredicates.named("foo").apply(productPackage));
   }
View Full Code Here

      assertTrue(ProductPackagePredicates.named("foo").apply(productPackage));
   }

    @Test
   public void testDoesNotMatch() {
      ProductPackage productPackage = ProductPackage.builder().name("foo").build();
      assertFalse(ProductPackagePredicates.named("bar").apply(productPackage));
   }
View Full Code Here

      return result.build();
   }

   @Override
   public Iterable<Iterable<ProductItem>> listHardwareProfiles() {
      ProductPackage productPackage = productPackageSupplier.get();
      Set<ProductItem> items = productPackage.getItems();
      Builder<Iterable<ProductItem>> result = ImmutableSet.builder();
      for (ProductItem cpuItem : filter(items, matches(cpuPattern))) {
         for (ProductItem ramItem : filter(items, categoryCode("ram"))) {
            for (ProductItem sanItem : filter(items, and(matches(disk0Type), categoryCode("guest_disk0")))) {
               result.add(ImmutableSet.of(cpuItem, ramItem, sanItem));
View Full Code Here

@Test(sequential = true,groups = "unit")
public class ProductPackagePredicatesTest {

   @Test
   public void testMatches() {
      ProductPackage productPackage = ProductPackage.builder().name("foo").build();
      assertTrue(ProductPackagePredicates.named("foo").apply(productPackage));
   }
View Full Code Here

      assertTrue(ProductPackagePredicates.named("foo").apply(productPackage));
   }

    @Test
   public void testDoesNotMatch() {
      ProductPackage productPackage = ProductPackage.builder().name("foo").build();
      assertFalse(ProductPackagePredicates.named("bar").apply(productPackage));
   }
View Full Code Here

   private ProductPackage cloudServerProductPackage;

   @Test
   public void testGetProductPackage() {
      for (ProductPackage productPackage : accountClient.getActivePackages()) {
         ProductPackage response = client.getProductPackage(productPackage.getId());

         assert null != response;
         assert response.getId() > 0 : response;
         assert response.getName() != null : response;
         assert response.getDescription() != null : response;

         assertTrue(response.getItems().size() >= 0);
         for (ProductItem item : response.getItems()) {
            // ProductItem newDetails = client.getProductItem(item.getId());
            // assertEquals(item.getId(), newDetails.getId());
            checkProductItem(item);
         }

         assertTrue(response.getDatacenters().size() > 0);
         for (Datacenter datacenter : response.getDatacenters()) {
            checkDatacenter(datacenter);
         }
      }
   }
View Full Code Here

         }
      }

      int pkgId = Iterables.find(api.getAccountClient().getActivePackages(),
               named(ProductPackageClientLiveTest.CLOUD_SERVER_PACKAGE_NAME)).getId();
      ProductPackage productPackage = api.getProductPackageClient().getProductPackage(pkgId);

      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();
View Full Code Here

               new Supplier<ProductPackage>() {
                  @Override
                  public ProductPackage get() {
                     AccountClient accountClient = client.getAccountClient();
                     ProductPackageClient productPackageClient = client.getProductPackageClient();
                     ProductPackage p = find(accountClient.getActivePackages(), named(virtualGuestPackageName));
                     return productPackageClient.getProductPackage(p.getId());
                  }
                 
                  @Override
                  public String toString() {
                     return Objects.toStringHelper(client).add("method", "accountClient.getActivePackages")
View Full Code Here

TOP

Related Classes of org.jclouds.softlayer.domain.ProductPackage$Builder

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.