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 2011/05/02 14:24:02 UTC
svn commit: r1098539 - in /lucene/dev/branches/branch_3x: ./ lucene/
lucene/backwards/ lucene/contrib/icu/src/test/org/apache/lucene/collation/
lucene/src/test/org/apache/lucene/collation/ solr/
Author: rmuir
Date: Mon May 2 12:24:02 2011
New Revision: 1098539
URL: http://svn.apache.org/viewvc?rev=1098539&view=rev
Log:
collation tests: try to find less jre bugs and just test thread safety
Modified:
lucene/dev/branches/branch_3x/ (props changed)
lucene/dev/branches/branch_3x/lucene/ (props changed)
lucene/dev/branches/branch_3x/lucene/backwards/ (props changed)
lucene/dev/branches/branch_3x/lucene/contrib/icu/src/test/org/apache/lucene/collation/TestICUCollationKeyAnalyzer.java
lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/collation/CollationTestBase.java
lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/collation/TestCollationKeyAnalyzer.java
lucene/dev/branches/branch_3x/solr/ (props changed)
Modified: lucene/dev/branches/branch_3x/lucene/contrib/icu/src/test/org/apache/lucene/collation/TestICUCollationKeyAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/icu/src/test/org/apache/lucene/collation/TestICUCollationKeyAnalyzer.java?rev=1098539&r1=1098538&r2=1098539&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/icu/src/test/org/apache/lucene/collation/TestICUCollationKeyAnalyzer.java (original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/icu/src/test/org/apache/lucene/collation/TestICUCollationKeyAnalyzer.java Mon May 2 12:24:02 2011
@@ -19,6 +19,7 @@ package org.apache.lucene.collation;
import com.ibm.icu.text.Collator;
+
import org.apache.lucene.analysis.Analyzer;
import java.util.Locale;
@@ -80,7 +81,7 @@ public class TestICUCollationKeyAnalyzer
public void testThreadSafe() throws Exception {
int iters = 20 * RANDOM_MULTIPLIER;
for (int i = 0; i < iters; i++) {
- Locale locale = randomLocale(random);
+ Locale locale = Locale.GERMAN;
Collator collator = Collator.getInstance(locale);
collator.setStrength(Collator.IDENTICAL);
assertThreadSafe(new ICUCollationKeyAnalyzer(collator));
Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/collation/CollationTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/collation/CollationTestBase.java?rev=1098539&r1=1098538&r2=1098539&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/collation/CollationTestBase.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/collation/CollationTestBase.java Mon May 2 12:24:02 2011
@@ -265,27 +265,6 @@ public abstract class CollationTestBase
}
assertEquals(expectedResult, buff.toString());
}
-
- private String randomString() {
- // ideally we could do this!
- // return _TestUtil.randomUnicodeString(random);
- //
- // http://bugs.icu-project.org/trac/ticket/8060
- // http://bugs.icu-project.org/trac/ticket/7732
- // ...
- //
- // as a workaround, just test the BMP for now (and avoid 0xFFFF etc)
- int length = _TestUtil.nextInt(random, 0, 10);
- char chars[] = new char[length];
- for (int i = 0; i < length; i++) {
- if (random.nextBoolean()) {
- chars[i] = (char) _TestUtil.nextInt(random, 0, 0xD7FF);
- } else {
- chars[i] = (char) _TestUtil.nextInt(random, 0xE000, 0xFFFD);
- }
- }
- return new String(chars, 0, length);
- }
public void assertThreadSafe(final Analyzer analyzer) throws Exception {
int numTestPoints = 100;
@@ -297,7 +276,7 @@ public abstract class CollationTestBase
// and ensure they are the same as the ones we produced in serial fashion.
for (int i = 0; i < numTestPoints; i++) {
- String term = randomString();
+ String term = _TestUtil.randomSimpleString(random);
TokenStream ts = analyzer.reusableTokenStream("fake", new StringReader(term));
CharTermAttribute encodedBytes = ts.addAttribute(CharTermAttribute.class);
ts.reset();
Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/collation/TestCollationKeyAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/collation/TestCollationKeyAnalyzer.java?rev=1098539&r1=1098538&r2=1098539&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/collation/TestCollationKeyAnalyzer.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/collation/TestCollationKeyAnalyzer.java Mon May 2 12:24:02 2011
@@ -83,8 +83,7 @@ public class TestCollationKeyAnalyzer ex
public void testThreadSafe() throws Exception {
int iters = 20 * RANDOM_MULTIPLIER;
for (int i = 0; i < iters; i++) {
- Locale locale = randomLocale(random);
- Collator collator = Collator.getInstance(locale);
+ Collator collator = Collator.getInstance(Locale.GERMAN);
collator.setStrength(Collator.PRIMARY);
assertThreadSafe(new CollationKeyAnalyzer(collator));
}