Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note that there does not have to be an equivalent non-prefixed version of the file. In the example above, only a "test.env-entry.properties" file exists and there is no equivalent plain "env-entry.properties" file. This prefixing works for any deployment descriptor in the META-INF/ directory or WEB-INF/ directory. The prefix does not have to be "test" and could be anything you choose. You can also have as many prefixed files as you need and could even go as far as to have one prefix per individual test.

More than one prefix

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:

Code Block

 //...
 properties.setProperty("openejb.altdd.prefix", "footest, test");

 InitialContext initialContext = new InitialContext(properties);

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:

Code Block

 //...
 properties.setProperty("openejb.altdd.prefix", "footest, test");

 InitialContext initialContext = new InitialContext(properties);

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.

Note that there is a "test.ejb-jar.xml" file that is present, however in both cases it is not used as the order of preference in the list is "left to right" meaning most preferred first.