Search in sources :

Example 41 with Module

use of org.apache.openejb.testing.Module in project tomee by apache.

the class DataSourceDefinitionWithEjbJarXmlTest method initModule.

@Module
public EjbJar initModule() throws Exception {
    final EjbJar ejbJar = new EjbJar();
    final StatelessBean statelessBean = ejbJar.addEnterpriseBean(new StatelessBean(DataSourceBean.class));
    final org.apache.openejb.jee.DataSource ds = new org.apache.openejb.jee.DataSource();
    ds.setUser(EXPECTED_USER_NAME);
    ds.setName("java:comp/env/" + DATASOURCE_NAME);
    ds.setUrl("jdbc:hsqldb:mem:test");
    ds.setClassName(DRIVER_CLASS);
    statelessBean.getDataSourceMap().put(DATASOURCE_NAME, ds);
    return ejbJar;
}
Also used : StatelessBean(org.apache.openejb.jee.StatelessBean) EjbJar(org.apache.openejb.jee.EjbJar) Module(org.apache.openejb.testing.Module)

Example 42 with Module

use of org.apache.openejb.testing.Module 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;
}
Also used : SingletonBean(org.apache.openejb.jee.SingletonBean) StatelessBean(org.apache.openejb.jee.StatelessBean) ResourceRef(org.apache.openejb.jee.ResourceRef) EjbJar(org.apache.openejb.jee.EjbJar) DataSource(javax.sql.DataSource) Module(org.apache.openejb.testing.Module)

Example 43 with Module

use of org.apache.openejb.testing.Module in project tomee by apache.

the class ResourcePropertyLeakTest method application.

@Module
public AppModule application() {
    final EjbModule ejbModule = new EjbModule(new EjbJar());
    final AppModule appModule = new AppModule(Thread.currentThread().getContextClassLoader(), null);
    appModule.getEjbModules().add(ejbModule);
    return appModule;
}
Also used : AppModule(org.apache.openejb.config.AppModule) EjbModule(org.apache.openejb.config.EjbModule) EjbJar(org.apache.openejb.jee.EjbJar) EjbModule(org.apache.openejb.config.EjbModule) AppModule(org.apache.openejb.config.AppModule) Module(org.apache.openejb.testing.Module)

Example 44 with Module

use of org.apache.openejb.testing.Module in project tomee by apache.

the class MoviesTest method beans.

@Module
public EjbJar beans() {
    EjbJar ejbJar = new EjbJar("movie-beans");
    ejbJar.addEnterpriseBean(new StatefulBean(MoviesImpl.class));
    return ejbJar;
}
Also used : StatefulBean(org.apache.openejb.jee.StatefulBean) EjbJar(org.apache.openejb.jee.EjbJar) Module(org.apache.openejb.testing.Module)

Example 45 with Module

use of org.apache.openejb.testing.Module in project tomee by apache.

the class AppComposerConfiguration method unit.

@Module
public static PersistenceUnit unit() {
    final PersistenceUnit jpa = new PersistenceUnit("jpa");
    jpa.setExcludeUnlistedClasses(true);
    return jpa;
}
Also used : PersistenceUnit(org.apache.openejb.jee.jpa.unit.PersistenceUnit) Module(org.apache.openejb.testing.Module)

Aggregations

Module (org.apache.openejb.testing.Module)86 EjbJar (org.apache.openejb.jee.EjbJar)30 StatelessBean (org.apache.openejb.jee.StatelessBean)25 Empty (org.apache.openejb.jee.Empty)19 EjbModule (org.apache.openejb.config.EjbModule)18 Persistence (org.apache.openejb.jee.jpa.unit.Persistence)18 PersistenceUnit (org.apache.openejb.jee.jpa.unit.PersistenceUnit)17 SingletonBean (org.apache.openejb.jee.SingletonBean)16 Beans (org.apache.openejb.jee.Beans)13 OpenejbJar (org.apache.openejb.jee.oejb3.OpenejbJar)9 Classes (org.apache.openejb.testing.Classes)9 AppModule (org.apache.openejb.config.AppModule)6 PojoDeployment (org.apache.openejb.jee.oejb3.PojoDeployment)5 Properties (java.util.Properties)4 WebModule (org.apache.openejb.config.WebModule)4 Resources (org.apache.openejb.config.sys.Resources)4 Service (org.apache.openejb.config.sys.Service)4 AssemblyDescriptor (org.apache.openejb.jee.AssemblyDescriptor)4 Interceptor (org.apache.openejb.jee.Interceptor)4 InterceptorBinding (org.apache.openejb.jee.InterceptorBinding)4