Update pmd-dist integration test for openjdk8

This commit is contained in:
Andreas Dangel 2020-08-06 11:52:07 +02:00
parent 63af9c14c0
commit 494b34f6d7
6 changed files with 17 additions and 34 deletions

View File

@ -19,22 +19,22 @@ if travis_isLinux; then
bundle config set --local with release_notes_preprocessing
bundle install
# install jdk7 for integration test
LOCAL_DIR=${HOME}/.cache/jdk7
TARGET_DIR=${HOME}/oraclejdk7
JDK7_ARCHIVE=jdk-7u80-linux-x64.tar.gz
DOWNLOAD_URL=https://pmd-code.org/oraclejdk/${JDK7_ARCHIVE}
# install openjdk8 for integration test
LOCAL_DIR=${HOME}/.cache/jdk8
TARGET_DIR=${HOME}/openjdk8
OPENJDK8_ARCHIVE=OpenJDK8U-jdk_x64_linux_hotspot_8u265b01.tar.gz
DOWNLOAD_URL=https://pmd-code.org/openjdk/jdk-8u265b01/${OPENJDK8_ARCHIVE}
mkdir -p ${LOCAL_DIR}
mkdir -p ${TARGET_DIR}
if [ ! -e ${LOCAL_DIR}/${JDK7_ARCHIVE} ]; then
if [ ! -e ${LOCAL_DIR}/${OPENJDK8_ARCHIVE} ]; then
log_info "Downloading from ${DOWNLOAD_URL} to ${LOCAL_DIR}"
wget --directory-prefix ${LOCAL_DIR} --timestamping --continue ${DOWNLOAD_URL}
else
log_info "Skipped download, file ${LOCAL_DIR}/${JDK7_ARCHIVE} already exists"
log_info "Skipped download, file ${LOCAL_DIR}/${OPENJDK8_ARCHIVE} already exists"
fi
log_info "Extracting to ${TARGET_DIR}"
tar --extract --file ${LOCAL_DIR}/${JDK7_ARCHIVE} -C ${TARGET_DIR} --strip-components=1
log_info "OracleJDK7 can be used via -Djava7.home=${TARGET_DIR}"
tar --extract --file ${LOCAL_DIR}/${OPENJDK8_ARCHIVE} -C ${TARGET_DIR} --strip-components=1
log_info "OpenJDK8 can be used via -Djava8.home=${TARGET_DIR}"
else
log_info "Not setting up ruby for ${TRAVIS_OS_NAME}."

View File

@ -11,7 +11,7 @@ VERSION=$(get_pom_version)
log_info "Building PMD ${VERSION} on branch ${TRAVIS_BRANCH}"
if travis_isLinux; then
MVN_BUILD_FLAGS="-B -V -Djava7.home=${HOME}/oraclejdk7"
MVN_BUILD_FLAGS="-B -V -Djava8.home=${HOME}/openjdk8"
else
MVN_BUILD_FLAGS="-B -V"
fi

View File

@ -259,11 +259,10 @@
<profiles>
<profile>
<profile>
<id>jdk7-compat-it</id>
<id>jdk8-compat-it</id>
<activation>
<property>
<name>java7.home</name>
<name>java8.home</name>
</property>
</activation>
<build>
@ -273,15 +272,15 @@
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>jdk7-compat-it</id>
<id>jdk8-compat-it</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<environmentVariables>
<JAVA_HOME>${java7.home}</JAVA_HOME>
<PATH>${java7.home}/bin:${env.PATH}</PATH>
<JAVA_HOME>${java8.home}</JAVA_HOME>
<PATH>${java8.home}/bin:${env.PATH}</PATH>
</environmentVariables>
</configuration>
</execution>

View File

@ -21,11 +21,6 @@ public class AllRulesIT extends AbstractBinaryDistributionTest {
@Parameters
public static Iterable<String> languagesToTest() {
if (PMDExecutor.isJava7Test()) {
// note: apex and scala require java8
return Arrays.asList("java", "javascript", "jsp", "modelica",
"plsql", "pom", "visualforce", "velocitytemplate", "xml", "xsl");
}
// note: scala and wsdl have no rules
return Arrays.asList("java", "apex", "javascript", "jsp", "modelica",
"plsql", "pom", "visualforce", "velocitytemplate", "xml", "xsl");

View File

@ -25,14 +25,8 @@ public class BinaryDistributionIT extends AbstractBinaryDistributionTest {
private static final String SUPPORTED_LANGUAGES_PMD;
static {
// note: apex and scala require java8
if (PMDExecutor.isJava7Test()) {
SUPPORTED_LANGUAGES_CPD = "Supported languages: [cpp, cs, dart, ecmascript, fortran, go, groovy, java, jsp, kotlin, lua, matlab, modelica, objectivec, perl, php, plsql, python, ruby, swift, vf, xml]";
SUPPORTED_LANGUAGES_PMD = "ecmascript, java, jsp, modelica, plsql, pom, vf, vm, wsdl, xml, xsl";
} else {
SUPPORTED_LANGUAGES_CPD = "Supported languages: [apex, cpp, cs, dart, ecmascript, fortran, go, groovy, java, jsp, kotlin, lua, matlab, modelica, objectivec, perl, php, plsql, python, ruby, scala, swift, vf, xml]";
SUPPORTED_LANGUAGES_PMD = "apex, ecmascript, java, jsp, modelica, plsql, pom, scala, swift, vf, vm, wsdl, xml, xsl";
}
SUPPORTED_LANGUAGES_CPD = "Supported languages: [apex, cpp, cs, dart, ecmascript, fortran, go, groovy, java, jsp, kotlin, lua, matlab, modelica, objectivec, perl, php, plsql, python, ruby, scala, swift, vf, xml]";
SUPPORTED_LANGUAGES_PMD = "apex, ecmascript, java, jsp, modelica, plsql, pom, scala, swift, vf, vm, wsdl, xml, xsl";
}
@Test

View File

@ -14,7 +14,6 @@ import java.util.List;
import java.util.concurrent.TimeUnit;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.SystemUtils;
import net.sourceforge.pmd.PMDVersion;
@ -134,8 +133,4 @@ public class PMDExecutor {
return runPMDUnix(tempDir, null, arguments);
}
}
public static boolean isJava7Test() {
return StringUtils.equals(System.getenv("JAVA_HOME"), System.getProperty("java7.home"));
}
}