lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1466715 - in /lucene/dev/branches/branch_4x/lucene/facet: ./ src/test/org/apache/lucene/facet/search/TestSearcherTaxonomyManager.java
Date Wed, 10 Apr 2013 22:18:38 GMT
Author: mikemccand
Date: Wed Apr 10 22:18:38 2013
New Revision: 1466715

URL: http://svn.apache.org/r1466715
Log:
fix test to stop if indexing threads hits an exception

Modified:
    lucene/dev/branches/branch_4x/lucene/facet/   (props changed)
    lucene/dev/branches/branch_4x/lucene/facet/src/test/org/apache/lucene/facet/search/TestSearcherTaxonomyManager.java

Modified: lucene/dev/branches/branch_4x/lucene/facet/src/test/org/apache/lucene/facet/search/TestSearcherTaxonomyManager.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/facet/src/test/org/apache/lucene/facet/search/TestSearcherTaxonomyManager.java?rev=1466715&r1=1466714&r2=1466715&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/facet/src/test/org/apache/lucene/facet/search/TestSearcherTaxonomyManager.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/facet/src/test/org/apache/lucene/facet/search/TestSearcherTaxonomyManager.java
Wed Apr 10 22:18:38 2013
@@ -56,42 +56,45 @@ public class TestSearcherTaxonomyManager
     Thread indexer = new Thread() {
         @Override
         public void run() {
-          Set<String> seen = new HashSet<String>();
-          List<String> paths = new ArrayList<String>();
-          while (true) {
-            Document doc = new Document();
-            List<CategoryPath> docPaths = new ArrayList<CategoryPath>();
-            int numPaths = _TestUtil.nextInt(random(), 1, 5);
-            for(int i=0;i<numPaths;i++) {
-              String path;
-              if (!paths.isEmpty() && random().nextInt(5) != 4) {
-                // Use previous path
-                path = paths.get(random().nextInt(paths.size()));
-              } else {
-                // Create new path
-                path = null;
-                while (true) {
-                  path = _TestUtil.randomRealisticUnicodeString(random());
-                  if (path.length() != 0 && !seen.contains(path) && path.indexOf(FacetIndexingParams.DEFAULT_FACET_DELIM_CHAR)
== -1) {
-                    seen.add(path);
-                    paths.add(path);
-                    break;
+          try {
+            Set<String> seen = new HashSet<String>();
+            List<String> paths = new ArrayList<String>();
+            while (true) {
+              Document doc = new Document();
+              List<CategoryPath> docPaths = new ArrayList<CategoryPath>();
+              int numPaths = _TestUtil.nextInt(random(), 1, 5);
+              for(int i=0;i<numPaths;i++) {
+                String path;
+                if (!paths.isEmpty() && random().nextInt(5) != 4) {
+                  // Use previous path
+                  path = paths.get(random().nextInt(paths.size()));
+                } else {
+                  // Create new path
+                  path = null;
+                  while (true) {
+                    path = _TestUtil.randomRealisticUnicodeString(random());
+                    if (path.length() != 0 && !seen.contains(path) && path.indexOf(FacetIndexingParams.DEFAULT_FACET_DELIM_CHAR)
== -1) {
+                      seen.add(path);
+                      paths.add(path);
+                      break;
+                    }
                   }
                 }
+                docPaths.add(new CategoryPath("field", path));
+              }
+              try {
+                facetFields.addFields(doc, docPaths);
+                w.addDocument(doc);
+              } catch (IOException ioe) {
+                throw new RuntimeException(ioe);
               }
-              docPaths.add(new CategoryPath("field", path));
-            }
-            try {
-              facetFields.addFields(doc, docPaths);
-              w.addDocument(doc);
-            } catch (IOException ioe) {
-              throw new RuntimeException(ioe);
-            }
 
-            if (tw.getSize() >= ordLimit) {
-              stop.set(true);
-              break;
+              if (tw.getSize() >= ordLimit) {
+                break;
+              }
             }
+          } finally {
+            stop.set(true);
           }
         }
       };



Mime
View raw message