blob: 44297adb1632d779083f5c6ff6f93f2aa5a47793 [file] [log] [blame]
Index: lucene/ivy-settings.xml
===================================================================
--- lucene/ivy-settings.xml (revision 1663149)
+++ lucene/ivy-settings.xml (working copy)
@@ -40,7 +40,9 @@
<!-- you might need to tweak this from china so it works -->
<ibiblio name="working-chinese-mirror" root="http://uk.maven.org/maven2" m2compatible="true" />
-
+
+ <ibiblio name="rr-snapshot" root="https://oss.sonatype.org/content/repositories/comcarrotsearch-1039" m2compatible="true" />
+
<!--
<filesystem name="local-maven-2" m2compatible="true" local="true">
<artifact
@@ -53,6 +55,7 @@
<chain name="default" returnFirst="true" checkmodified="true" changingPattern=".*SNAPSHOT">
<resolver ref="local"/>
<!-- <resolver ref="local-maven-2" /> -->
+ <resolver ref="rr-snapshot"/>
<resolver ref="main"/>
<resolver ref="maven.restlet.org" />
<resolver ref="sonatype-releases" />
Index: lucene/licenses/randomizedtesting-runner-2.1.12.jar.sha1
===================================================================
--- lucene/licenses/randomizedtesting-runner-2.1.12.jar.sha1 (revision 0)
+++ lucene/licenses/randomizedtesting-runner-2.1.12.jar.sha1 (working copy)
@@ -0,0 +1 @@
+a31b5efc13b29ad7cbb2ca0f35980f2e152d5845
Index: lucene/licenses/junit4-ant-2.1.9.jar.sha1
===================================================================
--- lucene/licenses/junit4-ant-2.1.9.jar.sha1 (revision 1663149)
+++ lucene/licenses/junit4-ant-2.1.9.jar.sha1 (working copy)
@@ -1 +0,0 @@
-ce61b54b0c33e45811e823441f8322c23de57842
Index: lucene/licenses/junit4-ant-2.1.12.jar.sha1
===================================================================
--- lucene/licenses/junit4-ant-2.1.12.jar.sha1 (revision 0)
+++ lucene/licenses/junit4-ant-2.1.12.jar.sha1 (working copy)
@@ -0,0 +1 @@
+09847aac214a15628aaa49f45daedcc14b856d1b
Index: lucene/licenses/randomizedtesting-runner-2.1.9.jar.sha1
===================================================================
--- lucene/licenses/randomizedtesting-runner-2.1.9.jar.sha1 (revision 1663149)
+++ lucene/licenses/randomizedtesting-runner-2.1.9.jar.sha1 (working copy)
@@ -1 +0,0 @@
-2d7283d02387a23434ef553d5e5e4e94f45b007a
Index: lucene/analysis/uima/build.xml
===================================================================
--- lucene/analysis/uima/build.xml (revision 1663149)
+++ lucene/analysis/uima/build.xml (working copy)
@@ -24,7 +24,10 @@
</description>
<property name="tests.userdir" value="src/test-files"/>
+ <!-- TODO: why is this limited to one JVM? -->
<property name="tests.jvms.override" value="1" />
+ <!-- TODO: go fix this in uima, its stupid -->
+ <property name="tests.policy" location="../../tools/junit4/solr-tests.policy"/>
<path id="uimajars">
<fileset dir="lib"/>
Index: lucene/ivy-versions.properties
===================================================================
--- lucene/ivy-versions.properties (revision 1663149)
+++ lucene/ivy-versions.properties (working copy)
@@ -7,7 +7,7 @@
/cglib/cglib-nodep = 2.2
/com.adobe.xmp/xmpcore = 5.1.2
-com.carrotsearch.randomizedtesting.version = 2.1.9
+com.carrotsearch.randomizedtesting.version = 2.1.12
/com.carrotsearch.randomizedtesting/junit4-ant = ${com.carrotsearch.randomizedtesting.version}
/com.carrotsearch.randomizedtesting/randomizedtesting-runner = ${com.carrotsearch.randomizedtesting.version}
Index: lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
===================================================================
--- lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java (revision 1663149)
+++ lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java (working copy)
@@ -81,7 +81,6 @@
import com.carrotsearch.randomizedtesting.rules.NoClassHooksShadowingRule;
import com.carrotsearch.randomizedtesting.rules.NoInstanceHooksOverridesRule;
import com.carrotsearch.randomizedtesting.rules.StaticFieldsInvariantRule;
-import com.carrotsearch.randomizedtesting.rules.SystemPropertiesInvariantRule;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.MockAnalyzer;
@@ -418,16 +417,6 @@
LEAVE_TEMPORARY = defaultValue;
}
- /**
- * These property keys will be ignored in verification of altered properties.
- * @see SystemPropertiesInvariantRule
- * @see #ruleChain
- * @see #classRules
- */
- private static final String [] IGNORED_INVARIANT_PROPERTIES = {
- "user.timezone", "java.rmi.server.randomIDs"
- };
-
/** Filesystem-based {@link Directory} implementations. */
private static final List<String> FS_DIRECTORIES = Arrays.asList(
"SimpleFSDirectory",
@@ -582,8 +571,20 @@
return !(name.equals("setUp") || name.equals("tearDown"));
}
})
- .around(new SystemPropertiesInvariantRule(IGNORED_INVARIANT_PROPERTIES))
.around(classNameRule = new TestRuleStoreClassName())
+ .around(new TestRuleRestoreSystemProperties(
+ // Enlist all properties to which we have write access (security manager);
+ // these should be restored to previous state, no matter what the outcome of the test.
+
+ // We reset the default locale and timezone; these properties change as a side-effect
+ "user.language",
+ "user.timezone",
+
+ // TODO: these should, ideally, be moved to Solr's base class.
+ "solr.directoryFactory",
+ "solr.solr.home",
+ "solr.data.dir"
+ ))
.around(classEnvRule = new TestRuleSetupAndRestoreClassEnv());
@@ -610,7 +611,6 @@
.outerRule(testFailureMarker)
.around(ignoreAfterMaxFailures)
.around(threadAndTestNameRule)
- .around(new SystemPropertiesInvariantRule(IGNORED_INVARIANT_PROPERTIES))
.around(new TestRuleSetupAndRestoreInstanceEnv())
.around(parentChainCallRule);
Index: lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java
===================================================================
--- lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java (revision 1663149)
+++ lucene/test-framework/src/java/org/apache/lucene/util/TestRuleSetupAndRestoreClassEnv.java (working copy)
@@ -20,10 +20,8 @@
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Date;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale;
-import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.TimeZone;
@@ -38,7 +36,6 @@
import org.apache.lucene.codecs.compressing.CompressingCodec;
import org.apache.lucene.codecs.lucene50.Lucene50Codec;
import org.apache.lucene.codecs.lucene50.Lucene50StoredFieldsFormat;
-import org.apache.lucene.codecs.lucene50.Lucene50StoredFieldsFormat.Mode;
import org.apache.lucene.codecs.mockrandom.MockRandomPostingsFormat;
import org.apache.lucene.codecs.simpletext.SimpleTextCodec;
import org.apache.lucene.index.RandomCodec;
@@ -68,11 +65,6 @@
* doesn't fit anywhere else).
*/
final class TestRuleSetupAndRestoreClassEnv extends AbstractBeforeAfterRule {
- /**
- * Restore these system property values.
- */
- private HashMap<String, String> restoreProperties = new HashMap<>();
-
private Codec savedCodec;
private Locale savedLocale;
private TimeZone savedTimeZone;
@@ -116,15 +108,10 @@
// enable this by default, for IDE consistency with ant tests (as it's the default from ant)
// TODO: really should be in solr base classes, but some extend LTC directly.
// we do this in beforeClass, because some tests currently disable it
- restoreProperties.put("solr.directoryFactory", System.getProperty("solr.directoryFactory"));
if (System.getProperty("solr.directoryFactory") == null) {
System.setProperty("solr.directoryFactory", "org.apache.solr.core.MockDirectoryFactory");
}
- // Restore more Solr properties.
- restoreProperties.put("solr.solr.home", System.getProperty("solr.solr.home"));
- restoreProperties.put("solr.data.dir", System.getProperty("solr.data.dir"));
-
// if verbose: print some debugging stuff about which codecs are loaded.
if (VERBOSE) {
Set<String> codecs = Codec.availableCodecs();
@@ -224,9 +211,6 @@
locale = testLocale.equals("random") ? randomLocale : localeForName(testLocale);
Locale.setDefault(locale);
- // TimeZone.getDefault will set user.timezone to the default timezone of the user's locale.
- // So store the original property value and restore it at end.
- restoreProperties.put("user.timezone", System.getProperty("user.timezone"));
savedTimeZone = TimeZone.getDefault();
TimeZone randomTimeZone = randomTimeZone(random());
timeZone = testTimeZone.equals("random") ? randomTimeZone : TimeZone.getTimeZone(testTimeZone);
@@ -291,15 +275,6 @@
*/
@Override
protected void after() throws Exception {
- for (Map.Entry<String,String> e : restoreProperties.entrySet()) {
- if (e.getValue() == null) {
- System.clearProperty(e.getKey());
- } else {
- System.setProperty(e.getKey(), e.getValue());
- }
- }
- restoreProperties.clear();
-
Codec.setDefault(savedCodec);
InfoStream.setDefault(savedInfoStream);
if (savedLocale != null) Locale.setDefault(savedLocale);
Index: lucene/test-framework/src/java/org/apache/lucene/util/TestRuleRestoreSystemProperties.java
===================================================================
--- lucene/test-framework/src/java/org/apache/lucene/util/TestRuleRestoreSystemProperties.java (revision 0)
+++ lucene/test-framework/src/java/org/apache/lucene/util/TestRuleRestoreSystemProperties.java (working copy)
@@ -0,0 +1,78 @@
+package org.apache.lucene.util;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
+import com.carrotsearch.randomizedtesting.rules.TestRuleAdapter;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Restore a given set of system properties to a snapshot taken at the beginning
+ * of the rule.
+ *
+ * This is semantically similar to {@link SystemPropertiesRestoreRule} but
+ * the list of properties to restore must be provided explicitly (because the security
+ * manager prevents us from accessing the whole set of properties).
+ *
+ * All properties to be restored must have r/w property permission.
+ */
+public class TestRuleRestoreSystemProperties extends TestRuleAdapter {
+ private final String[] propertyNames;
+ private final Map<String, String> restore = new HashMap<String, String>();
+
+ public TestRuleRestoreSystemProperties(String... propertyNames) {
+ this.propertyNames = propertyNames;
+
+ if (propertyNames.length == 0) {
+ throw new IllegalArgumentException("No properties to restore? Odd.");
+ }
+ }
+
+ @Override
+ protected void before() throws Throwable {
+ super.before();
+
+ assert restore.isEmpty();
+ for (String key : propertyNames) {
+ restore.put(key, System.getProperty(key));
+ }
+ }
+
+ @Override
+ protected void afterAlways(List<Throwable> errors) throws Throwable {
+ for (String key : propertyNames) {
+ try {
+ String value = restore.get(key);
+ if (value == null) {
+ System.clearProperty(key);
+ } else {
+ System.setProperty(key, value);
+ }
+ } catch (SecurityException e) {
+ // We should have permission to write but if we don't, record the error
+ errors.add(e);
+ }
+ }
+ restore.clear();
+
+ super.afterAlways(errors);
+ }
+}
Index: lucene/core/src/test/org/apache/lucene/util/TestMaxFailuresRule.java
===================================================================
--- lucene/core/src/test/org/apache/lucene/util/TestMaxFailuresRule.java (revision 1663149)
+++ lucene/core/src/test/org/apache/lucene/util/TestMaxFailuresRule.java (working copy)
@@ -22,7 +22,6 @@
import org.apache.lucene.util.junitcompat.WithNestedTests;
import org.junit.Assert;
import org.junit.BeforeClass;
-import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.Description;
import org.junit.runner.JUnitCore;
@@ -37,17 +36,11 @@
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope.Scope;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakZombies;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakZombies.Consequence;
-import com.carrotsearch.randomizedtesting.rules.SystemPropertiesInvariantRule;
-import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
/**
* @see TestRuleIgnoreAfterMaxFailures
- * @see SystemPropertiesInvariantRule
*/
public class TestMaxFailuresRule extends WithNestedTests {
- @Rule
- public SystemPropertiesRestoreRule restoreSysProps = new SystemPropertiesRestoreRule();
-
public TestMaxFailuresRule() {
super(true);
}
Index: lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java
===================================================================
--- lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java (revision 1663149)
+++ lucene/core/src/test/org/apache/lucene/util/junitcompat/WithNestedTests.java (working copy)
@@ -29,6 +29,7 @@
import org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures;
import org.apache.lucene.util.TestRuleIgnoreTestSuites;
import org.apache.lucene.util.TestRuleMarkFailure;
+import org.apache.lucene.util.TestRuleRestoreSystemProperties;
import org.apache.lucene.util.LuceneTestCase.SuppressSysoutChecks;
import org.junit.After;
import org.junit.Assert;
@@ -44,7 +45,6 @@
import com.carrotsearch.randomizedtesting.RandomizedRunner;
import com.carrotsearch.randomizedtesting.RandomizedTest;
import com.carrotsearch.randomizedtesting.SysGlobals;
-import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
import com.carrotsearch.randomizedtesting.rules.TestRuleAdapter;
/**
@@ -124,7 +124,7 @@
{
final TestRuleMarkFailure marker = new TestRuleMarkFailure();
rules = RuleChain
- .outerRule(new SystemPropertiesRestoreRule())
+ .outerRule(new TestRuleRestoreSystemProperties(TestRuleIgnoreTestSuites.PROPERTY_RUN_NESTED))
.around(new TestRuleAdapter() {
@Override
protected void afterAlways(List<Throwable> errors) throws Throwable {
Index: lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSeedFromUncaught.java
===================================================================
--- lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSeedFromUncaught.java (revision 1663149)
+++ lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSeedFromUncaught.java (working copy)
@@ -18,7 +18,6 @@
*/
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util.LuceneTestCase.SuppressSysoutChecks;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.JUnitCore;
Index: lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSystemPropertiesInvariantRule.java
===================================================================
--- lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSystemPropertiesInvariantRule.java (revision 1663149)
+++ lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSystemPropertiesInvariantRule.java (working copy)
@@ -1,158 +0,0 @@
-package org.apache.lucene.util.junitcompat;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.util.Properties;
-
-import org.junit.*;
-import org.junit.rules.TestRule;
-import org.junit.runner.JUnitCore;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-
-import com.carrotsearch.randomizedtesting.rules.SystemPropertiesInvariantRule;
-import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
-
-/**
- * @see SystemPropertiesRestoreRule
- * @see SystemPropertiesInvariantRule
- */
-public class TestSystemPropertiesInvariantRule extends WithNestedTests {
- public static final String PROP_KEY1 = "new-property-1";
- public static final String VALUE1 = "new-value-1";
-
- public TestSystemPropertiesInvariantRule() {
- super(true);
- }
-
- public static class Base extends WithNestedTests.AbstractNestedTest {
- public void testEmpty() {}
- }
-
- public static class InBeforeClass extends Base {
- @BeforeClass
- public static void beforeClass() {
- System.setProperty(PROP_KEY1, VALUE1);
- }
- }
-
- public static class InAfterClass extends Base {
- @AfterClass
- public static void afterClass() {
- System.setProperty(PROP_KEY1, VALUE1);
- }
- }
-
- public static class InTestMethod extends Base {
- public void testMethod1() {
- if (System.getProperty(PROP_KEY1) != null) {
- throw new RuntimeException("Shouldn't be here.");
- }
- System.setProperty(PROP_KEY1, VALUE1);
- }
-
- public void testMethod2() {
- testMethod1();
- }
- }
-
- public static class NonStringProperties extends Base {
- public void testMethod1() {
- if (System.getProperties().get(PROP_KEY1) != null) {
- throw new RuntimeException("Will pass.");
- }
-
- Properties properties = System.getProperties();
- properties.put(PROP_KEY1, new Object());
- Assert.assertTrue(System.getProperties().get(PROP_KEY1) != null);
- }
-
- public void testMethod2() {
- testMethod1();
- }
-
- @AfterClass
- public static void cleanup() {
- System.getProperties().remove(PROP_KEY1);
- }
- }
-
- public static class IgnoredProperty {
- @Rule
- public TestRule invariant = new SystemPropertiesInvariantRule(PROP_KEY1);
-
- @Test
- public void testMethod1() {
- System.setProperty(PROP_KEY1, VALUE1);
- }
- }
-
- @Before
- @After
- public void cleanup() {
- System.clearProperty(PROP_KEY1);
- }
-
- @Test
- public void testRuleInvariantBeforeClass() {
- Result runClasses = JUnitCore.runClasses(InBeforeClass.class);
- Assert.assertEquals(1, runClasses.getFailureCount());
- Assert.assertTrue(runClasses.getFailures().get(0).getMessage()
- .contains(PROP_KEY1));
- Assert.assertNull(System.getProperty(PROP_KEY1));
- }
-
- @Test
- public void testRuleInvariantAfterClass() {
- Result runClasses = JUnitCore.runClasses(InAfterClass.class);
- Assert.assertEquals(1, runClasses.getFailureCount());
- Assert.assertTrue(runClasses.getFailures().get(0).getMessage()
- .contains(PROP_KEY1));
- Assert.assertNull(System.getProperty(PROP_KEY1));
- }
-
- @Test
- public void testRuleInvariantInTestMethod() {
- Result runClasses = JUnitCore.runClasses(InTestMethod.class);
- Assert.assertEquals(2, runClasses.getFailureCount());
- for (Failure f : runClasses.getFailures()) {
- Assert.assertTrue(f.getMessage().contains(PROP_KEY1));
- }
- Assert.assertNull(System.getProperty(PROP_KEY1));
- }
-
- @Test
- public void testNonStringProperties() {
- Result runClasses = JUnitCore.runClasses(NonStringProperties.class);
- Assert.assertEquals(1, runClasses.getFailureCount());
- Assert.assertTrue(runClasses.getFailures().get(0).getMessage().contains("Will pass"));
- Assert.assertEquals(3, runClasses.getRunCount());
- }
-
- @Test
- public void testIgnoredProperty() {
- System.clearProperty(PROP_KEY1);
- try {
- Result runClasses = JUnitCore.runClasses(IgnoredProperty.class);
- Assert.assertEquals(0, runClasses.getFailureCount());
- Assert.assertEquals(VALUE1, System.getProperty(PROP_KEY1));
- } finally {
- System.clearProperty(PROP_KEY1);
- }
- }
-}
Index: lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSameRandomnessLocalePassedOrNot.java
===================================================================
--- lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSameRandomnessLocalePassedOrNot.java (revision 1663149)
+++ lucene/core/src/test/org/apache/lucene/util/junitcompat/TestSameRandomnessLocalePassedOrNot.java (working copy)
@@ -1,83 +0,0 @@
-package org.apache.lucene.util.junitcompat;
-
-import java.util.*;
-
-import org.apache.lucene.util.TestUtil;
-import org.apache.lucene.util.LuceneTestCase.SuppressSysoutChecks;
-import org.junit.*;
-import org.junit.rules.RuleChain;
-import org.junit.rules.TestRule;
-import org.junit.runner.JUnitCore;
-import org.junit.runner.Result;
-
-import com.carrotsearch.randomizedtesting.RandomizedContext;
-import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-public class TestSameRandomnessLocalePassedOrNot extends WithNestedTests {
- @ClassRule
- public static TestRule solrClassRules =
- RuleChain.outerRule(new SystemPropertiesRestoreRule());
-
- @Rule
- public TestRule solrTestRules =
- RuleChain.outerRule(new SystemPropertiesRestoreRule());
-
- public TestSameRandomnessLocalePassedOrNot() {
- super(true);
- }
-
- public static class Nested extends WithNestedTests.AbstractNestedTest {
- public static String pickString;
- public static Locale defaultLocale;
- public static TimeZone defaultTimeZone;
- public static String seed;
-
- @BeforeClass
- public static void setup() {
- seed = RandomizedContext.current().getRunnerSeedAsString();
-
- Random rnd = random();
- pickString = TestUtil.randomSimpleString(rnd);
-
- defaultLocale = Locale.getDefault();
- defaultTimeZone = TimeZone.getDefault();
- }
-
- public void testPassed() {
- System.out.println("Picked locale: " + defaultLocale);
- System.out.println("Picked timezone: " + defaultTimeZone.getID());
- }
- }
-
- @Test
- public void testSetupWithoutLocale() {
- Result runClasses = JUnitCore.runClasses(Nested.class);
- Assert.assertEquals(0, runClasses.getFailureCount());
-
- String s1 = Nested.pickString;
- System.setProperty("tests.seed", Nested.seed);
- System.setProperty("tests.timezone", Nested.defaultTimeZone.getID());
- System.setProperty("tests.locale", Nested.defaultLocale.toString());
- JUnitCore.runClasses(Nested.class);
- String s2 = Nested.pickString;
-
- Assert.assertEquals(s1, s2);
- }
-}
Index: lucene/core/src/test/org/apache/lucene/document/TestDateTools.java
===================================================================
--- lucene/core/src/test/org/apache/lucene/document/TestDateTools.java (revision 1663149)
+++ lucene/core/src/test/org/apache/lucene/document/TestDateTools.java (working copy)
@@ -5,12 +5,7 @@
import java.util.*;
import org.apache.lucene.util.LuceneTestCase;
-import org.junit.Rule;
-import org.junit.rules.RuleChain;
-import org.junit.rules.TestRule;
-import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -28,10 +23,6 @@
* limitations under the License.
*/
public class TestDateTools extends LuceneTestCase {
- @Rule
- public TestRule testRules =
- RuleChain.outerRule(new SystemPropertiesRestoreRule());
-
public void testStringToDate() throws ParseException {
Date d = null;
Index: lucene/tools/junit4/tests.policy
===================================================================
--- lucene/tools/junit4/tests.policy (revision 1663149)
+++ lucene/tools/junit4/tests.policy (working copy)
@@ -74,9 +74,21 @@
permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
// read access to all system properties:
- // needed by junit4 BootstrapEvent (it calls System.getProperties, used by ant xml reporting?)
- permission java.util.PropertyPermission "*", "read,write";
+ permission java.util.PropertyPermission "*", "read";
+ // write access to only these:
+ // locale randomization
+ permission java.util.PropertyPermission "user.language", "write";
+ // timezone randomization
+ permission java.util.PropertyPermission "user.timezone", "write";
+ // used by nested tests? (e.g. TestLeaveFilesIfTestFails). TODO: look into this
+ permission java.util.PropertyPermission "tests.runnested", "write";
+
+ // solr properties. TODO: move these out to SolrTestCase
+ permission java.util.PropertyPermission "solr.data.dir", "write";
+ permission java.util.PropertyPermission "solr.solr.home", "write";
+ permission java.util.PropertyPermission "solr.directoryFactory", "write";
+
// replicator: jetty tests require some network permissions:
// all possibilities of accepting/binding/connecting on localhost with ports >= 1024:
permission java.net.SocketPermission "localhost:1024-", "accept,listen,connect,resolve";
Index: lucene/replicator/src/test/org/apache/lucene/replicator/http/HttpReplicatorTest.java
===================================================================
--- lucene/replicator/src/test/org/apache/lucene/replicator/http/HttpReplicatorTest.java (revision 1663149)
+++ lucene/replicator/src/test/org/apache/lucene/replicator/http/HttpReplicatorTest.java (working copy)
@@ -48,10 +48,6 @@
import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
public class HttpReplicatorTest extends ReplicatorTestCase {
- @Rule
- public TestRule testRules =
- RuleChain.outerRule(new SystemPropertiesRestoreRule());
-
private Path clientWorkDir;
private Replicator serverReplicator;
private IndexWriter writer;
Index: lucene/replicator/build.xml
===================================================================
--- lucene/replicator/build.xml (revision 1663149)
+++ lucene/replicator/build.xml (working copy)
@@ -21,6 +21,9 @@
Files replication utility
</description>
+ <!-- TODO: go fix this in jetty, its stupid -->
+ <property name="tests.policy" location="../tools/junit4/solr-tests.policy"/>
+
<import file="../module-build.xml"/>
<path id="classpath">
Index: dev-tools/idea/.idea/libraries/JUnit.xml
===================================================================
--- dev-tools/idea/.idea/libraries/JUnit.xml (revision 1663149)
+++ dev-tools/idea/.idea/libraries/JUnit.xml (working copy)
@@ -2,7 +2,7 @@
<library name="JUnit">
<CLASSES>
<root url="jar://$PROJECT_DIR$/lucene/test-framework/lib/junit-4.10.jar!/" />
- <root url="jar://$PROJECT_DIR$/lucene/test-framework/lib/randomizedtesting-runner-2.1.9.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lucene/test-framework/lib/randomizedtesting-runner-2.1.12.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
Index: solr/licenses/randomizedtesting-runner-2.1.9.jar.sha1
===================================================================
--- solr/licenses/randomizedtesting-runner-2.1.9.jar.sha1 (revision 1663149)
+++ solr/licenses/randomizedtesting-runner-2.1.9.jar.sha1 (working copy)
@@ -1 +0,0 @@
-2d7283d02387a23434ef553d5e5e4e94f45b007a
Index: solr/licenses/junit4-ant-2.1.12.jar.sha1
===================================================================
--- solr/licenses/junit4-ant-2.1.12.jar.sha1 (revision 0)
+++ solr/licenses/junit4-ant-2.1.12.jar.sha1 (working copy)
@@ -0,0 +1 @@
+09847aac214a15628aaa49f45daedcc14b856d1b
Index: solr/licenses/junit4-ant-2.1.9.jar.sha1
===================================================================
--- solr/licenses/junit4-ant-2.1.9.jar.sha1 (revision 1663149)
+++ solr/licenses/junit4-ant-2.1.9.jar.sha1 (working copy)
@@ -1 +0,0 @@
-ce61b54b0c33e45811e823441f8322c23de57842
Index: solr/licenses/randomizedtesting-runner-2.1.12.jar.sha1
===================================================================
--- solr/licenses/randomizedtesting-runner-2.1.12.jar.sha1 (revision 0)
+++ solr/licenses/randomizedtesting-runner-2.1.12.jar.sha1 (working copy)
@@ -0,0 +1 @@
+a31b5efc13b29ad7cbb2ca0f35980f2e152d5845