Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

To use this functionality, just set the new "openejb.altdd.prefix" system property or InitialContext property to something like "test", then any descriptors in your META-INF/ directory that start with "test." will override the regular descriptor. So for example with an app like this:

  • META-INF/ejb-jar.xml
  • META-INF/test.ejb-jar.xml
  • META-INF/persistence.xml
  • META-INF/test.env-entry.properties

Just initialize your test case like so:

...

The logical result will be the prefixed file replacing the non-prefixed file as the active descriptor:

  • META-INF/ejb-jar.xml -> test.ejb-jar.xml
  • META-INF/persistence.xml
  • META-INF/env-entry.properties -> test.env-entry.properties

This will work in any environment in which OpenEJB works (embedded, standalone, tomcat, geronimo, etc.).

...

It is possible to have several prefixes, specified in order of preference, so that it is possible to avoid duplicating descriptors that are used in more than one "profile". For example, the "foo" test case uses the same "env-entries.properties" file as the "bar" test case, but both have their own ejb-jar.xml files:

  • META-INF/ejb-jar.xml
  • META-INF/test.ejb-jar.xml
  • META-INF/footest.ejb-jar.xml
  • META-INF/bartest.ejb-jar.xml
  • META-INF/persistence.xml
  • META-INF/test.env-entry.properties

The "foo" test case could set the openejb.altdd.prefix as follows:

...

Resulting the following logical view of the app:

  • META-INF/ejb-jar.xml -> footest.ejb-jar.xml
  • META-INF/persistence.xml
  • META-INF/env-entry.properties -> test.env-entry.properties

And the "bar" test case could set the openejb.altdd.prefix as follows:

...

Resulting the following logical view of the app:

  • META-INF/ejb-jar.xml -> bartest.ejb-jar.xml
  • META-INF/persistence.xml
  • META-INF/env-entry.properties -> test.env-entry.properties

In both scenarios the same env-entry.properties file (test.env-entry.properties) is shared.

...