Fix distribution tests in the face of many javas.

Review Request #3778 - Created April 28, 2016 and submitted

Information
John Sirois
pants
jsirois/distribution/fix_tests/distribution_environment
2894, 3296
095cdfa...
Reviewers
pants-reviews
gmalmquist, patricklaw, peiyu, stuhood, zundel
Previously, the distribution test failed on machine with multiple java
distributions installed.  This change re-factors `DistributionLocator`
into a thin factory class that produces a `_Locator` from option values.
This results in a more easily testable system.

 src/python/pants/java/distribution/distribution.py                         | 442 ++++++++++++++++++++++++++++++--------------------
 tests/python/pants_test/backend/jvm/tasks/test_junit_run_integration.py    |   2 +-
 tests/python/pants_test/java/distribution/test_distribution.py             | 277 ++++++++++---------------------
 tests/python/pants_test/java/distribution/test_distribution_integration.py |  98 ++++++-----
 4 files changed, 406 insertions(+), 413 deletions(-)

In the context of my machine, which has:

$ archlinux-java status
Available Java environments:
  java-6-jdk
  java-7-jdk
  java-7-openjdk
  java-8-jdk
  java-8-openjdk (default)
  java-9-jdk

Previously failed quite solidly:

./pants test.pytest --no-timeouts tests/python/pants_test/java/distribution/::
...
 ===== 17 failed, 43 passed in 83.05 seconds ======
...

Now green.

CI went green here:
https://travis-ci.org/pantsbuild/pants/builds/127109011

John Sirois
John Sirois
John Sirois
John Sirois
Stu Hood
John Sirois
John Sirois
John Sirois
Peiyu Wang
John Sirois
Review request changed

Status: Closed (submitted)

Change Summary:

Now on master:

git log -1 origin/master
commit e6fca77674554e516cfb358d1b395986acd3f7e7
Author: John Sirois <john.sirois@gmail.com>
Date:   Mon May 2 14:27:50 2016 -0600

    Fix distribution tests in the face of many javas.
    
    Previously, the distribution test failed on machine with multiple java
    distributions installed.  This change re-factors `DistributionLocator`
    into a thin factory class that produces a `_Locator` from option values.
    This results in a more easily testable system.
    
    Testing Done:
    In the context of my machine, which has:
    ```
    $ archlinux-java status
    Available Java environments:
      java-6-jdk
      java-7-jdk
      java-7-openjdk
      java-8-jdk
      java-8-openjdk (default)
      java-9-jdk
    ```
    
    Previously failed quite solidly:
    ```
    ./pants test.pytest --no-timeouts tests/python/pants_test/java/distribution/::
    ...
     ===== 17 failed, 43 passed in 83.05 seconds ======
    ...
    ```
    
    Now green.
    
    CI went green here:
      https://travis-ci.org/pantsbuild/pants/builds/127109011
    
    Bugs closed: 2894, 3296
    
    Reviewed at https://rbcommons.com/s/twitter/r/3778/
Loading...