--- old/./README.md 2018-09-06 11:13:39.000000000 +0530
+++ new/./README.md 2018-09-06 11:13:39.000000000 +0530
@@ -192,6 +192,9 @@
Then in another terminal (in the project root):
```bash
+cd core
+mvn clean install
+cd ..
mvn package
```
Note that you may need to define proxy settings if you happen to be behind a firewall. In your ~/.m2/settings.xml file (if you have none, simply create one), add:
--- old/application/org.openjdk.jmc.rjmx/META-INF/MANIFEST.MF 2018-09-06 11:13:40.000000000 +0530
+++ new/application/org.openjdk.jmc.rjmx/META-INF/MANIFEST.MF 2018-09-06 11:13:40.000000000 +0530
@@ -9,6 +9,7 @@
Import-Package: javax.mail,
javax.mail.internet
Export-Package: org.openjdk.jmc.rjmx,
+ org.openjdk.jmc.common,
org.openjdk.jmc.rjmx.actionprovider;
x-friends:="org.openjdk.jmc.console.ui,
org.openjdk.jmc.joverflow.ui,
@@ -48,7 +49,8 @@
org.openjdk.jmc.rjmx.triggers.internal;x-friends:="org.openjdk.jmc.alert,org.openjdk.jmc.console.ui.notification,org.openjdk.jmc.rjmx.test",
org.openjdk.jmc.rjmx.util.internal;x-friends:="org.openjdk.jmc.console.ui.mbeanbrowser,org.openjdk.jmc.console.ui,org.openjdk.jmc.rjmx.ui"
Require-Bundle: org.openjdk.jmc.ui.common;visibility:=reexport,
- org.openjdk.jmc.commands
+ org.openjdk.jmc.commands,
+ org.openjdk.jmc.common
Bundle-Vendor: Oracle Corporation
Bundle-Localization: plugin
Bundle-ActivationPolicy: lazy
--- old/application/pom.xml 2018-09-06 11:13:41.000000000 +0530
+++ new/application/pom.xml 2018-09-06 11:13:41.000000000 +0530
@@ -115,9 +115,46 @@
uitests
-
+
1.8
1.8
+
+
+
+ org.openjdk.jmc
+ common
+ 7.0.0-SNAPSHOT
+
+
+
+ org.openjdk.jmc
+ flightrecorder
+ 7.0.0-SNAPSHOT
+
+
+ org.openjdk.jmc
+ flightrecorder.rules
+ 7.0.0-SNAPSHOT
+
+
+ org.openjdk.jmc
+ flightrecorder.rules.jdk
+ 7.0.0-SNAPSHOT
+
+
+
+
+
+
+ org.eclipse.tycho
+ target-platform-configuration
+ ${tycho-version}
+
+ consider
+
+
+
+
--- old/application/tests/org.openjdk.jmc.flightrecorder.controlpanel.ui.test/META-INF/MANIFEST.MF 2018-09-06 11:13:42.000000000 +0530
+++ new/application/tests/org.openjdk.jmc.flightrecorder.controlpanel.ui.test/META-INF/MANIFEST.MF 2018-09-06 11:13:42.000000000 +0530
@@ -7,12 +7,12 @@
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Require-Bundle: org.junit,
- org.openjdk.jmc.common.test,
org.openjdk.jmc.rjmx.test,
org.openjdk.jmc.flightrecorder.configuration,
org.openjdk.jmc.flightrecorder.controlpanel.ui,
org.openjdk.jmc.flightrecorder.controlpanel.ui.configuration,
org.openjdk.jmc.rjmx.services.jfr,
- org.openjdk.jmc.rjmx.services.jfr.test
+ org.openjdk.jmc.rjmx.services.jfr.test,
+ org.openjdk.jmc.ui.common
Automatic-Module-Name: org.openjdk.jmc.flightrecorder.controlpanel.ui.test
Import-Package: org.openjdk.jmc.flightrecorder.jdk
--- old/application/tests/org.openjdk.jmc.rjmx.services.jfr.test/META-INF/MANIFEST.MF 2018-09-06 11:13:43.000000000 +0530
+++ new/application/tests/org.openjdk.jmc.rjmx.services.jfr.test/META-INF/MANIFEST.MF 2018-09-06 11:13:42.000000000 +0530
@@ -7,7 +7,6 @@
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Require-Bundle: org.junit,
- org.openjdk.jmc.common.test,
org.openjdk.jmc.rjmx.test,
org.openjdk.jmc.rjmx.services.jfr,
org.openjdk.jmc.rjmx,
--- old/application/tests/org.openjdk.jmc.rjmx.test/META-INF/MANIFEST.MF 2018-09-06 11:13:43.000000000 +0530
+++ new/application/tests/org.openjdk.jmc.rjmx.test/META-INF/MANIFEST.MF 2018-09-06 11:13:43.000000000 +0530
@@ -8,7 +8,8 @@
Bundle-ActivationPolicy: lazy
Require-Bundle: org.junit,
org.openjdk.jmc.rjmx,
- org.openjdk.jmc.common.test
+ org.openjdk.jmc.common
Export-Package: org.openjdk.jmc.rjmx.test,
- org.openjdk.jmc.rjmx.test.testutil
+ org.openjdk.jmc.rjmx.test.testutil,
+ org.openjdk.jmc.common.test
Automatic-Module-Name: org.openjdk.jmc.rjmx.test
--- old/application/tests/org.openjdk.jmc.ui.test/META-INF/MANIFEST.MF 2018-09-06 11:13:44.000000000 +0530
+++ new/application/tests/org.openjdk.jmc.ui.test/META-INF/MANIFEST.MF 2018-09-06 11:13:44.000000000 +0530
@@ -8,5 +8,9 @@
Bundle-ActivationPolicy: lazy
Require-Bundle: org.junit,
org.openjdk.jmc.ui,
- org.openjdk.jmc.common.test
+ org.openjdk.jmc.rjmx.test
Automatic-Module-Name: org.openjdk.jmc.ui.test
+Import-Package: org.openjdk.jmc.common,
+ org.openjdk.jmc.common.unit,
+ org.openjdk.jmc.common.util,
+ org.openjdk.jmc.common.version
--- old/core/org.openjdk.jmc.common/pom.xml 2018-09-06 11:13:45.000000000 +0530
+++ new/core/org.openjdk.jmc.common/pom.xml 2018-09-06 11:13:45.000000000 +0530
@@ -38,34 +38,5 @@
missioncontrol.core
7.0.0-SNAPSHOT
- org.openjdk.jmc.common
- eclipse-plugin
-
-
-
- org.sonatype.plugins
- nexus-staging-maven-plugin
- 1.6.8
- true
-
- jmc-publish-snapshot
- true
-
-
-
- org.apache.maven.plugins
- maven-gpg-plugin
- 1.6
-
-
- gpg-sign
- deploy
-
- sign
-
-
-
-
-
-
+ common
--- old/core/org.openjdk.jmc.flightrecorder.rules.jdk/pom.xml 2018-09-06 11:13:46.000000000 +0530
+++ new/core/org.openjdk.jmc.flightrecorder.rules.jdk/pom.xml 2018-09-06 11:13:46.000000000 +0530
@@ -38,34 +38,36 @@
missioncontrol.core
7.0.0-SNAPSHOT
- org.openjdk.jmc.flightrecorder.rules.jdk
- eclipse-plugin
+ flightrecorder.rules.jdk
+
+
+ org.openjdk.jmc
+ common
+ ${project.version}
+
+
+ org.openjdk.jmc
+ flightrecorder
+ ${project.version}
+
+
+ org.openjdk.jmc
+ flightrecorder.rules
+ ${project.version}
+
+
+
-
-
- org.sonatype.plugins
- nexus-staging-maven-plugin
- 1.6.8
- true
-
- jmc-publish-snapshot
- true
-
-
-
- org.apache.maven.plugins
- maven-gpg-plugin
- 1.6
-
-
- gpg-sign
- deploy
-
- sign
-
-
-
-
-
+
+
+ src/main/resources
+
+
+ .
+
+ plugin.xml
+
+
+
--- old/core/org.openjdk.jmc.flightrecorder.rules/pom.xml 2018-09-06 11:13:47.000000000 +0530
+++ new/core/org.openjdk.jmc.flightrecorder.rules/pom.xml 2018-09-06 11:13:46.000000000 +0530
@@ -38,34 +38,37 @@
missioncontrol.core
7.0.0-SNAPSHOT
- org.openjdk.jmc.flightrecorder.rules
- eclipse-plugin
+ flightrecorder.rules
+
+
+
+ org.openjdk.jmc
+ common
+ ${project.version}
+
+
+ org.openjdk.jmc
+ flightrecorder
+ ${project.version}
+
+
+ org.owasp.encoder
+ encoder
+ 1.2.1
+
+
+
-
-
- org.sonatype.plugins
- nexus-staging-maven-plugin
- 1.6.8
- true
-
- jmc-publish-snapshot
- true
-
-
-
- org.apache.maven.plugins
- maven-gpg-plugin
- 1.6
-
-
- gpg-sign
- deploy
-
- sign
-
-
-
-
-
+
+
+ src/main/resources
+
+
+ .
+
+ plugin.xml
+
+
+
--- old/core/org.openjdk.jmc.flightrecorder/pom.xml 2018-09-06 11:13:47.000000000 +0530
+++ new/core/org.openjdk.jmc.flightrecorder/pom.xml 2018-09-06 11:13:47.000000000 +0530
@@ -38,34 +38,13 @@
missioncontrol.core
7.0.0-SNAPSHOT
- org.openjdk.jmc.flightrecorder
- eclipse-plugin
-
-
-
- org.sonatype.plugins
- nexus-staging-maven-plugin
- 1.6.8
- true
-
- jmc-publish-snapshot
- true
-
-
-
- org.apache.maven.plugins
- maven-gpg-plugin
- 1.6
-
-
- gpg-sign
- deploy
-
- sign
-
-
-
-
-
-
+
+ flightrecorder
+
+
+ org.openjdk.jmc
+ common
+ ${project.version}
+
+
--- old/core/pom.xml 2018-09-06 11:13:48.000000000 +0530
+++ new/core/pom.xml 2018-09-06 11:13:48.000000000 +0530
@@ -33,13 +33,19 @@
-->
4.0.0
-
- org.openjdk.jmc
- missioncontrol
- 7.0.0-SNAPSHOT
-
+ org.openjdk.jmc
missioncontrol.core
+ 7.0.0-SNAPSHOT
pom
+
+
+ UTF-8
+ UTF-8
+ 1.7
+ 1.7
+ META-INF
+
+
org.openjdk.jmc.common
org.openjdk.jmc.flightrecorder
@@ -47,47 +53,66 @@
org.openjdk.jmc.flightrecorder.rules.jdk
tests
+
+
+
+ jmc-publish-snapshot
+ ${snapshot.repo}
+
+
+
+
+
+
+ maven-jar-plugin
+ 3.1.0
+
+
+ ${manifest-location}/MANIFEST.MF
+
+
+
+
+ org.apache.felix
+ maven-bundle-plugin
+ 3.5.1
+
+ ${manifest-location}
+
+
+
+
- org.apache.maven.plugins
- maven-source-plugin
- 3.0.1
-
-
- attach-sources
-
- jar
-
-
-
+ org.sonatype.plugins
+ nexus-staging-maven-plugin
+ 1.6.8
+ true
+
+ jmc-publish-snapshot
+ true
+
org.apache.maven.plugins
- maven-javadoc-plugin
- 3.0.0
+ maven-gpg-plugin
+ 1.6
- attach-javadocs
+ gpg-sign
+ deploy
- jar
+ sign
-
-
- -Xdoclint:all
- -Xdoclint:-missing
-
- *.internal
- true
- false
-
+
+
+ org.apache.felix
+ maven-bundle-plugin
+ 3.5.1
-
- 1.7
- 1.7
-
--- old/core/tests/org.openjdk.jmc.common.test/pom.xml 2018-09-06 11:13:49.000000000 +0530
+++ new/core/tests/org.openjdk.jmc.common.test/pom.xml 2018-09-06 11:13:49.000000000 +0530
@@ -38,6 +38,34 @@
missioncontrol.core.tests
7.0.0-SNAPSHOT
- org.openjdk.jmc.common.test
- eclipse-test-plugin
+ common.test
+ 7.0.0-SNAPSHOT
+ jar
+
+
+ org.openjdk.jmc
+ common
+ ${project.version}
+
+
+ junit
+ junit
+ test
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+
+ test-jar
+
+
+
+
+
+
--- old/core/tests/org.openjdk.jmc.flightrecorder.rules.jdk.test/pom.xml 2018-09-06 11:13:50.000000000 +0530
+++ new/core/tests/org.openjdk.jmc.flightrecorder.rules.jdk.test/pom.xml 2018-09-06 11:13:49.000000000 +0530
@@ -38,27 +38,69 @@
missioncontrol.core.tests
7.0.0-SNAPSHOT
- org.openjdk.jmc.flightrecorder.rules.jdk.test
- eclipse-test-plugin
+ flightrecorder.rules.jdk.test
+
+
+
+ org.openjdk.jmc
+ flightrecorder.rules.test
+ test-jar
+ test
+ ${project.version}
+
+
+ org.openjdk.jmc
+ flightrecorder.test
+ test-jar
+ test
+ ${project.version}
+
+
+ org.openjdk.jmc
+ common.test
+ test-jar
+ test
+ ${project.version}
+
+
+ org.openjdk.jmc
+ common
+ ${project.version}
+
+
+ org.openjdk.jmc
+ flightrecorder
+ ${project.version}
+
+
+ org.openjdk.jmc
+ flightrecorder.rules
+ ${project.version}
+
+
+ org.openjdk.jmc
+ flightrecorder.rules.jdk
+ ${project.version}
+
+
+ junit
+ junit
+ test
+
+
-
- org.eclipse.tycho
- target-platform-configuration
- ${tycho-version}
-
-
-
-
-
- eclipse-plugin
- org.openjdk.jmc.flightrecorder.rules.extensionprovider
- 0.0.0
-
-
-
-
-
-
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+
+ test-jar
+
+
+
+
+
--- old/core/tests/org.openjdk.jmc.flightrecorder.rules.test/pom.xml 2018-09-06 11:13:50.000000000 +0530
+++ new/core/tests/org.openjdk.jmc.flightrecorder.rules.test/pom.xml 2018-09-06 11:13:50.000000000 +0530
@@ -38,6 +38,57 @@
missioncontrol.core.tests
7.0.0-SNAPSHOT
- org.openjdk.jmc.flightrecorder.rules.test
- eclipse-test-plugin
+ flightrecorder.rules.test
+ 7.0.0-SNAPSHOT
+
+
+ org.openjdk.jmc
+ flightrecorder.test
+ test-jar
+ test
+ ${project.version}
+
+
+ org.openjdk.jmc
+ common.test
+ test-jar
+ test
+ ${project.version}
+
+
+ org.openjdk.jmc
+ common
+ ${project.version}
+
+
+ org.openjdk.jmc
+ flightrecorder
+ ${project.version}
+
+
+ org.openjdk.jmc
+ flightrecorder.rules
+ ${project.version}
+
+
+ junit
+ junit
+ test
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+
+ test-jar
+
+
+
+
+
+
--- old/core/tests/org.openjdk.jmc.flightrecorder.test/pom.xml 2018-09-06 11:13:51.000000000 +0530
+++ new/core/tests/org.openjdk.jmc.flightrecorder.test/pom.xml 2018-09-06 11:13:51.000000000 +0530
@@ -38,6 +38,46 @@
missioncontrol.core.tests
7.0.0-SNAPSHOT
- org.openjdk.jmc.flightrecorder.test
- eclipse-test-plugin
+ flightrecorder.test
+ 7.0.0-SNAPSHOT
+
+
+
+ org.openjdk.jmc
+ common.test
+ test-jar
+ test
+ ${project.version}
+
+
+ org.openjdk.jmc
+ common
+ ${project.version}
+
+
+ org.openjdk.jmc
+ flightrecorder
+ ${project.version}
+
+
+ junit
+ junit
+ test
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+
+ test-jar
+
+
+
+
+
+
--- old/core/tests/pom.xml 2018-09-06 11:13:52.000000000 +0530
+++ new/core/tests/pom.xml 2018-09-06 11:13:52.000000000 +0530
@@ -39,6 +39,7 @@
7.0.0-SNAPSHOT
missioncontrol.core.tests
+ 7.0.0-SNAPSHOT
pom
org.openjdk.jmc.common.test
@@ -50,6 +51,8 @@
**/Test*.java,**/*Test.java,**/*TestCase.java
**/*$*
true
+ 1.7
+ 1.7
@@ -97,14 +100,24 @@
+
+
+
+ junit
+ junit
+ 4.12
+ test
+
+
+
- org.eclipse.tycho
- tycho-surefire-plugin
- ${tycho-version}
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.22.0
- -nl en
+ -Duser.language=en -Duser.region=nl
${test.includes}
${test.excludes}
${fail.if.no.tests}
--- old/./pom.xml 2018-09-06 11:13:53.000000000 +0530
+++ new/./pom.xml 2018-09-06 11:13:53.000000000 +0530
@@ -69,7 +69,6 @@
- core
application
releng
--- /dev/null 2018-09-06 11:13:54.000000000 +0530
+++ new/application/tests/org.openjdk.jmc.rjmx.test/src/test/java/org/openjdk/common/test/MCTestCase.java 2018-09-06 11:13:53.000000000 +0530
@@ -0,0 +1,246 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * The contents of this file are subject to the terms of either the Universal Permissive License
+ * v 1.0 as shown at http://oss.oracle.com/licenses/upl
+ *
+ * or the following license:
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted
+ * provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions
+ * and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other materials provided with
+ * the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors may be used to
+ * endorse or promote products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
+ * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.openjdk.jmc.common.test;
+
+import static org.junit.Assert.assertArrayEquals;
+
+import java.util.Arrays;
+
+import org.junit.Assert;
+import org.junit.Assume;
+import org.openjdk.jmc.common.util.StringToolkit;
+import org.openjdk.jmc.common.version.JavaVMVersionToolkit;
+import org.openjdk.jmc.common.version.JavaVersion;
+import org.openjdk.jmc.common.version.JavaVersionSupport;
+
+/**
+ * TestCase extended with convenience assert methods.
+ */
+@SuppressWarnings("nls")
+public class MCTestCase {
+ /**
+ * Shadowing {@link Assert#assertNull(String, Object)} to provide a more useful error message.
+ */
+ static public void assertNull(String message, Object object) {
+ if (object != null) {
+ failNotEquals(message, null, object);
+ }
+ }
+
+ /**
+ * Shadowing {@link Assert#assertNull(Object)} to provide a more useful error message.
+ */
+ static public void assertNull(Object object) {
+ if (object != null) {
+ failNotEquals(null, null, object);
+ }
+ }
+
+ static public void failNotEquals(String message, Object expected, Object actual) {
+ if (!expected.equals(actual)) {
+ Assert.fail(
+ ((message != null) ? message + ' ' : "") + "expected:<" + expected + "> but was:<" + actual + ">");
+ }
+ }
+
+ /**
+ * Asserts that with respect to all bits in the mask, a long is equal to the given value. If it
+ * is not an AssertionFailedError is thrown with the given message.
+ */
+ static public void assertMaskedEquals(String message, long expected, long actual, long mask) {
+ if (((expected ^ actual) & mask) != 0) {
+ Assert.fail(((message != null) ? message + ' ' : "") //$NON-NLS-1$
+ + "masked with " + hex(mask) + " expected:<" + hex(expected) + "> was not:<" + hex(actual) + ">"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
+ }
+
+ /**
+ * Asserts that with respect to all bits in the mask, a long is equal to the given value.
+ */
+ static public void assertMaskedEquals(long expected, long actual, long mask) {
+ assertMaskedEquals(null, expected, actual, mask);
+ }
+
+ protected static String hex(long val) {
+ return "0x" + Long.toHexString(val); //$NON-NLS-1$
+ }
+
+ /**
+ * Asserts that a {@link Comparable} is within the given (inclusive) range. If it is not an
+ * AssertionFailedError is thrown with the given message.
+ */
+ static public > void assertBetween(String message, T min, T max, T actual) {
+ if ((min.compareTo(actual) > 0) || (max.compareTo(actual) < 0)) {
+ Assert.fail(((message != null) ? message + ' ' : "") //$NON-NLS-1$
+ + "expected in:[" + min + ", " + max + "] was not:<" + actual + ">"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
+ }
+
+ /**
+ * Asserts that a {@link Comparable} is within the given (inclusive) range.
+ */
+ static public > void assertBetween(T min, T max, T actual) {
+ assertBetween(null, min, max, actual);
+ }
+
+ /**
+ * Asserts that a {@link Comparable} is less or equal than the given value. If it is not an
+ * AssertionFailedError is thrown with the given message.
+ */
+ static public > void assertMax(String message, T max, T actual) {
+ if (max.compareTo(actual) < 0) {
+ Assert.fail(((message != null) ? message + ' ' : "") //$NON-NLS-1$
+ + "expected max:<" + max + "> was not:<" + actual + ">"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+
+ /**
+ * Asserts that a {@link Comparable} is less or equal than the given value.
+ */
+ static public > void assertMax(T max, T actual) {
+ assertMax(null, max, actual);
+ }
+
+ /**
+ * Asserts that a {@link Comparable} is greater or equal than the given value. If it is not an
+ * AssertionFailedError is thrown with the given message.
+ */
+ static public > void assertMin(String message, T min, T actual) {
+ if (min.compareTo(actual) > 0) {
+ Assert.fail(((message != null) ? message + ' ' : "") //$NON-NLS-1$
+ + "expected min:<" + min + "> was not:<" + actual + ">"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+
+ /**
+ * Asserts that a {@link Comparable} is greater or equal than the given value.
+ */
+ static public > void assertMin(T min, T actual) {
+ assertMin(null, min, actual);
+ }
+
+ /**
+ * Asserts that a {@link Comparable} is less than the given value. If it is not an
+ * AssertionFailedError is thrown with the given message.
+ */
+ static public > void assertLessThan(String message, T greaterVal, T actual) {
+ if (greaterVal.compareTo(actual) <= 0) {
+ Assert.fail(((message != null) ? message + ' ' : "") //$NON-NLS-1$
+ + "expected less than:<" + greaterVal + "> was not:<" + actual + ">"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+
+ /**
+ * Asserts that a {@link Comparable} is less than the given value.
+ */
+ static public > void assertLessThan(T greaterVal, T actual) {
+ assertLessThan(null, greaterVal, actual);
+ }
+
+ /**
+ * Asserts that a {@link Comparable} is greater than the given value. If it is not an
+ * AssertionFailedError is thrown with the given message.
+ */
+ static public > void assertGreaterThan(String message, T lesserVal, T actual) {
+ if (lesserVal.compareTo(actual) >= 0) {
+ Assert.fail(((message != null) ? message + ' ' : "") //$NON-NLS-1$
+ + "expected greater than:<" + lesserVal + "> was not:<" + actual + ">"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+
+ /**
+ * Asserts that a {@link Comparable} is greater than the given value.
+ */
+ static public > void assertGreaterThan(T lesserVal, T actual) {
+ assertGreaterThan(null, lesserVal, actual);
+ }
+
+ public static void assertArrayEqualsWithMoreInfo(String message, Object[] expecteds, Object[] actuals) {
+ try {
+ assertArrayEquals(message, expecteds, actuals);
+ } catch (AssertionError e) {
+ StringBuilder sb = new StringBuilder();
+ sb.append(e.getMessage());
+ sb.append(" (Expected {");
+ sb.append(StringToolkit.join(Arrays.asList(expecteds), ", ")).append("}");
+ sb.append(", got {");
+ sb.append(StringToolkit.join(Arrays.asList(actuals), ", ")).append("}");
+ throw new AssertionError(sb.toString(), e);
+ }
+ }
+
+ protected void skipIfEarlierThan8u0() {
+ Assume.assumeTrue("This feature is only valid on JDK8u0 or later.", //$NON-NLS-1$
+ (getClientVersion().compareTo(JVMVersion.JDK8)) >= 0);
+ }
+
+ protected void skipIfEarlierThan7u40() {
+ Assume.assumeTrue("This feature is only valid on JDK7u40 or later.", //$NON-NLS-1$
+ (getClientVersion().compareTo(JVMVersion.JDK7u40)) >= 0);
+ }
+
+ protected void skipIfEarlierThan7u4() {
+ Assume.assumeTrue("This feature is only valid on JDK7u4 or later.", //$NON-NLS-1$
+ (getClientVersion().compareTo(JVMVersion.JDK7u4)) >= 0);
+ }
+
+ protected void skipIfEarlierThan7u0() {
+ Assume.assumeTrue("This feature is only valid on JDK7u0 or later.", //$NON-NLS-1$
+ (getClientVersion().compareTo(JVMVersion.JDK7)) >= 0);
+ }
+
+ // This enum needs to be in the proper order.
+ private enum JVMVersion {
+ ANY, UNKNOWN, JRockit, JDK6, JDK7, JDK7u4, JDK7u40, JDK8
+ }
+
+ private JVMVersion getClientVersion() {
+ if (JavaVMVersionToolkit.isJRockitJVMName(System.getProperty("java.vm.name"))) { //$NON-NLS-1$
+ return JVMVersion.JRockit;
+ } else if (JavaVMVersionToolkit.isHotspotJVMName(System.getProperty("java.vm.name"))) { //$NON-NLS-1$
+ JavaVersion javaVersion = new JavaVersion(System.getProperty("java.version")); //$NON-NLS-1$
+ if (javaVersion.isGreaterOrEqualThan(JavaVersionSupport.JDK_8)) {
+ return JVMVersion.JDK8;
+ } else if (javaVersion.isGreaterOrEqualThan(JavaVersionSupport.JDK_7_U_40)) {
+ return JVMVersion.JDK7u40;
+ } else if (javaVersion.isGreaterOrEqualThan(JavaVersionSupport.JDK_7_U_4)) {
+ return JVMVersion.JDK7u4;
+ } else if (javaVersion.isGreaterOrEqualThan(JavaVersionSupport.JDK_7)) {
+ return JVMVersion.JDK7;
+ } else if (javaVersion.isGreaterOrEqualThan(JavaVersionSupport.JDK_6)) {
+ return JVMVersion.JDK6;
+ }
+ }
+ return JVMVersion.UNKNOWN;
+ }
+}