You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2010/09/13 19:37:26 UTC
svn commit: r996611 [3/3] - in /lucene/dev/trunk:
lucene/contrib/ant/src/test/org/apache/lucene/ant/
lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/
lucene/contrib/benchmark/src/test/org/apache/lucene/benchmark/byTask/utils/
lucen...
Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java Mon Sep 13 17:37:20 2010
@@ -54,10 +54,6 @@ public class TestPayloadNearQuery extend
private byte[] payload2 = new byte[]{2};
private byte[] payload4 = new byte[]{4};
- public TestPayloadNearQuery(String s) {
- super(s);
- }
-
private class PayloadAnalyzer extends Analyzer {
@Override
public TokenStream tokenStream(String fieldName, Reader reader) {
@@ -104,7 +100,7 @@ public class TestPayloadNearQuery extend
}
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
directory = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random, directory,
@@ -126,7 +122,7 @@ public class TestPayloadNearQuery extend
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
searcher.close();
reader.close();
directory.close();
Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java Mon Sep 13 17:37:20 2010
@@ -60,10 +60,6 @@ public class TestPayloadTermQuery extend
private byte[] payloadMultiField2 = new byte[]{4};
protected Directory directory;
- public TestPayloadTermQuery(String s) {
- super(s);
- }
-
private class PayloadAnalyzer extends Analyzer {
@@ -109,7 +105,7 @@ public class TestPayloadTermQuery extend
}
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
directory = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random, directory,
@@ -133,7 +129,7 @@ public class TestPayloadTermQuery extend
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
searcher.close();
reader.close();
directory.close();
Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestBasics.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestBasics.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestBasics.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestBasics.java Mon Sep 13 17:37:20 2010
@@ -38,7 +38,7 @@ import org.apache.lucene.search.QueryUti
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.English;
-import org.apache.lucene.util.LuceneTestCaseJ4;
+import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util._TestUtil;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -58,7 +58,7 @@ import static org.junit.Assert.*;
* testing of the indexing and search code.
*
*/
-public class TestBasics extends LuceneTestCaseJ4 {
+public class TestBasics extends LuceneTestCase {
private static IndexSearcher searcher;
private static IndexReader reader;
private static Directory directory;
Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestFieldMaskingSpanQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestFieldMaskingSpanQuery.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestFieldMaskingSpanQuery.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestFieldMaskingSpanQuery.java Mon Sep 13 17:37:20 2010
@@ -52,7 +52,7 @@ public class TestFieldMaskingSpanQuery e
protected IndexReader reader;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
directory = newDirectory();
RandomIndexWriter writer= new RandomIndexWriter(random, directory);
@@ -116,7 +116,7 @@ public class TestFieldMaskingSpanQuery e
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
searcher.close();
reader.close();
directory.close();
Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java Mon Sep 13 17:37:20 2010
@@ -43,7 +43,7 @@ public class TestNearSpansOrdered extend
new QueryParser(TEST_VERSION_CURRENT, FIELD, new MockAnalyzer());
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
searcher.close();
reader.close();
directory.close();
@@ -51,7 +51,7 @@ public class TestNearSpansOrdered extend
}
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
directory = newDirectory();
RandomIndexWriter writer= new RandomIndexWriter(random, directory);
Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java Mon Sep 13 17:37:20 2010
@@ -55,13 +55,9 @@ public class TestPayloadSpans extends Lu
protected IndexReader indexReader;
private IndexReader closeIndexReader;
private Directory directory;
-
- public TestPayloadSpans(String s) {
- super(s);
- }
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
PayloadHelper helper = new PayloadHelper();
searcher = helper.setUp(similarity, 1000);
Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestSpans.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestSpans.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestSpans.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestSpans.java Mon Sep 13 17:37:20 2010
@@ -47,7 +47,7 @@ public class TestSpans extends LuceneTes
public static final String field = "field";
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
directory = newDirectory();
RandomIndexWriter writer= new RandomIndexWriter(random, directory);
@@ -62,7 +62,7 @@ public class TestSpans extends LuceneTes
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
searcher.close();
reader.close();
directory.close();
Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java Mon Sep 13 17:37:20 2010
@@ -52,7 +52,7 @@ public class TestSpansAdvanced extends L
* Initializes the tests by adding 4 identical documents to the index.
*/
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
// create test index
mDirectory = newDirectory();
@@ -69,7 +69,7 @@ public class TestSpansAdvanced extends L
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
searcher.close();
reader.close();
mDirectory.close();
Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced2.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced2.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced2.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced2.java Mon Sep 13 17:37:20 2010
@@ -41,7 +41,7 @@ public class TestSpansAdvanced2 extends
* Initializes the tests by adding documents to the index.
*/
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
// create test index
@@ -61,7 +61,7 @@ public class TestSpansAdvanced2 extends
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
searcher2.close();
reader2.close();
super.tearDown();
Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/store/TestCopyBytes.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/store/TestCopyBytes.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/store/TestCopyBytes.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/store/TestCopyBytes.java Mon Sep 13 17:37:20 2010
@@ -18,13 +18,13 @@ package org.apache.lucene.store;
*/
-import org.apache.lucene.util.LuceneTestCaseJ4;
+import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util._TestUtil;
import org.junit.Test;
import static org.junit.Assert.*;
-public class TestCopyBytes extends LuceneTestCaseJ4 {
+public class TestCopyBytes extends LuceneTestCase {
private byte value(int idx) {
return (byte) ((idx%256) * (1+(idx/256)));
Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/store/TestMultiMMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/store/TestMultiMMap.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/store/TestMultiMMap.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/store/TestMultiMMap.java Mon Sep 13 17:37:20 2010
@@ -38,7 +38,7 @@ public class TestMultiMMap extends Lucen
File workDir;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
workDir = new File(TEMP_DIR, "TestMultiMMap");
workDir.mkdirs();
Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/store/TestRAMDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/store/TestRAMDirectory.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/store/TestRAMDirectory.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/store/TestRAMDirectory.java Mon Sep 13 17:37:20 2010
@@ -47,7 +47,7 @@ public class TestRAMDirectory extends Lu
// setup the index
@Override
- protected void setUp () throws Exception {
+ public void setUp() throws Exception {
super.setUp();
indexDir = new File(TEMP_DIR, "RAMDirIndex");
@@ -152,7 +152,7 @@ public class TestRAMDirectory extends Lu
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
// cleanup
if (indexDir != null && indexDir.exists()) {
rmDir (indexDir);
Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/store/TestWindowsMMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/store/TestWindowsMMap.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/store/TestWindowsMMap.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/store/TestWindowsMMap.java Mon Sep 13 17:37:20 2010
@@ -34,7 +34,7 @@ public class TestWindowsMMap extends Luc
private final static String alphabet = "abcdefghijklmnopqrstuvwzyz";
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
}
Copied: lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java (from r996433, lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java)
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java?p2=lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java&p1=lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java&r1=996433&r2=996611&rev=996611&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java Mon Sep 13 17:37:20 2010
@@ -54,6 +54,8 @@ import org.junit.runner.Description;
import org.junit.runner.RunWith;
import org.junit.runner.manipulation.Filter;
import org.junit.runner.manipulation.NoTestsRemainException;
+import org.junit.runner.notification.Failure;
+import org.junit.runner.notification.RunListener;
import org.junit.runner.notification.RunNotifier;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.model.FrameworkMethod;
@@ -78,12 +80,8 @@ import java.util.WeakHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
/**
- * Base class for all Lucene unit tests, Junit4 variant.
- * Replaces LuceneTestCase.
+ * Base class for all Lucene unit tests, Junit3 or Junit4 variant.
* <p>
* </p>
* <p>
@@ -109,15 +107,8 @@ import static org.junit.Assert.fail;
* @see #assertSaneFieldCaches(String)
*/
-
-// If we really need functionality in runBare override from LuceneTestCase,
-// we can introduce RunBareWrapper and override runChild, and add the
-// @RunWith annotation as below. runChild will be called for
-// every test. But the functionality we used to
-// get from that override is provided by InterceptTestCaseEvents
-//@RunWith(RunBareWrapper.class)
-@RunWith(LuceneTestCaseJ4.LuceneTestCaseRunner.class)
-public abstract class LuceneTestCaseJ4 {
+@RunWith(LuceneTestCase.LuceneTestCaseRunner.class)
+public abstract class LuceneTestCase extends Assert {
/**
* true iff tests are run in verbose mode. Note: if it is false, tests are not
@@ -189,11 +180,6 @@ public abstract class LuceneTestCaseJ4 {
}
private List<UncaughtExceptionEntry> uncaughtExceptions = Collections.synchronizedList(new ArrayList<UncaughtExceptionEntry>());
- // checks if class correctly annotated
- private static final Object PLACEHOLDER = new Object();
- private static final Map<Class<? extends LuceneTestCaseJ4>,Object> checkedClasses =
- Collections.synchronizedMap(new WeakHashMap<Class<? extends LuceneTestCaseJ4>,Object>());
-
// saves default codec: we do this statically as many build indexes in @beforeClass
private static String savedDefaultCodec;
private static Codec codec;
@@ -335,17 +321,7 @@ public abstract class LuceneTestCaseJ4 {
@Override
public void starting(FrameworkMethod method) {
// set current method name for logging
- LuceneTestCaseJ4.this.name = method.getName();
- // check if the current test's class annotated all test* methods with @Test
- final Class<? extends LuceneTestCaseJ4> clazz = LuceneTestCaseJ4.this.getClass();
- if (!checkedClasses.containsKey(clazz)) {
- checkedClasses.put(clazz, PLACEHOLDER);
- for (Method m : clazz.getMethods()) {
- if (m.getName().startsWith("test") && m.getAnnotation(Test.class) == null) {
- fail("In class '" + clazz.getName() + "' the method '" + m.getName() + "' is not annotated with @Test.");
- }
- }
- }
+ LuceneTestCase.this.name = method.getName();
super.starting(method);
}
@@ -476,7 +452,29 @@ public abstract class LuceneTestCaseJ4 {
}
}
+
+ // These deprecated methods should be removed soon, when all tests using no Epsilon are fixed:
+
+ @Deprecated
+ static public void assertEquals(double expected, double actual) {
+ assertEquals(null, expected, actual);
+ }
+
+ @Deprecated
+ static public void assertEquals(String message, double expected, double actual) {
+ assertEquals(message, Double.valueOf(expected), Double.valueOf(actual));
+ }
+
+ @Deprecated
+ static public void assertEquals(float expected, float actual) {
+ assertEquals(null, expected, actual);
+ }
+ @Deprecated
+ static public void assertEquals(String message, float expected, float actual) {
+ assertEquals(message, Float.valueOf(expected), Float.valueOf(actual));
+ }
+
/**
* Convinience method for logging an iterator.
*
@@ -508,8 +506,8 @@ public abstract class LuceneTestCaseJ4 {
dumpIterator(label, iter, stream);
}
- private static final Map<Class<? extends LuceneTestCaseJ4>,Long> staticSeeds =
- Collections.synchronizedMap(new WeakHashMap<Class<? extends LuceneTestCaseJ4>,Long>());
+ private static final Map<Class<? extends LuceneTestCase>,Long> staticSeeds =
+ Collections.synchronizedMap(new WeakHashMap<Class<? extends LuceneTestCase>,Long>());
/**
* Returns a {@link Random} instance for generating random numbers from a beforeclass
@@ -518,7 +516,7 @@ public abstract class LuceneTestCaseJ4 {
* for reproducing the test using {@link #newStaticRandom(Class, long)} with the recorded seed
* .
*/
- public static Random newStaticRandom(Class<? extends LuceneTestCaseJ4> clazz) {
+ public static Random newStaticRandom(Class<? extends LuceneTestCase> clazz) {
Long seed = seedRnd.nextLong();
staticSeeds.put(clazz, seed);
return new Random(seed);
@@ -530,7 +528,7 @@ public abstract class LuceneTestCaseJ4 {
* If an error occurs in the test that is not reproducible, you can use this method to
* initialize the number generator with the seed that was printed out during the failing test.
*/
- public static Random newStaticRandom(Class<? extends LuceneTestCaseJ4> clazz, long seed) {
+ public static Random newStaticRandom(Class<? extends LuceneTestCase> clazz, long seed) {
staticSeeds.put(clazz, Long.valueOf(seed));
System.out.println("WARNING: random static seed of testclass '" + clazz + "' is fixed to: " + seed);
return new Random(seed);
@@ -777,6 +775,21 @@ public abstract class LuceneTestCaseJ4 {
/** optionally filters the tests to be run by TEST_METHOD */
public static class LuceneTestCaseRunner extends BlockJUnit4ClassRunner {
+ private List<FrameworkMethod> testMethods;
+
+ @Override
+ protected List<FrameworkMethod> computeTestMethods() {
+ if (testMethods != null)
+ return testMethods;
+ testMethods = getTestClass().getAnnotatedMethods(Test.class);
+ for (Method m : getTestClass().getJavaClass().getMethods())
+ if (m.getName().startsWith("test") &&
+ m.getAnnotation(Test.class) == null &&
+ m.getParameterTypes().length == 0 &&
+ m.getGenericReturnType() == Void.TYPE)
+ testMethods.add(new FrameworkMethod(m));
+ return testMethods;
+ }
@Override
protected void runChild(FrameworkMethod arg0, RunNotifier arg1) {
@@ -804,4 +817,104 @@ public abstract class LuceneTestCaseJ4 {
}
}
}
+
+ /**
+ * Test runner for Lucene test classes that test Locale-sensitive behavior.
+ * <p>
+ * This class will run tests under the default Locale, but then will also run
+ * tests under all available JVM locales. This is helpful to ensure tests will
+ * not fail under a different environment.
+ * </p>
+ */
+ public static class LocalizedTestCaseRunner extends LuceneTestCaseRunner {
+ /**
+ * Before changing the default Locale, save the default Locale here so
+ * that it can be restored.
+ */
+ private final Locale defaultLocale = Locale.getDefault();
+
+ /**
+ * The locale being used as the system default Locale
+ */
+ private Locale locale;
+
+ private final RunListener listener = new RunListener() {
+ @Override
+ public void testFailure(Failure failure) throws Exception {
+ super.testFailure(failure);
+ String methodName = failure.getDescription().getMethodName();
+ if (locale.equals(defaultLocale))
+ System.out.println("Test failure of '" + methodName
+ + "' occurred with the default Locale " + locale);
+ else
+ System.out.println("Test failure of '" + methodName
+ + "' occurred under a different Locale " + locale);
+ }
+ };
+
+ public LocalizedTestCaseRunner(Class<?> clazz) throws InitializationError {
+ super(clazz);
+ }
+
+ @Override
+ protected void runChild(FrameworkMethod arg0, RunNotifier arg1) {
+ arg1.addListener(listener);
+ locale = defaultLocale;
+ super.runChild(arg0, arg1);
+
+ for (Locale other : Locale.getAvailableLocales()) {
+ locale = other;
+ Locale.setDefault(locale);
+ super.runChild(arg0, arg1);
+ }
+
+ Locale.setDefault(defaultLocale);
+ }
+ }
+
+ /**
+ * Test runner for Lucene test classes that run across all core codecs.
+ */
+ public static class MultiCodecTestCaseRunner extends LuceneTestCaseRunner {
+ /**
+ * Before changing the default Codec, save the default Codec here so
+ * that it can be restored.
+ */
+ private final String defaultCodec = CodecProvider.getDefaultCodec();
+
+ /**
+ * The Codec being used as the system default
+ */
+ private String codec;
+
+ private final RunListener listener = new RunListener() {
+ @Override
+ public void testFailure(Failure failure) throws Exception {
+ super.testFailure(failure);
+ String methodName = failure.getDescription().getMethodName();
+ System.out.println("Test failure of '" + methodName
+ + "' occurred with codec " + codec);
+ }
+ };
+
+ public MultiCodecTestCaseRunner(Class<?> clazz) throws InitializationError {
+ super(clazz);
+ }
+
+ @Override
+ protected void runChild(FrameworkMethod arg0, RunNotifier arg1) {
+ arg1.addListener(listener);
+ // If we're running w/ PreFlex codec we must swap in the
+ // test-only PreFlexRW codec (since core PreFlex can
+ // only read segments):
+ swapCodec(new PreFlexRWCodec());
+ for (String other : CodecProvider.CORE_CODECS) {
+ codec = other;
+ CodecProvider.setDefaultCodec(codec);
+ super.runChild(arg0, arg1);
+ }
+ CodecProvider.setDefaultCodec(defaultCodec);
+ }
+
+ }
}
Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestBitVector.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestBitVector.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestBitVector.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestBitVector.java Mon Sep 13 17:37:20 2010
@@ -28,9 +28,6 @@ import org.apache.lucene.store.RAMDirect
*/
public class TestBitVector extends LuceneTestCase
{
- public TestBitVector(String s) {
- super(s);
- }
/**
* Test the default constructor on BitVectors of various sizes.
Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestCharacterUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestCharacterUtils.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestCharacterUtils.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestCharacterUtils.java Mon Sep 13 17:37:20 2010
@@ -18,7 +18,7 @@ package org.apache.lucene.util;
*/
import static org.junit.Assert.*;
-import static org.apache.lucene.util.LuceneTestCaseJ4.TEST_VERSION_CURRENT;
+import static org.apache.lucene.util.LuceneTestCase.TEST_VERSION_CURRENT;
import java.io.IOException;
import java.io.Reader;
Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestFieldCacheSanityChecker.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestFieldCacheSanityChecker.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestFieldCacheSanityChecker.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestFieldCacheSanityChecker.java Mon Sep 13 17:37:20 2010
@@ -38,7 +38,7 @@ public class TestFieldCacheSanityChecker
private static final int NUM_DOCS = 1000;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
dirA = newDirectory();
dirB = newDirectory();
@@ -74,7 +74,7 @@ public class TestFieldCacheSanityChecker
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
readerA.close();
readerB.close();
readerX.close();
Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestPriorityQueue.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestPriorityQueue.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestPriorityQueue.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestPriorityQueue.java Mon Sep 13 17:37:20 2010
@@ -20,9 +20,6 @@ package org.apache.lucene.util;
import java.util.Random;
public class TestPriorityQueue extends LuceneTestCase {
- public TestPriorityQueue(String name) {
- super(name);
- }
private static class IntegerQueue extends PriorityQueue<Integer> {
public IntegerQueue(int count) {
Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestSetOnce.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestSetOnce.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestSetOnce.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestSetOnce.java Mon Sep 13 17:37:20 2010
@@ -24,7 +24,7 @@ import java.util.Random;
import org.apache.lucene.util.SetOnce.AlreadySetException;
import org.junit.Test;
-public class TestSetOnce extends LuceneTestCaseJ4 {
+public class TestSetOnce extends LuceneTestCase {
private static final class SetOnceThread extends Thread {
SetOnce<Integer> set;
Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/_TestUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/_TestUtil.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/_TestUtil.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/_TestUtil.java Mon Sep 13 17:37:20 2010
@@ -36,7 +36,7 @@ public class _TestUtil {
/** Returns temp dir, containing String arg in its name;
* does not create the directory. */
public static File getTempDir(String desc) {
- return new File(LuceneTestCaseJ4.TEMP_DIR, desc + "." + new Random().nextLong());
+ return new File(LuceneTestCase.TEMP_DIR, desc + "." + new Random().nextLong());
}
public static void rmDir(File dir) throws IOException {
Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/automaton/TestDeterminism.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/automaton/TestDeterminism.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/automaton/TestDeterminism.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/automaton/TestDeterminism.java Mon Sep 13 17:37:20 2010
@@ -26,7 +26,7 @@ import org.apache.lucene.util.LuceneTest
public class TestDeterminism extends LuceneTestCase {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
}
Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java Mon Sep 13 17:37:20 2010
@@ -27,7 +27,7 @@ import java.util.Random;
public class TestUTF32ToUTF8 extends LuceneTestCase {
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
}
Modified: lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/charfilter/HTMLStripCharFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/charfilter/HTMLStripCharFilterTest.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/charfilter/HTMLStripCharFilterTest.java (original)
+++ lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/charfilter/HTMLStripCharFilterTest.java Mon Sep 13 17:37:20 2010
@@ -18,8 +18,6 @@ package org.apache.lucene.analysis.charf
*/
import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -34,18 +32,13 @@ import org.apache.lucene.util.LuceneTest
public class HTMLStripCharFilterTest extends LuceneTestCase {
-
- public HTMLStripCharFilterTest(String s) {
- super(s);
- }
-
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
super.tearDown();
}
//this is some text here is a link and another link . This is an entity: & plus a <. Here is an &
Modified: lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/charfilter/TestMappingCharFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/charfilter/TestMappingCharFilter.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/charfilter/TestMappingCharFilter.java (original)
+++ lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/charfilter/TestMappingCharFilter.java Mon Sep 13 17:37:20 2010
@@ -30,7 +30,7 @@ public class TestMappingCharFilter exten
NormalizeCharMap normMap;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
normMap = new NormalizeCharMap();
Modified: lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestAnalyzers.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestAnalyzers.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestAnalyzers.java (original)
+++ lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestAnalyzers.java Mon Sep 13 17:37:20 2010
@@ -39,10 +39,6 @@ import org.apache.lucene.util.Version;
public class TestAnalyzers extends BaseTokenStreamTestCase {
- public TestAnalyzers(String name) {
- super(name);
- }
-
public void testSimple() throws Exception {
Analyzer a = new SimpleAnalyzer(TEST_VERSION_CURRENT);
assertAnalyzesTo(a, "foo bar FOO BAR",
Modified: lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestKeywordAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestKeywordAnalyzer.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestKeywordAnalyzer.java (original)
+++ lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestKeywordAnalyzer.java Mon Sep 13 17:37:20 2010
@@ -39,7 +39,7 @@ public class TestKeywordAnalyzer extends
private IndexSearcher searcher;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
directory = new RAMDirectory();
IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(
Modified: lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestStopAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestStopAnalyzer.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestStopAnalyzer.java (original)
+++ lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/core/TestStopAnalyzer.java Mon Sep 13 17:37:20 2010
@@ -34,13 +34,9 @@ public class TestStopAnalyzer extends Ba
private StopAnalyzer stop = new StopAnalyzer(TEST_VERSION_CURRENT);
private Set<Object> inValidTokens = new HashSet<Object>();
-
- public TestStopAnalyzer(String s) {
- super(s);
- }
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
Iterator<?> it = StopAnalyzer.ENGLISH_STOP_WORDS_SET.iterator();
Modified: lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestLimitTokenCountAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestLimitTokenCountAnalyzer.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestLimitTokenCountAnalyzer.java (original)
+++ lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestLimitTokenCountAnalyzer.java Mon Sep 13 17:37:20 2010
@@ -28,10 +28,6 @@ import org.apache.lucene.util.Version;
public class TestLimitTokenCountAnalyzer extends BaseTokenStreamTestCase {
- public TestLimitTokenCountAnalyzer(String name) {
- super(name);
- }
-
public void testLimitTokenCountAnalyzer() throws IOException {
Analyzer a = new LimitTokenCountAnalyzer(new WhitespaceAnalyzer(TEST_VERSION_CURRENT), 2);
// dont use assertAnalyzesTo here, as the end offset is not the end of the string!
Modified: lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/EdgeNGramTokenFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/EdgeNGramTokenFilterTest.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/EdgeNGramTokenFilterTest.java (original)
+++ lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/EdgeNGramTokenFilterTest.java Mon Sep 13 17:37:20 2010
@@ -30,7 +30,7 @@ public class EdgeNGramTokenFilterTest ex
private TokenStream input;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
input = new WhitespaceTokenizer(TEST_VERSION_CURRENT, new StringReader("abcde"));
}
Modified: lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/EdgeNGramTokenizerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/EdgeNGramTokenizerTest.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/EdgeNGramTokenizerTest.java (original)
+++ lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/EdgeNGramTokenizerTest.java Mon Sep 13 17:37:20 2010
@@ -29,7 +29,7 @@ public class EdgeNGramTokenizerTest exte
private StringReader input;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
input = new StringReader("abcde");
}
Modified: lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/NGramTokenFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/NGramTokenFilterTest.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/NGramTokenFilterTest.java (original)
+++ lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/NGramTokenFilterTest.java Mon Sep 13 17:37:20 2010
@@ -30,7 +30,7 @@ public class NGramTokenFilterTest extend
private TokenStream input;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
input = new WhitespaceTokenizer(TEST_VERSION_CURRENT, new StringReader("abcde"));
}
Modified: lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/NGramTokenizerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/NGramTokenizerTest.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/NGramTokenizerTest.java (original)
+++ lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/ngram/NGramTokenizerTest.java Mon Sep 13 17:37:20 2010
@@ -29,7 +29,7 @@ public class NGramTokenizerTest extends
private StringReader input;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
input = new StringReader("abcde");
}
Modified: lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/payloads/NumericPayloadTokenFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/payloads/NumericPayloadTokenFilterTest.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/payloads/NumericPayloadTokenFilterTest.java (original)
+++ lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/payloads/NumericPayloadTokenFilterTest.java Mon Sep 13 17:37:20 2010
@@ -29,11 +29,6 @@ import java.io.StringReader;
public class NumericPayloadTokenFilterTest extends BaseTokenStreamTestCase {
-
- public NumericPayloadTokenFilterTest(String s) {
- super(s);
- }
-
public void test() throws IOException {
String test = "The quick red fox jumped over the lazy brown dogs";
Modified: lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/payloads/TokenOffsetPayloadTokenFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/payloads/TokenOffsetPayloadTokenFilterTest.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/payloads/TokenOffsetPayloadTokenFilterTest.java (original)
+++ lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/payloads/TokenOffsetPayloadTokenFilterTest.java Mon Sep 13 17:37:20 2010
@@ -27,11 +27,6 @@ import java.io.StringReader;
public class TokenOffsetPayloadTokenFilterTest extends BaseTokenStreamTestCase {
-
- public TokenOffsetPayloadTokenFilterTest(String s) {
- super(s);
- }
-
public void test() throws IOException {
String test = "The quick red fox jumped over the lazy brown dogs";
Modified: lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/payloads/TypeAsPayloadTokenFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/payloads/TypeAsPayloadTokenFilterTest.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/payloads/TypeAsPayloadTokenFilterTest.java (original)
+++ lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/payloads/TypeAsPayloadTokenFilterTest.java Mon Sep 13 17:37:20 2010
@@ -29,11 +29,6 @@ import java.io.StringReader;
public class TypeAsPayloadTokenFilterTest extends BaseTokenStreamTestCase {
-
- public TypeAsPayloadTokenFilterTest(String s) {
- super(s);
- }
-
public void test() throws IOException {
String test = "The quick red fox jumped over the lazy brown dogs";
Modified: lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzerTest.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzerTest.java (original)
+++ lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzerTest.java Mon Sep 13 17:37:20 2010
@@ -47,7 +47,7 @@ public class QueryAutoStopWordAnalyzerTe
QueryAutoStopWordAnalyzer protectedAnalyzer;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
dir = new RAMDirectory();
appAnalyzer = new WhitespaceAnalyzer(TEST_VERSION_CURRENT);
@@ -67,7 +67,7 @@ public class QueryAutoStopWordAnalyzerTe
}
@Override
- protected void tearDown() throws Exception {
+ public void tearDown() throws Exception {
reader.close();
super.tearDown();
}
Modified: lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/shingle/ShingleFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/shingle/ShingleFilterTest.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/shingle/ShingleFilterTest.java (original)
+++ lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/shingle/ShingleFilterTest.java Mon Sep 13 17:37:20 2010
@@ -788,7 +788,7 @@ public class ShingleFilterTest extends B
};
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
testTokenWithHoles = new Token[] {
createToken("please", 0, 6),
Modified: lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/shingle/TestShingleMatrixFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/shingle/TestShingleMatrixFilter.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/shingle/TestShingleMatrixFilter.java (original)
+++ lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/shingle/TestShingleMatrixFilter.java Mon Sep 13 17:37:20 2010
@@ -40,10 +40,6 @@ import org.apache.lucene.analysis.tokena
public class TestShingleMatrixFilter extends BaseTokenStreamTestCase {
- public TestShingleMatrixFilter(String name) {
- super(name);
- }
-
public void testIterator() throws IOException {
WhitespaceTokenizer wst = new WhitespaceTokenizer(TEST_VERSION_CURRENT, new StringReader("one two three four five"));
Modified: lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/DateRecognizerSinkTokenizerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/DateRecognizerSinkTokenizerTest.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/DateRecognizerSinkTokenizerTest.java (original)
+++ lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/DateRecognizerSinkTokenizerTest.java Mon Sep 13 17:37:20 2010
@@ -26,11 +26,6 @@ import org.apache.lucene.analysis.core.W
public class DateRecognizerSinkTokenizerTest extends BaseTokenStreamTestCase {
-
- public DateRecognizerSinkTokenizerTest(String s) {
- super(s);
- }
-
public void test() throws IOException {
DateRecognizerSinkFilter sinkFilter = new DateRecognizerSinkFilter(new SimpleDateFormat("MM/dd/yyyy", Locale.US));
String test = "The quick red fox jumped over the lazy brown dogs on 7/11/2006 The dogs finally reacted on 7/12/2006";
Modified: lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TestTeeSinkTokenFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TestTeeSinkTokenFilter.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TestTeeSinkTokenFilter.java (original)
+++ lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TestTeeSinkTokenFilter.java Mon Sep 13 17:37:20 2010
@@ -39,7 +39,6 @@ import org.apache.lucene.util.AttributeS
import org.apache.lucene.util.English;
import java.io.IOException;
import java.io.StringReader;
-import java.util.Random;
/**
@@ -51,13 +50,8 @@ public class TestTeeSinkTokenFilter exte
protected String[] tokens1;
protected String[] tokens2;
-
- public TestTeeSinkTokenFilter(String s) {
- super(s);
- }
-
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
tokens1 = new String[]{"The", "quick", "Burgundy", "Fox", "jumped", "over", "the", "lazy", "Red", "Dogs"};
tokens2 = new String[]{"The", "Lazy", "Dogs", "should", "stay", "on", "the", "porch"};
Modified: lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TokenRangeSinkTokenizerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TokenRangeSinkTokenizerTest.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TokenRangeSinkTokenizerTest.java (original)
+++ lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TokenRangeSinkTokenizerTest.java Mon Sep 13 17:37:20 2010
@@ -24,11 +24,6 @@ import org.apache.lucene.analysis.core.W
public class TokenRangeSinkTokenizerTest extends BaseTokenStreamTestCase {
-
- public TokenRangeSinkTokenizerTest(String s) {
- super(s);
- }
-
public void test() throws IOException {
TokenRangeSinkFilter sinkFilter = new TokenRangeSinkFilter(2, 4);
String test = "The quick red fox jumped over the lazy brown dogs";
Modified: lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TokenTypeSinkTokenizerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TokenTypeSinkTokenizerTest.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TokenTypeSinkTokenizerTest.java (original)
+++ lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TokenTypeSinkTokenizerTest.java Mon Sep 13 17:37:20 2010
@@ -28,10 +28,6 @@ import org.apache.lucene.analysis.tokena
public class TokenTypeSinkTokenizerTest extends BaseTokenStreamTestCase {
- public TokenTypeSinkTokenizerTest(String s) {
- super(s);
- }
-
public void test() throws IOException {
TokenTypeSinkFilter sinkFilter = new TokenTypeSinkFilter("D");
String test = "The quick red fox jumped over the lazy brown dogs";
Modified: lucene/dev/trunk/modules/analysis/icu/src/test/org/apache/lucene/analysis/icu/segmentation/TestLaoBreakIterator.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/modules/analysis/icu/src/test/org/apache/lucene/analysis/icu/segmentation/TestLaoBreakIterator.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/modules/analysis/icu/src/test/org/apache/lucene/analysis/icu/segmentation/TestLaoBreakIterator.java (original)
+++ lucene/dev/trunk/modules/analysis/icu/src/test/org/apache/lucene/analysis/icu/segmentation/TestLaoBreakIterator.java Mon Sep 13 17:37:20 2010
@@ -33,7 +33,7 @@ public class TestLaoBreakIterator extend
private BreakIterator wordIterator;
@Override
- protected void setUp() throws Exception {
+ public void setUp() throws Exception {
super.setUp();
InputStream is = getClass().getResourceAsStream("Lao.brk");
wordIterator = new LaoBreakIterator(RuleBasedBreakIterator.getInstanceFromCompiledRules(is));
Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/SolrTestCaseJ4.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/SolrTestCaseJ4.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/SolrTestCaseJ4.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/SolrTestCaseJ4.java Mon Sep 13 17:37:20 2010
@@ -19,7 +19,7 @@
package org.apache.solr;
-import org.apache.lucene.util.LuceneTestCaseJ4;
+import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.SolrInputField;
@@ -51,7 +51,7 @@ import static org.junit.Assert.fail;
* Unlike AbstractSolrTestCase, a new core is not created for each test method.
*
*/
-public abstract class SolrTestCaseJ4 extends LuceneTestCaseJ4 {
+public abstract class SolrTestCaseJ4 extends LuceneTestCase {
@BeforeClass
public static void beforeClassSolrTestCase() throws Exception {
Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/core/TestPropInject.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/core/TestPropInject.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/core/TestPropInject.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/core/TestPropInject.java Mon Sep 13 17:37:20 2010
@@ -14,10 +14,7 @@ public class TestPropInject extends Abst
}
public String getSolrConfigFile() {
- if ("testMergePolicyDefaults".equals(getName()) || "testPropsDefaults".equals(getName()))
- return "solrconfig-propinject-indexdefault.xml";
- else
- return "solrconfig-propinject.xml";
+ return "solrconfig-propinject.xml";
}
class ExposeWriterHandler extends DirectUpdateHandler2 {
@@ -38,14 +35,6 @@ public class TestPropInject extends Abst
assertEquals(64.0, mp.getMaxMergeMB());
uh.close();
}
-
- public void testMergePolicyDefaults() throws Exception {
- ExposeWriterHandler uh = new ExposeWriterHandler();
- IndexWriter writer = uh.getWriter();
- LogByteSizeMergePolicy mp = (LogByteSizeMergePolicy)writer.getMergePolicy();
- assertEquals(32.0, mp.getMaxMergeMB());
- uh.close();
- }
public void testProps() throws Exception {
ExposeWriterHandler uh = new ExposeWriterHandler();
@@ -54,12 +43,4 @@ public class TestPropInject extends Abst
assertEquals(2, cms.getMaxThreadCount());
uh.close();
}
-
- public void testPropsDefaults() throws Exception {
- ExposeWriterHandler uh = new ExposeWriterHandler();
- IndexWriter writer = uh.getWriter();
- ConcurrentMergeScheduler cms = (ConcurrentMergeScheduler)writer.getMergeScheduler();
- assertEquals(4, cms.getMaxThreadCount());
- uh.close();
- }
}
Added: lucene/dev/trunk/solr/src/test/org/apache/solr/core/TestPropInjectDefaults.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/core/TestPropInjectDefaults.java?rev=996611&view=auto
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/core/TestPropInjectDefaults.java (added)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/core/TestPropInjectDefaults.java Mon Sep 13 17:37:20 2010
@@ -0,0 +1,68 @@
+package org.apache.solr.core;
+
+/**
+ * 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.io.IOException;
+
+import org.apache.lucene.index.ConcurrentMergeScheduler;
+import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.LogByteSizeMergePolicy;
+import org.apache.solr.update.DirectUpdateHandler2;
+import org.apache.solr.util.AbstractSolrTestCase;
+
+public class TestPropInjectDefaults extends AbstractSolrTestCase {
+
+ @Override
+ public String getSchemaFile() {
+ return "schema.xml";
+ }
+
+ @Override
+ public String getSolrConfigFile() {
+ return "solrconfig-propinject-indexdefault.xml";
+ }
+
+ class ExposeWriterHandler extends DirectUpdateHandler2 {
+ public ExposeWriterHandler() throws IOException {
+ super(h.getCore());
+ }
+
+ public IndexWriter getWriter() throws IOException {
+ forceOpenWriter();
+ return writer;
+ }
+ }
+
+ public void testMergePolicyDefaults() throws Exception {
+ ExposeWriterHandler uh = new ExposeWriterHandler();
+ IndexWriter writer = uh.getWriter();
+ LogByteSizeMergePolicy mp = (LogByteSizeMergePolicy)writer.getMergePolicy();
+ assertEquals(32.0, mp.getMaxMergeMB());
+ uh.close();
+ }
+
+
+ public void testPropsDefaults() throws Exception {
+ ExposeWriterHandler uh = new ExposeWriterHandler();
+ IndexWriter writer = uh.getWriter();
+ ConcurrentMergeScheduler cms = (ConcurrentMergeScheduler)writer.getMergeScheduler();
+ assertEquals(4, cms.getMaxThreadCount());
+ uh.close();
+ }
+
+}
Propchange: lucene/dev/trunk/solr/src/test/org/apache/solr/core/TestPropInjectDefaults.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/schema/LegacyDateFieldTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/schema/LegacyDateFieldTest.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/schema/LegacyDateFieldTest.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/schema/LegacyDateFieldTest.java Mon Sep 13 17:37:20 2010
@@ -20,14 +20,16 @@ package org.apache.solr.schema;
import org.apache.solr.schema.DateField;
import org.apache.solr.util.DateMathParser;
import org.apache.lucene.document.Fieldable;
-import org.apache.lucene.util.LocalizedTestCase;
+import org.apache.lucene.util.LuceneTestCase;
+import org.junit.runner.RunWith;
import java.util.Date;
import java.util.TimeZone;
import java.util.Locale;
import java.text.DateFormat;
-public class LegacyDateFieldTest extends LocalizedTestCase {
+@RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
+public class LegacyDateFieldTest extends LuceneTestCase {
// if and when this class is removed, make sure to refactor all
// appropriate code to DateFieldTest
Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/util/DateMathParserTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/util/DateMathParserTest.java?rev=996611&r1=996610&r2=996611&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/util/DateMathParserTest.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/util/DateMathParserTest.java Mon Sep 13 17:37:20 2010
@@ -17,8 +17,9 @@
package org.apache.solr.util;
-import org.apache.lucene.util.LocalizedTestCase;
+import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.util.DateMathParser;
+import org.junit.runner.RunWith;
import java.text.SimpleDateFormat;
import java.text.DateFormat;
@@ -34,7 +35,8 @@ import java.text.ParseException;
/**
* Tests that the functions in DateMathParser
*/
-public class DateMathParserTest extends LocalizedTestCase {
+@RunWith(LuceneTestCase.LocalizedTestCaseRunner.class)
+public class DateMathParserTest extends LuceneTestCase {
public static TimeZone UTC = TimeZone.getTimeZone("UTC");