mirror of https://github.com/apache/lucene.git
SOLR-2552: make sure each test class starts/ends searcher tracking
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1128466 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cb9dfc11a1
commit
478414756e
|
@ -36,12 +36,8 @@ import org.apache.solr.handler.JsonUpdateRequestHandler;
|
||||||
import org.apache.solr.request.LocalSolrQueryRequest;
|
import org.apache.solr.request.LocalSolrQueryRequest;
|
||||||
import org.apache.solr.request.SolrQueryRequest;
|
import org.apache.solr.request.SolrQueryRequest;
|
||||||
import org.apache.solr.request.SolrRequestHandler;
|
import org.apache.solr.request.SolrRequestHandler;
|
||||||
import org.apache.solr.response.ResultContext;
|
|
||||||
import org.apache.solr.response.SolrQueryResponse;
|
|
||||||
import org.apache.solr.schema.IndexSchema;
|
import org.apache.solr.schema.IndexSchema;
|
||||||
import org.apache.solr.schema.SchemaField;
|
import org.apache.solr.schema.SchemaField;
|
||||||
import org.apache.solr.search.DocIterator;
|
|
||||||
import org.apache.solr.search.DocList;
|
|
||||||
import org.apache.solr.search.SolrIndexSearcher;
|
import org.apache.solr.search.SolrIndexSearcher;
|
||||||
import org.apache.solr.servlet.DirectSolrConnection;
|
import org.apache.solr.servlet.DirectSolrConnection;
|
||||||
import org.apache.solr.util.TestHarness;
|
import org.apache.solr.util.TestHarness;
|
||||||
|
@ -66,6 +62,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClassSolrTestCase() throws Exception {
|
public static void beforeClassSolrTestCase() throws Exception {
|
||||||
|
startTrackingSearchers();
|
||||||
ignoreException("ignore_exception");
|
ignoreException("ignore_exception");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +70,7 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
|
||||||
public static void afterClassSolrTestCase() throws Exception {
|
public static void afterClassSolrTestCase() throws Exception {
|
||||||
deleteCore();
|
deleteCore();
|
||||||
resetExceptionIgnores();
|
resetExceptionIgnores();
|
||||||
|
endTrackingSearchers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -96,7 +94,6 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
|
||||||
/** Call initCore in @BeforeClass to instantiate a solr core in your test class.
|
/** Call initCore in @BeforeClass to instantiate a solr core in your test class.
|
||||||
* deleteCore will be called for you via SolrTestCaseJ4 @AfterClass */
|
* deleteCore will be called for you via SolrTestCaseJ4 @AfterClass */
|
||||||
public static void initCore(String config, String schema, String solrHome) throws Exception {
|
public static void initCore(String config, String schema, String solrHome) throws Exception {
|
||||||
startTrackingSearchers();
|
|
||||||
configString = config;
|
configString = config;
|
||||||
schemaString = schema;
|
schemaString = schema;
|
||||||
if (solrHome != null) {
|
if (solrHome != null) {
|
||||||
|
@ -108,12 +105,12 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
|
||||||
|
|
||||||
static long numOpens;
|
static long numOpens;
|
||||||
static long numCloses;
|
static long numCloses;
|
||||||
protected static void startTrackingSearchers() {
|
public static void startTrackingSearchers() {
|
||||||
numOpens = SolrIndexSearcher.numOpens.get();
|
numOpens = SolrIndexSearcher.numOpens.get();
|
||||||
numCloses = SolrIndexSearcher.numCloses.get();
|
numCloses = SolrIndexSearcher.numCloses.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void endTrackingSearchers() {
|
public static void endTrackingSearchers() {
|
||||||
long endNumOpens = SolrIndexSearcher.numOpens.get();
|
long endNumOpens = SolrIndexSearcher.numOpens.get();
|
||||||
long endNumCloses = SolrIndexSearcher.numCloses.get();
|
long endNumCloses = SolrIndexSearcher.numCloses.get();
|
||||||
|
|
||||||
|
@ -293,8 +290,6 @@ public abstract class SolrTestCaseJ4 extends LuceneTestCase {
|
||||||
h = null;
|
h = null;
|
||||||
lrf = null;
|
lrf = null;
|
||||||
configString = schemaString = null;
|
configString = schemaString = null;
|
||||||
|
|
||||||
endTrackingSearchers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,8 @@ import org.apache.solr.common.SolrInputField;
|
||||||
import org.apache.solr.common.params.CommonParams;
|
import org.apache.solr.common.params.CommonParams;
|
||||||
import org.apache.solr.common.util.XML;
|
import org.apache.solr.common.util.XML;
|
||||||
import org.apache.solr.request.*;
|
import org.apache.solr.request.*;
|
||||||
import org.apache.solr.util.TestHarness;
|
import org.junit.AfterClass;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -93,6 +94,16 @@ public abstract class AbstractSolrTestCase extends LuceneTestCase {
|
||||||
return SolrTestCaseJ4.TEST_HOME();
|
return SolrTestCaseJ4.TEST_HOME();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void beforeClassAbstractSolrTestCase() throws Exception {
|
||||||
|
SolrTestCaseJ4.startTrackingSearchers();
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterClass
|
||||||
|
public static void afterClassAbstractSolrTestCase() throws Exception {
|
||||||
|
SolrTestCaseJ4.endTrackingSearchers();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The directory used to story the index managed by the TestHarness h
|
* The directory used to story the index managed by the TestHarness h
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue