use of org.apache.openejb.jee.EjbJar$JAXB in project tomee by apache.
the class OpenEjbContainerNoRestartTest method normalRestart.
@Test
public void normalRestart() throws Exception {
final EJBContainer container1 = EJBContainer.createEJBContainer(new Properties() {
{
put(EJBContainer.MODULES, new EjbJar());
}
});
container1.close();
final EJBContainer container2 = EJBContainer.createEJBContainer(new Properties() {
{
put(EJBContainer.MODULES, new EjbJar());
}
});
container2.close();
assertNotSame(container1, container2);
}
use of org.apache.openejb.jee.EjbJar$JAXB in project tomee by apache.
the class ConcurrentMethodTest method test.
public void test() throws Exception {
final Assembler assembler = new Assembler();
final ConfigurationFactory config = new ConfigurationFactory();
assembler.createProxyFactory(config.configureService(ProxyFactoryInfo.class));
assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
final EjbJar ejbJar = new EjbJar();
ejbJar.addEnterpriseBean(new SingletonBean(Color.class));
final EjbJarInfo ejbJarInfo = config.configureApplication(ejbJar);
assembler.createApplication(ejbJarInfo);
loadAttributes(ejbJarInfo, "Color");
assertAccessTimeoutAttribute(1, TimeUnit.SECONDS, Color.class.getMethod("color", Object.class));
assertLockAttribute("Read", Color.class.getMethod("color", Object.class));
assertAccessTimeoutAttribute(1, TimeUnit.SECONDS, Color.class.getMethod("color", String.class));
assertLockAttribute("Write", Color.class.getMethod("color", String.class));
assertAccessTimeoutAttribute(2, TimeUnit.HOURS, Color.class.getMethod("color", Boolean.class));
assertLockAttribute("Read", Color.class.getMethod("color", Boolean.class));
}
use of org.apache.openejb.jee.EjbJar$JAXB in project tomee by apache.
the class DescriptorDataSourceDefinitionTest method application.
@Module
public EjbJar application() throws Exception {
final EjbJar ejbJar = new EjbJar();
final SingletonBean orange = ejbJar.addEnterpriseBean(new SingletonBean(OrangeBean.class));
orange.getDataSource().add(new org.apache.openejb.jee.DataSource().name("java:comp/env/superDS").className("org.hsqldb.jdbc.JDBCDataSource").user("sa").password("").url("jdbc:hsqldb:mem:superDS"));
orange.getResourceRef().add(new ResourceRef().lookup("java:comp/env/superDS").injectionTarget(OrangeBean.class, "ds"));
final StatelessBean yellow = ejbJar.addEnterpriseBean(new StatelessBean(YellowBean.class));
yellow.getDataSource().add(new org.apache.openejb.jee.DataSource().name("java:comp/env/superMegaDS").className("org.hsqldb.jdbc.JDBCDataSource").user("sa").password("").url("jdbc:hsqldb:mem:superDS"));
yellow.getResourceRef().add(new ResourceRef().lookup("java:comp/env/superMegaDS").injectionTarget(YellowBean.class, "mega"));
yellow.getDataSource().add(new org.apache.openejb.jee.DataSource().name("java:comp/env/superGigaDS").className("org.hsqldb.jdbc.JDBCDataSource").user("sa").password("").url("jdbc:hsqldb:mem:superDS"));
yellow.getResourceRef().add(new ResourceRef().lookup("java:comp/env/superGigaDS").injectionTarget(YellowBean.class, "giga"));
return ejbJar;
}
use of org.apache.openejb.jee.EjbJar$JAXB in project tomee by apache.
the class CrossClassLoaderProxyTest method setUp.
protected void setUp() throws Exception {
super.setUp();
System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.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);
statelessContainerInfo.properties.setProperty("TimeOut", "10");
statelessContainerInfo.properties.setProperty("MaxSize", "0");
statelessContainerInfo.properties.setProperty("StrictPooling", "false");
assembler.createContainer(statelessContainerInfo);
// Setup the descriptor information
final StatelessBean bean = new StatelessBean(WidgetBean.class);
bean.addBusinessLocal(Widget.class.getName());
bean.addBusinessRemote(RemoteWidget.class.getName());
bean.setHomeAndRemote(WidgetHome.class, WidgetRemote.class);
bean.addPostConstruct("init");
bean.addPreDestroy("destroy");
final EjbJar ejbJar = new EjbJar();
ejbJar.addEnterpriseBean(bean);
assembler.createApplication(config.configureApplication(ejbJar));
WidgetBean.lifecycle.clear();
}
use of org.apache.openejb.jee.EjbJar$JAXB 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);
}
Aggregations