Java Doc for TestHarness.java in  » Search-Engine » apache-solr-1.2.0 » org » apache » solr » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Search Engine » apache solr 1.2.0 » org.apache.solr.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.solr.util.TestHarness

TestHarness
public class TestHarness (Code)
This class provides a simple harness that may be useful when writing testcases.

This class lives in the main source tree (and not in the test source tree), so that it will be included with even the most minimal solr distribution, in order to encourage plugin writers to create unit tests for their plugins.
author:
   hossman
version:
   $Id:$


Inner Class :public class LocalRequestFactory

Field Summary
 XmlUpdateRequestHandlerupdater
    

Constructor Summary
public  TestHarness(String dataDirectory)
     Assumes "solrconfig.xml" is the config file to use, and "schema.xml" is the schema path to use.
public  TestHarness(String dataDirectory, String schemaFile)
     Assumes "solrconfig.xml" is the config file to use.
public  TestHarness(String dataDirectory, String confFile, String schemaFile)
    

Method Summary
public  voidappendSimpleDoc(StringBuffer buf, String... fieldsAndValues)
     A helper that adds an xml <doc> containing all of the fields and values specified (odds are fields, evens are values) to a StringBuffer.
public  StringcheckUpdateStatus(String xml, String code)
     Validates that an "update" (add, commit or optimize) results in success.
public  voidclose()
    
public static  Stringcommit(String... args)
     Helper that returns an <commit> String with optional key/val pairs.
public static  StringdeleteById(String id)
    
public static  StringdeleteByQuery(String q)
    
public  SolrCoregetCore()
    
public  LocalRequestFactorygetRequestFactory(String qtype, int start, int limit)
    
public  LocalRequestFactorygetRequestFactory(String qtype, int start, int limit, String... args)
     0 and Even numbered args are keys, Odd numbered args are values.
public  LocalRequestFactorygetRequestFactory(String qtype, int start, int limit, Map<String, String> args)
    
public static  StringBuffermakeSimpleDoc(String... fieldsAndValues)
    
public static  Stringoptimize(String... args)
     Helper that returns an <optimize> String with optional key/val pairs.
public  Stringquery(SolrQueryRequest req)
     Processes a "query" using a user constructed SolrQueryRequest
Parameters:
  req - the Query to process, will be closed.
public  Stringquery(String handler, SolrQueryRequest req)
     Processes a "query" using a user constructed SolrQueryRequest
Parameters:
  handler - the name of the request handler to process the request
Parameters:
  req - the Query to process, will be closed.
public  Stringupdate(String xml)
     Processes an "update" (add, commit or optimize) and returns the response as a String.
public  StringvalidateAddDoc(String... fieldsAndValues)
     Validates that an add of a single document results in success.
public  StringvalidateErrorUpdate(String xml)
     Validates that an "update" (add, commit or optimize) results in success.
public  StringvalidateQuery(SolrQueryRequest req, String... tests)
    
public  StringvalidateUpdate(String xml)
     Validates that an "update" (add, commit or optimize) results in success.
public  StringvalidateXPath(String xml, String... tests)
     A helper method which valides a String against an array of XPath test strings.

Field Detail
updater
XmlUpdateRequestHandler updater(Code)




Constructor Detail
TestHarness
public TestHarness(String dataDirectory)(Code)
Assumes "solrconfig.xml" is the config file to use, and "schema.xml" is the schema path to use.
Parameters:
  dataDirectory - path for index data, will not be cleaned up



TestHarness
public TestHarness(String dataDirectory, String schemaFile)(Code)
Assumes "solrconfig.xml" is the config file to use.
Parameters:
  dataDirectory - path for index data, will not be cleaned up
Parameters:
  schemaFile - path of schema file



TestHarness
public TestHarness(String dataDirectory, String confFile, String schemaFile)(Code)

Parameters:
  dataDirectory - path for index data, will not be cleaned up
Parameters:
  confFile - solrconfig filename
Parameters:
  schemaFile - schema filename




Method Detail
appendSimpleDoc
public void appendSimpleDoc(StringBuffer buf, String... fieldsAndValues) throws IOException(Code)
A helper that adds an xml <doc> containing all of the fields and values specified (odds are fields, evens are values) to a StringBuffer.



