You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by britter <gi...@git.apache.org> on 2016/09/10 13:14:20 UTC
[GitHub] maven-surefire pull request #120: Add convinient method to check for the cur...
GitHub user britter opened a pull request:
https://github.com/apache/maven-surefire/pull/120
Add convinient method to check for the currently used Java Version
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/britter/maven-surefire assume-java-version
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/maven-surefire/pull/120.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #120
----
commit ff951f9dd2836101ce0df86b79da76bc51c2996b
Author: Benedikt Ritter <be...@gmail.com>
Date: 2016-09-10T13:13:24Z
Add convinient method to check for the currently used Java Version
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
[GitHub] maven-surefire pull request #120: Add convinient method to check for the cur...
Posted by Tibor17 <gi...@git.apache.org>.
Github user Tibor17 commented on a diff in the pull request:
https://github.com/apache/maven-surefire/pull/120#discussion_r78302041
--- Diff: surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java ---
@@ -159,4 +164,10 @@ public static IntegrationTestSuiteResults parseReportList( List<ReportTestSuite>
throw new RuntimeException( "Couldn't parse XML reports", e );
}
}
+
+ public static void assumeJavaVersion(JavaVersion version)
+ {
+ assumeThat( "java.specification.version: ",
+ SystemUtils.JAVA_SPECIFICATION_VERSION, is( greaterThanOrEqualTo( version.toString() ) ) );
--- End diff --
Unfortunately `org.apache.commons.lang3.JavaVersion` is not `Comparable`. How would this work with string `1.10`? JDK 9, I guess, returns `9` instead of `1.9`. Did you try? If so then such lexical comparison should be fine. JDK 10 I hope will follow the same pattern. Version `10.1` bigger than `10`. Are you facing any problem with lexicographic comparison?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
[GitHub] maven-surefire pull request #120: Add convinient method to check for the cur...
Posted by Tibor17 <gi...@git.apache.org>.
Github user Tibor17 commented on a diff in the pull request:
https://github.com/apache/maven-surefire/pull/120#discussion_r79310840
--- Diff: surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java ---
@@ -172,7 +173,7 @@ public static IntegrationTestSuiteResults parseReportList( List<ReportTestSuite>
public static void assumeJavaVersion( JavaVersion version )
{
- assumeThat( "java.specification.version: ",
- JAVA_SPECIFICATION_VERSION, is( greaterThanOrEqualTo( version.toString() ) ) );
+ assumeTrue( "java.specification.version: " + JAVA_SPECIFICATION_VERSION,
+ SystemUtils.isJavaVersionAtLeast( version ) );
--- End diff --
Yes this is cool. Thx.
I will come back to your PRs soon.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
[GitHub] maven-surefire issue #120: Add convinient method to check for the currently ...
Posted by Tibor17 <gi...@git.apache.org>.
Github user Tibor17 commented on the issue:
https://github.com/apache/maven-surefire/pull/120
@britter
Thank you for contributing.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
[GitHub] maven-surefire issue #120: Add convinient method to check for the currently ...
Posted by Tibor17 <gi...@git.apache.org>.
Github user Tibor17 commented on the issue:
https://github.com/apache/maven-surefire/pull/120
>>Did you know, that it is possible to mark PRs as merged in GitHub?
I don't see such option in GUI. Is not it because of we are not the owner of this repo `apache`?
Maybe they sould make be ASF member, however I am in ASF Maven group.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
[GitHub] maven-surefire pull request #120: Add convinient method to check for the cur...
Posted by britter <gi...@git.apache.org>.
Github user britter commented on a diff in the pull request:
https://github.com/apache/maven-surefire/pull/120#discussion_r78354537
--- Diff: surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java ---
@@ -159,4 +164,10 @@ public static IntegrationTestSuiteResults parseReportList( List<ReportTestSuite>
throw new RuntimeException( "Couldn't parse XML reports", e );
}
}
+
+ public static void assumeJavaVersion(JavaVersion version)
+ {
+ assumeThat( "java.specification.version: ",
+ SystemUtils.JAVA_SPECIFICATION_VERSION, is( greaterThanOrEqualTo( version.toString() ) ) );
--- End diff --
I'll update this, but I won't get to it before Friday/Saturday. Stay tuned \U0001f60e
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
[GitHub] maven-surefire pull request #120: Add convinient method to check for the cur...
Posted by Tibor17 <gi...@git.apache.org>.
Github user Tibor17 commented on a diff in the pull request:
https://github.com/apache/maven-surefire/pull/120#discussion_r79314476
--- Diff: surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java ---
@@ -172,7 +173,7 @@ public static IntegrationTestSuiteResults parseReportList( List<ReportTestSuite>
public static void assumeJavaVersion( JavaVersion version )
{
- assumeThat( "java.specification.version: ",
- JAVA_SPECIFICATION_VERSION, is( greaterThanOrEqualTo( version.toString() ) ) );
+ assumeTrue( "java.specification.version: " + JAVA_SPECIFICATION_VERSION,
+ SystemUtils.isJavaVersionAtLeast( version ) );
--- End diff --
I am running the build _mvn install -Prun-its_, let's wait for the result.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
[GitHub] maven-surefire pull request #120: Add convinient method to check for the cur...
Posted by britter <gi...@git.apache.org>.
Github user britter closed the pull request at:
https://github.com/apache/maven-surefire/pull/120
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
[GitHub] maven-surefire pull request #120: Add convinient method to check for the cur...
Posted by Tibor17 <gi...@git.apache.org>.
Github user Tibor17 commented on a diff in the pull request:
https://github.com/apache/maven-surefire/pull/120#discussion_r78301886
--- Diff: surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java ---
@@ -159,4 +164,10 @@ public static IntegrationTestSuiteResults parseReportList( List<ReportTestSuite>
throw new RuntimeException( "Couldn't parse XML reports", e );
}
}
+
+ public static void assumeJavaVersion(JavaVersion version)
+ {
+ assumeThat( "java.specification.version: ",
--- End diff --
Nice PR. Maybe `SystemUtils.JAVA_SPECIFICATION_VERSION + ": ` instead. Do you like static imports?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
[GitHub] maven-surefire pull request #120: Add convinient method to check for the cur...
Posted by Tibor17 <gi...@git.apache.org>.
Github user Tibor17 commented on a diff in the pull request:
https://github.com/apache/maven-surefire/pull/120#discussion_r78351427
--- Diff: surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java ---
@@ -159,4 +164,10 @@ public static IntegrationTestSuiteResults parseReportList( List<ReportTestSuite>
throw new RuntimeException( "Couldn't parse XML reports", e );
}
}
+
+ public static void assumeJavaVersion(JavaVersion version)
+ {
+ assumeThat( "java.specification.version: ",
+ SystemUtils.JAVA_SPECIFICATION_VERSION, is( greaterThanOrEqualTo( version.toString() ) ) );
--- End diff --
I would not use JDK 9 for such simple comparison.
Back to `SystemUtils.JAVA_SPECIFICATION_VERSION, is( greaterThanOrEqualTo( version.toString() ) ) );`
It's matter of taste if you just compare strings or float numbers. Comparing float numbers would make me sleep better.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
[GitHub] maven-surefire issue #120: Add convinient method to check for the currently ...
Posted by britter <gi...@git.apache.org>.
Github user britter commented on the issue:
https://github.com/apache/maven-surefire/pull/120
@Tibor17 thank you for integrating this. Did you know, that it is possible to mark PRs as merged in GitHub? I've documented the workflow in the [Apache Commons Wiki](http://wiki.apache.org/commons/UsingGIT#Applying_Pull_Requests_.28for_git_based_components.29).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
[GitHub] maven-surefire pull request #120: Add convinient method to check for the cur...
Posted by britter <gi...@git.apache.org>.
Github user britter commented on a diff in the pull request:
https://github.com/apache/maven-surefire/pull/120#discussion_r78776416
--- Diff: surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java ---
@@ -159,4 +164,10 @@ public static IntegrationTestSuiteResults parseReportList( List<ReportTestSuite>
throw new RuntimeException( "Couldn't parse XML reports", e );
}
}
+
+ public static void assumeJavaVersion(JavaVersion version)
+ {
+ assumeThat( "java.specification.version: ",
--- End diff --
I've added the static import.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
[GitHub] maven-surefire pull request #120: Add convinient method to check for the cur...
Posted by britter <gi...@git.apache.org>.
Github user britter commented on a diff in the pull request:
https://github.com/apache/maven-surefire/pull/120#discussion_r78336717
--- Diff: surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java ---
@@ -159,4 +164,10 @@ public static IntegrationTestSuiteResults parseReportList( List<ReportTestSuite>
throw new RuntimeException( "Couldn't parse XML reports", e );
}
}
+
+ public static void assumeJavaVersion(JavaVersion version)
+ {
+ assumeThat( "java.specification.version: ",
+ SystemUtils.JAVA_SPECIFICATION_VERSION, is( greaterThanOrEqualTo( version.toString() ) ) );
--- End diff --
Hello @Tibor17
> Unfortunately org.apache.commons.lang3.JavaVersion is not Comparable
Java enums are comparable by default.
> How would this work with string 1.10? [...]
I'm currently working on Commons Lang Release 3.5 which I expect to be ready in two weeks or so. Commons Lang 3.5 will have full Java 9 support with regards to version number. Furthermore it will have a better API for comparing the current version against a desired version:
```
if(JavaVersion.CURRENT.atLeast(JavaVersion.JAVA_1_8)) {
// do something only possible with Java 8
}
```
I suggest to apply this for now so I can finish the junit-5 IT PR with this new check API. I will provide a PR for updating this again to the new API introduced in Commons Lang 3.5 when Lang 3.5 is ready. Makes sense?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
[GitHub] maven-surefire issue #120: Add convinient method to check for the currently ...
Posted by britter <gi...@git.apache.org>.
Github user britter commented on the issue:
https://github.com/apache/maven-surefire/pull/120
@Tibor17 you have to follow the workflow described [here](http://wiki.apache.org/commons/UsingGIT#Applying_Pull_Requests_.28for_git_based_components.29). It's not possible to merge using the UI.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
[GitHub] maven-surefire issue #120: Add convinient method to check for the currently ...
Posted by Tibor17 <gi...@git.apache.org>.
Github user Tibor17 commented on the issue:
https://github.com/apache/maven-surefire/pull/120
@britter
I have created Jira issue for this Task
https://issues.apache.org/jira/browse/SUREFIRE-1282
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
[GitHub] maven-surefire issue #120: Add convinient method to check for the currently ...
Posted by britter <gi...@git.apache.org>.
Github user britter commented on the issue:
https://github.com/apache/maven-surefire/pull/120
Hello @Tibor17
I've addressed you're comment about comparing Strings. There already is an API for comparing JavaVersions in SystemUtils. Hope you like this.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
[GitHub] maven-surefire pull request #120: Add convinient method to check for the cur...
Posted by britter <gi...@git.apache.org>.
Github user britter commented on a diff in the pull request:
https://github.com/apache/maven-surefire/pull/120#discussion_r78775898
--- Diff: surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java ---
@@ -159,4 +164,10 @@ public static IntegrationTestSuiteResults parseReportList( List<ReportTestSuite>
throw new RuntimeException( "Couldn't parse XML reports", e );
}
}
+
+ public static void assumeJavaVersion(JavaVersion version)
+ {
+ assumeThat( "java.specification.version: ",
--- End diff --
Hey Tibor,
do you mean to use a constant instead of the string in the message part of `assumeThat`? There is no constant for the property name in Commons Lang. But I could introduce one in `HelperAssertions` or we could extend SystemUtils, but then we have to wait for the next release of Commons Lang.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org