The ApplicationComposer JUnit runner, allows certain types to be returned by the @Module annotated methods. EjbModule is not allowed and it would be helpful if a specific JNDI mapping needs to be defined for tests (that was our case). That way instead of
@Module
public EjbJar beans()
{
EjbJar ejbJar = new EjbJar("application");
ejbJar.addEnterpriseBean(new StatelessBean(SomeClass.class));
return ejbJar;
}
a whole module can be created in-class
@Module
public EjbModule module()
{
EjbJar ejbJar = new EjbJar("application");
ejbJar.addEnterpriseBean(new StatelessBean(SomeClass.class));
EjbModule ejbModule = new EjbModule(ejbJar, new OpenejbJar());
EjbDeployment deployment = new EjbDeployment(new StatefulBean(SomeClass.class));
deployment.getJndi().add(new Jndi("custombindings/myClass", "Local"));
ejbModule.getOpenejbJar().addEjbDeployment(deployment);
return ejbModule;
}