Thanks Ralf for the clarification. On 7/13/07, Ralf Joachim <[EMAIL PROTECTED]> wrote:
Hi Sachith, as I told you in an earlier mail. If you like to you can initially start from a schema and generate source code for test classes with the JAXB2 reference implementation from that schema. But this step should not be included in tests of your tool to generate schemas. Instead the source code and the expected schema should be part of the test case only. From my point of view the test need to: - compile source of test classes - feed the test classes into your schema generator (this gives you a tree of schema objects) - serialize scheam objects into xsd - compare generated and expected xsd an alternative would be to: - compile source of test classes - feed the test classes into your schema generator (this gives you a tree of schema objects) - load expected xsd into a tree of scheam objects - compare the 2 scheam object trees If you choose the first alternative for your test framework you first have to take a look at our test framework for xml binding. This does't use any foreign library to compare 2 xml documents, instead it uses org.castor.xmlctf.xmldiff.XMLDiff to compare them (at least as far as I recall). I'd prefer the second approach even if that will require you to implement equals or compare methods to schema objects. I expect that comparing the 2 schema object trees will enable you to output very detailed error messages if something fails and that will definitly easy your job. You should also be aware that your job at GSoC project isn't about selecting a bunch of libraries that implement one or the other required function. We could have done that in a few days ourself. It is about implementing a schema generator at Castor yourself including everything that is required to test and execute that generator. Well, that will take quite some time, but beside aquiring developers for open source projects GSoC is about earning money. Apart of the problem with license we are, or should I better say I am, quite restrictive to keep the dependecies on foreign libraries as small as possible, as you need to download and maintain that dependecies with every new release of a library. So if you suggest to add a new dependency be prepared to argue about pros and cons. To get an idea of what we expect as a result of a GSoC project you should take a look at ddlgen modul which has been implemented by one student at last year GSoC. Having said that about 2/3 of that project had been finished at mid term evaluation and the main work in the second half of this project had been refactorings. Regards Ralf Sachith Dhanushka schrieb: > Hi, > > I appreciate if some one can help me to clarify the question on my > earlier email. > > Also I was asked > by Werner, my mentor, not to use JAXB-RI classes at least for testing purposes. So what should be my approach to testing? I can not start with a schema as I need JAXB2-RI to convert that to set of java classes. I also do not feel like having generated classes within my test hierarchy. If I am testing against 20 schemas, then I will have at least about 60 generated classes, in vain. > > > Can some one please advice me a way to do testing. I can not move > forward without proper testing for the code I've written so far. The > thing is when I am fixing new bugs I do not want to break things that > were working. So I am reluctant to implement anything new until I get a > testing framework. Please help. > > Thanks, > SD > > > On 7/10/07, *Sachith Dhanushka* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > Hi, > > I just completed the test framework for my project. As I suggested > earlier also, this is how it works. > > I start with a schema file. Generate JAXB2 classes from it and > compile it. Then use the code I wrote to generate the schema out of > it. After that I use the same generated code to generate the schema > using JAXB2 schema gen tool. Finally I compare the schema coming out > of my tool against the schema that I get from schema gen tool using > XMLUnit. All the JAXB2 related code are written using the ant taks that are provided. > > > I am doing the same processfor ALL the schema files within > test-resources folder. > > One observations was that I can not test the schema that I generate > with the original schema. Reason is that JAXB2 loses some > information during the code generation process. For example, choices > will disappear. My task is to generate the same schema that JAXB2 > schema generates so comparing it with it. > > I have bit of trouble using XMLUnit to compare two schemas. Some > times it gives me an error eventhough two schemas are equal. The > reason is that it is expecting same element order in both the files, > it seems. This might not happen as the tools generate schema > elements in the order they encounter java files. So can anyone of > you suggest me a better way to compare two schemas or at least two > xml files? > Ralf once suggested to use Castor schema model to compare two > schemas. But I couldn't find a way within the Schema class, like an > overriden equals method or compare method. So if some one can give > me a pointer it would be great. > > Thanks, > SD > > --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email