Hi Sachith,

to 1: Stay with the org.exolab.castor.jaxb2schema package for the time being.

to 2: 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

to 3: sounds good and according to your follow up mail you already solved that.

PS: could you please attach a patch of your current progress to CASTOR-2033 every few days for us to get an idea of what you are working at at the moment. The patch do not need to always include the required libs.

Regards
Ralf


Sachith Dhanushka schrieb:
Hi,

Let me summarize all the queations that I have right now, so that Werner, Ralf or some one who has some insight can help me.

1. Where will my code fit? Which module and package? For the time being I didn't put my code anywhere, but I have a separate self contained environment for my project with an ant build. Also I used the org.exolab.castor.jaxb2schema.* as the package name.

2. How can I write the tests for the code. What I am thinking is like this. - Start with a schema and generate code for it using JAXB2 schema gen tool. - feed those generated classes in to my code, build Castor schema model.
 - Serialize the schema model and compare it with the original schema used.
One of the difficulties I encounter was that the two schemas might be semantically equal but syntactically different. For example the starting schema might contain maxOccurs=1, but the generated schema won't contain it as it is the default. So I might have problems in automating the testing.

3. How do I know which class to start with to feed in to my code? Basically what will be the external api of my code.For the time being it is public Schema buildSchema(Class clazz) throws CastorException; But this requires the user to pass the root element classname in to the code. But alternatively I was thinking to scan a folder and load the classes. But I am not sure how feasible this is.

Those are some of the questions that I have right now. Will post the rest as and when I have problems.
Thanks,
SD`2

---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to