You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jclouds.apache.org by Andrea Turli <no...@github.com> on 2013/07/30 19:25:41 UTC

[jclouds] Fix provider softlayer (#77)

This PR is a fix for softlayer as there are many failures when running *LiveTests on provider/softlayer at 1.6.1-incubating.

We&#39;d like to have it merged and released on next 1.6.2-incubating or whatever will be called.

Thanks for your review
You can merge this Pull Request by running:

  git pull https://github.com/andreaturli/jclouds fix/softlayer

Or you can view, comment on it, or merge it online at:

  https://github.com/jclouds/jclouds/pull/77

-- Commit Summary --

  * fixed ProductOrder pojo

-- File Changes --

    M providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/ProductItemToImage.java (23)
    M providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/ProductItems.java (3)
    M providers/softlayer/src/main/java/org/jclouds/softlayer/compute/strategy/SoftLayerComputeServiceAdapter.java (1)
    M providers/softlayer/src/main/java/org/jclouds/softlayer/domain/ProductOrder.java (2)
    M providers/softlayer/src/test/java/org/jclouds/softlayer/compute/SoftLayerComputeServiceAdapterLiveTest.java (7)
    M providers/softlayer/src/test/java/org/jclouds/softlayer/compute/functions/ProductItemToImageTest.java (9)
    M providers/softlayer/src/test/java/org/jclouds/softlayer/compute/functions/ProductItemsTest.java (4)
    M providers/softlayer/src/test/java/org/jclouds/softlayer/features/DatacenterClientLiveTest.java (17)
    M providers/softlayer/src/test/java/org/jclouds/softlayer/features/ProductPackageClientLiveTest.java (1)
    M providers/softlayer/src/test/java/org/jclouds/softlayer/features/VirtualGuestClientLiveTest.java (74)

-- Patch Links --

https://github.com/jclouds/jclouds/pull/77.patch
https://github.com/jclouds/jclouds/pull/77.diff


Re: [jclouds] Fix provider softlayer (#77)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #305](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/305/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-26265645

Re: [jclouds] Fix provider softlayer (#77)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #241](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/241/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-21850085

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -61,7 +62,7 @@ public String apply(ProductItem productItem) {
>           @Override
>           public ProductItemPrice apply(ProductItem productItem) {
>              if (productItem.getPrices().size() < 1)

`if (productItem.getPrices().isEmpty()) {`?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r5494074

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -71,11 +78,8 @@ public void testListVirtualGuests() throws Exception {
>        }
>     }
>  
> -   @Test(enabled = false, groups = "live")
> +   @Test(enabled = true, groups = "live")

Just `@Test(groups = "live")`?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r5494201

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -66,9 +69,9 @@ protected SoftLayerClient create(Properties props, Iterable<Module> modules) {
>     }
>  
>     @Test
> -   public void testListLocations() {
> -      assertFalse(Iterables.isEmpty(adapter.listLocations()));
> -   }
> +       public void testListLocations() {
> +        assertFalse(Iterables.isEmpty(adapter.listLocations()));

Add a failure message?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r6902243

Re: [jclouds] Fix provider softlayer (#77)

Posted by Eli Polonsky <no...@github.com>.
I think CCI is the general name. (Cluster Computing Intefrace?)

CCI includes virtual guests and small and dedicated bare metal instances.
So bare metal is not supported at all by jclouds?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-28146877

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
>     }
>  
>     @Test
>     public void testIdManyPrices() {
>        ProductItemPrice price1 = ProductItemPrice.builder().id(1234).build();
>        ProductItemPrice price2 = ProductItemPrice.builder().id(5678).build();
> -      ProductItem item = ProductItem.builder().prices(ImmutableSet.of(price1,price2)).build();
> -      assertEquals("1234",imageId().apply(item));
> +      ProductItem item = ProductItem.builder().id(1234).prices(ImmutableSet.of(price1,price2)).build();
> +      assertEquals("Expected the ID of the ProductItemPrice to be returned", "1234",imageId().apply(item));

Indeed. I think [I linked](https://github.com/jclouds/jclouds/pull/77/files#r6902366) to that Assert version, as far as I can see...

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r6912202

Re: [jclouds] Fix provider softlayer (#77)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #373](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/373/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-27952259

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> +   public void checkProductItem(ProductItem item) {
> +       assertTrue(item.getId() > 0, "item id must be more than 0");
> +       assertNotNull(item.getDescription(), "item description must be not null");
> +       checkCategories(item.getCategories());
> +       // units and capacity may be null
> +       assertTrue(item.getPrices().size() >= 0);
> +       for (ProductItemPrice price : item.getPrices()) {
> +          checkPrice(price);
> +       }
> +   }
> +
> +    public void checkCategories(Set<ProductItemCategory> categories) {
> +       for (ProductItemCategory category : categories) {
> +           assert category.getId() > 0 : category;
> +           assert category.getName() != null : category;
> +           assert category.getCategoryCode() != null : category;

Still using `assert` here

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r7000527

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrea Turli <no...@github.com>.
@demobox I've created a new PR described at https://issues.apache.org/jira/browse/JCLOUDS-375

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-28288106

Re: [jclouds] Fix provider softlayer (#77)

Posted by Richard Downer <no...@github.com>.
@andreaturli, I'm sure Adrian was joking - if not he can open a Jira for 1.8 :smile: demobox's comment [here](https://github.com/jclouds/jclouds/pull/77#issuecomment-27805666) still has two unticked items, and another comment [here](https://github.com/jclouds/jclouds/pull/77#discussion-diff-7482124).

What IDE are you using Andrea? Perhaps I can help set you up with jclouds code formatting rules.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-27949454

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -157,8 +141,6 @@ private void checkVirtualGuest(VirtualGuest vg) {
>        assert vg.getMaxCpu() > 0 : vg;
>        assert vg.getMaxCpuUnits() != null : vg;
>        assert vg.getMaxMemory() > 0 : vg;
> -      assert vg.getMetricPollDate() != null : vg;
> -      assert vg.getModifyDate() != null : vg;

Any reason why these checks are being removed? Are they no longer applicable?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r7000576

Re: [jclouds] Fix provider softlayer (#77)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #836](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/836/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-27952263

Re: [jclouds] Fix provider softlayer (#77)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #426](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/426/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-24801447

Re: [jclouds] Fix provider softlayer (#77)

Posted by Aled Sage <no...@github.com>.
@andreaturli have you addressed @demobox 's comment about `price.getId() + ""` always being non-null? That code still looks wrong.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-23682342

Re: [jclouds] Fix provider softlayer (#77)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #757](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/757/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-26064523

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> +
> +import static org.testng.Assert.assertEquals;
> +
> +/**
> + *
> + * @author Adrian Cole
> + */
> +@Test(groups = "unit", testName = "AccountClientExpectTest")
> +public class AccountClientExpectTest extends BaseRestClientExpectTest<SoftLayerClient> {
> +
> +   public static String ACTIVE_PACKAGE_MASK = "id;name";
> +
> +   public AccountClientExpectTest() {
> +     provider = "softlayer";
> +  }
> +

Bad indents here and in the rest of this file

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r7442903

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -47,7 +47,9 @@
>  @Test(groups = "live")
>  public class SoftLayerTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
>  
> -   public SoftLayerTemplateBuilderLiveTest() {
> +    public static final int MAX_RAM = 48 * 1024;
> +
> +    public SoftLayerTemplateBuilderLiveTest() {

Formatting (indent is wrong)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r6902279

Re: [jclouds] Fix provider softlayer (#77)

Posted by Aled Sage <no...@github.com>.
This failed for me, when there were some other VMs already in existance in my account.

To get it to work, I had to also add:

    diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/VirtualGuestToNodeMetadata.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/VirtualGuestToNodeMetadata.java
    index 93f0fc4..6f438e3 100644
    --- a/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/VirtualGuestToNodeMetadata.java
    +++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/VirtualGuestToNodeMetadata.java
    @@ -88,10 +88,9 @@ public class VirtualGuestToNodeMetadata implements Function<VirtualGuest, NodeMe
           if (image != null) {
              builder.imageId(image.getId());
              builder.operatingSystem(image.getOperatingSystem());
    +         builder.hardware(hardware.getHardware(from));
           }
     
    -      builder.hardware(hardware.getHardware(from));
    -
           builder.status(serverStateToNodeStatus.get(from.getPowerState().getKeyName()));
     
           // These are null for 'bad' guest orders in the HALTED state.
    @@ -147,6 +146,8 @@ public class VirtualGuestToNodeMetadata implements Function<VirtualGuest, NodeMe
                 return null;
              Iterable<ProductItem> items = Iterables.transform(order.getPrices(), ProductItems.item());
              ProductItem os = Iterables.find(items, ProductItemPredicates.categoryCode("os"));
    +         if (os.getPrices().isEmpty())
    +            return null;
              return new ProductItemToImage().apply(os);
           }
        }


---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-23683116

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -66,6 +68,7 @@
>  import com.google.common.collect.ImmutableSet;
>  import com.google.common.collect.ImmutableSet.Builder;
>  import com.google.common.collect.Iterables;
> +import org.jclouds.softlayer.features.AccountClient;

New imports without a code change in this file..?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r6901289

Re: [jclouds] Fix provider softlayer (#77)

Posted by ahgittin <no...@github.com>.
in the hardware profiles i'm seeing ram values such as 1, 2, 3, 5, 10, 14, 15, 32, 48.  are these GB?  odd values however; maybe it is some form of ID ?  

for things like minRam to work i think they need to be translated to MB.

    Profile: {id=2226,2242,13916, providerId=2226,2242,13916, processors=[{cores=6.0, speed=2.0}], ram=11, volumes=[{id=3899, type=LOCAL, size=100.0, bootDevice=true, durable=false}], hypervisor=XenServer, supportsImage=ALWAYS_TRUE}
    Profile: {id=2229,2246,13887, providerId=2229,2246,13887, processors=[{cores=10.0, speed=2.0}], ram=15, volumes=[{id=3876, type=LOCAL, size=100.0, bootDevice=true, durable=false}], hypervisor=XenServer, supportsImage=ALWAYS_TRUE}


---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-23773151

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> Any progress on this?

Thanks for the update - will try to have a look today or tomorrow.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-27797014

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> +           checkPrice(price);
> +       }
> +   }
> +
> +    public void checkCategories(Set<ProductItemCategory> categories) {
> +       for (ProductItemCategory category : categories) {
> +           assert category.getId() > 0 : category;
> +           assert category.getName() != null : category;
> +           assert category.getCategoryCode() != null : category;
> +       }
> +   }
> +
> +    public void checkPrice(ProductItemPrice price) {
> +       assert price.getId() > 0 : price;
> +       assert price.getItemId() > 0 : price;
> +       assert price.getRecurringFee() != null || price.getHourlyRecurringFee() != null : price;

Please use TestNG [asserts](http://testng.org/javadoc/org/testng/Assert.html) in these tests.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r6902412

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> he was joking, isn't he?

Yes, apologies if that wasn't clear! Both comments about the package rename were jokes.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-27960098

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
>      */
>     Set<ProductPackage> getActivePackages();
>  
> +
> +   /**
> +    * @return return all the active packages.

Change the description of what is returned so that it is clear what the difference is? And add a `@see #getActivePackages()`?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r7441253

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -128,4 +131,11 @@ protected void tearDown() {
>     protected Iterable<Module> setupModules() {
>        return ImmutableSet.<Module> of(getLoggingModule(), new SshjSshClientModule());
>     }
> +
> +    @Override
> +    protected Properties setupProperties() {
> +        Properties properties = super.setupProperties();
> +        properties.setProperty("jclouds.ssh.max-retries", "10");
> +        return properties;
> +    }

Formatting (indent is wrong)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r6902270

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -91,7 +91,7 @@ protected Builder() {
>           .apiMetadata(new SoftLayerApiMetadata())
>           .homepage(URI.create("http://www.softlayer.com"))
>           .console(URI.create("https://manage.softlayer.com"))
> -         .iso3166Codes("SG","US-CA","US-TX","US-VA","US-WA","US-TX", "NL")
> +         .iso3166Codes("SG","US-CA","US-TX","US-VA","US-WA","US-TX", "NL", "NSFTW-IL")

That would seem like a bug, then - the state code for Washington state is US-WA (see e.g. [here](http://en.wikipedia.org/wiki/ISO_3166-2:US). Could you check that with Softlayer?

It's at least worth a comment in the code, I'd say ;-)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r6931717

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -78,7 +79,11 @@ public void testCreateNodeWithGroupEncodedIntoNameThenStoreCredentials() {
>        String group = "foo";
>        String name = "node" + new Random().nextInt();
>  
> -      Template template = templateBuilder.build();
> +      Template template = templateBuilder.minRam(3)
> +                                          //.osFamily(OsFamily.UBUNTU).os64Bit(true).osVersionMatches("1[012].[01][04]")
> +                                          //.hardwareId("2228,2236,13899")/*

Remove commented-out code?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r5494079

Re: [jclouds] Fix provider softlayer (#77)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #767](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/767/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-26265670

Re: [jclouds] Fix provider softlayer (#77)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #236](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/236/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-21810622

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
>     public void testIdMissingPrices() {
>        ProductItem item = ProductItem.builder().build();
> -      imageId().apply(item);
> +      assertEquals(item.getId() + "", imageId().apply(item));

Since we know what `item.getId()` is, could we just have
```
 assertEquals("", imageId().apply(item));
```
here?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r5508196

Re: [jclouds] Fix provider softlayer (#77)

Posted by Ignasi Barrera <no...@github.com>.
@demobox Should this be cherry-picked to master?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-28286430

Re: [jclouds] Fix provider softlayer (#77)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #593](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/593/) FAILURE
Looks like there's a problem with this pull request

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-22479981

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -33,15 +34,18 @@
>  
>     @Test
>     public void testGetActivePackages() {

Erm...is this not "testGetActivePackagesReduced" now? And should we not have a test for _both_ calls?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r6902382

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> +   }
> +
> +    public void checkCategories(Set<ProductItemCategory> categories) {
> +       for (ProductItemCategory category : categories) {
> +          assertTrue(category.getId() > 0, "category id must be more than 0");
> +          assertNotNull(category.getName(), "category name must be not null");
> +          assertNotNull(category.getCategoryCode(), "category code must be not null");
> +       }
> +   }
> +
> +    public void checkPrice(ProductItemPrice price) {
> +        assertTrue(price.getId() > 0, "price id must be more than 0");
> +        assertTrue(price.getItemId() > 0, "price itemId must be more than 0");
> +        assertTrue(price.getRecurringFee() != null || price.getHourlyRecurringFee() != null,
> +                "price.getRecurringFee() must be not null OR price.getHourlyRecurringFee() must be not null");
> +   }

Bad indenting here

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r7442791

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrea Turli <no...@github.com>.
@demobox I've addressed all your comments (hopefully :) ) in particular, I've also added an ExpectTest for AccountClientExpectTest to test testGetActivePackages and testGetReducedActivePackages

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-26263224

Re: [jclouds] Fix provider softlayer (#77)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #327](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/327/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-26420797

Re: [jclouds] Fix provider softlayer (#77)

Posted by Eli Polonsky <no...@github.com>.
thanks, though i think this flag is just a part of the response, letting you know if the order is bare metal or not. 
to actually order a bare metal instance there is a different API http://sldn.softlayer.com/reference/services/SoftLayer_Hardware/createObject

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-28147312

Re: [jclouds] Fix provider softlayer (#77)

Posted by Aled Sage <no...@github.com>.
> @@ -189,7 +188,7 @@ public void testNoDescription() {
>     @Test
>     public void testId() {
>        ProductItemPrice price = ProductItemPrice.builder().id(1234).build();

Very minor point: could change `price = ...` to not set that id to 1234, so it's clear which we're asserting should have id 1234. Same for in `testIdManyPrices()`

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r5491092

Re: [jclouds] Fix provider softlayer (#77)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #790](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/790/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-26420829

Re: [jclouds] Fix provider softlayer (#77)

Posted by ahgittin <no...@github.com>.
When I stop trying to query by `minRam` I also get the error @aledsage reports, so this is NOT working for me.


---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-23773721

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrea Turli <no...@github.com>.
Thanks @mattstep. Do you want me to address your comments and squash the new changes on the same commit or 2 commmits are acceptable?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-21818421

Re: [jclouds] Fix provider softlayer (#77)

Posted by Eli Polonsky <no...@github.com>.
Hey guys. any reason this pull request is not accepted yet?

i cherry picked it into my own fork and can also verify that is works well.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-28146265

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -179,7 +176,8 @@ public Integer apply(String description) {
>           public String apply(ProductItem productItem) {
>              checkNotNull(productItem, "productItem");
>              ProductItemPrice price = ProductItems.price().apply(productItem);
> -            return "" + price.getId();
> +            assert price != null;

Use `checkNotNull` as a couple of lines before?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r6901268

Re: [jclouds] Fix provider softlayer (#77)

Posted by Aled Sage <no...@github.com>.
@andreaturli Adrian's package rename comment was *definitely* a joke, as was demobox's response - `You mean "project bluewash"? ;-)`

Please push the remaining local changes (without any project rename!).

As an aside for future reference, if ever renaming a provider or package, then please do it in its own pull request rather mixing it with commits for other changes.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-27956686

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrea Turli <no...@github.com>.
> @@ -157,8 +141,6 @@ private void checkVirtualGuest(VirtualGuest vg) {
>        assert vg.getMaxCpu() > 0 : vg;
>        assert vg.getMaxCpuUnits() != null : vg;
>        assert vg.getMaxMemory() > 0 : vg;
> -      assert vg.getMetricPollDate() != null : vg;
> -      assert vg.getModifyDate() != null : vg;

I'd say no longer applicable as they can be also null.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r7001116

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrea Turli <no...@github.com>.
> @@ -91,7 +91,7 @@ protected Builder() {
>           .apiMetadata(new SoftLayerApiMetadata())
>           .homepage(URI.create("http://www.softlayer.com"))
>           .console(URI.create("https://manage.softlayer.com"))
> -         .iso3166Codes("SG","US-CA","US-TX","US-VA","US-WA","US-TX", "NL")
> +         .iso3166Codes("SG","US-CA","US-TX","US-VA","US-WA","US-TX", "NL", "NSFTW-IL")

@demobox Really don't know :) Apparently it is the ISO code for Seattle according to Softlayer, in fact  `listLocations` returns the following entries:
```
Datacenter{id=18171, name=sea01, longName=Seattle, locationAddress=Address{id=3, country=NSFTW, state=IL, description=208.100.0.117}, regions=[[keyname=FIRST_AVAILABLE, description=First Available], [keyname=SEATTLE, description=SEA01 - Seattle - West Coast U.S.]]}, 
Datacenter{id=37473, name=wdc01, longName=Washington, DC, locationAddress=Address{id=4, country=US, state=VA, description=Washington DC - WDC01 - Chantilly}, regions=[[keyname=WASHINGTON_DC, description=WDC01 - Washington, DC - East Coast U.S.], [keyname=FIRST_AVAILABLE, description=First Available]]}, 
Datacenter{id=138124, name=dal05, longName=Dallas 5, locationAddress=Address{id=722, country=US, state=TX, description=Dallas - DAL05 - Corporate HQ}, regions=[[keyname=DALLAS05, description=DAL05 - Dallas - Central U.S.]]}, 
Datacenter{id=168642, name=sjc01, longName=San Jose 1, locationAddress=Address{id=1822, country=US, state=CA, description=San Jose - SJC01}, regions=[[keyname=FIRST_AVAILABLE, description=First Available], [keyname=SANJOSE, description=SJC01 - San Jose - West Coast U.S.]]}, 
Datacenter{id=224092, name=sng01, longName=Singapore 1, locationAddress=Address{id=2982, country=SG, state=null, description=Singapore - SNG01}, regions=[[keyname=SINGAPORE, description=SNG01 - Singapore - Southeast Asia]]}, 
Datacenter{id=265592, name=ams01, longName=Amsterdam 1, locationAddress=Address{id=3322, country=NL, state=null, description=Amsterdam - AMS01}, regions=[[keyname=AMSTERDAM, description=AMS01 - Amsterdam - Western Europe]]}
```

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r6909810

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
>     }
>  
>     @Test
>     public void testIdManyPrices() {
>        ProductItemPrice price1 = ProductItemPrice.builder().id(1234).build();
>        ProductItemPrice price2 = ProductItemPrice.builder().id(5678).build();
> -      ProductItem item = ProductItem.builder().prices(ImmutableSet.of(price1,price2)).build();
> -      assertEquals("1234",imageId().apply(item));
> +      ProductItem item = ProductItem.builder().id(1234).prices(ImmutableSet.of(price1,price2)).build();

Make this value different from the IDs of the two prices?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r7442768

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> Thanks for the update - will try to have a look today or tomorrow.

Couple more points I see:

- [ ] Fix [indents](https://github.com/jclouds/jclouds/pull/77/files#r7442791) in BaseSoftLayerClientLiveTest, AccountClientExpectTest and SoftLayerComputeServiceLiveTest
- [ ] Update [ProductItemToImageTest.testIdManyPrices](https://github.com/jclouds/jclouds/pull/77/files#r7442768)
- [ ] Small [formatting change](https://github.com/jclouds/jclouds/pull/77/files#r7000453) in SoftLayerComputeServiceLiveTest
- [ ] Add Javadoc details for [getReducedActivePackages](https://github.com/jclouds/jclouds/pull/77/files#r7441253)
- [ ] Add a code comment for the [odd ISO code](https://github.com/jclouds/jclouds/pull/77/files#r7441199)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-27805666

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -157,8 +141,6 @@ private void checkVirtualGuest(VirtualGuest vg) {
>        assert vg.getMaxCpu() > 0 : vg;
>        assert vg.getMaxCpuUnits() != null : vg;
>        assert vg.getMaxMemory() > 0 : vg;
> -      assert vg.getMetricPollDate() != null : vg;
> -      assert vg.getModifyDate() != null : vg;

OK, clear, thanks!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r7050036

Re: [jclouds] Fix provider softlayer (#77)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #789](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/789/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-26420827

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -91,7 +91,7 @@ protected Builder() {
>           .apiMetadata(new SoftLayerApiMetadata())
>           .homepage(URI.create("http://www.softlayer.com"))
>           .console(URI.create("https://manage.softlayer.com"))
> -         .iso3166Codes("SG","US-CA","US-TX","US-VA","US-WA","US-TX", "NL")
> +         .iso3166Codes("SG","US-CA","US-TX","US-VA","US-WA","US-TX", "NL", "NSFTW-IL")

Could we still have a code comment here?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r7000363

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrea Turli <no...@github.com>.
Ah sorry, didn't know that mostly because I've never used that feature.
Not sure it can help you, but this [link](http://sldn.softlayer.com/search/apachesolr_search/bare%20metal) shows that bare metal is an extra flag for most of the supported hardware. So maybe it is possible with the current implementation to provision them.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-28147167

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
>     }
>  
>     @Test
>     public void testIdManyPrices() {
>        ProductItemPrice price1 = ProductItemPrice.builder().id(1234).build();
>        ProductItemPrice price2 = ProductItemPrice.builder().id(5678).build();
> -      ProductItem item = ProductItem.builder().prices(ImmutableSet.of(price1,price2)).build();
> -      assertEquals("1234",imageId().apply(item));
> +      ProductItem item = ProductItem.builder().id(1234).prices(ImmutableSet.of(price1,price2)).build();
> +      assertEquals("Expected the ID of the ProductItemPrice to be returned", "1234",imageId().apply(item));

Message should be last. Also, space before the comma.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r6902366

Re: [jclouds] Fix provider softlayer (#77)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #295](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/295/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-26064450

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrea Turli <no...@github.com>.
I've addressed those two items locally, waiting for package renaming discussion clarification before pushing.

thanks @richardcloudsoft, I think I should have solved the formatting rules in my IDE.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-27950379

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> jclouds » jclouds #581 UNSTABLE

Interesting but probably unrelated [test failure](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/org.apache.jclouds$jclouds-core/581/testReport/junit/org.jclouds.http/BackoffLimitedRetryJavaTest/setUpJetty/)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-27923546

Re: [jclouds] Fix provider softlayer (#77)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #304](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/304/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-22481882

Re: [jclouds] Fix provider softlayer (#77)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #831](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/831/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-27808671

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
Thanks for the changes, @andreaturli! Two points still open in the checklist ;-)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-27932681

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -147,6 +145,8 @@ public Image getImage(VirtualGuest guest) {
>              return null;
>           Iterable<ProductItem> items = Iterables.transform(order.getPrices(), ProductItems.item());
>           ProductItem os = Iterables.find(items, ProductItemPredicates.categoryCode("os"));
> +          if (os.getPrices().isEmpty())
> +              return null;

Formatting - bad indent

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r7000388

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -44,8 +45,19 @@
>  @RequestFilters(BasicAuthentication.class)
>  @Path("/v{jclouds.api-version}")
>  public interface AccountAsyncClient {
> +   public static String ACTIVE_PACKAGE_MASK = "id;name";

If this is only used in one place, inline? After all, "objectMask" below is not a constant either.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r7000416

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrea Turli <no...@github.com>.
thanks @iliapolo! nope this is supposed to deal only with CCIs

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-28146758

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> +import org.jclouds.http.HttpResponse;
> +import org.jclouds.rest.internal.BaseRestClientExpectTest;
> +import org.jclouds.softlayer.SoftLayerClient;
> +import org.jclouds.softlayer.domain.ProductPackage;
> +import org.testng.annotations.Test;
> +
> +import java.net.URI;
> +
> +import static org.testng.Assert.assertEquals;
> +
> +/**
> + * 
> + * @author Adrian Cole
> + */
> +@Test(groups = "unit", testName = "AccountClientExpectTest")
> +public class AccountClientExpectTest extends BaseRestClientExpectTest<SoftLayerClient> {

Bad indents in this file

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r7000496

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> what.. no massive package rename to ibm.softlayer? :P

You mean "project bluewash"? ;-)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-27923609

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -91,7 +91,7 @@ protected Builder() {
>           .apiMetadata(new SoftLayerApiMetadata())
>           .homepage(URI.create("http://www.softlayer.com"))
>           .console(URI.create("https://manage.softlayer.com"))
> -         .iso3166Codes("SG","US-CA","US-TX","US-VA","US-WA","US-TX", "NL")
> +         .iso3166Codes("SG","US-CA","US-TX","US-VA","US-WA","US-TX", "NL", "NSFTW-IL")

Out of curiosity...what _is_ that ISO code?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r6901245

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -32,7 +32,7 @@
>  
>     /**
>      * 
> -    * @return Gets all the active packages.
> +    * @return return all the active packages.

[minor] `@return all the active packages.` should be enough

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r7000424

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrea Turli <no...@github.com>.
thanks @demobox: very nice work! 
I think I've now addressed all the remaining comments from your good looking list ;)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-27806996

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -157,8 +141,7 @@ private void checkVirtualGuest(VirtualGuest vg) {
>        assert vg.getMaxCpu() > 0 : vg;
>        assert vg.getMaxCpuUnits() != null : vg;
>        assert vg.getMaxMemory() > 0 : vg;
> -      assert vg.getMetricPollDate() != null : vg;
> -      assert vg.getModifyDate() != null : vg;
> +      // this can be null assert vg.getModifyDate() != null : vg;

What does this mean? Why are we not checking the modifyDate any more?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r6902489

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrea Turli <no...@github.com>.
@demobox thanks for your review and hints for the future.
Sorry about the 3-space indent rule violated too many times.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-26418172

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> Should this be cherry-picked to master?

@nacx: I'd prefer to see a new PR with some successful PR builds and, if possible, confirmation of a successful live test run..?


---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-28287406

Re: [jclouds] Fix provider softlayer (#77)

Posted by Adrian Cole <no...@github.com>.
what.. no massive package rename to ibm.softlayer? :P

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-24818642

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -44,6 +45,7 @@
>  @RequestFilters(BasicAuthentication.class)
>  @Path("/v{jclouds.api-version}")
>  public interface AccountAsyncClient {
> +   public static String ACTIVE_PACKAGE_MASK = "id;name";
>  
>     /**
>      * @see AccountClient#getActivePackages()

Wrong link?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r6902197

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -54,4 +57,11 @@ protected void checkUserMetadataContains(NodeMetadata node, ImmutableMap<String,
>     public void testOptionToNotBlock() {
>        // start call is blocking anyway.
>     }
> -}
> +
> +    @Override
> +    protected Properties setupProperties() {
> +        Properties properties = super.setupProperties();
> +        properties.setProperty("jclouds.ssh.max-retries", "20");
> +        return properties;
> +    }

Formatting (indent is wrong)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r6902272

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -42,4 +42,11 @@
>      */
>     Set<ProductPackage> getActivePackages();
>  
> +
> +   /**
> +    *
> +    * @return Gets all the active packages in a reduced version: only id and name (payload reduced via Object mask).
> +    */
> +   Set<ProductPackage> getActivePackagesReduced();

Also, perhaps "getReducedActivePackages" or some other name that indicates that "ActivePackages" are the still the main object being returned here?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r6902201

Re: [jclouds] Fix provider softlayer (#77)

Posted by ahgittin <no...@github.com>.
>     }
>  
>     @Test
>     public void testIdManyPrices() {
>        ProductItemPrice price1 = ProductItemPrice.builder().id(1234).build();
>        ProductItemPrice price2 = ProductItemPrice.builder().id(5678).build();
> -      ProductItem item = ProductItem.builder().prices(ImmutableSet.of(price1,price2)).build();
> -      assertEquals("1234",imageId().apply(item));
> +      ProductItem item = ProductItem.builder().id(1234).prices(ImmutableSet.of(price1,price2)).build();
> +      assertEquals("Expected the ID of the ProductItemPrice to be returned", "1234",imageId().apply(item));

@andreaturli yes i think you're right: the `org.testng.Assert` assert methods are the preferred ones, not `AssertJUnit`

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r6910423

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -91,7 +91,7 @@ protected Builder() {
>           .apiMetadata(new SoftLayerApiMetadata())
>           .homepage(URI.create("http://www.softlayer.com"))
>           .console(URI.create("https://manage.softlayer.com"))
> -         .iso3166Codes("SG","US-CA","US-TX","US-VA","US-WA","US-TX", "NL")
> +         .iso3166Codes("SG","US-CA","US-TX","US-VA","US-WA","US-TX", "NL", "NSFTW-IL")

> Could we still have a code comment here?

I'd still be grateful if we could have a comment here, as this certainly looks like a strange ISO code. Is there any reason you'd like to prevent having a comment at this location?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r7441199

Re: [jclouds] Fix provider softlayer (#77)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #591](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/591/) UNSTABLE
Looks like there's a problem with this pull request
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-27953724

Re: [jclouds] Fix provider softlayer (#77)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #240](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/240/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-21847774

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrea Turli <no...@github.com>.
@demobox I've addressed your comments, what do you guys think now?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-22495405

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -42,4 +42,11 @@
>      */
>     Set<ProductPackage> getActivePackages();
>  
> +
> +   /**
> +    *
> +    * @return Gets all the active packages in a reduced version: only id and name (payload reduced via Object mask).

`@return all the...`?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r6902207

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -189,16 +188,16 @@ public void testNoDescription() {
>     @Test
>     public void testId() {
>        ProductItemPrice price = ProductItemPrice.builder().id(1234).build();
> -      ProductItem item = ProductItem.builder().prices(price).build();
> -      assertEquals("1234",imageId().apply(item));
> +      ProductItem item = ProductItem.builder().id(5678).prices(price).build();
> +      assertEquals("Expected the ID of the ProductItemPrice to be returned", "1234",imageId().apply(item));

Message comes [last](http://testng.org/javadoc/org/testng/Assert.html#assertEquals(boolean, boolean, java.lang.String\))?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r6902346

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -179,7 +176,8 @@ public Integer apply(String description) {
>           public String apply(ProductItem productItem) {
>              checkNotNull(productItem, "productItem");
>              ProductItemPrice price = ProductItems.price().apply(productItem);
> -            return "" + price.getId();
> +            checkNotNull(price, "price");
> +            return String.valueOf(price.getId());

Combine into `return String.valueOf(checkNotNull(price, "price").getId());`?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r7000372

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
Thanks for the changes. A couple of further comments:

* are we missing a test for getActivePackagesReduced?
* please ensure your indents match the jclouds code formatting standard
* if we're using TestNG asserts in _some_ places in this code (and we are), please use them for _all_ asserts

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-26095758

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> Hey guys. any reason this pull request is not accepted yet?

@iliapolo: Now that I see the main remaining TODO item has been resolved, there should be no reason, no! I'll try to merge this in the course of the day...

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-28154396

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
Committed to [1.6.x](https://git-wip-us.apache.org/repos/asf?p=jclouds.git;a=commit;h=f278450355bbaa95c841c2f857a528091b90d723) and updated [JCLOUDS-213](https://issues.apache.org/jira/browse/JCLOUDS-213). Thanks, @andreaturli!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-28154779

Re: [jclouds] Fix provider softlayer (#77)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #135](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/135/) FAILURE
Looks like there's a problem with this pull request

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-22480007

Re: [jclouds] Fix provider softlayer (#77)

Posted by Eli Polonsky <no...@github.com>.
can this pull request also provision bare metal instances on softlayer? 


---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-28146523

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -66,9 +69,9 @@ protected SoftLayerClient create(Properties props, Iterable<Module> modules) {
>     }
>  
>     @Test
> -   public void testListLocations() {
> -      assertFalse(Iterables.isEmpty(adapter.listLocations()));
> -   }
> +       public void testListLocations() {

Formatting

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r6902238

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrea Turli <no...@github.com>.
@demobox @ahgittin @aledsage all your comments have been addressed in my last commit. Please let me know if it is mergeable :)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-26062683

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrea Turli <no...@github.com>.
Thanks @aledsage @mattstep @demobox for your review. I've addressed your comments.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-21845986

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -52,7 +54,16 @@
>     @Path("/SoftLayer_Account/ActivePackages.json")
>     @Consumes(MediaType.APPLICATION_JSON)
>     @Fallback(NullOnNotFoundOr404.class)
> -   ListenableFuture<Set<ProductPackage>> getActivePackages();
> +   @QueryParams(keys = "objectMask", values = ACTIVE_PACKAGE_MASK)
> +   ListenableFuture<Set<ProductPackage>> getActivePackagesReduced();

What is an `ActivePackageReduced`? A "lightweight" version with only some of the fields filled in? In that case, some Javadoc to describe the difference?

Also, perhaps "getReducedActivePackages" or some other name that indicates that "ActivePackages" are the still the main object being returned here?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r6901348

Re: [jclouds] Fix provider softlayer (#77)

Posted by Aled Sage <no...@github.com>.
For the patch I suggested higher up... I've confirmed that without it I get the same error calling`computeService.listNodes()`, and that with the patch it does still list all of the VMs shown in https://manage.softlayer.com/CloudLayer/computing.

Agree with @ahginnin about BM versus GB, but suggest that be done in a different pull request.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-23939588

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -179,7 +176,7 @@ public Integer apply(String description) {
>           public String apply(ProductItem productItem) {
>              checkNotNull(productItem, "productItem");
>              ProductItemPrice price = ProductItems.price().apply(productItem);
> -            return "" + price.getId();
> +            return Objects.firstNonNull(price.getId() + "", "");

Isn't `price.getId() + ""` _always_ going to be non-null?
```
System.out.println((null + "") == null); // prints false
```

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r5508163

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> jclouds » jclouds #591 UNSTABLE

Looks like an unrelated [test failure](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/org.apache.jclouds$jclouds-core/591/testReport/junit/org.jclouds.rest.functions/PresentWhenApiVersionLexicographicallyAtOrAfterSinceApiVersionTest/testCacheIsFasterWhenNoAnnotationPresent/), by the way.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-28154466

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrea Turli <no...@github.com>.
Thanks @demobox 

I thought when Adrian said "what.. no massive package rename to ibm.softlayer? :P" he was joking, isn't he?
if we rename the packages, what about the project (pom.xml should change as well?)

Thanks again

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-27946323

Re: [jclouds] Fix provider softlayer (#77)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #581](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/581/) UNSTABLE
Looks like there's a problem with this pull request
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-27810616

Re: [jclouds] Fix provider softlayer (#77)

Posted by Matt Stephenson <no...@github.com>.
Either is fine, just for the future, break it into separate commits.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-21820886

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrea Turli <no...@github.com>.
>     }
>  
>     @Test
>     public void testIdManyPrices() {
>        ProductItemPrice price1 = ProductItemPrice.builder().id(1234).build();
>        ProductItemPrice price2 = ProductItemPrice.builder().id(5678).build();
> -      ProductItem item = ProductItem.builder().prices(ImmutableSet.of(price1,price2)).build();
> -      assertEquals("1234",imageId().apply(item));
> +      ProductItem item = ProductItem.builder().id(1234).prices(ImmutableSet.of(price1,price2)).build();
> +      assertEquals("Expected the ID of the ProductItemPrice to be returned", "1234",imageId().apply(item));

`org.testng.AssertJUnit` contains this method:
```
static public void assertEquals(String message, Object expected, Object actual)
```

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r6909976

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -31,4 +41,31 @@
>     public BaseSoftLayerClientLiveTest() {
>        this.provider = "softlayer";
>     }
> +
> +   public void checkProductItem(ProductItem item) {
> +       assertTrue(item.getId() > 0, "item id must be more than 0");
> +       assertNotNull(item.getDescription(), "item description must be not null");
> +       checkCategories(item.getCategories());
> +       // units and capacity may be null
> +       assertTrue(item.getPrices().size() >= 0);

Use `!...isEmpty()` or `assertFalse(...isEmpty()`?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r7000520

Re: [jclouds] Fix provider softlayer (#77)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #368](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/368/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-27808650

Re: [jclouds] Fix provider softlayer (#77)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #233](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/233/) SUCCESS
This pull request looks good

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-24801755

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -31,4 +39,31 @@
>     public BaseSoftLayerClientLiveTest() {
>        this.provider = "softlayer";
>     }
> +
> +   public void checkProductItem(ProductItem item) {
> +       assertTrue(item.getId() > 0, "item id must be more than 0");
> +       assertNotNull(item.getDescription(), "item description must be not null");
> +       checkCategories(item.getCategories());
> +       // units and capacity may be null
> +       assertFalse(item.getPrices().isEmpty());
> +       for (ProductItemPrice price : item.getPrices()) {
> +          checkPrice(price);
> +       }

Indent

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r7482124

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
>   * @author Adrian Cole
>   */
> -@Test(groups = "live", enabled = true, sequential = true)
> +

Remove blank line

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r7000453

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrea Turli <no...@github.com>.
@demobox thanks again for your review. Any progress on this?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-27773540

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -128,4 +131,11 @@ protected void tearDown() {
>     protected Iterable<Module> setupModules() {
>        return ImmutableSet.<Module> of(getLoggingModule(), new SshjSshClientModule());
>     }
> +
> +    @Override
> +    protected Properties setupProperties() {
> +       Properties properties = super.setupProperties();
> +       properties.setProperty("jclouds.ssh.max-retries", "10");
> +       return properties;
> +    }

Formatting - bad indent

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r7000444

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -42,4 +42,11 @@
>      */
>     Set<ProductPackage> getActivePackages();
>  
> +
> +   /**
> +    *
> +    * @return return all the active packages in a reduced version: only id and name.

See above

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r7000428

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -166,4 +150,22 @@ private void checkVirtualGuest(VirtualGuest vg) {
>        assert vg.getPrimaryIpAddress() != null : vg;
>     }
>  
> +   private Iterable<ProductItemPrice> getPrices(Template template, ProductPackage productPackage) {
> +      Builder<ProductItemPrice> result = ImmutableSet.builder();
> +
> +      int imageId = Integer.parseInt(template.getImage().getId());
> +      result.add(ProductItemPrice.builder().id(imageId).build());
> +
> +      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());
> +      }
> +      Float portSpeed = 10f;

`float portSpeed`?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r5494209

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -54,4 +57,11 @@ protected void checkUserMetadataContains(NodeMetadata node, ImmutableMap<String,
>     public void testOptionToNotBlock() {
>        // start call is blocking anyway.
>     }
> -}
> +
> +    @Override
> +    protected Properties setupProperties() {
> +       Properties properties = super.setupProperties();
> +       properties.setProperty("jclouds.ssh.max-retries", "20");
> +       return properties;
> +    }

Formatting - bad indent

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r7000462

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -189,7 +188,7 @@ public void testNoDescription() {
>     @Test
>     public void testId() {
>        ProductItemPrice price = ProductItemPrice.builder().id(1234).build();

Actually, as far as I can see from [the code](https://github.com/jclouds/jclouds/blob/master/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/ProductItemToImage.java#L182), the ID that is returned is that of _the ProductItemPrice_, **not** the _ProductItem_. If that is the intention, this test should remain unchanged or even be something like
```
ProductItemPrice price = ProductItemPrice.builder().id(1234).build();
ProductItem item = ProductItem.builder().id(2345).prices(price).build();
assertEquals("1234", imageId().apply(item), "Expected the ID of the ProductItemPrice to be returned");
```

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r5494191

Re: [jclouds] Fix provider softlayer (#77)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #694](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/694/) UNSTABLE
Looks like there's a problem with this pull request

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-24801769

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -207,12 +179,4 @@ private void checkAddress(Address address) {
>        if (!ImmutableSet.of("SG", "NL").contains(address.getCountry()))
>           assert address.getState() != null : address;
>     }
> -
> -   private void checkCategories(Set<ProductItemCategory> categories) {
> -      for (ProductItemCategory category : categories) {
> -         assert category.getId() > 0 : category;
> -         assert category.getName() != null : category;
> -         assert category.getCategoryCode() != null : category;
> -      }
> -   }

Please use TestNG [asserts](http://testng.org/javadoc/org/testng/Assert.html) here also...or is there any significant reason not to?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r6902455

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
Thanks for the changes, @andreaturli. Two quick comments:
* jclouds is moving away from Expect-style tests in favour or mockwebserver tests. I think we're find for this PR, but just as a pointer for future tests
* please ensure any new code is properly formatting with a 3-space indent. Having to pick out lots of 4-space indents here and there makes it harder to focus on the actual changes in a review :-(

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77#issuecomment-26416495

Re: [jclouds] Fix provider softlayer (#77)

Posted by Andrew Phillips <no...@github.com>.
> @@ -16,6 +16,18 @@
>   */
>  package org.jclouds.softlayer.compute.functions;
>  
> +import com.google.common.collect.ImmutableSet;
> +import org.jclouds.compute.domain.Image;
> +import org.jclouds.compute.domain.OperatingSystem;
> +import org.jclouds.compute.domain.OsFamily;
> +import org.jclouds.softlayer.domain.ProductItem;
> +import org.jclouds.softlayer.domain.ProductItemPrice;
> +import org.testng.annotations.Test;
> +
> +import java.util.Arrays;
> +import java.util.List;
> +import java.util.NoSuchElementException;
> +

Spurious import reordering? Please preserve the initial order and ensure the diff only contains _changes_ to the import set. Thanks!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/77/files#r6902311