use of org.apache.openejb.config.EjbModule in project tomee by apache.
the class DeploymentContextPropertiesTest method testModuleContextProperties.
public void testModuleContextProperties() 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));
final EjbJarInfo moduleInfo = config.configureApplication(ejbModule);
assertProperty(moduleInfo.properties, "color", "orange");
assembler.createApplication(moduleInfo);
}
final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
final BeanContext beanContext = containerSystem.getBeanContext("WidgetBean");
final Properties properties = beanContext.getModuleContext().getProperties();
assertProperty(properties, "color", "orange");
}
use of org.apache.openejb.config.EjbModule 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");
}
use of org.apache.openejb.config.EjbModule in project tomee by apache.
the class JaxRpcInvocationTest method buildTestApp.
public EjbModule buildTestApp() {
final EjbJar ejbJar = new EjbJar();
final StatelessBean bean = ejbJar.addEnterpriseBean(new StatelessBean(EchoBean.class));
bean.setServiceEndpoint(EchoServiceEndpoint.class.getName());
return new EjbModule(this.getClass().getClassLoader(), this.getClass().getSimpleName(), "test", ejbJar, null);
}
use of org.apache.openejb.config.EjbModule in project tomee by apache.
the class JaxWsInvocationTest method buildTestApp.
public EjbModule buildTestApp() {
final EjbJar ejbJar = new EjbJar();
final StatelessBean bean = ejbJar.addEnterpriseBean(new StatelessBean(EchoBean.class));
bean.setServiceEndpoint(EchoServiceEndpoint.class.getName());
return new EjbModule(this.getClass().getClassLoader(), this.getClass().getSimpleName(), "test", ejbJar, null);
}
use of org.apache.openejb.config.EjbModule in project tomee by apache.
the class StatelessConstructorInjectionTest method setUp.
protected void setUp() throws Exception {
super.setUp();
System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, InitContextFactory.class.getName());
final ConfigurationFactory config = new ConfigurationFactory();
final Assembler assembler = new Assembler();
assembler.createProxyFactory(config.configureService(ProxyFactoryInfo.class));
assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
// containers
final StatelessSessionContainerInfo statelessContainerInfo = config.configureService(StatelessSessionContainerInfo.class);
assembler.createContainer(statelessContainerInfo);
// Setup the descriptor information
final EjbJar ejbJar = new EjbJar();
ejbJar.addEnterpriseBean(new StatelessBean(FooBean.class));
final StatelessBean bean = ejbJar.addEnterpriseBean(new StatelessBean(WidgetBean.class));
bean.getEnvEntry().add(new EnvEntry("count", Integer.class.getName(), "10"));
assembler.createApplication(config.configureApplication(new EjbModule(ejbJar).withCdi()));
}
Aggregations