Inspired by some user blog posts, we've added a new feature so support for altDD (alternative deployment descriptors) can be done in a test or other environment without much work.
Basically, 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:
Just initialize your test case like so:
Properties properties = new Properties(); properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory"); properties.setProperty("openejb.altdd.prefix", "test"); InitialContext initialContext = new InitialContext(properties);
The logical result will be:
This will work in any environment in which OpenEJB works (embedded, standalone, tomcat, geronimo, etc.).