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;
}
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;
}
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;
}
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;
}
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();
}
}
Aggregations