You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "Lance Norskog (JIRA)" <ji...@apache.org> on 2009/09/06 05:51:58 UTC

[jira] Created: (SOLR-1413) Add MockSolrServer to SolrJ client tests

Add MockSolrServer to SolrJ client tests
----------------------------------------

                 Key: SOLR-1413
                 URL: https://issues.apache.org/jira/browse/SOLR-1413
             Project: Solr
          Issue Type: Test
          Components: clients - java
         Environment: Any Solr distribution. Uses only the SolrJ client code, nothing in the Solr core.
            Reporter: Lance Norskog
            Priority: Minor


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/




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1413) Add MockSolrServer to SolrJ client tests

Posted by "Noble Paul (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12751831#action_12751831 ] 

Noble Paul commented on SOLR-1413:
----------------------------------

Why should it be opening a ServerSocket ? Why can't you start a jetty server and register a servlet to respond with the appropriate response for ach given url. 

> Add MockSolrServer to SolrJ client tests
> ----------------------------------------
>
>                 Key: SOLR-1413
>                 URL: https://issues.apache.org/jira/browse/SOLR-1413
>             Project: Solr
>          Issue Type: Test
>          Components: clients - java
>         Environment: Any Solr distribution. Uses only the SolrJ client code, nothing in the Solr core.
>            Reporter: Lance Norskog
>            Priority: Minor
>         Attachments: SOLR-1413.patch
>
>
> 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/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-1413) Add MockSolrServer to SolrJ client tests

Posted by "Lance Norskog (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-1413?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lance Norskog updated SOLR-1413:
--------------------------------

    Attachment: SOLR-1413.patch

> Add MockSolrServer to SolrJ client tests
> ----------------------------------------
>
>                 Key: SOLR-1413
>                 URL: https://issues.apache.org/jira/browse/SOLR-1413
>             Project: Solr
>          Issue Type: Test
>          Components: clients - java
>         Environment: Any Solr distribution. Uses only the SolrJ client code, nothing in the Solr core.
>            Reporter: Lance Norskog
>            Priority: Minor
>         Attachments: SOLR-1413.patch, SOLR-1413.patch
>
>
> 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/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-1413) Add MockSolrServer to SolrJ client tests

Posted by "Lance Norskog (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-1413?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lance Norskog updated SOLR-1413:
--------------------------------

    Attachment: SOLR-1413.patch

> Add MockSolrServer to SolrJ client tests
> ----------------------------------------
>
>                 Key: SOLR-1413
>                 URL: https://issues.apache.org/jira/browse/SOLR-1413
>             Project: Solr
>          Issue Type: Test
>          Components: clients - java
>         Environment: Any Solr distribution. Uses only the SolrJ client code, nothing in the Solr core.
>            Reporter: Lance Norskog
>            Priority: Minor
>         Attachments: SOLR-1413.patch
>
>
> 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/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1413) Add MockSolrServer to SolrJ client tests

Posted by "Noble Paul (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12752350#action_12752350 ] 

Noble Paul commented on SOLR-1413:
----------------------------------

I guess your "Mock Servlets" do not use http session . If this is true everything should be ok.ideally requests to Solr does not need sessions

> Add MockSolrServer to SolrJ client tests
> ----------------------------------------
>
>                 Key: SOLR-1413
>                 URL: https://issues.apache.org/jira/browse/SOLR-1413
>             Project: Solr
>          Issue Type: Test
>          Components: clients - java
>         Environment: Any Solr distribution. Uses only the SolrJ client code, nothing in the Solr core.
>            Reporter: Lance Norskog
>            Priority: Minor
>         Attachments: SOLR-1413.patch, SOLR-1413.patch
>
>
> 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/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1413) Add MockSolrServer to SolrJ client tests

Posted by "Noble Paul (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12752319#action_12752319 ] 

Noble Paul commented on SOLR-1413:
----------------------------------

the patch looks fine.

> Add MockSolrServer to SolrJ client tests
> ----------------------------------------
>
>                 Key: SOLR-1413
>                 URL: https://issues.apache.org/jira/browse/SOLR-1413
>             Project: Solr
>          Issue Type: Test
>          Components: clients - java
>         Environment: Any Solr distribution. Uses only the SolrJ client code, nothing in the Solr core.
>            Reporter: Lance Norskog
>            Priority: Minor
>         Attachments: SOLR-1413.patch, SOLR-1413.patch
>
>
> 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/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (SOLR-1413) Add MockSolrServer to SolrJ client tests

