use of org.apache.openejb.config.EjbModule in project tomee by apache.
the class ValidationBase method validate.
public void validate(final AppModule appModule) {
final ClassLoader loader = Thread.currentThread().getContextClassLoader();
try {
for (final EjbModule ejbModule : appModule.getEjbModules()) {
Thread.currentThread().setContextClassLoader(ejbModule.getClassLoader());
module = ejbModule;
validate(ejbModule);
}
for (final ClientModule clientModule : appModule.getClientModules()) {
Thread.currentThread().setContextClassLoader(clientModule.getClassLoader());
module = clientModule;
validate(clientModule);
}
} finally {
Thread.currentThread().setContextClassLoader(loader);
}
}
use of org.apache.openejb.config.EjbModule in project tomee by apache.
the class CheckDescriptorLocation method validate.
@Override
public void validate(final AppModule appModule) {
final List<String> validated = new ArrayList<String>();
for (final WebModule webModule : safe(appModule.getWebModules())) {
validated.add(webModule.getModuleId());
validateWebModule(webModule);
}
for (final EjbModule ejbModule : safe(appModule.getEjbModules())) {
//without this check, CheckDescriptorLocationTest#testWarWithDescriptorInRoot() would fail
if (!validated.contains(ejbModule.getModuleId())) {
validateEjbModule(ejbModule);
}
}
}
use of org.apache.openejb.config.EjbModule in project tomee by apache.
the class DeploymentContextOptionsTest method testAllLevels.
public void testAllLevels() throws Exception {
SystemInstance.get().setProperty("color", "orangeSystem");
final ConfigurationFactory config = new ConfigurationFactory();
final Assembler assembler = new Assembler();
{
assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
}
{
// Setup the descriptor information
final EjbModule ejbModule = new EjbModule(new EjbJar(), new OpenejbJar());
final EjbJar ejbJar = ejbModule.getEjbJar();
final StatelessBean statelessBean = ejbJar.addEnterpriseBean(new StatelessBean(WidgetBean.class));
{
// Set at BeanContext level
final OpenejbJar openejbJar = ejbModule.getOpenejbJar();
final EjbDeployment deployment = openejbJar.addEjbDeployment(statelessBean);
deployment.getProperties().put("color", "orangeBean");
}
{
// Set at ModuleContext level
final OpenejbJar openejbJar = ejbModule.getOpenejbJar();
openejbJar.getProperties().put("color", "orangeModule");
}
final AppModule appModule = new AppModule(ejbModule);
{
// Set at AppContext level
appModule.getProperties().put("color", "orangeApp");
}
assembler.createApplication(config.configureApplication(appModule));
}
final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
final BeanContext beanContext = containerSystem.getBeanContext("WidgetBean");
assertOption(beanContext.getOptions(), "color", "orangeBean");
assertOption(beanContext.getModuleContext().getOptions(), "color", "orangeModule");
assertOption(beanContext.getModuleContext().getAppContext().getOptions(), "color", "orangeApp");
assertOption(SystemInstance.get().getOptions(), "color", "orangeSystem");
}
use of org.apache.openejb.config.EjbModule in project tomee by apache.
the class DeploymentContextOptionsTest method testSystemInstanceOptions.
public void testSystemInstanceOptions() throws Exception {
SystemInstance.get().setProperty("color", "orange");
final ConfigurationFactory config = new ConfigurationFactory();
final Assembler assembler = new Assembler();
{
assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
}
{
// Setup the descriptor information
final EjbModule ejbModule = new EjbModule(new EjbJar(), new OpenejbJar());
final EjbJar ejbJar = ejbModule.getEjbJar();
ejbJar.addEnterpriseBean(new StatelessBean(WidgetBean.class));
final AppModule appModule = new AppModule(ejbModule);
assembler.createApplication(config.configureApplication(appModule));
}
final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
final BeanContext beanContext = containerSystem.getBeanContext("WidgetBean");
assertOption(beanContext.getOptions(), "color", "orange");
assertOption(beanContext.getModuleContext().getOptions(), "color", "orange");
assertOption(beanContext.getModuleContext().getAppContext().getOptions(), "color", "orange");
assertOption(SystemInstance.get().getOptions(), "color", "orange");
}
use of org.apache.openejb.config.EjbModule in project tomee by apache.
the class DeploymentContextPropertiesTest method testAppContextProperties.
public void testAppContextProperties() throws Exception {
final ConfigurationFactory config = new ConfigurationFactory();
final Assembler assembler = new Assembler();
{
assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
}
{
// Setup the descriptor information
final EjbModule ejbModule = new EjbModule(new EjbJar(), new OpenejbJar());
final EjbJar ejbJar = ejbModule.getEjbJar();
ejbJar.addEnterpriseBean(new StatelessBean(WidgetBean.class));
final AppModule appModule = new AppModule(ejbModule);
appModule.getProperties().setProperty("color", "orange");
final AppInfo appInfo = config.configureApplication(appModule);
assertProperty(appInfo.properties, "color", "orange");
assembler.createApplication(appInfo);
}
final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
final BeanContext beanContext = containerSystem.getBeanContext("WidgetBean");
final Properties properties = beanContext.getModuleContext().getAppContext().getProperties();
assertProperty(properties, "color", "orange");
}
Aggregations