fixed testcases which failed with -Dtests.multiplier > 1

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1058540 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Simon Willnauer 2011-01-13 13:16:34 +00:00
parent f19e8c58fb
commit 23ad1c0f19
5 changed files with 35 additions and 2 deletions

View File

@ -24,6 +24,7 @@ import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.client.solrj.response.TermsResponse.Term;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@ -36,6 +37,15 @@ public class TermsResponseTest extends SolrJettyTestBase {
public static void beforeTest() throws Exception {
initCore(EXAMPLE_CONFIG, EXAMPLE_SCHEMA, EXAMPLE_HOME);
}
@Before
@Override
public void setUp() throws Exception{
super.setUp();
clearIndex();
assertU(commit());
assertU(optimize());
}
@Test
public void testTermsResponse() throws Exception {

View File

@ -18,6 +18,7 @@
package org.apache.solr.core;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.SingleInstanceLockFactory;
import org.apache.lucene.util.LuceneTestCase;
import java.io.IOException;
@ -27,7 +28,7 @@ import java.io.IOException;
public class RAMDirectoryFactoryTest extends LuceneTestCase {
public void testOpenReturnsTheSameForSamePath() throws IOException {
final Directory directory = new RefCntRamDirectory();
RAMDirectoryFactory factory = new RAMDirectoryFactory() {
RAMDirectoryFactory factory = new RAMDirectoryFactory() {
@Override
Directory openNew(String path) throws IOException {
return directory;
@ -40,6 +41,8 @@ public class RAMDirectoryFactoryTest extends LuceneTestCase {
"every time open() is called for the same path", directory, dir1);
assertEquals("RAMDirectoryFactory should not create new instance of RefCntRamDirectory " +
"every time open() is called for the same path", directory, dir2);
dir1.close();
dir2.close();
}
public void testOpenSucceedForEmptyDir() throws IOException {

View File

@ -76,7 +76,7 @@ public class TestCSVLoader extends SolrTestCaseJ4 {
}
void cleanup() {
assertU(delQ("id:[100 TO 110]"));
assertU(delQ("*:*"));
assertU(commit());
}

View File

@ -55,6 +55,14 @@ public class QueryElevationComponentTest extends SolrTestCaseJ4 {
clearIndex();
assertU(commit());
assertU(optimize());
// make sure this component is initialized correctly for each test
QueryElevationComponent comp = (QueryElevationComponent)h.getCore().getSearchComponent("elevate");
NamedList<String> args = new NamedList<String>();
args.add( QueryElevationComponent.CONFIG_FILE, "elevate.xml" );
args.add( QueryElevationComponent.FIELD_TYPE, "string" );
comp.init( args );
comp.inform( h.getCore() );
comp.forceElevation = false;
}
@Test

View File

@ -40,6 +40,10 @@ public class SpellCheckComponentTest extends SolrTestCaseJ4 {
@BeforeClass
public static void beforeClass() throws Exception {
initCore("solrconfig-spellcheckcomponent.xml","schema.xml");
}
public void setUp() throws Exception {
super.setUp();
assertU(adoc("id", "0", "lowerfilt", "This is a title"));
assertU((adoc("id", "1", "lowerfilt",
"The quick reb fox jumped over the lazy brown dogs.")));
@ -55,6 +59,14 @@ public class SpellCheckComponentTest extends SolrTestCaseJ4 {
assertU((commit()));
}
public void tearDown() throws Exception {
super.tearDown();
assertU(delQ("*:*"));
optimize();
assertU((commit()));
}
@Test
public void testExtendedResultsCount() throws Exception {
assertJQ(req("qt",rh, SpellCheckComponent.COMPONENT_NAME, "true", SpellCheckComponent.SPELLCHECK_BUILD, "true", "q","bluo", SpellCheckComponent.SPELLCHECK_COUNT,"5", SpellCheckComponent.SPELLCHECK_EXTENDED_RESULTS,"false")