You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Sian January <si...@googlemail.com> on 2007/02/15 11:50:21 UTC

Re: [jira] Commented: (HARMONY-617) [classlib][luni] HttpURLConnection does not support persistent connections

Hi everyone,

I have been working on implementing persistence for HttpURLConnections and
working with Alexander Kleymenov to make sure it's properly tested.  We're
currently discussing one of the tests that Alexander wrote to test
persistent connections throught a proxy if anyone would like to join in.
Please see HARMONY-617 for details.

Alexander - in the HttpConnectionManager I currently use proxy, host name
and port to uniquely identify a connection but it seems from your test like
the RI just uses host name and port.  I think it shouldn't be too difficult
to switch to do the same, so I will do that unless anyone has any
objections.

Thanks,

Sian




On 15/02/07, Tim Ellison (JIRA) <ji...@apache.org> wrote:
>
>
>    [
> https://issues.apache.org/jira/browse/HARMONY-617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12473332]
>
> Tim Ellison commented on HARMONY-617:
> -------------------------------------
>
> (please move ths conversation onto the dev list)
>
>
> > [classlib][luni] HttpURLConnection does not support persistent
> connections
> >
> --------------------------------------------------------------------------
> >
> >                 Key: HARMONY-617
> >                 URL: https://issues.apache.org/jira/browse/HARMONY-617
> >             Project: Harmony
> >          Issue Type: Bug
> >          Components: Classlib
> >            Reporter: Alexander Kleymenov
> >         Assigned To: Paulex Yang
> >         Attachments: luni.patch, luni2.patch, patch-test2.txt,
> test.patch
> >
> >
> > Current HttpURLConnection does not support persistent connections while
> RI implementation does.
> > Implementation of this mechanism will allow sufficiently increase the
> performance of network applications based on HttpURLConnections. To make
> Harmony's implementation more attractive for use this support SHALL be
> implemented.
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>


-- 
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU

Re: [jira] Commented: (HARMONY-617) [classlib][luni] HttpURLConnection does not support persistent connections

Posted by Alexander Kleymenov <kl...@gmail.com>.
Sian,

> That's a good idea - I didn't realise there were conventions for test
> names.  I will make this change and write some security tests and then
> upload a final patch.

Thank you, I'm looking forward to see it.
Please, ask if you need any help with this.

Alexander

Re: [jira] Commented: (HARMONY-617) [classlib][luni] HttpURLConnection does not support persistent connections

Posted by Sian January <si...@googlemail.com>.
Hi Alexander,

On 22/02/07, Alexander Kleymenov <kl...@gmail.com> wrote:
>
> Hi Sian,
>
> Sian January wrote:
> >
> > My latest patch (luni3.patch) fixes Alexander's tests to comply with the
> > RI on how proxied connections are reused. I have not yet separated out
> > the tests that are implementation specific but I am planning to move
> > them into a separate class in the same package (e.g.
> >
> org.apache.harmony.tests.internal.net.www.protocol.http.PersistenceTest)
> > unless anyone disagrees.
>
> Thank you for the improvement! Everything works fine with your latest
> patch.
> In addition to it I've added patch implementing new test cases
> for persistent https connections. Please, check them and give me know if
> there are any questions or issues.


Thanks for this - I have had a look and the new https tests look great.

In additions to existing test cases it could be suitable for us to
> implement test cases checking for security issues
> (related to checkConnect, getProperty and others).


Yes - I had thought about this too.

What's regarding new test - I agree with package name, but to fully comply
> with "Testing Conventions Used in the Apache Harmony Class Library" [1] we
> should place implementation specific tests in luni/src/test/impl
> directory. It seems that luni module does not comply with conventions,
> but it's a good chance for us to start moving it in right direction.


That's a good idea - I didn't realise there were conventions for test
names.  I will make this change and write some security tests and then
upload a final patch.

Regards,

Sian


Another point for discussion could be test cases using connections to
> external web servers. I agree with necessity of such a 'real world'
> operation testing, but such the tests are more like system tests, not
> unit. Among the other things with such tests they require some external
> environment [pre]configuration: access to the internet or (in case of
> its unavailability) local web server launching.  Parameters of
> such a configuration (in our case it is address, port and, perhaps,
> proxy used for connection) should be passed to the test before
> its execution. Only in this case such tests can operate correctly and do
> what is expected.
>
> As I know there is no means for implementation of such a tests
> on classlib yet. Although there were related discussions turned on this
> problem,
> but did not reached final resolution (see [2] for example).
>
> I could suggest the mechanism resolving this.
> It can be implemented similar to DRLVM regression testing framework:
> To launch system test cases we can implement Ant's scripts
> checking/making required environment configuration and starting the test
> with
> passing required parameters. In our case we can check for internet
> connection and use external web server, or launch Jetty if it is
> unavailable.
> There is no need in code duplication for test cases differing from each
> other only by external system configuration. In our case the test cases
> checking real-world operation could look like follows:
>
>    1. Launch Jetty before execution:
>
>       <target name="test" depends="launch-jetty">
>
>           <run-junit-test "o.a.harmony.test.HttpURLConnectionTest"
>                vmarg="-Dserver.address=${http.jetty.address}"/>
>
>       </target>
>
>    2. Executed only in case of direct internet access:
>
>       <target name="test" if="internet.connection.exists">
>
>           <run-junit-test "o.a.harmony.test.HttpURLConnectionTest"
>                vmarg="-Dserver.address=${http.web.address}">
>
>       </target>
>
>
> Our JUnit test will remain as is in the same location as now, but new
> system
> test cases (like above) will use it from different perspective - not as
> a unit functional, but as a system functional test.
>
> Such an approach is simple, quite universal, does not require much coding
> work,
> does not depend on new external tools and libraries, and could be easily
> integrated into current repository/build/testing system.
> What does Community think of it?
>
> Thank you,
> Alexander
>
>
> [1] "Testing Conventions Used in the Apache Harmony Class Library":
>    http://harmony.apache.org/subcomponents/classlibrary/testing.html
>
> [2] [testing] code for exotic configurations
>    Somewhere at:
>    http://mail-archives.apache.org/mod_mbox/harmony-dev/200601.mbox/thread
>



-- 
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU

Re: [jira] Commented: (HARMONY-617) [classlib][luni] HttpURLConnection does not support persistent connections

Posted by Andrew Zhang <zh...@gmail.com>.
On 2/22/07, Alexander Kleymenov <kl...@gmail.com> wrote:
>
> Hi Andrew,
>
> > Hi Alexander, why not launch jetty in embedded mode, say, in the test
> code?
>
> It'll make the test dependable on Jetty. And it requires some suporting
> framework to be implemented.


iirc, jetty.jar has already been in dependency list.

> We had a long discussion about jetty, and agreed to use it as a embedded
> web
> > server for harmony test,
>
> To evaluate such an approach some sample tests are needed. I looked for
> them, but could not find.


The sample code looks very simple:
 jetty-based test example:
setUp code:
            port = Support_PortManager.getNextPort();
            Server server = new Server(port);
            ResourceHandler resource_handler=new ResourceHandler();
            resource_handler.setResourceBase("somewhere");
            server.setHandler(resource_handler);
            server.start();
tearDown code:
            server.stop();

> although I'm not sure whether it works for persistent connections.
>
> I doubt it is possible to test persistence implementation with
> external http server. Say, how is it possible to test that our
> implementation will work correctly with 2 established persistent
> connections
> while third connection was interrupted by the server? There could be many
> examples of such testing situations requiring tight control over http
> server
> behaviour.
>
> Thank you for your note, I think we should decide is Jetty appropriate for
> using
> here or not.


Jetty is very flexible, and easy to implement customized handler as we
discussed before[1][2].  Thanks!

[1]
http://mail-archives.apache.org/mod_mbox/harmony-dev/200608.mbox/%3C2c9597b90608010403o24fce892gf6fc7045cadeb166@mail.gmail.com%3E
[2] http://harmony.apache.org/subcomponents/classlibrary/agreements.html


Alexander
>



-- 
Best regards,
Andrew Zhang

Re: [jira] Commented: (HARMONY-617) [classlib][luni] HttpURLConnection does not support persistent connections

Posted by Alexander Kleymenov <kl...@gmail.com>.
Hi Andrew,

> Hi Alexander, why not launch jetty in embedded mode, say, in the test code?

It'll make the test dependable on Jetty. And it requires some suporting
framework to be implemented.

> We had a long discussion about jetty, and agreed to use it as a embedded web
> server for harmony test,

To evaluate such an approach some sample tests are needed. I looked for
them, but could not find.

> although I'm not sure whether it works for persistent connections.

I doubt it is possible to test persistence implementation with
external http server. Say, how is it possible to test that our
implementation will work correctly with 2 established persistent connections
while third connection was interrupted by the server? There could be many
examples of such testing situations requiring tight control over http server
behaviour.

Thank you for your note, I think we should decide is Jetty appropriate for using
here or not.

Alexander

Re: [jira] Commented: (HARMONY-617) [classlib][luni] HttpURLConnection does not support persistent connections

Posted by Andrew Zhang <zh...@gmail.com>.
On 2/22/07, Alexander Kleymenov <kl...@gmail.com> wrote:
>
> Hi Sian,
>
> Sian January wrote:
> >
> > My latest patch (luni3.patch) fixes Alexander's tests to comply with the
> > RI on how proxied connections are reused. I have not yet separated out
> > the tests that are implementation specific but I am planning to move
> > them into a separate class in the same package (e.g.
> >
> org.apache.harmony.tests.internal.net.www.protocol.http.PersistenceTest)
> > unless anyone disagrees.
>
> Thank you for the improvement! Everything works fine with your latest
> patch.
> In addition to it I've added patch implementing new test cases
> for persistent https connections. Please, check them and give me know if
> there are any questions or issues.
>
> In additions to existing test cases it could be suitable for us to
> implement test cases checking for security issues
> (related to checkConnect, getProperty and others).
>
> What's regarding new test - I agree with package name, but to fully comply
> with "Testing Conventions Used in the Apache Harmony Class Library" [1] we
> should place implementation specific tests in luni/src/test/impl
> directory. It seems that luni module does not comply with conventions,
> but it's a good chance for us to start moving it in right direction.
>
> Another point for discussion could be test cases using connections to
> external web servers. I agree with necessity of such a 'real world'
> operation testing, but such the tests are more like system tests, not
> unit. Among the other things with such tests they require some external
> environment [pre]configuration: access to the internet or (in case of
> its unavailability) local web server launching.  Parameters of
> such a configuration (in our case it is address, port and, perhaps,
> proxy used for connection) should be passed to the test before
> its execution. Only in this case such tests can operate correctly and do
> what is expected.
>
> As I know there is no means for implementation of such a tests
> on classlib yet. Although there were related discussions turned on this
> problem,
> but did not reached final resolution (see [2] for example).
>
> I could suggest the mechanism resolving this.
> It can be implemented similar to DRLVM regression testing framework:
> To launch system test cases we can implement Ant's scripts
> checking/making required environment configuration and starting the test
> with
> passing required parameters. In our case we can check for internet
> connection and use external web server, or launch Jetty if it is
> unavailable.
> There is no need in code duplication for test cases differing from each
> other only by external system configuration. In our case the test cases
> checking real-world operation could look like follows:
>
>    1. Launch Jetty before execution:
>
>       <target name="test" depends="launch-jetty">
>
>           <run-junit-test "o.a.harmony.test.HttpURLConnectionTest"
>                vmarg="-Dserver.address=${http.jetty.address}"/>
>
>       </target>


Hi Alexander, why not launch jetty in embedded mode, say, in the test code?
We had a long discussion about jetty, and agreed to use it as a embedded web
server for harmony test, although I'm not sure whether it works for
persistent connections. iirc, someone(Tony Wu/Richard Liang?) has already
used jetty for network test. Your thoughts? Thanks!

   2. Executed only in case of direct internet access:
>
>       <target name="test" if="internet.connection.exists">
>
>           <run-junit-test "o.a.harmony.test.HttpURLConnectionTest"
>                vmarg="-Dserver.address=${http.web.address}">
>
>       </target>
>
>
> Our JUnit test will remain as is in the same location as now, but new
> system
> test cases (like above) will use it from different perspective - not as
> a unit functional, but as a system functional test.
>
> Such an approach is simple, quite universal, does not require much coding
> work,
> does not depend on new external tools and libraries, and could be easily
> integrated into current repository/build/testing system.
> What does Community think of it?
>
> Thank you,
> Alexander
>
>
> [1] "Testing Conventions Used in the Apache Harmony Class Library":
>    http://harmony.apache.org/subcomponents/classlibrary/testing.html
>
> [2] [testing] code for exotic configurations
>    Somewhere at:
>    http://mail-archives.apache.org/mod_mbox/harmony-dev/200601.mbox/thread
>



-- 
Best regards,
Andrew Zhang

Re: [jira] Commented: (HARMONY-617) [classlib][luni] HttpURLConnection does not support persistent connections

Posted by Alexander Kleymenov <kl...@gmail.com>.
Hi Sian,

Sian January wrote:
>
> My latest patch (luni3.patch) fixes Alexander's tests to comply with the
> RI on how proxied connections are reused. I have not yet separated out
> the tests that are implementation specific but I am planning to move
> them into a separate class in the same package (e.g.
>     org.apache.harmony.tests.internal.net.www.protocol.http.PersistenceTest)
> unless anyone disagrees.

Thank you for the improvement! Everything works fine with your latest patch.
In addition to it I've added patch implementing new test cases
for persistent https connections. Please, check them and give me know if
there are any questions or issues.

In additions to existing test cases it could be suitable for us to
implement test cases checking for security issues
(related to checkConnect, getProperty and others).

What's regarding new test - I agree with package name, but to fully comply
with "Testing Conventions Used in the Apache Harmony Class Library" [1] we
should place implementation specific tests in luni/src/test/impl
directory. It seems that luni module does not comply with conventions,
but it's a good chance for us to start moving it in right direction.

Another point for discussion could be test cases using connections to
external web servers. I agree with necessity of such a 'real world'
operation testing, but such the tests are more like system tests, not
unit. Among the other things with such tests they require some external
environment [pre]configuration: access to the internet or (in case of
its unavailability) local web server launching.  Parameters of
such a configuration (in our case it is address, port and, perhaps,
proxy used for connection) should be passed to the test before
its execution. Only in this case such tests can operate correctly and do
what is expected.

As I know there is no means for implementation of such a tests
on classlib yet. Although there were related discussions turned on this problem,
but did not reached final resolution (see [2] for example).

I could suggest the mechanism resolving this.
It can be implemented similar to DRLVM regression testing framework:
To launch system test cases we can implement Ant's scripts
checking/making required environment configuration and starting the test with
passing required parameters. In our case we can check for internet
connection and use external web server, or launch Jetty if it is unavailable.
There is no need in code duplication for test cases differing from each
other only by external system configuration. In our case the test cases
checking real-world operation could look like follows:

    1. Launch Jetty before execution:

       <target name="test" depends="launch-jetty">

           <run-junit-test "o.a.harmony.test.HttpURLConnectionTest"
                vmarg="-Dserver.address=${http.jetty.address}"/>

       </target>

    2. Executed only in case of direct internet access:

       <target name="test" if="internet.connection.exists">

           <run-junit-test "o.a.harmony.test.HttpURLConnectionTest"
                vmarg="-Dserver.address=${http.web.address}">

       </target>


Our JUnit test will remain as is in the same location as now, but new system
test cases (like above) will use it from different perspective - not as
a unit functional, but as a system functional test.

Such an approach is simple, quite universal, does not require much coding work,
does not depend on new external tools and libraries, and could be easily
integrated into current repository/build/testing system.
What does Community think of it?

Thank you,
Alexander


[1] "Testing Conventions Used in the Apache Harmony Class Library":
    http://harmony.apache.org/subcomponents/classlibrary/testing.html

[2] [testing] code for exotic configurations
    Somewhere at:
    http://mail-archives.apache.org/mod_mbox/harmony-dev/200601.mbox/thread

Re: [jira] Commented: (HARMONY-617) [classlib][luni] HttpURLConnection does not support persistent connections

Posted by Boris Kuznetsov <bo...@gmail.com>.
Agree,
we should comply with RI's behavior.

On 2/15/07, Sian January <si...@googlemail.com> wrote:
> Hi everyone,
>
> I have been working on implementing persistence for HttpURLConnections and
> working with Alexander Kleymenov to make sure it's properly tested.  We're
> currently discussing one of the tests that Alexander wrote to test
> persistent connections throught a proxy if anyone would like to join in.
> Please see HARMONY-617 for details.
>
> Alexander - in the HttpConnectionManager I currently use proxy, host name
> and port to uniquely identify a connection but it seems from your test like
> the RI just uses host name and port.  I think it shouldn't be too difficult
> to switch to do the same, so I will do that unless anyone has any
> objections.
>
> Thanks,
>
> Sian
>
>
>
>
> On 15/02/07, Tim Ellison (JIRA) <ji...@apache.org> wrote:
> >
> >
> >    [
> > https://issues.apache.org/jira/browse/HARMONY-617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12473332]
> >
> > Tim Ellison commented on HARMONY-617:
> > -------------------------------------
> >
> > (please move ths conversation onto the dev list)
> >
> >
> > > [classlib][luni] HttpURLConnection does not support persistent
> > connections
> > >
> > --------------------------------------------------------------------------
> > >
> > >                 Key: HARMONY-617
> > >                 URL: https://issues.apache.org/jira/browse/HARMONY-617
> > >             Project: Harmony
> > >          Issue Type: Bug
> > >          Components: Classlib
> > >            Reporter: Alexander Kleymenov
> > >         Assigned To: Paulex Yang
> > >         Attachments: luni.patch, luni2.patch, patch-test2.txt,
> > test.patch
> > >
> > >
> > > Current HttpURLConnection does not support persistent connections while
> > RI implementation does.
> > > Implementation of this mechanism will allow sufficiently increase the
> > performance of network applications based on HttpURLConnections. To make
> > Harmony's implementation more attractive for use this support SHALL be
> > implemented.
> >
> > --
> > This message is automatically generated by JIRA.
> > -
> > You can reply to this email to add a comment to the issue online.
> >
> >
>
>
> --
> Unless stated otherwise above:
> IBM United Kingdom Limited - Registered in England and Wales with number
> 741598.
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
>


-- 
Best regards,
Boris Kuznetsov