harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Ellison <t.p.elli...@gmail.com>
Subject Re: local test server (Was: Re: [jira] Commented: (HARMONY-71) java.net.URLConnection.setUseCaches throws unspecified IllegalAccessError)
Date Thu, 23 Feb 2006 12:17:45 GMT
This sounds like the discussion we had a while ago along the lines of
'what is a reasonable environment we should expect developers/testers to
set-up locally, and what should be stubbed in the test suite itself.'

i.e. which of the following are reasonable items to put in the readme?
go and set-up a http server, ftp server, socks server, LDAP server,
kerberos server, smtp server, ...

Regards,
Tim

Stepan Mishura wrote:
> I feel that I need to study more details about net testing. Also to made
> discussion more concrete and constructive I'll to try to provide 'a proof of
> concept'.  I believe that this won't be a wasted effort and it won't take
> too much time. I'm going to select a number of 'common testing scenarios',
> for example, I will try to "force a server to send a chunked response"
> without creating a special resource to be requested. And demonstrate that it
> is possible to run them without external server or sophisticated internal
> server.
> Anyway I was going to continue to work with Kerberos server stub (because
> I'm not delighted with configuring external Kerberos server in order to run
> unit tests) and this is a good change for me to review this issue from
> another angle.
> 
> Thanks,
> Stepan Mishura
> Intel Middleware Products Division
> 
> 
> On 2/23/06, George Harley <george.c.harley <at> googlemail.com> wrote:
>>
>> Tim Ellison wrote:
>>> George Harley wrote:
>>>
>>>> Geir Magnusson Jr wrote:
>>>>
>>>>> George Harley wrote:
>>>>>
>>>>>> Geir Magnusson Jr wrote:
>>>>>>
>>>>>>> So, does this summarize to :
>>>>>>>
>>>>>>> 1) We need a new server or we should enahnce the current one?
>>>>>>>
>>>>>>> 2) We need instructions on how to do this.
>>>>>>>
>>>>>>> ?
>>>>>>>
>>>>>>> (I hope we don't need httpd to test Harmony...)
>>>>>>>
>>>>>> Could you remind me what the "current one" is ?
>>>>>>
>>>>> The one in the pending JIRA
>>>>>
>>>> There is no server in the pending JIRA.
>>>>
>>> (psst) take a look at
>>>
>> <HARMONY-57>\Harmony\Harmony_Tests\src\test\java\tests\support\Support_HttpServer.java
>>> Regards,
>>> Tim
>>>
>> Hi Tim,
>>
>> Funny. That's a test support class that is used to mock up an HTTP
>> server for one, admittedly large, test case method (test_getInputStream
>> in tests.api.java.net.URLConnectionTest).
>>
>> It is not "the server".
>>
>> There are a significantly larger number of test case methods that rely
>> on using the configured external HTTP/FTP/SOCKS servers to test out
>> their functionality.
>>
>> Best regards,
>> George
>> IBM UK
>>
>>
>>>> As briefly mentioned somewhere
>>>> else in this thread, the submitted zip for that JIRA contains
>>>> configuration code and properties files that permits the tester to use
>>>> any server in any location (including localhost) and test resources for
>>>> deploying on those servers.
>>>>
>>>>
>>>>>> What is the problem with using httpd to test Harmony ?
>>>>>>
>>>>> It's a rather large external dependency.  Reminds me of the time we
>>>>> got the TCK for JavaMail (a story in itself) and the only practical
>>>>> way to use it was to get Sun's IMAP server which only ran on Solaris.
>>>>>
>>>>> So what I was getting at is can we use something smaller/lighter that
>>>>> we can include in the project for this?  What is it required to do?
>>>>>
>>>> The tests require an HTTP server, an FTP server and a SOCKS server to
>> be
>>>> listening on certain (configurable) ports. The respective servers need
>>>> to have certain resources - text files, jars etc - deployed on them as
>> a
>>>> number of the java.net.* tests try and access them from the configured
>>>> locations. The tests check that the expected content is available, that
>>>> it is the expected size, contains the expected data etc etc.
>>>>
>>>> There are a number of mature, stable, freely available HTTP/FTP/SOCKS
>>>> servers out there that will do just great for satisfying the demands of
>>>> these tests so I don't propose to recommend anything in particular
>>>> (although I have had no problems running Apache HTTPD on my local
>>>> Windows machine). I don't see any justification for someone to spend
>>>> time developing a "new server" to run these tests. But, hey, it's not
>> my
>>>> time that will be wasted...
>>>>
>>>>
>>>>> geir
>>>>>
>>>>>
>>>>>
>>>>>>> Stepan Mishura wrote:
>>>>>>>
>>>>>>>> Hi Richard,
>>>>>>>>
>>>>>>>> Yes, I'm always for simplifying testing routine. And creating
a
>>>>>>>> detail guide
>>>>>>>> for configuring some testing server is a possible way to
do it.
>>>>>>>> However I'd
>>>>>>>> prefer to try to develop a simple local test server that
is easy to
>>>>>>>> configure. I believe that it will cover most of cases.
>>>>>>>>
>>>>>>>> And I assume that there may be a number of sophisticated
test cases
>>>>>>>> that
>>>>>>>> requires a special server set up. But I'd place them separately
>>>>>>>> this was
>>>>>>>> discussed in '[testing] code for exotic configurations' topic.
>>>>>>>>
>>>>>>>> Otherwise there is a chance to get the following detailed
>>>>>>>> instructions:
>>>>>>>> 1) Download http server from http://www.apache.org
>>>>>>>> ...
>>>>>>>> 50) Do this and that
>>>>>>>> ...
>>>>>>>> 100) Now you can run net tests
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Stepan
>>>>>>>>
>>>>>>>>
>>>>>>>> On 2/22/06, Richard Liang <richard.liangyx@gmail.com>
wrote:
>>>>>>>>
>>>>>>>>> Dears,
>>>>>>>>> Agree that server (maybe not local) is required for some
>>>>>>>>> sophisticated
>>>>>>>>> test cases. To make thing simply, we may provide more
detail guide
>>>>>>>>> (step-by-step) on how to setup/configure a typical testing
server.
>> Or
>>>>>>>>> shall we setup a test server and allow user to share
our testing
>>>>>>>>> server?
>>>>>>>>>
>>>>>>>>> Richard Liang
>>>>>>>>> China Software Development Lab, IBM
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Tim Ellison 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?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> 2) It is not as simple as I expected - my impression
was that a
>>>>>>>>>>> local
>>>>>>>>>>>
>>>>>>>>> server
>>>>>>>>>
>>>>>>>>>>> implementation should be very simple because
we are not going to
>>>>>>>>>>> test
>>>>>>>>>>> whether it corresponds to http spec. or not.
IMHO, it should
>> only
>>>>>>>>> provide a
>>>>>>>>>
>>>>>>>>>>> test case with:
>>>>>>>>>>> - a port number to open communication
>>>>>>>>>>> - access to a server's input/output streams to
verify a request
>>>>>>>>>>> to a
>>>>>>>>>>>
>>>>>>>>> server
>>>>>>>>>
>>>>>>>>>>> or to form a server's response.
>>>>>>>>>>> Naive? Well, I'm aware that I'm not so experienced
in
>>>>>>>>>>> java.netdevelopment
>>>>>>>>>>> and testing and may be I'm wrong.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>> The local server I referenced can be used for a number
of the
>>>>>>>>>> java.net
>>>>>>>>>> tests, some of which do require more sophisticated
behavior, like
>>>>>>>>>> basic
>>>>>>>>>> authentication, eTags, etc.
>>>>>>>>>>
>>>>>>>>>> I agree that the tests in HARMONY-71 only need something
to
>>>>>>>>>> accept their
>>>>>>>>>> connection, but I was simply pointing out that there
will be a
>> local
>>>>>>>>>> server we can use if that contribution is accepted
into the
>>>>>>>>>> project, so
>>>>>>>>>> probably not worth writing another.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> I'd like to start with the first issue (BTW,
is it ok to discuss
>>>>>>>>>>>
>>>>>>>>> details of
>>>>>>>>>
>>>>>>>>>>> contribution implementation if it is not accepted
yet?).
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>> Sure -- I would expect people to be evaluating it
thoroughly so
>> that
>>>>>>>>>> they can vote the code in/out.  The PPMC will shout
early if the
>>>>>>>>>> paperwork implies a contribution is unacceptable.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> Can we avoid adding
>>>>>>>>>>> a code that is specific for some test case to
a local server?
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>> Does it interfere with what you want to do?
>>>>>>>>>> In some cases, the test case needs to know what is
on the server
>> a
>>>>>>>>>> priori, so that it can test the client behavior correctly.
>>>>>>>>>>
>>>>>>>>>> Regards,
>>>>>>>>>> Tim
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> On 2/16/06, Tim Ellison wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>> I would rather that you just opened a new
JIRA issue for that
>>>>>>>>>>>> as it
>>>>>>>>>>>> doesn't relate to the original problem.
>>>>>>>>>>>>
>>>>>>>>>>>> FYI there is a local server incoming in the
HARMONY-57
>>>>>>>>>>>> contribution,
>>>>>>>>>>>>
>>>>>>>>> so
>>>>>>>>>
>>>>>>>>>>>> don't spend any time on it, see:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>> <HARMONY-57>\Harmony\Harmony_Tests\src\test\java\tests\support\Support_HttpServer.java
>>>>>>>>>
>>>>>>>>>>>> Regards,
>>>>>>>>>>>> Tim
>>>>>>>>>>>>
>>>>>>>>>>>> Stepan Mishura (JIRA) wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>     [
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>> http://issues.apache.org/jira/browse/HARMONY-71?page=comments#action_12366637
>>>>>>>>> ]
>>>>>>>>>
>>>>>>>>>>>>> Stepan Mishura commented on HARMONY-71:
>>>>>>>>>>>>> ---------------------------------------
>>>>>>>>>>>>>
>>>>>>>>>>>>> Tim,
>>>>>>>>>>>>>
>>>>>>>>>>>>> Added test case (test_setUseCachesZ)
depends on network and it
>>>>>>>>>>>>> fails
>>>>>>>>>>>>>
>>>>>>>>> if
>>>>>>>>>
>>>>>>>>>>>> it can not create connection with apache.org.
The same for
>>>>>>>>>>>> HARMONY-72.
>>>>>>>>>>>>
>>>>>>>>> I'm
>>>>>>>>>
>>>>>>>>>>>> going to attach a patch file with a local
server in it. Could
>> you
>>>>>>>>> reopen
>>>>>>>>>
>>>>>>>>>>>> this JIRA?
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> Thanks,
>>>>>>>>>>>>> Stepan.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>>  java.net.URLConnection.setUseCaches
throws unspecified
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>> IllegalAccessError
>>>>>>>>>>>>
>>>>>>>>>>>>
>> --------------------------------------------------------------------------
>>>>>>>>>
>>>>>>>>>>>>>>          Key: HARMONY-71
>>>>>>>>>>>>>>          URL: http://issues.apache.org/jira/browse/HARMONY-71
>>>>>>>>>>>>>>      Project: Harmony
>>>>>>>>>>>>>>         Type: Bug
>>>>>>>>>>>>>>   Components: Classlib
>>>>>>>>>>>>>>     Reporter: Svetlana Samoilenko
>>>>>>>>>>>>>>     Assignee: Tim Ellison
>>>>>>>>>>>>>> According to j2se 1.4.2 specification
method
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>> java.net.URLConnection.setUseCaches(boolean)
throws
>>>>>>>>>>>>
>>>>>>>>> IllegalStateException,
>>>>>>>>>
>>>>>>>>>>>> if already connected. Harmony throws
>>>>>>>>>>>> java.lang.IllegalAccessErrorinstead,
>>>>>>>>>>>> that contradicts the specification.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>> Code to reproduce:
>>>>>>>>>>>>>> import java.io.IOException;
>>>>>>>>>>>>>> import java.net.*;
>>>>>>>>>>>>>> public class test2 {
>>>>>>>>>>>>>>     public static void main(String[]
args) {
>>>>>>>>>>>>>>         HttpURLConnection u=null;
>>>>>>>>>>>>>>         try {
>>>>>>>>>>>>>>             u=(HttpURLConnection)(new
URL("http://intel.com
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>> ").openConnection());
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>>             u.connect();
>>>>>>>>>>>>>>         } catch (MalformedURLException
e) {
>>>>>>>>>>>>>>             System.out.println("unexpected
>>>>>>>>>>>>>>
>>>>>>>>> MalformedURLException"+e);
>>>>>>>>>
>>>>>>>>>>>>>>         } catch (IOException f) {
>>>>>>>>>>>>>>             System.out.println("unexpected
IOException"+f);
>>>>>>>>>>>>>>         }
>>>>>>>>>>>>>>         try {
>>>>>>>>>>>>>>            u.setUseCaches(true);
>>>>>>>>>>>>>>         } catch (IllegalStateException
e) {
>>>>>>>>>>>>>>            System.out.println("OK.
Expected
>>>>>>>>>>>>>> IllegalStateException");
>>>>>>>>>>>>>>            e.printStackTrace();
>>>>>>>>>>>>>>         };
>>>>>>>>>>>>>>     }
>>>>>>>>>>>>>> }
>>>>>>>>>>>>>> Steps to Reproduce:
>>>>>>>>>>>>>> 1. Build Harmony (check-out on 2006-01-30)
j2se subset as
>>>>>>>>>>>>>> described
>>>>>>>>>>>>>>
>>>>>>>>> in
>>>>>>>>>
>>>>>>>>>>>> README.txt.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>> 2. Compile test2.java using BEA 1.4
javac
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> javac -d . test2.java
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> 3. Run java using compatible VM (J9)
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> java -showversion test2
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Output:
>>>>>>>>>>>>>> C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe
-showversion
>> test2
>>>>>>>>>>>>>> java version "1.4.2_04"
>>>>>>>>>>>>>> Java(TM) 2 Runtime Environment, Standard
Edition (build
>>>>>>>>>>>>>> 1.4.2_04-b05
>>>>>>>>>>>>>>
>>>>>>>>> )
>>>>>>>>>
>>>>>>>>>>>>>> BEA WebLogic JRockit(TM) 1.4.2_04
JVM (build
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>> ari-31788-20040616-1132-win-ia32, Native
Threads, GC strategy:
>>>>>>>>>>>>
>>>>>>>>> parallel)
>>>>>>>>>
>>>>>>>>>>>>>> OK. Expected IllegalStateException
>>>>>>>>>>>>>> java.lang.IllegalStateException:
Already connected
>>>>>>>>>>>>>>         at java.net.URLConnection.setUseCaches(Z)V(
>>>>>>>>>>>>>>
>>>>>>>>> URLConnection.java
>>>>>>>>>
>>>>>>>>>>>> :828)
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>>         at test2.main([Ljava.lang.String;)V(test2.java:17)
>>>>>>>>>>>>>> C:\tmp>C:\harmony\trunk\deploy\jre\bin\java
-showversion
>> test2
>>>>>>>>>>>>>> (c) Copyright 1991, 2005 The Apache
Software Foundation or
>> its
>>>>>>>>>>>>>>
>>>>>>>>>>>> licensors, as applicable.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>> java.lang.IllegalAccessError: Connection
already established
>>>>>>>>>>>>>>         at
>>>>>>>>>>>>>> java.net.URLConnection.setUseCaches(URLConnection.java
>>>>>>>>>>>>>>
>>>>>>>>> :923)
>>>>>>>>>
>>>>>>>>>>>>>>         at test2.main(test2.java:17)
>>>>>>>>>>>>>> Suggested junit test case:
>>>>>>>>>>>>>> ------------------------
>>>>>>>>>>>>>>
>> URLConnectionTest.java-------------------------------------------------
>>>>>>>>>
>>>>>>>>>>>>>> import java.io.IOException;
>>>>>>>>>>>>>> import java.net.*;
>>>>>>>>>>>>>> import junit.framework.*;
>>>>>>>>>>>>>> public class URLConnectionTest extends
TestCase {
>>>>>>>>>>>>>>     public static void main(String[]
args) {
>>>>>>>>>>>>>>         junit.textui.TestRunner.run(URLConnectionTest.class);
>>>>>>>>>>>>>>     }
>>>>>>>>>>>>>>     public void test_setUseCaches
() {
>>>>>>>>>>>>>>         HttpURLConnection u=null;
>>>>>>>>>>>>>>         try {
>>>>>>>>>>>>>>             u=(HttpURLConnection)(new
URL("http://intel.com
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>> ").openConnection());
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>>             u.connect();
>>>>>>>>>>>>>>         } catch (MalformedURLException
e) {
>>>>>>>>>>>>>>             fail("unexpected MalformedURLException"+e);
>>>>>>>>>>>>>>         } catch (IOException f) {
>>>>>>>>>>>>>>             fail("unexpected IOException"+f);
>>>>>>>>>>>>>>         }
>>>>>>>>>>>>>>         try {
>>>>>>>>>>>>>>            u.setUseCaches(true);
>>>>>>>>>>>>>>         } catch (IllegalStateException
e) { //expected
>>>>>>>>>>>>>>         };
>>>>>>>>>>>>>>    }
>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>>
>>>>>>>>>>>> Tim Ellison (t.p.ellison@gmail.com)
>>>>>>>>>>>> IBM Java technology centre, UK.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>> --
>>>>>>>> Thanks,
>>>>>>>> Stepan Mishura
>>>>>>>> Intel Middleware Products Division
>>>>>>>>
>>>>>>>>
>>>
>>
> 
> 
> --
> Thanks,
> Stepan Mishura
> Intel Middleware Products Division
> 

-- 

Tim Ellison (t.p.ellison@gmail.com)
IBM Java technology centre, UK.

Mime
View raw message