checkUpdateStatus
public String checkUpdateStatus(String xml, String code) throws SAXException(Code)
Validates that an "update" (add, commit or optimize) results in success. :TODO: currently only deals with one add/doc at a time, this will need changed if/when SOLR-2 is resolved
Parameters:
  xml - The XML of the update null if succesful, otherwise the XML response to the update



close
public void close()(Code)
Shuts down and frees any resources



commit
public static String commit(String... args)(Code)
Helper that returns an <commit> String with optional key/val pairs.
Parameters:
  args - 0 and Even numbered args are params, Odd numbered args are values.



deleteById
public static String deleteById(String id)(Code)
Generates a delete by id xml string
Parameters:
  id - ID that has not already been xml escaped



deleteByQuery
public static String deleteByQuery(String q)(Code)
Generates a delete by query xml string
Parameters:
  q - Query that has not already been xml escaped



getCore
public SolrCore getCore()(Code)



getRequestFactory
public LocalRequestFactory getRequestFactory(String qtype, int start, int limit)(Code)



getRequestFactory
public LocalRequestFactory getRequestFactory(String qtype, int start, int limit, String... args)(Code)
0 and Even numbered args are keys, Odd numbered args are values.



getRequestFactory
public LocalRequestFactory getRequestFactory(String qtype, int start, int limit, Map<String, String> args)(Code)



makeSimpleDoc
public static StringBuffer makeSimpleDoc(String... fieldsAndValues)(Code)
A helper that creates an xml <doc> containing all of the fields and values specified
Parameters:
  fieldsAndValues - 0 and Even numbered args are fields names odds are field values.



optimize
public static String optimize(String... args)(Code)
Helper that returns an <optimize> String with optional key/val pairs.
Parameters:
  args - 0 and Even numbered args are params, Odd numbered args are values.



query
public String query(SolrQueryRequest req) throws IOException, Exception(Code)
Processes a "query" using a user constructed SolrQueryRequest
Parameters:
  req - the Query to process, will be closed. The XML response to the query
exception:
  Exception - any exception in the response.
exception:
  IOException - if there is a problem writing the XML
See Also:   LocalSolrQueryRequest



query
public String query(String handler, SolrQueryRequest req) throws IOException, Exception(Code)
Processes a "query" using a user constructed SolrQueryRequest
Parameters:
  handler - the name of the request handler to process the request
Parameters:
  req - the Query to process, will be closed. The XML response to the query
exception:
  Exception - any exception in the response.
exception:
  IOException - if there is a problem writing the XML
See Also:   LocalSolrQueryRequest



update
public String update(String xml)(Code)
Processes an "update" (add, commit or optimize) and returns the response as a String. The better approach is to instanciate a Updatehandler directly
Parameters:
  xml - The XML of the update The XML response to the update



validateAddDoc
public String validateAddDoc(String... fieldsAndValues) throws XPathExpressionException, SAXException, IOException(Code)
Validates that an add of a single document results in success.
Parameters:
  fieldsAndValues - Odds are field names, Evens are values null if succesful, otherwise the XML response to the update
See Also:   TestHarness.appendSimpleDoc



validateErrorUpdate
public String validateErrorUpdate(String xml) throws SAXException(Code)
Validates that an "update" (add, commit or optimize) results in success. :TODO: currently only deals with one add/doc at a time, this will need changed if/when SOLR-2 is resolved
Parameters:
  xml - The XML of the update null if succesful, otherwise the XML response to the update



validateQuery
public String validateQuery(SolrQueryRequest req, String... tests) throws IOException, Exception(Code)
Validates a "query" response against an array of XPath test strings
Parameters:
  req - the Query to process null if all good, otherwise the first test that fails.
exception:
  Exception - any exception in the response.
exception:
  IOException - if there is a problem writing the XML
See Also:   LocalSolrQueryRequest



validateUpdate
public String validateUpdate(String xml) throws SAXException(Code)
Validates that an "update" (add, commit or optimize) results in success. :TODO: currently only deals with one add/doc at a time, this will need changed if/when SOLR-2 is resolved
Parameters:
  xml - The XML of the update null if succesful, otherwise the XML response to the update



validateXPath
public String validateXPath(String xml, String... tests) throws XPathExpressionException, SAXException(Code)
A helper method which valides a String against an array of XPath test strings.
Parameters:
  xml - The xml String to validate
Parameters:
  tests - Array of XPath strings to test (in boolean mode) on the xml null if all good, otherwise the first test that fails.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.