HBASE-23829 Get `-PrunSmallTests` passing on JDK11

Signed-off-by: stack <stack@apache.org>
This commit is contained in:
Nick Dimiduk 2020-02-13 12:43:05 -08:00 committed by Nick Dimiduk
parent f66cbe1a40
commit 059c189451
6 changed files with 86 additions and 34 deletions

View File

@ -17,6 +17,7 @@
*/ */
package org.apache.hadoop.hbase.util; package org.apache.hadoop.hbase.util;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.startsWith; import static org.hamcrest.CoreMatchers.startsWith;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
@ -69,7 +70,7 @@ public class TestFutureUtils {
} catch (HBaseIOException e) { } catch (HBaseIOException e) {
assertEquals("Inject error!", e.getMessage()); assertEquals("Inject error!", e.getMessage());
StackTraceElement[] elements = e.getStackTrace(); StackTraceElement[] elements = e.getStackTrace();
assertThat(elements[0].toString(), startsWith("java.lang.Thread.getStackTrace")); assertThat(elements[0].toString(), containsString("java.lang.Thread.getStackTrace"));
assertThat(elements[1].toString(), assertThat(elements[1].toString(),
startsWith("org.apache.hadoop.hbase.util.FutureUtils.setStackTrace")); startsWith("org.apache.hadoop.hbase.util.FutureUtils.setStackTrace"));
assertThat(elements[2].toString(), assertThat(elements[2].toString(),

View File

@ -138,6 +138,14 @@ limitations under the License.
<artifactId>hadoop-common</artifactId> <artifactId>hadoop-common</artifactId>
<version>${hadoop.version}</version> <version>${hadoop.version}</version>
</dependency> </dependency>
<dependency>
<!--
a missing transitive dependency on JDK9+ (obsoleted by Hadoop-3.3.0+, HADOOP-15775)
-->
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
<scope>runtime</scope>
</dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>

View File

@ -480,7 +480,7 @@ public class TestLogLevel {
Throwable t = throwable; Throwable t = throwable;
while (t != null) { while (t != null) {
String msg = t.toString(); String msg = t.toString();
if (msg != null && msg.contains(substr)) { if (msg != null && msg.toLowerCase().contains(substr.toLowerCase())) {
return; return;
} }
t = t.getCause(); t = t.getCause();

View File

@ -88,13 +88,6 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId> <artifactId>maven-enforcer-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>extra-enforcer-rules</artifactId>
<version>${extra.enforcer.version}</version>
</dependency>
</dependencies>
<executions> <executions>
<execution> <execution>
<id>enforce-banned-dependencies</id> <id>enforce-banned-dependencies</id>

View File

@ -77,13 +77,6 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId> <artifactId>maven-enforcer-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>extra-enforcer-rules</artifactId>
<version>${extra.enforcer.version}</version>
</dependency>
</dependencies>
<executions> <executions>
<execution> <execution>
<id>enforce-banned-dependencies</id> <id>enforce-banned-dependencies</id>

93
pom.xml
View File

@ -983,6 +983,23 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>${enforcer.version}</version>
<dependencies>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>extra-enforcer-rules</artifactId>
<version>${extra.enforcer.version}</version>
</dependency>
<dependency>
<groupId>de.skuzzle.enforcer</groupId>
<artifactId>restrict-imports-enforcer-rule</artifactId>
<version>${restrict-imports.enforcer.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
<plugins> <plugins>
@ -1021,20 +1038,6 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId> <artifactId>maven-enforcer-plugin</artifactId>
<version>${enforcer.version}</version>
<dependencies>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>extra-enforcer-rules</artifactId>
<version>${extra.enforcer.version}</version>
</dependency>
<dependency>
<groupId>de.skuzzle.enforcer</groupId>
<artifactId>restrict-imports-enforcer-rule</artifactId>
<version>${restrict-imports.enforcer.version}</version>
</dependency>
</dependencies>
<!-- version set by parent -->
<executions> <executions>
<execution> <execution>
<id>hadoop-profile-min-maven-min-java-banned-xerces</id> <id>hadoop-profile-min-maven-min-java-banned-xerces</id>
@ -2390,10 +2393,45 @@
<activation> <activation>
<jdk>[1.11,)</jdk> <jdk>[1.11,)</jdk>
</activation> </activation>
<dependencyManagement> <properties>
<dependencies> <!-- TODO: replicate logic for windows support -->
</dependencies> <argLine>--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED ${hbase-surefire.argLine}</argLine>
</dependencyManagement> </properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>hadoop3-profile-required</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireProperty>
<!--
$ JAVA_HOME=... mvn -Dhadoop.profile=3.0 -PrunSmallTests help:active-profiles enforcer:display-info clean test
enforcer plugin does not see active profiles on sub-modules, so enforce based
on the presence of the activation property and value.
-->
<property>hadoop.profile</property>
<regex>.*3\.0$</regex>
<message>
HBase with JDK11 requires Hadoop3. Activate the profile with `-Dhadoop.profile=3.0`.
</message>
<regexMessage>
HBase with JDK11 requires Hadoop3. Activate the profile with `-Dhadoop.profile=3.0`.
</regexMessage>
</requireProperty>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile> </profile>
<!-- profile activated by the Jenkins patch testing job --> <!-- profile activated by the Jenkins patch testing job -->
<profile> <profile>
@ -2866,6 +2904,16 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<!--
a missing transitive dependency on JDK9+ (obsoleted by Hadoop-3.3.0+, HADOOP-15775)
duplicated here because hadoop-3.0 piggy-backs off the hadoop-2.0 profile.
-->
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
<version>1.2.0</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.apache.hadoop</groupId> <groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId> <artifactId>hadoop-client</artifactId>
@ -3208,6 +3256,15 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<!--
a missing transitive dependency on JDK9+ (obsoleted by Hadoop-3.3.0+, HADOOP-15775)
-->
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
<version>1.2.0</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.apache.hadoop</groupId> <groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId> <artifactId>hadoop-common</artifactId>