harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stepan Mishura" <stepan.mish...@gmail.com>
Subject Re: [classlib][support] Using new framework for testing serialization (was: Re: [jira] Updated: (HARMONY-1098) [classlib][instrument]Add tests for UnmodifiableClassException and IllegalClassFormatException)
Date Thu, 10 Aug 2006 07:51:07 GMT
On 8/10/06, Jimmy, Jing Lv wrote:
>
> Stepan Mishura wrote:
> > On 8/10/06, Jimmy, Jing Lv wrote:
> >>
> >> Stepan Mishura wrote:
> >> > Hi Jimmy,
> >> >
> >> > I looked into SerializationTester - it creates golden file if it
> failed
> >> to
> >> > find required file. But IMO generating ser-files should be done
> >> explicitly.
> >> > And I like unambiguity in behaviour. So if there is no ser-file a
> test
> >> > should just fail reporting that there is no required file.
> >> >
> >> > So I'm going just add utility method: createGoldenFile -  you should
> >> invoke
> >> > it from your test, for example,
> >>
> >> Hi Stepan,
> >>
> >>     Yes, I agree, it'll be great if there's one such method.
> >>
> >> > public void testSerializationCompatibility() {
> >> >
> >> > SerializationTest.createGoldenFile
> >> ("<module_nio>/src/test/resources/serialization",
> >> >
> >> > this, new BufferOverflowException());
> >> > }
> >> >
> >>
> >> I remember pass "this" as a parameter can parse the name of the
> >> directory, so I suggest it can just be:
> >>
> >> SerializationTest.createGoldenFile(this, new
> BufferOverflowException());
> >
> >
> > But then you have to move generated file to the appropriate place by
> hands.
> > Is this convenient?
> >
>
> Hi Stepan,
>
>     IMO, most ser file should be put into a certain directory, so the
> the appropriate directory is always there.
>
>     I'd like to add a new method to the framework as:
>
> public static void createGoldenFile(TestCase test,Object object)
> throws  IOException {
>     createGoldenFile("src/test/resources/serialization",test,object);
> }


But if 'root' param is relative path them the generated file is placed in
'bin' (i.e. <module_root>/bin/test).  folder. Am I right? So you have to
move it by hands anyway to <module_root>/src/test/resources/serialization
folder.

Thanks,
Stepan.

    I have tried the new method, and it works well :)
