Tim, George, I'd like to resume this topic

>
>There is no way to force a server to send you a chunked response using
>regular HTTP headers, so in this case the server and client have an
>understanding that when the client asks for a particular resource the
>server will send it back in chunks.
>

I've created a small local server that just demonstrates common approach
only. The idea is the next: a simple local server provides a way for a unit
test to configure a server's response (also it may be improved to save a
request message to be check by a unit test):
              ---invoke--->            ---request--->
A unit tests            tested API             a local server instance
    |         <---result---            <---response---   ^
    |                                                              |
     -------------------configure server--------------------

I believe this approach may be applied for most of cases and allow us to
eliminate dependency on an external server.

I've created JIRA (see Harmony-164) and attached a file with local server
and 2 JUnit test cases (one of them sends a chunked response, please note
there is no server's code specific for a selected test). Could you please
review the code and let me know what you think?

Thanks,
Stepan


On 2/22/06, Tim Ellison <[EMAIL PROTECTED]> wrote:
>
> Stepan Mishura wrote:
> > On 2/21/06, Tim Ellison <[EMAIL PROTECTED]> wrote:
> >
> >> Stepan Mishura wrote:
> >>> I glanced through a local server code from HARMONY-57 contribution
> >> without
> >>> looking into implementation details and ... this made me think. I
> catch
> >> hold
> >>> of the following:
> >>> 1) The server contains some testing code that looks not good for me
> >> Care to explain?
> >
> >
> > Support_HttpServer.java has the following code:
> >
> > class ServerThread implements Runnable {
> >     public void run() {
> >          ....
> >         // call the test function based on the requested resource
> >          if (resourceName.equals(CHUNKEDTEST))
> >              chunkedTest();
> >          <... lot of 'else if' ...>
> >         ...
> >        }
> >
> >        private void chunkedTest() {
> >             <... construct server's respond and send it ...>
> >        }
> >
> > I'd prefer to avoid this and to have a server implementation that
> provides a
> > way for unit test to check received request and to configure a server's
> > respond.
>
> and I thought you wanted it simple ;-)
>
> There is no way to force a server to send you a chunked response using
> regular HTTP headers, so in this case the server and client have an
> understanding that when the client asks for a particular resource the
> server will send it back in chunks.
>
> If that understanding was encoded differently, say in the search field
> of the URL rather than the path would that make you happier?  do you
> have some other idea?
>
> <snip>
>
> >> Does it interfere with what you want to do?
> >
> > Sure, we have javax.security.auth.kerberos.KerberosTicket class that
> > currently contains a stub. I was thinking about implementing the stub
> and
> > how to test it. So I played a little bit with developing Kerberos stub
> > server. When I saw that tests for URLConnection class failed because
> they
> > need local stub server then I got interested how to solve this similar
> > issue.
>
> Not clear how that interferes.  You should feel free to reuse the server
> code and extend it as you need to do a faux Kerberos server.
>
> Regards,
> Tim
>
> --
>
> Tim Ellison ([EMAIL PROTECTED])
> IBM Java technology centre, UK.
>



--
Thanks,
Stepan Mishura
Intel Middleware Products Division

Reply via email to