Posted by "Noble Paul (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12752352#action_12752352 ] 

Noble Paul edited comment on SOLR-1413 at 9/7/09 10:50 PM:
-----------------------------------------------------------

We don't really need to register a new servlet for every "path" one standard servlet can take care of all the paths.

let the servlet have a method. 

{code:java}
public void addPath(String path, Map<String,Object>httpheaders, NamedList httpResponse ){
}
{code}

      was (Author: noble.paul):
    We don't really need to register a new servlet for every "path" one standard servlet can take care of all the paths.

let the servlet have a method. 

{code:java}
public void addPath(Map<String,Object>httpheaders, NamedList httpResponse ){
}
{code}
  
> Add MockSolrServer to SolrJ client tests
> ----------------------------------------
>
>                 Key: SOLR-1413
>                 URL: https://issues.apache.org/jira/browse/SOLR-1413
>             Project: Solr
>          Issue Type: Test
>          Components: clients - java
>         Environment: Any Solr distribution. Uses only the SolrJ client code, nothing in the Solr core.
>            Reporter: Lance Norskog
>            Priority: Minor
>         Attachments: SOLR-1413.patch, SOLR-1413.patch
>
>
> 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/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1413) Add MockSolrServer to SolrJ client tests

Posted by "Noble Paul (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12752352#action_12752352 ] 

Noble Paul commented on SOLR-1413:
----------------------------------

We don't really need to register a new servlet for every "path" one standard servlet can take care of all the paths.

let the servlet have a method. 

{code:java}
public void addPath(Map<String,Object>httpheaders, NamedList httpResponse ){
}
{code}

> Add MockSolrServer to SolrJ client tests
> ----------------------------------------
>
>                 Key: SOLR-1413
>                 URL: https://issues.apache.org/jira/browse/SOLR-1413
>             Project: Solr
>          Issue Type: Test
>          Components: clients - java
>         Environment: Any Solr distribution. Uses only the SolrJ client code, nothing in the Solr core.
>            Reporter: Lance Norskog
>            Priority: Minor
>         Attachments: SOLR-1413.patch, SOLR-1413.patch
>
>
> 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/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1413) Add MockSolrServer to SolrJ client tests

Posted by "Lance Norskog (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12752320#action_12752320 ] 

Lance Norskog commented on SOLR-1413:
-------------------------------------

Thanks!

In fact I'm now afraid it won't work, I don't know java HTTP coding ver well. Are HTTP sessions are matched between threads in the SolrJ client app and servlet HTTP sessions?

That is, if 8 client threads walk the same sequence of mock responses, will the Apache Commons simple and multi-threaded connection managers vector the client threads to the right sessions? If not, the clients will get a random sequence of responses and some of the sessions will run out of responses.

Do I have to turn on something in the Servlet?

> Add MockSolrServer to SolrJ client tests
> ----------------------------------------
>
>                 Key: SOLR-1413
>                 URL: https://issues.apache.org/jira/browse/SOLR-1413
>             Project: Solr
>          Issue Type: Test
>          Components: clients - java
>         Environment: Any Solr distribution. Uses only the SolrJ client code, nothing in the Solr core.
>            Reporter: Lance Norskog
>            Priority: Minor
>         Attachments: SOLR-1413.patch, SOLR-1413.patch
>
>
> 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/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-1413) Add MockSolrServer to SolrJ client tests

Posted by "Lance Norskog (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-1413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12752312#action_12752312 ] 

Lance Norskog commented on SOLR-1413:
-------------------------------------

Noble, you and your sensible ideas :)

Yes, it's cleaner with a Jetty server and a custom servlet. Version 2 of the patch uses this.

BTW, the point of this is that using the SolrJ client with lots of threads might have problems, and this allows direct investigation.

> Add MockSolrServer to SolrJ client tests
> ----------------------------------------
>
>                 Key: SOLR-1413
>                 URL: https://issues.apache.org/jira/browse/SOLR-1413
>             Project: Solr
>          Issue Type: Test
>          Components: clients - java
>         Environment: Any Solr distribution. Uses only the SolrJ client code, nothing in the Solr core.
>            Reporter: Lance Norskog
>            Priority: Minor
>         Attachments: SOLR-1413.patch, SOLR-1413.patch
>
>
> 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/

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.