Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 55505 invoked from network); 13 Mar 2006 14:04:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 13 Mar 2006 14:04:52 -0000 Received: (qmail 2950 invoked by uid 500); 13 Mar 2006 14:04:37 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 2899 invoked by uid 500); 13 Mar 2006 14:04:37 -0000 Mailing-List: contact harmony-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-dev@incubator.apache.org Received: (qmail 2888 invoked by uid 99); 13 Mar 2006 14:04:37 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Mar 2006 06:04:37 -0800 X-ASF-Spam-Status: No, hits=1.4 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: 202.81.18.152 is neither permitted nor denied by domain of richard.liangyx@gmail.com) Received: from [202.81.18.152] (HELO ausmtp04.au.ibm.com) (202.81.18.152) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Mar 2006 06:04:33 -0800 Received: from sd0208e0.au.ibm.com (d23rh904.au.ibm.com [202.81.18.202]) by ausmtp04.au.ibm.com (8.12.10/8.13.5) with ESMTP id k2DEBrQt279162 for ; Tue, 14 Mar 2006 01:11:55 +1100 Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.250.243]) by sd0208e0.au.ibm.com (8.12.10/NCO/VER6.8) with ESMTP id k2DE7Hix244416 for ; Tue, 14 Mar 2006 01:07:24 +1100 Received: from d23av02.au.ibm.com (loopback [127.0.0.1]) by d23av02.au.ibm.com (8.12.11/8.13.3) with ESMTP id k2DE3rRG016370 for ; Tue, 14 Mar 2006 01:03:53 +1100 Received: from d23m0011.cn.ibm.com (d23m0011.cn.ibm.com [9.181.32.74]) by d23av02.au.ibm.com (8.12.11/8.12.11) with ESMTP id k2DE3qSY016340 for ; Tue, 14 Mar 2006 01:03:53 +1100 Received: from [127.0.0.1] ([9.65.84.42]) by d23m0011.cn.ibm.com (Lotus Domino Release 6.53HF294) with ESMTP id 2006031322034565-4960 ; Mon, 13 Mar 2006 22:03:45 +0800 Message-ID: <44157B80.60204@gmail.com> Date: Mon, 13 Mar 2006 22:02:40 +0800 From: Richard Liang Organization: IBM China Software Development Lab User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: harmony-dev@incubator.apache.org Subject: Re: Location of test data files References: <176117377.1141718258821.JavaMail.jira@ajax> <440D3FD9.3060000@gmail.com> <440D6A11.20106@googlemail.com> <906dd82e0603070337r45239913h@mail.gmail.com> <440D743B.6010306@googlemail.com> <906dd82e0603070426i5c23890di@mail.gmail.com> <440D8CF2.4030304@pobox.com> <906dd82e0603070628n7578952dh@mail.gmail.com> <440E91F5.6020406@gmail.com> <44106708.2000406@googlemail.com> <906dd82e0603100109r4f50bae0l@mail.gmail.com> <4411B8E2.1060206@googlemail.com> <4411D168.3060607@googlemail.com> <44126B5C.1020104@gmail.com> <44156FF6.5020109@googlemail.com> In-Reply-To: <44156FF6.5020109@googlemail.com> X-MIMETrack: Itemize by SMTP Server on D23M0011/23/M/IBM(Release 6.53HF294 | January 28, 2005) at 13/03/2006 22:03:49, Serialize by Router on D23M0011/23/M/IBM(Release 6.53HF294 | January 28, 2005) at 13/03/2006 22:03:52, Serialize complete at 13/03/2006 22:03:52 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1; format=flowed X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N George Harley wrote: > Richard Liang wrote: >> George Harley wrote: >>> Hi Mikhail (again), >>> >>> Just a couple of brief observations about the SerializationTest.java >>> code as it stands in SVN today : >>> >>> 1) The reference/golden .dat files for Serializable classes in a >>> given module could be added under the module's src/test/resources >>> directory (in sub-folders corresponding to their package names). In >>> an Ant build these would be copied under the test bin using a >>> tweaked version of the "copy-test-resources" target (see the >>> proposed changes to make/build-java.xml contained in the >>> HARMONY-57). At runtime this would make the .dat files available >>> from the classpath. >>> >> Hello George, >> >> It's good to put all test data files for one module into one folder, >> such as "src/test/resources". However, there may be other options, >> personally I'd like to put the test data file into the same directory >> of the test case which uses the data file. This may make the >> maintenance work easy. :-) >> Anyway, I think we shall follow the same style. > > Hi Richard, > > Just to avoid any ambiguity here, what I proposed was to place the > reference serialization files *under* a given module's > src/test/resources folder in sub-folders that matched the package name > of the test class - and not just have them all in one folder. > Yes, George. That's make sense :-) > For instance, the LUNI module could have a SimpleTimeZoneTest.dat file > located in the folder > /src/test/resources/serialization/tests/api/java/util > > Another alternative would be to use a tree structure that mirrored the > package name of the Serializable type under test. > e.g. > /src/test/resources/serialization/java/util/SimpleTimeZoneTest.dat > > > > I think that separating out all test artefacts from actual source code > is cleaner and IMHO makes the maintenance easier :-) > I think there is no big difference. But anyway we shall agree with one of the three options. 1) Put test data files into a separated folder, and use the package name of test case as its namespace. e.g., /src/test/resources/serialization/tests/api/java/util 2) Put test data files into a separated folder, and use the package name of the class under test as its namespace. e.g. /src/test/resources/serialization/java/util/SimpleTimeZoneTest.dat 3. Put test data files into the same location as the test case. Shall we vote? :-) > Using either Ant or it is pretty straightforward to > get these resources placed on the classpath when the tests are run. > Yes. I think we all agree with this. > > Best regards, > George > >> >>> 2) The need for the "TEST_SRC_DIR" system property goes away if >>> method getDataFile() were updated to use java.net.URI. >>> e.g, >>> >>> protected File getDataFile(int index) { >>> String name = "/" + this.getClass().getName().replace('.', '/') + >>> "." >>> + index + ".dat"; >>> return new >>> File(URI.create(this.getClass().getResource(name).toString())); >>> >>> >>> It seems to me that the src/test/resources directory would be an >>> ideal place to keep a module's reference .dat files. >>> >>> Best regards, >>> George >>> >>> >>> George Harley wrote: >>>> Mikhail Loenko wrote: >>>>> 2006/3/9, George Harley : >>>>> ... >>>>> >>>>>> Such a testing effort still sounds pretty daunting though. >>>>>> >>>>> >>>>> BTW, there is a framework for serialization testing which is >>>>> currently >>>>> in the security module: >>>>> >>>>> modules/security/test/common/unit/org/apache/harmony/security/test/SerializationTest.java >>>>> >>>>> >>>>> It serves to simplify serialization testing and has the docs >>>>> inside. Actually >>>>> almost all serializable security-related classes are tested with >>>>> this framework. >>>>> >>>>> Does it make sense to move the framework to a common place? >>>>> >>>> >>>> Hi Mikhail ! >>>> >>>> I've spent a little bit of time running this (with a couple of my own >>>> little concrete subclasses of SerializationTest) and I really like it. >>>> It was pretty straightforward to create a JUnit error for the case of >>>> java.util.TimeZone after my overridden version of getData() used >>>> TimeZone.getDefault() to generate a couple of TimeZone instances from >>>> the RI. >>>> >>>> I can definitely see a case for broadening this approach outside just >>>> the security classes. Really impressive stuff ! >>>> >>>> Best regards, >>>> George >>>> >>>>> Thanks, >>>>> Mikhail >>>>> >>>>> >>>> >>>> >>>> >>>> >>> >>> >> >> > > -- Richard Liang China Software Development Lab, IBM