persistence@glassfish.java.net

Changing entity-persistence-tests to add test cases for issue #1074, #1131

From: Sanjeeb Kumar Sahoo <Sanjeeb.Sahoo_at_Sun.COM>
Date: Sat, 07 Oct 2006 00:27:26 +0530

Hi Tom,

I am working on adding test cases for issue #1074 (mapping files are not
searched in Classpath) and issue #1131 (orm.xml in referenced jar is not
processed). Instead of adding new test cases, I thought I should modify
the existing packaging plans and persistence units. Attached here with
are the changes.

Change summary:
Current test set up:
-----------------------
1. build produces *3* jar files, viz:
toplink-essentials-tests.jar,
toplink-essentials-ddl-generation-tests.jar and
toplink-essentials-validation-tests.jar.

2. In addition to containing all the Junit tests and framework classes,
toplink-essentials-tests.jar contains
all the model classes except validationfailed/** and xml/merge/inherited/**.

3. persistence.xml is packaged in toplink-essentials-tests.jar.

4. All the mapping files from config/META-INF dir are packaged in
toplink-essentials.jar.

New
------
1. build produces *6* jar files, viz:
toplink-essentials-tests.jar,
toplink-essentials-annotation-model-tests.jar,
toplink-essentials-xml-only-model-tests.jar,
toplink-essentials-xml-merge-model-tests.jar,
toplink-essentials-ddl-generation-tests.jar and
toplink-essentials-validation-tests.jar.

Contents of toplink-essentials-validation-tests.jar and
toplink-essentials-ddl-generation-tests.jar remain unchanged.

2. *toplink-essentials-tests.jar* contains *only* JUnit tests and
framework classes (i.e. classes belonging to
oracle/toplink/essentials/testing/tests and
oracle/toplink/essentials/testing/framework packages). It does not
contain any model classes or XML files.
Model classes are packaged in three different files:
*a) toplink-essentials-annotation-model-tests.jar* includes
oracle/toplink/essentials/testing/models/ classes excluding
oracle/toplink/essentials/testing/models/cmp3/xml/** and
oracle/toplink/essentials/testing/models/cmp3/validationfailed/**.

*b) toplink-essentials-xml-only-model-tests.jar* includes
oracle/toplink/essentials/testing/models/cmp3/xml/, but excludes
oracle/toplink/essentials/testing/models/cmp3/xml/merge/**

*c) toplink-essentials-xml-merge-model-tests.jar* includes
oracle/toplink/essentials/testing/models/cmp3/xml/merge/, but excludes
oracle/toplink/essentials/testing/models/cmp3/xml/merge/inherited/** as
these excluded classes are packaged in
toplink-essentials-ddl-generation-tests.jar.
                                                  
3. persistence.xml is now packaged in
toplink-essentials-annotation-model-tests.jar. So, this becomes new PU
Root. We now use <jar-file> element in persistence.xml as shown below to
reference model classes from other two jars:
        <jar-file>toplink-essentials-xml-only-model-tests.jar</jar-file>
        <jar-file>toplink-essentials-xml-merge-model-tests.jar</jar-file>

4. Out of the 10 mapping files in config/META-INF/, only orm.xml is
packaged in toplink-essentials-annotation-model-tests.jar. Other mapping
files are distributed among toplink-essentials-xml-only-model-tests.jar
and toplink-essentials-xml-merge-model-tests.jar.

5. To test issue #1131, while packaging one of the mapping files in
referenced jar file, I am renaming it to orm.xml. See build.xml for more
details.

6. I have broken config/META-INF/orm.xml into two mappings files, one
called orm.xml and another called inheritance-entity-mappings.xml. This
helps us making sure that we are able to process orm.xml from each URL
separately.

With this change, all the tests have passed. You can also build yourself
to see the new structure. Let me know your comments.

Chris,

I saw a comment made by you in persistence.xml while fixing issue #589.
Can you please review this change to make sure that regression test case
for issue #589 is not lost.

Thanks,
Sahoo