Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-1413

Add MockSolrServer to SolrJ client tests

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Test
    • Status: Closed
    • Minor
    • Resolution: Implemented
    • None
    • 3.3
    • clients - java
    • None
    • Any Solr distribution. Uses only the SolrJ client code, nothing in the Solr core.

    Description

      The SolrJ unit test suite has no "mock" solr server for HTTP access, and there are no low-level tests of the Solrj HTTP wire protocols.

      This patch includes org.apache.solr.client.solrj.MockHTTPServer.java and org.apache.solr.client.solrj.TestHTTP_XML_single.java. The mock server does not parse its input and responds with pre-configured byte streams. The latter does a few tests in the XML wire format. Most of the tests do one request and set up success and failure responses.

      Unfortunately, there is a bug: I could not get 2 successive requests to work. The mock server's TCP socket does not work when reading the second request. If someone who knows the JDK socket classes could look at the mock server, I would greatly appreciate it.

      The alternative is to steal a bunch of files from the apache commons httpclient test suite. This is a quite sophisticate bunch of code:

      http://svn.apache.org/repos/asf/httpcomponents/oac.hc3x/trunk/src/test/org/apache/commons/httpclient/server/

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            lancenorskog Lance Norskog
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment