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]> 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