>     Can I or would you please make a patch for it? Thanks! :)
>
> >> And after running a test on RI replace with
> >> SerializationTest.verifyGolden
> >> > ();
> >> >
> >> > If there will be better idea how to generate golden files (or you'll
> >> > convince me that SerializationTester  does the right thing) I with
> >> pleasure
> >> > commit a patch or implement it by myself.
> >> >
> >>
> >> I've tried the new framework again and it works for me now :)
> >>
> >> However I have a little question here, as it parse "this" for the path
> >> of the ser file, and because of the our test naming convention, the
> path
> >> name is very long here.Is that possible to cut it shorter?
> >> in old framework,it is:
> >> (src/test/resource/)serialization.java.lang.instrument
> >> in new framework,it changes to:
> >>
> >>
> (src/test/resource/)serialization.org.apache.harmony.tests.java.lang.instrument
> >>
> >
> >
> > Well, it is possible to update framework to shrink the path in that way.
> > But
> > is this really necessary? I guess that after generating ser-files we put
> > them to SVN and won't look at them any more. It is not expected to
> update
> > them often.
> >
>
> OK, let it be :)
>
> > Thanks,
> > Stepan.
> >
> > This is a little problem though. I'm OK if it does not changes.
> >>
> >> > Thanks,
> >> > Stepan.
> >> >
> >> >
> >> > On 8/9/06, Stepan Mishura wrote:
> >> >>
> >> >>  On 8/8/06, Jimmy, Jing Lv wrote:
> >> >> >
> >> >> > Stepan Mishura wrote:
> >> >> > > Hi Jimmy,
> >> >> > >
> >> >> > > I expect that we agreed to use new serialization framework
for
> new
> >> >> > tests.
> >> >> > > But I see that people continue develop tests for serialization
> >> using
> >> >> > the
> >> >> > > old
> >> >> > > framework (i.e. SerializationTester).
> >> >> > >
> >> >> > > Could you tell me why you prefer the old framework? Is the
new
> >> >> > framework
> >> >> > > for
> >> >> > > testing serialization complex, hard-to-use, bad documented
or
> >> >> > something
> >> >> > > else?
> >> >> > >
> >> >> > > Thank you in advance for your feedback,
> >> >> > > Stepan.
> >> >> > >
> >> >> >
> >> >> > Hi Stepan,
> >> >> >
> >> >> >    Perhaps people are all lazy... (just kidding :P)
> >> >> >    In fact, I've try the new framework already some days ago,
I
> find
> >> >> > two problems:
> >> >> >    1. I find no method to make the ser file, as you know, in old
> >> >> > framework, if no such file was found, it will create one at once,
> >> that
> >> >> > was easy for us to put the file to the proper directory and run
> >> again,
> >> >> > this time the test passes successfully. To me, write test once,
> run
> >> >> > twice, only in two minutes I finish the testing, that was nice
:)
> >> >>
> >> >>
> >> >>  OK, I see. I'll think how to add this to the new framework. I'll
> let
> >> you
> >> >> know when I add this to the framework.
> >> >>
> >> >>    2. Perhaps this is my mistake, I write a test[1], though I put
> ser
> >> >> > file to the directory (e.g,
> >> >> >
> >> >>
> >>
> src/tset/resource/serialization/org/apache/harmony/tests/java/lang/instrument),
> >>
> >> >>
> >> >> >
> >> >> > the new framework fails to load the file. I've debug into the
> code,
> >> >> find
> >> >> > the path name correct, but the classloader load null(on eclipse
> 3.2,
> >> >> > winxp). After that I thought the framework may be still on
> progress
> >> and
> >> >> > not ready yet, so I give up and go on with the old one.
> >> >>
> >> >>
> >> >>  I think that you should check your classpath - src/test/resource
> >> folder
> >> >> should be included or ser files from this folder should be copied to
> >> the
> >> >> classpath by the build.
> >> >>
> >> >> Thanks,
> >> >>  Stepan.
> >> >>
> >> >>    Please correct me if I misuse the new framework.
> >> >> >
> >> >> >    However I shall agree to use the new framework if no more
> problem
> >> >> > exists. Indeed the new framework looks good to me :) And the
> effort
> >> to
> >> >> > change test code is not heavy then.
> >> >> >
> >> >> > [1]
> >> >> > public void test_compatibilitySerialization() throws Exception
{
> >> >> >         SerializationTest.verifyGolden (this, new
> >> >> >
> >> llegalClassFormatException());
> >> >> >     }
> >> >> >
> >> >> > >
> >> >> > > On 8/8/06, Jimmy, Jing Lv (JIRA) <jira@apache.org>
wrote:
> >> >> > >>
> >> >> > >>     [
> >> http://issues.apache.org/jira/browse/HARMONY-1098?page=all ]
> >> >> > >>
> >> >> > >> Jimmy, Jing Lv updated HARMONY-1098:
> >> >> > >> ------------------------------------
> >> >> > >>
> >> >> > >>    Attachment: instrument_patch.zip
> >> >> > >>
> >> >> > >> Hi,
> >> >> > >>
> >> >> > >>    Would you please try my patch?
> >> >> > >>    Please decompress to module\instrument, and run
> >> >> > >> module\instrument\instrument_patch\filecp.sh
> >> >> > >>
> >> >> > >> Thanks!
> >> >> > >>
> >> >> > >> Best regards,
> >> >> > >> Jimmy
> >> >> > >>
> >> >> > >> > [classlib][instrument]Add tests for
> UnmodifiableClassException
> >> and
> >> >> > >> IllegalClassFormatException
> >> >> > >> >
> >> >> > >>
> >> >> >
> >> >>
> >>
> ----------------------------------------------------------------------------------------------
> >>
> >> >>
> >> >> > >>
> >> >> > >> >
> >> >> > >> >                 Key: HARMONY-1098
> >> >> > >> >                 URL:
> >> >> > http://issues.apache.org/jira/browse/HARMONY-1098
> >> >> > >> >             Project: Harmony
> >> >> > >> >          Issue Type: Improvement
> >> >> > >> >          Components: Classlib
> >> >> > >> >            Reporter: Jimmy, Jing Lv
> >> >> > >> >         Attachments: instrument_patch.zip
> >> >> > >> >
> >> >> > >> >
> >> >> > >> > Add serialization tests for UnmodifiableClassException
and
> >> >> > >> IllegalClassFormatException.
> >> >> > >>
> >> >> > >> --
> >> >> > >> This message is automatically generated by JIRA.
> >> >> > >> -
> >> >> > >> If you think it was sent incorrectly contact one of the
> >> >> > administrators:
> >> >> > >> http://issues.apache.org/jira/secure/Administrators.jspa
> >> >> > >> -
> >> >> > >> For more information on JIRA, see:
> >> >> > http://www.atlassian.com/software/jira
>
> --
Thanks,
Stepan Mishura
Intel Middleware Products Division

------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message