From 6b51065b2f80f721c08a11cbb739400569e5642b Mon Sep 17 00:00:00 2001 From: Mark Robert Miller Date: Sun, 31 Aug 2014 17:15:37 +0000 Subject: [PATCH] SOLR-6458: Hard coded ENGLISH locale for AbstractSolrMorphlineTestBase tests. git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1621609 13f79535-47bb-0310-9956-ffa450edef68 --- .../solr/AbstractSolrMorphlineTestBase.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/AbstractSolrMorphlineTestBase.java b/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/AbstractSolrMorphlineTestBase.java index af0b033c6dc..584284d1555 100644 --- a/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/AbstractSolrMorphlineTestBase.java +++ b/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/AbstractSolrMorphlineTestBase.java @@ -41,6 +41,7 @@ import org.apache.solr.client.solrj.impl.XMLResponseParser; import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.common.SolrDocument; import org.junit.After; +import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.kitesdk.morphline.api.Collector; @@ -61,7 +62,7 @@ import com.google.common.io.Files; import com.typesafe.config.Config; public class AbstractSolrMorphlineTestBase extends SolrTestCaseJ4 { - + private static Locale savedLocale; protected Collector collector; protected Command morphline; protected SolrServer solrServer; @@ -84,10 +85,23 @@ public class AbstractSolrMorphlineTestBase extends SolrTestCaseJ4 { @BeforeClass public static void beforeClass() throws Exception { + // TODO: test doesn't work with some Locales, see SOLR-6458 + savedLocale = Locale.getDefault(); + Locale.setDefault(Locale.ENGLISH); + + // we leave this in case the above is addressed 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())); + myInitCore(DEFAULT_BASE_DIR); } + + @AfterClass + public static void afterClass() throws Exception { + if (savedLocale != null) { + Locale.setDefault(savedLocale); + } + } protected static void myInitCore(String baseDirName) throws Exception { Joiner joiner = Joiner.on(File.separator);