harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geir Magnusson Jr <g...@pobox.com>
Subject Re: problems with security2
Date Thu, 19 Jan 2006 14:38:54 GMT
Ok - I'll try this...  thanks

Stepan Mishura wrote:
> The possible fix is to change class name to be loaded, so the following
> update may be applied to the test:
> 
> ---
> modules/security2/test/common/unit/javax/security/auth/login/LoginContextTest_1.java
> (revision
> 370462)
> +++
> modules/security2/test/common/unit/javax/security/auth/login/LoginContextTest_1.java
> (working
> copy)
> @@ -843,7 +843,7 @@
>          };
>          Thread.currentThread().setContextClassLoader(testClassLoader);
>          String klassName = TestConfig
> -                .addInstalledRequired("no such class here.");
> +                .addInstalledRequired("NoSuchClassHere");
>          try {
>              LoginContext lc = new LoginContext(CONFIG_NAME);
>              lc.login();
> 
> Thanks,
> Stepan
> 
> 
> On 1/19/06, Stepan Mishura <stepan.mishura@gmail.com> wrote:
>>> Can you give me some clue about what to look for?
>>>
>> I found out that the test is implementation specific. I used BEA JRockit
>> 1.4.2_04 to run tests and after I switched to Sun's JDK 1.4.2_04 the test
>> failed.
>>
>> The test verifies that implementation of LoginContext class uses a
>> thread's context class loader to load a LoginModule class. To check that the
>> test sets a custom class loader as a context class loader for the current
>> thread, creates LoginContext object and invokes its login() method. The
>> custom class loader has overridden loadClass() method that stores all class
>> names to be loaded.
>>
>> So the difference is BEA JRockit invokes loadClass() method and Sun's JDK
>> doesn't.
>> I've minimized test case to demonstrate the difference:
>>
>>     public void testThreadContextClassLoader(){
>>
>>         // custom class loader
>>         ClassLoader testClassLoader = new ClassLoader() {
>>             protected synchronized Class loadClass(String klassName,
>>                     boolean resolve) throws ClassNotFoundException {
>>
>>                 System.out.println("ClassLoader.loadClass: " + klassName);
>>
>>                 return super.loadClass(klassName, resolve);
>>             }
>>         };
>>
>>         ClassLoader saveCCL = Thread.currentThread
>> ().getContextClassLoader();
>>
>>         Thread.currentThread().setContextClassLoader(testClassLoader);
>>
>>         try {
>>             Class.forName("no such class here.", false, testClassLoader);
>>             fail("No expected ClassNotFoundException");
>>         } catch (ClassNotFoundException ex){
>>         } finally {
>>             Thread.currentThread().setContextClassLoader(saveCCL);
>>         }
>>     }
>>
>>
>> Thanks,
>> Stepan
>>
>>
>> On 1/18/06, Geir Magnusson Jr <geir@pobox.com> wrote:
>>> Can you give me some clue about what to look for?
>>>
>>> geir
>>>
>>> Stepan Mishura wrote:
>>>>> 5) Now I run the tests
>>>>>
>>>>>    ant tests.run
>>>>>
>>>>> and get after a while...
>>>>>
>>>>>      ....
>>>>>      ....
>>>>>     [junit] Running javax.security.auth.login.LoginContextTest_1
>>>>>     [junit] Tests run: 6, Failures: 1, Errors: 0, Time elapsed: 0.016sec
>>>>>
>>>> I can not reproduce this failure. (I just did sync. with repository to
>>>> verify that nothing has change since my last checkout)
>>>>
>>>> Thanks,
>>>> Stepan
>>>>
>>>>
>>>> On 1/18/06, Geir Magnusson Jr <geir@pobox.com> wrote:
>>>>>
>>>>> Mikhail Loenko wrote:
>>>>>> I've just updated from SVN, all unit tests from security2 passed
>>>>>> (including serialization ones).
>>>>> I don't see how.
>>>>>
>>>>>> Could you please provide more details?
>>>>> Sure!
>>>>>
>>>>> 1) I did a fresh checkout :
>>>>>
>>>>>    svn co https://svn.apache.org/repos/asf/incubator/
>>>>>          harmony/enhanced/classlib/trunk/modules/security2
>>>>>
>>>>> 2) cd security2/make
>>>>>
>>>>> 3) ant
>>>>>
>>>>>   (all built fine)
>>>>>
>>>>> 4) Now, I keep a mostly empty classpath because I fear and loathe
>>>>> anything that depends on local developer classpath (I did fix this
>>> for
>>>>> security2 but backed it out because I wanted to ensure that the tests
>>>>> ran in "stock" form)  So adding to the classpath
>>>>>
>>>>> C:\Documents and Settings\gmagnuss>echo %CLASSPATH%
>>>>> C:\Program Files\Java\j2re1.4.2_10\lib\ext\QTJava.zip
>>>>>
>>>>> C:\Documents and Settings\gmagnuss>set
>>>>> CLASSPATH=%CLASSPATH%;c:\junit.jar;c:\bcprov-jdk14-131.jar
>>>>>
>>>>> C:\Documents and Settings\gmagnuss>echo %CLASSPATH%
>>>>> C:\Program
>>>>> Files\Java\j2re1.4.2_10\lib\ext\QTJava.zip;c:\junit.jar;c:\bcprov-
>>>>> jdk14-131.jar
>>>>>
>>>>> 5) Now I run the tests
>>>>>
>>>>>    ant tests.run
>>>>>
>>>>> and get after a while...
>>>>>
>>>>>      ....
>>>>>      ....
>>>>>     [junit] Running javax.security.auth.login.LoginContextTest_1
>>>>>     [junit] Tests run: 6, Failures: 1, Errors: 0, Time elapsed: 0.016sec
>>>>>
>>>>> BUILD FAILED
>>>>> C:\TEMP\geir\security2\make\build.xml:393: Test
>>>>> javax.security.auth.login.LoginContextTest_1 failed
>>>>>
>>>>> Total time: 4 minutes 22 seconds
>>>>> C:\TEMP\geir\security2\make>
>>>>>
>>>>> and find in the test report :
>>>>>
>>>>> Testsuite: javax.security.auth.login.LoginContextTest_1
>>>>> Tests run: 6, Failures: 1, Errors: 0, Time elapsed: 0.016 sec
>>>>>
>>>>> Testcase: testLoginContextString took 0 sec
>>>>> Testcase: testLoginContextStringCallbackHandler took 0.016 sec
>>>>> Testcase: testLoginContextStringSubject took 0 sec
>>>>> Testcase: testLoginContextStringSubjectCallbackHandler took 0 sec
>>>>> Testcase: testLoginContextStringSubjectCallbackHandlerConfiguration
>>> took
>>>>> 0 sec
>>>>> Testcase: testLogin_minus1 took 0 sec
>>>>>        FAILED
>>>>> null
>>>>> junit.framework.AssertionFailedError
>>>>>        at
>>>>> javax.security.auth.login.LoginContextTest_1.testLogin_minus1
>>>>> (LoginContextTest_1.java:858)
>>>>>        at
>>>>> com.openintel.drl.security.test.PerformanceTest.runBare (
>>>>> PerformanceTest.java:157)
>>>>>
>>>>>
>>>>>
>>>>> (aside - can we adopt the convention that all tests end in "Test" and
>>>>> not anything after?  That way we can by pattern have "Data", "Config"
>>>>> etc - any stuff that tests might need...)
>>>>>
>>>>>
>>>>> Anyway, that's from a fresh checkout, using :
>>>>>
>>>>> - WinXP SP2
>>>>> - Sun's JDK 1.4.2_10
>>>>> - JUnit 3.8.1
>>>>> - bcprov  for JDK14 v1.3.1
>>>>>
>>>>>
>>>>>> Thanks,
>>>>>> Mikhail
>>>>>>
>>>>>>
>>>>>> On 1/18/06, Geir Magnusson Jr < geir@pobox.com> wrote:
>>>>>>> I am haplessly plodding along.  I found one problem (mine) which
>>> fixed
>>>>> a
>>>>>>> test, and now I seem to have a more interesting problem with
the
>>>>>>> serialization tests...
>>>>>>>
>>>>>>> Are the serialization tests "golden data" files somehow
>>> dependent  the
>>>>>>> com.openintel package structure and would be allergic to a
>>>>>>> org.apache.harmony package structure?
>>>>>>>
>>>>>>> geir
>>>>>>>
>>>>>>>
>>>>>>> Geir Magnusson Jr wrote:
>>>>>>>> I've been trying to refactor security2 into the org.apachepacakage
>>>>> space.
>>>>>>>> I'm now having test failures.
>>>>>>>>
>>>>>>>> Can someone else do a co of security2 and verify?  I've backed
out
>>> the
>>>>>>>> change so that you need junit and bcprov on your classpath
(argh!)
>>> and
>>>>>>>> turned on haltonfailure so that the tests will stop once
something
>>>>> goes
>>>>>>>> wrong.
>>>>>>>>
>>>>>>>> I thought I was being careful - while it's clear that I have
no
>>> idea
>>>>>>>> what I'm doing, there's clearly something a little more subtle
>>> going
>>>>> on
>>>>>>>> here because I wouldn't think that just moving package names
would
>>> be
>>>>> a
>>>>>>>> problem.  I assume that there's some provider or other
>>>>> configuration-ish
>>>>>>>> issue.
>>>>>>>>
>>>>>>>> This would be a good learning experience for all of us how
this
>>> works.
>>>>> I
>>>>>>>> need to run out for about 20 min... bbiab.
>>>>>>>>
>>>>>>>> geir
>>>>>>>>
>>>>>>>>
>>>>> [
>>>>>
>>
> 

Mime
View raw message