| org.apache.solr.util.AbstractSolrTestCase
All known Subclasses: org.apache.solr.schema.BadIndexSchemaTest, org.apache.solr.search.TestQueryUtils, org.apache.solr.core.SolrCoreTest, org.apache.solr.servlet.DirectSolrConnectionTest, org.apache.solr.handler.TestCSVLoader, org.apache.solr.servlet.SolrRequestParserTest, org.apache.solr.schema.IndexSchemaTest, org.apache.solr.EchoParamsTest, org.apache.solr.core.TestBadConfig, org.apache.solr.handler.StandardRequestHandlerTest, org.apache.solr.update.DirectUpdateHandlerTest, org.apache.solr.schema.RequiredFieldsTest, org.apache.solr.SampleTest, org.apache.solr.update.AutoCommitTest, org.apache.solr.core.RequestHandlersTest, org.apache.solr.OutputWriterTest, org.apache.solr.BasicFunctionalityTest, org.apache.solr.core.TestConfig, org.apache.solr.DisMaxRequestHandlerTest, org.apache.solr.schema.NotRequiredUniqueKeyTest, org.apache.solr.analysis.TestWordDelimiterFilter, org.apache.solr.ConvertedLegacyTest, org.apache.solr.HighlighterTest, org.apache.solr.util.SolrPluginUtilsTest,
AbstractSolrTestCase | abstract public class AbstractSolrTestCase extends TestCase (Code) | | An Abstract base class that makes writing Solr JUnit tests "easier"
Test classes that subclass this need only specify the path to the
schema.xml file (:TODO: the solrconfig.xml as well) and write some
testMethods. This class takes care of creating/destroying the index,
and provides several assert methods to assist you.
See Also: AbstractSolrTestCase.setUp See Also: AbstractSolrTestCase.tearDown |
Inner Class :public static class Doc | |
Method Summary | |
public String | add(Doc doc, String... args) Generates an <add><doc>... | public String | adoc(String... fieldsAndValues) Generates a simple <add><doc>... | public void | assertFailedU(String update) | public void | assertFailedU(String message, String update) | public void | assertQ(SolrQueryRequest req, String... tests) | public void | assertQ(String message, SolrQueryRequest req, String... tests) | public void | assertQEx(String message, SolrQueryRequest req, int code) | public void | assertU(String update) | public void | assertU(String message, String update) | public String | commit(String... args) | public String | delI(String id) Generates a <delete>... | public String | delQ(String q) Generates a <delete>... | public Doc | doc(String... fieldsAndValues) Generates a simple <doc>... | abstract public String | getSchemaFile() Subclasses must define this method to return the name of the
schema.xml they wish to use. | abstract public String | getSolrConfigFile() Subclasses must define this method to return the name of the
solrconfig.xml they wish to use. | public String | optimize(String... args) | public static boolean | recurseDelete(File f) | public SolrQueryRequest | req(String... q) | public SolrQueryRequest | req(String[] params, String... moreParams) | public void | setUp() | public void | tearDown() Shuts down the test harness, and makes the best attempt possible
to delete dataDir, unless the system property "solr.test.leavedatadir"
is set. |
dataDir | protected File dataDir(Code) | | The directory used to story the index managed by the TestHarness h
|
h | protected TestHarness h(Code) | | Harness initialized by initTestHarness.
For use in test methods as needed.
|
assertFailedU | public void assertFailedU(String update)(Code) | | Validates an update XML String failed
|
assertFailedU | public void assertFailedU(String message, String update)(Code) | | Validates an update XML String failed
|
assertQ | public void assertQ(SolrQueryRequest req, String... tests)(Code) | | Validates a query matches some XPath test expressions and closes the query
|
assertQEx | public void assertQEx(String message, SolrQueryRequest req, int code)(Code) | | Makes sure a query throws a SolrException with the listed response code
|
assertU | public void assertU(String update)(Code) | | Validates an update XML String is successful
|
assertU | public void assertU(String message, String update)(Code) | | Validates an update XML String is successful
|
doc | public Doc doc(String... fieldsAndValues)(Code) | | Generates a simple <doc>... XML String with no options
Parameters: fieldsAndValues - 0th and Even numbered args are fields names, Odds are field values. See Also: TestHarness.makeSimpleDoc |
getSchemaFile | abstract public String getSchemaFile()(Code) | | Subclasses must define this method to return the name of the
schema.xml they wish to use.
|
getSolrConfigFile | abstract public String getSolrConfigFile()(Code) | | Subclasses must define this method to return the name of the
solrconfig.xml they wish to use.
|
recurseDelete | public static boolean recurseDelete(File f)(Code) | | |
setUp | public void setUp() throws Exception(Code) | | Initializes things your test might need
- Creates a dataDir in the "java.io.tmpdir"
- initializes the TestHarness h using this data directory, and getSchemaPath()
- initializes the LocalRequestFactory lrf using sensible defaults.
|
tearDown | public void tearDown() throws Exception(Code) | | Shuts down the test harness, and makes the best attempt possible
to delete dataDir, unless the system property "solr.test.leavedatadir"
is set.
|
|
|