Search in sources :

Example 61 with Module

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

the class MoviesTest method persistence.

@Module
public PersistenceUnit persistence() {
    PersistenceUnit unit = new PersistenceUnit("movie-unit");
    unit.setJtaDataSource("movieDatabase");
    unit.setNonJtaDataSource("movieDatabaseUnmanaged");
    unit.getClazz().add(Movie.class.getName());
    unit.setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
    return unit;
}
Also used : PersistenceUnit(org.apache.openejb.jee.jpa.unit.PersistenceUnit) Module(org.apache.openejb.testing.Module)

Example 62 with Module

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

the class CustomEndpointConfiguratorTest method module.

@Module
public EjbModule module() {
    final EjbModule module = new EjbModule(new EjbJar());
    module.setOpenejbJar(new OpenejbJar());
    final SingletonBean bean = new SingletonBean(MyWebservice.class);
    bean.setLocalBean(new Empty());
    final EjbDeployment deployment = new EjbDeployment(bean);
    deployment.getProperties().setProperty("openejb.endpoint.configurator", CustomConfigurator.class.getName());
    module.getOpenejbJar().addEjbDeployment(deployment);
    module.getEjbJar().addEnterpriseBean(bean);
    return module;
}
Also used : SingletonBean(org.apache.openejb.jee.SingletonBean) Empty(org.apache.openejb.jee.Empty) OpenejbJar(org.apache.openejb.jee.oejb3.OpenejbJar) EjbModule(org.apache.openejb.config.EjbModule) EjbDeployment(org.apache.openejb.jee.oejb3.EjbDeployment) EjbJar(org.apache.openejb.jee.EjbJar) EjbModule(org.apache.openejb.config.EjbModule) Module(org.apache.openejb.testing.Module)

Example 63 with Module

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

the class WsJMXTest method war.

@Module
@Classes({ AnEjbEndpoint.class, AnPojoEndpoint.class })
public WebApp war() {
    final WebApp webapp = new WebApp().contextRoot("app");
    Servlet servlet = new Servlet();
    servlet.setServletName("toto");
    servlet.setServletClass(AnPojoEndpoint.class.getName());
    ServletMapping servletMapping = new ServletMapping();
    servletMapping.setServletName("pojo");
    servletMapping.getUrlPattern().add("/toto");
    webapp.getServlet().add(servlet);
    webapp.getServletMapping().add(servletMapping);
    return webapp;
}
Also used : ServletMapping(org.apache.openejb.jee.ServletMapping) Servlet(org.apache.openejb.jee.Servlet) WebApp(org.apache.openejb.jee.WebApp) Module(org.apache.openejb.testing.Module) Classes(org.apache.openejb.testing.Classes)

Example 64 with Module

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

the class CheckedExceptionMapperTest method module.

@Module
@Classes({ ExampleExceptionMapper.class })
public EjbModule module() {
    final SingletonBean bean = new SingletonBean(ExampleRest.class);
    bean.setRestService(true);
    final EjbJar ejbJar = new EjbJar("beans");
    ejbJar.addEnterpriseBean(bean);
    final OpenejbJar openejbJar = new OpenejbJar();
    openejbJar.addEjbDeployment(new EjbDeployment(bean));
    final Properties properties = openejbJar.getEjbDeployment().iterator().next().getProperties();
    properties.setProperty("cxf.jaxrs.providers", "org.apache.openejb.server.cxf.rs.CheckedExceptionMapperTest$ExampleExceptionMapper");
    final EjbModule module = new EjbModule(ejbJar);
    module.setOpenejbJar(openejbJar);
    return module;
}
Also used : SingletonBean(org.apache.openejb.jee.SingletonBean) OpenejbJar(org.apache.openejb.jee.oejb3.OpenejbJar) EjbModule(org.apache.openejb.config.EjbModule) EjbDeployment(org.apache.openejb.jee.oejb3.EjbDeployment) Properties(java.util.Properties) EjbJar(org.apache.openejb.jee.EjbJar) EjbModule(org.apache.openejb.config.EjbModule) Module(org.apache.openejb.testing.Module) Classes(org.apache.openejb.testing.Classes)

Example 65 with Module

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

the class CustomContextTest method service.

@Module
public static EjbModule service() throws Exception {
    final EjbModule module = new EjbModule(new EjbJar(), new OpenejbJar());
    final SingletonBean bean = new SingletonBean(CustomContextInjectedBean.class);
    bean.setLocalBean(new Empty());
    module.getEjbJar().addEnterpriseBean(bean);
    final PojoDeployment e = new PojoDeployment();
    e.setClassName("jaxrs-application");
    e.getProperties().setProperty("cxf.jaxrs.providers", CustomProvider.class.getName());
    module.getOpenejbJar().getPojoDeployment().add(e);
    return module;
}
Also used : SingletonBean(org.apache.openejb.jee.SingletonBean) Empty(org.apache.openejb.jee.Empty) OpenejbJar(org.apache.openejb.jee.oejb3.OpenejbJar) EjbModule(org.apache.openejb.config.EjbModule) PojoDeployment(org.apache.openejb.jee.oejb3.PojoDeployment) EjbJar(org.apache.openejb.jee.EjbJar) EjbModule(org.apache.openejb.config.EjbModule) 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