Search in sources :

Example 16 with StatefulBean

use of org.apache.openejb.jee.StatefulBean in project tomee by apache.

the class CheckInvalidCallbacksTest method test3.

@Keys(@Key(value = "callback.invocationcontext.notallowed", count = 4))
public EjbJar test3() {
    final EjbJar ejbJar = new EjbJar();
    ejbJar.addEnterpriseBean(new StatefulBean(CallbackViolatorBean.class));
    return ejbJar;
}
Also used : StatefulBean(org.apache.openejb.jee.StatefulBean) EjbJar(org.apache.openejb.jee.EjbJar)

Example 17 with StatefulBean

use of org.apache.openejb.jee.StatefulBean in project tomee by apache.

the class CheckNoBusinessMethodTest method noBusinessMethod.

@Keys({ @Key(value = "no.busines.method.case", count = 4), @Key(value = "no.busines.method.args", count = 4), @Key(value = "no.busines.method", count = 4) })
public EjbJar noBusinessMethod() throws OpenEJBException {
    // System.setProperty("openejb.validation.output.level", "VERBOSE");
    final EjbJar ejbJar = new EjbJar();
    final StatelessBean stateLessLocal = new StatelessBean(FooStatelessSession.class);
    stateLessLocal.setLocalHome("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooLocalHome");
    stateLessLocal.setLocal("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooLocal");
    final StatefulBean statefulLocal = new StatefulBean(FooStatefulSession.class);
    statefulLocal.setLocalHome("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooLocalHome");
    statefulLocal.setLocal("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooLocal");
    final StatelessBean stateLessRemote = new StatelessBean(FooRemoteStatelessSession.class);
    stateLessRemote.setHome("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooRemoteHome");
    stateLessRemote.setRemote("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooRemote");
    final StatefulBean statefulRemote = new StatefulBean(FooRemoteStatefulSession.class);
    statefulRemote.setHome("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooRemoteHome");
    statefulRemote.setRemote("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooRemote");
    ejbJar.addEnterpriseBean(stateLessLocal);
    ejbJar.addEnterpriseBean(statefulLocal);
    ejbJar.addEnterpriseBean(stateLessRemote);
    ejbJar.addEnterpriseBean(statefulRemote);
    return ejbJar;
}
Also used : StatelessBean(org.apache.openejb.jee.StatelessBean) StatefulBean(org.apache.openejb.jee.StatefulBean) EjbJar(org.apache.openejb.jee.EjbJar)

Example 18 with StatefulBean

use of org.apache.openejb.jee.StatefulBean 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 19 with StatefulBean

use of org.apache.openejb.jee.StatefulBean in project tomee by apache.

the class MistakenResourceRefUsageTest method wrongUsage.

@Keys({ @Key(value = "resourceRef.onEntityManagerFactory", count = 2), @Key(value = "resourceRef.onEntityManager", count = 2), @Key(value = "resourceAnnotation.onClassWithNoName", count = 2) })
public EjbJar wrongUsage() throws OpenEJBException {
    final EjbJar ejbJar = new EjbJar();
    ejbJar.addEnterpriseBean(new StatelessBean(FooStateless.class));
    ejbJar.addEnterpriseBean(new StatefulBean(FooStateful.class));
    return ejbJar;
}
Also used : StatelessBean(org.apache.openejb.jee.StatelessBean) StatefulBean(org.apache.openejb.jee.StatefulBean) EjbJar(org.apache.openejb.jee.EjbJar)

Example 20 with StatefulBean

use of org.apache.openejb.jee.StatefulBean in project tomee by apache.

the class EjbContextTest method test.

public void test() throws Exception {
    final Assembler assembler = new Assembler();
    final ConfigurationFactory config = new ConfigurationFactory();
    assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
    assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
    final EjbJar ejbJar = new EjbJar();
    ejbJar.addEnterpriseBean(new StatefulBean("Stateful", MySessionBean.class));
    ejbJar.addEnterpriseBean(new StatelessBean("Stateless", MySessionBean.class));
    ejbJar.addEnterpriseBean(new SingletonBean("Singleton", MySessionBean.class));
    assembler.createApplication(config.configureApplication(ejbJar));
    final Properties properties = new Properties();
    properties.put(Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName());
    final InitialContext context = new InitialContext(properties);
    {
        final MySessionBean bean = (MySessionBean) context.lookup("StatefulLocalBean");
        bean.test();
    }
    {
        final MySessionBean bean = (MySessionBean) context.lookup("StatelessLocalBean");
        bean.test();
    }
    {
        final MySessionBean bean = (MySessionBean) context.lookup("SingletonLocalBean");
        bean.test();
    }
}
Also used : SingletonBean(org.apache.openejb.jee.SingletonBean) TransactionServiceInfo(org.apache.openejb.assembler.classic.TransactionServiceInfo) StatelessBean(org.apache.openejb.jee.StatelessBean) StatefulBean(org.apache.openejb.jee.StatefulBean) ConfigurationFactory(org.apache.openejb.config.ConfigurationFactory) Assembler(org.apache.openejb.assembler.classic.Assembler) Properties(java.util.Properties) LocalInitialContextFactory(org.apache.openejb.osgi.client.LocalInitialContextFactory) SecurityServiceInfo(org.apache.openejb.assembler.classic.SecurityServiceInfo) InitialContext(javax.naming.InitialContext) EjbJar(org.apache.openejb.jee.EjbJar)

Aggregations

StatefulBean (org.apache.openejb.jee.StatefulBean)36 EjbJar (org.apache.openejb.jee.EjbJar)33 Assembler (org.apache.openejb.assembler.classic.Assembler)18 SecurityServiceInfo (org.apache.openejb.assembler.classic.SecurityServiceInfo)18 TransactionServiceInfo (org.apache.openejb.assembler.classic.TransactionServiceInfo)18 ConfigurationFactory (org.apache.openejb.config.ConfigurationFactory)16 LocalInitialContextFactory (org.apache.openejb.core.LocalInitialContextFactory)12 StatelessBean (org.apache.openejb.jee.StatelessBean)12 ProxyFactoryInfo (org.apache.openejb.assembler.classic.ProxyFactoryInfo)10 StatefulSessionContainerInfo (org.apache.openejb.assembler.classic.StatefulSessionContainerInfo)7 EjbModule (org.apache.openejb.config.EjbModule)7 EjbJarInfo (org.apache.openejb.assembler.classic.EjbJarInfo)6 NamedMethod (org.apache.openejb.jee.NamedMethod)6 InitialContext (javax.naming.InitialContext)5 AppModule (org.apache.openejb.config.AppModule)3 InitContextFactory (org.apache.openejb.core.ivm.naming.InitContextFactory)3 AssemblyDescriptor (org.apache.openejb.jee.AssemblyDescriptor)3 SingletonBean (org.apache.openejb.jee.SingletonBean)3 Timeout (org.apache.openejb.jee.Timeout)3 Properties (java.util.Properties)2