lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r778024 - in /lucene/java/trunk/src/test/org/apache/lucene: index/TestIndexWriterReader.java search/TestSort.java
Date Sat, 23 May 2009 21:00:04 GMT
Author: mikemccand
Date: Sat May 23 21:00:03 2009
New Revision: 778024

URL: http://svn.apache.org/viewvc?rev=778024&view=rev
Log:
LUCENE-1655: get unit tests back to 1.4 only

Modified:
    lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterReader.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestSort.java

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterReader.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterReader.java?rev=778024&r1=778023&r2=778024&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterReader.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriterReader.java Sat May
23 21:00:03 2009
@@ -23,7 +23,6 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Random;
-import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.lucene.analysis.WhitespaceAnalyzer;
 import org.apache.lucene.document.Document;
@@ -42,6 +41,24 @@
 
 public class TestIndexWriterReader extends LuceneTestCase {
   static PrintStream infoStream;
+
+  private static class HeavyAtomicInt {
+    private int value;
+    public HeavyAtomicInt(int start) {
+      value = start;
+    }
+    public synchronized int addAndGet(int inc) {
+      value += inc;
+      return value;
+    }
+    public synchronized int incrementAndGet() {
+      value++;
+      return value;
+    }
+    public synchronized int intValue() {
+      return value;
+    }
+  }
   
   public static int count(Term t, IndexReader r) throws IOException {
     int count = 0;
@@ -259,7 +276,6 @@
     final static int NUM_THREADS = 5;
     final Thread[] threads = new Thread[NUM_THREADS];
     IndexWriter mainWriter;
-    AtomicInteger delCount = new AtomicInteger();
     List deletedTerms = new ArrayList();
     LinkedList toDeleteTerms = new LinkedList();
     Random random;
@@ -329,8 +345,8 @@
     final List failures = new ArrayList();
     IndexReader[] readers;
     boolean didClose = false;
-    AtomicInteger count = new AtomicInteger(0);
-    AtomicInteger numAddIndexesNoOptimize = new AtomicInteger(0);
+    HeavyAtomicInt count = new HeavyAtomicInt(0);
+    HeavyAtomicInt numAddIndexesNoOptimize = new HeavyAtomicInt(0);
     
     public AddDirectoriesThreads(int numDirs, IndexWriter mainWriter) throws Throwable {
       this.numDirs = numDirs;

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestSort.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/search/TestSort.java?rev=778024&r1=778023&r2=778024&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestSort.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestSort.java Sat May 23 21:00:03
2009
@@ -929,7 +929,7 @@
           TopDocsCollector tdc = TopFieldCollector.create(sort[i], 10,
               tfcOptions[j][0], tfcOptions[j][1], tfcOptions[j][2], false);
 
-          assertEquals(actualTFCClasses[j], tdc.getClass().getSimpleName());
+          assertTrue(tdc.getClass().getName().endsWith("$"+actualTFCClasses[j]));
           
           full.search(bq, tdc);
           



Mime
View raw message