// Add the test case as an @ManagedBean
{
final EjbJar ejbJar = new EjbJar();
final OpenejbJar openejbJar = new OpenejbJar();
final ManagedBean bean = ejbJar.addEnterpriseBean(new ManagedBean(javaClass.getSimpleName(), javaClass.getName(), true));
bean.setTransactionType(TransactionType.BEAN);
final EjbDeployment ejbDeployment = openejbJar.addEjbDeployment(bean);
ejbDeployment.setDeploymentId(javaClass.getName());
appModule.getEjbModules().add(new EjbModule(ejbJar, openejbJar));
}
Application application = null;
// Invoke the @Module producer methods to build out the AppModule
for (FrameworkMethod method : testClass.getAnnotatedMethods(Module.class)) {
final Object obj = method.invokeExplosively(testInstance);
if (obj instanceof WebModule) {
appModule.getWebModules().add((WebModule) obj);
} else if (obj instanceof EjbModule) {
appModule.getEjbModules().add((EjbModule) obj);
} else if (obj instanceof EjbJar) {
final EjbJar ejbJar = (EjbJar) obj;
setId(ejbJar, method);
appModule.getEjbModules().add(new EjbModule(ejbJar));
} else if (obj instanceof EnterpriseBean) {
final EnterpriseBean bean = (EnterpriseBean) obj;
final EjbJar ejbJar = new EjbJar(method.getName());
ejbJar.addEnterpriseBean(bean);
EjbModule ejbModule = new EjbModule(ejbJar);
Class<?> clazz = Thread.currentThread().getContextClassLoader().loadClass(bean.getEjbClass());
ejbModule.setFinder(new AnnotationFinder(new ClassesArchive(clazz)).link());
appModule.getEjbModules().add(ejbModule);
} else if (obj instanceof Application) {