lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r926743 - in /lucene/dev/trunk/solr/src: java/org/apache/solr/util/AbstractSolrTestCase.java test/org/apache/solr/client/solrj/SolrExampleTests.java
Date Tue, 23 Mar 2010 19:31:42 GMT
Author: yonik
Date: Tue Mar 23 19:31:42 2010
New Revision: 926743

URL: http://svn.apache.org/viewvc?rev=926743&view=rev
Log:
tests: ignore expected exceptions

Modified:
    lucene/dev/trunk/solr/src/java/org/apache/solr/util/AbstractSolrTestCase.java
    lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java

Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/util/AbstractSolrTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/util/AbstractSolrTestCase.java?rev=926743&r1=926742&r2=926743&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/util/AbstractSolrTestCase.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/util/AbstractSolrTestCase.java Tue Mar
23 19:31:42 2010
@@ -34,6 +34,7 @@ import junit.framework.TestCase;
 import javax.xml.xpath.XPathExpressionException;
 
 import java.io.*;
+import java.util.HashSet;
 import java.util.List;
 import java.util.ArrayList;
 
@@ -103,6 +104,7 @@ public abstract class AbstractSolrTestCa
   private String factoryProp;
   public void setUp() throws Exception {
     log.info("####SETUP_START " + getName());
+    ignoreException("ignore_exception");
     factoryProp = System.getProperty("solr.directoryFactory");
     if (factoryProp == null) {
       System.setProperty("solr.directoryFactory","solr.RAMDirectoryFactory");
@@ -125,6 +127,18 @@ public abstract class AbstractSolrTestCa
     log.info("####SETUP_END " + getName());
   }
 
+    /** Causes an exception matching the regex pattern to not be logged. */
+  public static void ignoreException(String pattern) {
+    if (SolrException.ignorePatterns == null)
+      SolrException.ignorePatterns = new HashSet<String>();
+    SolrException.ignorePatterns.add(pattern);
+  }
+
+  public static void resetExceptionIgnores() {
+    SolrException.ignorePatterns = null;
+    ignoreException("ignore_exception");  // always ignore "ignore_exception"
+  }
+
   /** Subclasses that override setUp can optionally call this method
    * to log the fact that their setUp process has ended.
    */
@@ -162,6 +176,8 @@ public abstract class AbstractSolrTestCa
         System.err.println("!!!! WARNING: best effort to remove " + dataDir.getAbsolutePath()
+ " FAILED !!!!!");
       }
     }
+
+    resetExceptionIgnores();  
   }
 
   /** Validates an update XML String is successful

Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java?rev=926743&r1=926742&r2=926743&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/SolrExampleTests.java Tue
Mar 23 19:31:42 2010
@@ -490,7 +490,7 @@ abstract public class SolrExampleTests e
     
     try {
       SolrPing ping = new SolrPing();
-      ping.getParams().set( "qt", "unknown handler!" );
+      ping.getParams().set( "qt", "unknown handler! ignore_exception" );
       ping.process( server );
       fail( "sent unknown query type!" );
     }



Mime
View raw message