use of org.apache.openejb.jee.EjbJar$JAXB in project tomee by apache.
the class ApplicationWideTest method testShouldCreateAResourceAndNotRemoveOnUndeploy.
public void testShouldCreateAResourceAndNotRemoveOnUndeploy() throws Exception {
final EjbModule ejbModule = new EjbModule(new EjbJar(), new OpenejbJar());
final EjbJar ejbJar = ejbModule.getEjbJar();
ejbJar.addEnterpriseBean(new StatelessBean(EchoBean.class));
final AppModule appModule = new AppModule(ejbModule);
final Container container = new Container();
container.setId("My Container");
container.setCtype("STATELESS");
container.getProperties().setProperty("ApplicationWide", "true");
appModule.getContainers().add(container);
final ConfigurationFactory config = new ConfigurationFactory();
final Assembler assembler = new Assembler();
{
// setup the system
assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
}
final AppInfo appInfo = config.configureApplication(appModule);
assembler.createApplication(appInfo);
{
final ContainerSystem containerSystem = assembler.getContainerSystem();
final org.apache.openejb.Container appContainer = containerSystem.getContainer(ejbModule.getModuleId() + "/My Container");
assertNotNull(appContainer);
}
assembler.destroyApplication(appInfo);
{
final ContainerSystem containerSystem = assembler.getContainerSystem();
final org.apache.openejb.Container appContainer = containerSystem.getContainer(ejbModule.getModuleId() + "/My Container");
assertNotNull(appContainer);
}
}
use of org.apache.openejb.jee.EjbJar$JAXB in project tomee by apache.
the class DeploymentContextOptionsTest method testBeanContextOptions.
public void testBeanContextOptions() 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();
final OpenejbJar openejbJar = ejbModule.getOpenejbJar();
final StatelessBean statelessBean = ejbJar.addEnterpriseBean(new StatelessBean(WidgetBean.class));
{
// Set at BeanContext level
final EjbDeployment deployment = openejbJar.addEjbDeployment(statelessBean);
deployment.getProperties().put("color", "orange");
}
assembler.createApplication(config.configureApplication(ejbModule));
}
final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
final BeanContext beanContext = containerSystem.getBeanContext("WidgetBean");
assertOption(beanContext.getOptions(), "color", "orange");
assertNoOption(beanContext.getModuleContext().getOptions(), "color");
assertNoOption(beanContext.getModuleContext().getAppContext().getOptions(), "color");
}
use of org.apache.openejb.jee.EjbJar$JAXB in project tomee by apache.
the class DeploymentContextOptionsTest method testModuleContextOptions.
public void testModuleContextOptions() 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();
final OpenejbJar openejbJar = ejbModule.getOpenejbJar();
openejbJar.getProperties().setProperty("color", "orange");
ejbJar.addEnterpriseBean(new StatelessBean(WidgetBean.class));
assembler.createApplication(config.configureApplication(ejbModule));
}
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");
assertNoOption(beanContext.getModuleContext().getAppContext().getOptions(), "color");
}
use of org.apache.openejb.jee.EjbJar$JAXB in project tomee by apache.
the class DeploymentContextOptionsTest method testAppContextOptions.
public void testAppContextOptions() 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");
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");
}
use of org.apache.openejb.jee.EjbJar$JAXB in project tomee by apache.
the class DeploymentContextPropertiesTest method testBeanContextProperties.
public void testBeanContextProperties() 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();
final OpenejbJar openejbJar = ejbModule.getOpenejbJar();
final StatelessBean statelessBean = ejbJar.addEnterpriseBean(new StatelessBean(WidgetBean.class));
final EjbDeployment deployment = openejbJar.addEjbDeployment(statelessBean);
deployment.getProperties().put("color", "orange");
assembler.createApplication(config.configureApplication(ejbModule));
}
final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
final BeanContext beanContext = containerSystem.getBeanContext("WidgetBean");
final Properties properties = beanContext.getProperties();
assertProperty(properties, "color", "orange");
}
Aggregations