Search in sources :

Example 51 with Module

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

the class QuartzPersistenceForEJBTimersTest method application.

@Module
public AppModule application() {
    final EjbModule ejbModule = new EjbModule(new EjbJar());
    ejbModule.getEjbJar().addEnterpriseBean(new SingletonBean(MyTimedEjb.class).localBean());
    final Properties quartzConfig = new PropertiesBuilder().p("org.apache.openejb.quartz.scheduler.instanceName", "TestScheduler").p("org.apache.openejb.quartz.scheduler.instanceId", "AUTO").p("org.apache.openejb.quartz.threadPool.class", SimpleThreadPool.class.getName()).p("org.apache.openejb.quartz.threadPool.threadCount", "4").p("org.apache.openejb.quartz.threadPool.threadPriority", "5").p("org.apache.openejb.quartz.jobStore.class", JobStoreCMT.class.getName()).p("org.apache.openejb.quartz.jobStore.driverDelegateClass", HSQLDBDelegate.class.getName()).p("org.apache.openejb.quartz.jobStore.dataSource", "QUARTZ").p("org.apache.openejb.quartz.jobStore.nonManagedTXDataSource", "QUARTZ_NOTX").p("org.apache.openejb.quartz.jobStore.tablePrefix", "qrtz_").p("org.apache.openejb.quartz.jobStore.isClustered", "true").p("org.apache.openejb.quartz.jobStore.clusterCheckinInterval", "60000").p("org.apache.openejb.quartz.jobStore.txIsolationLevelSerializable", "true").p("org.apache.openejb.quartz.jobStore.maxMisfiresToHandleAtATime", "100").p("org.apache.openejb.quartz.dataSource.QUARTZ.jndiURL", "openejb:Resource/QuartzPersistenceForEJBTimersDB").p("org.apache.openejb.quartz.dataSource.QUARTZ_NOTX.jndiURL", "openejb:Resource/QuartzPersistenceForEJBTimersDBNoTx").build();
    final AppModule appModule = new AppModule(Thread.currentThread().getContextClassLoader(), null);
    appModule.getEjbModules().add(ejbModule);
    appModule.getProperties().putAll(quartzConfig);
    return appModule;
}
Also used : SingletonBean(org.apache.openejb.jee.SingletonBean) AppModule(org.apache.openejb.config.AppModule) HSQLDBDelegate(org.apache.openejb.quartz.impl.jdbcjobstore.HSQLDBDelegate) EjbModule(org.apache.openejb.config.EjbModule) Properties(java.util.Properties) PropertiesBuilder(org.apache.openejb.testng.PropertiesBuilder) SimpleThreadPool(org.apache.openejb.quartz.simpl.SimpleThreadPool) 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 52 with Module

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

the class VagueEnvEntriesMatchTest method foo.

@Module
public SingletonBean foo() {
    final SingletonBean singletonBean = new SingletonBean(Blue.class);
    singletonBean.getEnvEntry().add(new EnvEntry().name("one").type(String.class).value("hello"));
    singletonBean.getEnvEntry().add(new EnvEntry().name("two").type(String.class).value("false"));
    singletonBean.getEnvEntry().add(new EnvEntry().name(Blue.class.getName() + "/two").type(String.class).value("true"));
    return singletonBean;
}
Also used : SingletonBean(org.apache.openejb.jee.SingletonBean) EnvEntry(org.apache.openejb.jee.EnvEntry) Module(org.apache.openejb.testing.Module)

Example 53 with Module

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

the class SecondStatelessInterceptedTest method module.

@Module
public EjbJar module() {
    final EjbJar ejbJar = new EjbJar();
    final StatelessBean bean = ejbJar.addEnterpriseBean(new StatelessBean(SecondStatelessInterceptedBean.class));
    final AssemblyDescriptor assembly = ejbJar.getAssemblyDescriptor();
    assembly.addInterceptorBinding(new InterceptorBinding("*", new Interceptor(DefaultInterceptorOne.class)));
    assembly.addInterceptorBinding(new InterceptorBinding("*", new Interceptor(DefaultInterceptorTwo.class)));
    assembly.addInterceptorBinding(new InterceptorBinding(bean)).setExcludeDefaultInterceptors(true);
    return ejbJar;
}
Also used : InterceptorBinding(org.apache.openejb.jee.InterceptorBinding) StatelessBean(org.apache.openejb.jee.StatelessBean) AssemblyDescriptor(org.apache.openejb.jee.AssemblyDescriptor) Interceptor(org.apache.openejb.jee.Interceptor) EjbJar(org.apache.openejb.jee.EjbJar) Module(org.apache.openejb.testing.Module)

Example 54 with Module

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

the class JTAPuAndBmtTest method persistence.

@Module
public Persistence persistence() {
    final PersistenceUnit unit = new PersistenceUnit("foo-unit");
    unit.addClass(TheEntity.class);
    unit.setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
    unit.getProperties().setProperty("openjpa.RuntimeUnenhancedClasses", "supported");
    unit.setExcludeUnlistedClasses(true);
    final Persistence persistence = new Persistence(unit);
    persistence.setVersion("2.0");
    return persistence;
}
Also used : Persistence(org.apache.openejb.jee.jpa.unit.Persistence) PersistenceUnit(org.apache.openejb.jee.jpa.unit.PersistenceUnit) Module(org.apache.openejb.testing.Module)

Example 55 with Module

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

the class JTAPuAndBmtTest method app.

@Module
public StatelessBean app() throws Exception {
    final StatelessBean bean = new StatelessBean(BmtManager.class);
    bean.setLocalBean(new Empty());
    return bean;
}
Also used : Empty(org.apache.openejb.jee.Empty) StatelessBean(org.apache.openejb.jee.StatelessBean) 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