SOLR-8874: Make Solr tests work with Java 9 Jigsaw

This commit is contained in:
Uwe Schindler 2016-03-19 14:53:59 +01:00
parent cc774994fc
commit f93f90ca1b
11 changed files with 33 additions and 10 deletions

View File

@ -568,11 +568,14 @@ public abstract class LuceneTestCase extends Assert {
private final static long STATIC_LEAK_THRESHOLD = 10 * 1024 * 1024;
/** By-name list of ignored types like loggers etc. */
private final static Set<String> STATIC_LEAK_IGNORED_TYPES =
Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
private final static Set<String> STATIC_LEAK_IGNORED_TYPES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
"org.slf4j.Logger",
"org.apache.solr.SolrLogFormatter",
EnumSet.class.getName())));
"java.io.File", // Solr sometimes refers to this in a static way, but it has a "java.nio.fs.Path" inside
Path.class.getName(), // causes problems because interface is implemented by hidden classes
Class.class.getName(),
EnumSet.class.getName()
)));
/**
* This controls how suite-level rules are nested. It is important that _all_ rules declared

View File

@ -152,10 +152,13 @@
<!--
We don't want to run HDFS tests on Windows, because they require Cygwin.
If you have Cygwin or manually raised permgen, you can override this property on command line:
We don't want to run HDFS tests on Java 9 Jigsaw, because Hadoop/HDFS is completely broken with Java's module system.
-->
<condition property="tests.disableHdfs" value="true">
<os family="windows"/>
<or>
<os family="windows"/>
<available classname="java.lang.reflect.Module"/>
</or>
</condition>
<target name="validate" depends="compile-tools">

View File

@ -42,7 +42,8 @@ public class SolrCellMorphlineTest extends AbstractSolrMorphlineTestBase {
@BeforeClass
public static void beforeClass2() {
assumeFalse("FIXME: Morphlines currently has issues with Windows paths", Constants.WINDOWS);
assumeFalse("This test fails with Java 9 (https://issues.apache.org/jira/browse/PDFBOX-3155)", Constants.JRE_IS_MINIMUM_JAVA9);
assumeFalse("This test fails with Java 9 (https://issues.apache.org/jira/browse/PDFBOX-3155, https://issues.apache.org/jira/browse/SOLR-8876)",
Constants.JRE_IS_MINIMUM_JAVA9);
}
@Before

View File

@ -21,6 +21,7 @@ import com.google.common.base.Joiner;
import com.google.common.io.Files;
import com.typesafe.config.Config;
import org.apache.commons.io.FileUtils;
import org.apache.lucene.util.Constants;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrQuery;
@ -85,6 +86,8 @@ public class AbstractSolrMorphlineTestBase extends SolrTestCaseJ4 {
@BeforeClass
public static void beforeClass() throws Exception {
assumeFalse("This test fails on Java 9 (https://issues.apache.org/jira/browse/SOLR-8876)", Constants.JRE_IS_MINIMUM_JAVA9);
// TODO: test doesn't work with some Locales, see SOLR-6458
savedLocale = Locale.getDefault();
Locale.setDefault(Locale.ENGLISH);

View File

@ -25,6 +25,7 @@ import com.codahale.metrics.MetricRegistry;
import com.google.common.collect.ListMultimap;
import com.typesafe.config.Config;
import org.apache.commons.io.FileUtils;
import org.apache.lucene.util.Constants;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.cloud.AbstractFullDistribZkTestBase;
import org.apache.solr.cloud.AbstractZkTestCase;
@ -63,6 +64,8 @@ public abstract class AbstractSolrMorphlineZkTestBase extends AbstractFullDistri
@BeforeClass
public static void setupClass() throws Exception {
assumeFalse("This test fails on Java 9 (https://issues.apache.org/jira/browse/SOLR-8876)", Constants.JRE_IS_MINIMUM_JAVA9);
assumeFalse("This test fails on UNIX with Turkish default locale (https://issues.apache.org/jira/browse/SOLR-6387)",
new Locale("tr").getLanguage().equals(Locale.getDefault().getLanguage()));
solrHomeDirectory = createTempDir().toFile();

View File

@ -56,6 +56,8 @@ public class SaslZkACLProviderTest extends SolrTestCaseJ4 {
@BeforeClass
public static void beforeClass() {
assumeFalse("FIXME: This test fails on Java 9 (https://issues.apache.org/jira/browse/SOLR-8052)", Constants.JRE_IS_MINIMUM_JAVA9);
assumeFalse("FIXME: SOLR-7040: This test fails under IBM J9",
Constants.JAVA_VENDOR.startsWith("IBM"));
System.setProperty("solrcloud.skip.autorecovery", "true");

View File

@ -19,6 +19,8 @@ package org.apache.solr.cloud;
import java.io.File;
import java.lang.invoke.MethodHandles;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@ -91,10 +93,10 @@ public class TestCloudDeleteByQuery extends SolrCloudTestCase {
private static void createMiniSolrCloudCluster() throws Exception {
final String configName = "solrCloudCollectionConfig";
File configDir = new File(TEST_HOME() + File.separator + "collection1" + File.separator + "conf");
final Path configDir = Paths.get(TEST_HOME(), "collection1", "conf");
configureCluster(NUM_SERVERS)
.addConfig(configName, configDir.toPath())
.addConfig(configName, configDir)
.configure();
Map<String, String> collectionProperties = new HashMap<>();

View File

@ -34,8 +34,10 @@ public class TestImplicitCoreProperties extends SolrTestCaseJ4 {
@AfterClass
public static void teardownContainer() {
if (cc != null)
if (cc != null) {
cc.shutdown();
}
cc = null;
}
@Test

View File

@ -58,6 +58,7 @@ public class CoreAdminCreateDiscoverTest extends SolrTestCaseJ4 {
@AfterClass
public static void afterClass() throws Exception {
admin = null; // Release it or the test harness complains.
solrHomeDirectory = null;
}
private static void setupCore(String coreName, boolean blivet) throws IOException {

View File

@ -265,6 +265,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
// clean up static
sslConfig = null;
testSolrHome = null;
}
IpTables.unblockAllPorts();

View File

@ -150,8 +150,10 @@ public class SolrCloudTestCase extends SolrTestCaseJ4 {
@AfterClass
public static void shutdownCluster() throws Exception {
if (cluster != null)
if (cluster != null) {
cluster.shutdown();
}
cluster = null;
}
@Before