mirror of https://github.com/apache/lucene.git
tests: ignore expected exceptions
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@926743 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7ee2e53289
commit
43d6b2e7e2
|
@ -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 AbstractSolrTestCase extends TestCase {
|
|||
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 AbstractSolrTestCase extends TestCase {
|
|||
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 AbstractSolrTestCase extends TestCase {
|
|||
System.err.println("!!!! WARNING: best effort to remove " + dataDir.getAbsolutePath() + " FAILED !!!!!");
|
||||
}
|
||||
}
|
||||
|
||||
resetExceptionIgnores();
|
||||
}
|
||||
|
||||
/** Validates an update XML String is successful
|
||||
|
|
|
@ -490,7 +490,7 @@ abstract public class SolrExampleTests extends SolrExampleTestBase
|
|||
|
||||
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!" );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue