[rfc][icedtea-web] Fix for JavaConsoleTest

Jiri Vanek jvanek at redhat.com
Tue Nov 25 15:37:09 UTC 2014


Well, this is cosmetic, but why
- s2...
+ s2..
+ s3
+ s4..

It making one feels like s2 wa chnaged (and not just renamed)
sorry for nitpicking, but may you adapt it to

   s2...
+ s3..
+ s4


?

Ok to push afterwards,

J.

On 11/25/2014 04:34 PM, Jie Kang wrote:
>
>
> ----- Original Message -----
>> On 11/25/2014 04:09 PM, Jie Kang wrote:
>>>
>>>
>>> ----- Original Message -----
>>>> On 11/25/2014 03:55 PM, Jie Kang wrote:
>>>>>
>>>>>
>>>>> ----- Original Message -----
>>>>>> On 11/25/2014 03:41 PM, Jie Kang wrote:
>>>>>>> Hello,
>>>>>>>
>>>>>>>
>>>>>>> This patch fixes a newly failing unit test in JavaConsoleTest related
>>>>>>> to
>>>>>>> PR2063 [1].
>>>>>>>
>>>>>>> The test 'CreatePluginHeaderTestNotOK' fails due to the changes to
>>>>>>> PluginMessage, PluginHeader and Header. The test has been fixed in
>>>>>>> accordance with the changes and now passes.
>>>>>>>
>>>>>>> How does it look?
>>>>>>>
>>>>>>>
>>>>>>> [1]http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=2063
>>>>>>>
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> -- Jie Kang
>>>>>>>
>>>>>>>
>>>>>>> itw-java-console-test.patch
>>>>>>>
>>>>>>>
>>>>>>> diff --git
>>>>>>> a/tests/netx/unit/net/sourceforge/jnlp/util/logging/JavaConsoleTest.java
>>>>>>> b/tests/netx/unit/net/sourceforge/jnlp/util/logging/JavaConsoleTest.java
>>>>>>> ---
>>>>>>> a/tests/netx/unit/net/sourceforge/jnlp/util/logging/JavaConsoleTest.java
>>>>>>> +++
>>>>>>> b/tests/netx/unit/net/sourceforge/jnlp/util/logging/JavaConsoleTest.java
>>>>>>> @@ -15,7 +15,7 @@
>>>>>>>
>>>>>>>
>>>>>>>           String s1 = "plugindebug 1384850630162925
>>>>>>>           [jvanek][ITW-C-PLUGIN][MESSAGE_DEBUG][Tue Nov 19 09:43:50 CET
>>>>>>>           2013][/home/jvanek/Desktop/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.cc:1204]
>>>>>>>           ITNPP Thread# 140513434003264, gthread 0x7fcbd531f8c0:   PIPE:
>>>>>>>           plugin read: plugin PluginProxyInfo reference
>>>>>>>           1http://www.walter-fendt.de:80";
>>>>>>> -     String s2 = "plugindebugX 1384850630162954
>>>>>>> [jvanek][ITW-Cplugindebug
>>>>>>> 1384850630163008 [jvanek][ITW-C-PLUGIN][MESSAGE_DEBUG][Tue Nov 19
>>>>>>> 09:43:50
>>>>>>> CET
>>>>>>> 2013][/home/jvanek/Desktop/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.cc:1124]
>>>>>>> ITNPP Thread# 140513434003264, gthread 0x7fcbd531f8c0: parts[0]=plugin,
>>>>>>> parts[1]=PluginProxyInfo, reference, parts[3]=1,
>>>>>>> parts[4]=http://www.walter-fendt.de:80  --
>>>>>>> decoded_url=http://www.walter-fendt.de:80";
>>>>>>> +     String s2 = "plugindebugX blob [jvanek][ITW-Cplugindebug
>>>>>>> 1384850630163008 [jvanek][ITW-C-PLUGIN][MESSAGE_DEBUG][Tue Nov 19
>>>>>>> 09:43:50
>>>>>>> CET
>>>>>>> 2013][/home/jvanek/Desktop/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.cc:1124]
>>>>>>> ITNPP Thread# 140513434003264, gthread 0x7fcbd531f8c0: parts[0]=plugin,
>>>>>>> parts[1]=PluginProxyInfo, reference, parts[3]=1,
>>>>>>> parts[4]=http://www.walter-fendt.de:80  --
>>>>>>> decoded_url=http://www.walter-fendt.de:80";
>>>>>>>           String s3 = "preinit_pluginerror 1384850630163298
>>>>>>>           [jvanek][ITW-C-PLUGIN][MESSAGE_DEBUG][Tue Nov 19 09:43:50 CET
>>>>>>>           2013][/home/jvanek/Desktop/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.cc:1134]
>>>>>>>           ITNPP Thread# 140513434003264, gthread 0x7fcbd531f8c0: Proxy
>>>>>>>           info:
>>>>>>>           plugin PluginProxyInfo reference 1 DIRECT";
>>>>>>>
>>>>>>>          @Test
>>>>>>> @@ -47,12 +47,9 @@
>>>>>>>              PluginMessage p2 = new PluginMessage(s2);
>>>>>>>              Assert.assertTrue(p2.wasError);
>>>>>>>              Assert.assertTrue(p2.header.isC);
>>>>>>> -
>>>>>>> Assert.assertEquals(OutputController.Level.WARNING_ALL,p2.header.level);
>>>>>>> -        Assert.assertTrue(p2.header.date.toString().contains(new
>>>>>>> Date().toString().substring(0,16))); //means no Tue Nov 19 09:43:50 :)
>>>>>>> -        Assert.assertTrue(p2.header.user.equals("jvanek"));
>>>>>>> +        Assert.assertEquals(OutputController.Level.WARNING_ALL,
>>>>>>> p2.header.level);
>>>>>>> +        Assert.assertTrue(p2.header.date.toString().contains(new
>>>>>>> Date().toString().substring(0, 16))); //means no Tue Nov 19 09:43:50 :)
>>>>>>>              Assert.assertTrue(p2.header.thread1.equals("unknown"));
>>>>>>>              Assert.assertTrue(p2.header.thread2.equals("unknown"));
>>>>>>> -
>>>>>>> -
>>>>>>>          }
>>>>>>>      }
>>>>>>>
>>>>>>
>>>>>>
>>>>>> This is ok. What else to do?
>>>>>>
>>>>>> Just one nit - may you please add separate test for original String s2?
>>>>>
>>>>> Hello,
>>>>>
>>>>>
>>>>> The issue I found causing the old test to fail was that the PluginMessage
>>>>> for s2 had new behaviour:
>>>>>
>>>>>         String s2 = "plugindebugX 1384850630162954
>>>>>         [jvanek][ITW-Cplugindebug
>>>>>         1384850630163008 [jvanek][ITW-C-PLUGIN][MESSAGE_DEBUG][Tue Nov 19
>>>>>         09:43:50 CET
>>>>>         2013][/home/jvanek/Desktop/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.cc:1124]
>>>>>         ITNPP Thread# 140513434003264, gthread 0x7fcbd531f8c0:
>>>>>         parts[0]=plugin, parts[1]=PluginProxyInfo, reference, parts[3]=1,
>>>>>         parts[4]=http://www.walter-fendt.de:80 --
>>>>>         decoded_url=http://www.walter-fendt.de:80";
>>>>>
>>>>>
>>>>> Before:
>>>>>
>>>>>     message.header.date = 'ITW-C-PLUGIN' : this causes an exception to
>>>>>     occur
>>>>>     when we attempt to convert this to 'java.util.Date'
>>>>>
>>>>> After:
>>>>>
>>>>>     message.header.date is now a String : there is no exception occurring
>>>>>     and
>>>>>     'ITW-C-PLUGIN' is accepted.
>>>>>
>>>>> This means that PluginMessage for s2 has 'wasError == false', since no
>>>>> exception occurs when parsing.
>>>>>
>>>>> I feel like a test for this string is not very helpful anymore.
>>>>>
>>>> Oposite here. It is testing some beaviour.
>>>>
>>>> So it deserves specvial test.
>>>>     assert waserror==true and some other fields for it ...
>>>
>>>     For s2: wasError == false
>>>
>>>     So assertTrue(wasError) will fail :\
>>>
>>>     Suggestions?;;
>>>
>>
>> O lot of....
>>
>> I think orrigianal s2 now belongs to
>> CreatePluginHeaderTestOK
>>
>> ?
>
>
> Okay then. It just feels weird to me to put it there.
>
>
> Patch attached.
>
>
> Thanks!
>>
>>
>



More information about the distro-pkg-dev mailing list