Package org.jclouds.softlayer.domain

Examples of org.jclouds.softlayer.domain.ProductPackage


   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


      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

         }
      }

      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

      Set<ProductPackage> response = api.getAccountClient().getActivePackages();
      assert null != response;

      assertTrue(response.size() >= 0);
      for (ProductPackage p : response) {
          ProductPackage productPackage = api.getProductPackageClient().getProductPackage(p.getId());
          assert productPackage.getId() > 0 : response;
          assert productPackage.getName() != null : response;

          for (ProductItem item : productPackage.getItems()) {
              checkProductItem(item);
          }
      }
   }
View Full Code Here

   private ProductPackage cloudServerProductPackage;

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

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

         assertTrue(response.getItems().size() >= 0);
         for (ProductItem item : response.getItems()) {
            checkProductItem(item);
         }

         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);

      VirtualGuest guest = VirtualGuest.builder().domain("jclouds.org").hostname(
               TEST_HOSTNAME_PREFIX + new Random().nextInt()).build();

      Template template = templateBuilder.build();

      ProductOrder order = ProductOrder.builder()
              .packageId(productPackage.getId())
              .quantity(1)
              .location(template.getLocation().getId())
              .useHourlyPricing(true)
              .prices(getPrices(template, productPackage))
              .virtualGuests(guest).build();
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

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

               new Supplier<ProductPackage>() {
                  @Override
                  public ProductPackage get() {
                     AccountApi accountApi = client.getAccountApi();
                     ProductPackageApi productPackageApi = client.getProductPackageApi();
                     ProductPackage p = find(accountApi.getActivePackages(), named(virtualGuestPackageName));
                     return productPackageApi.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

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.