use of org.apache.openejb.jee.SingletonBean in project tomee by apache.
the class CheckInvalidCallbacksTest method test.
@Keys({ @Key(value = "ignoredMethodAnnotation", count = 10, type = KeyType.WARNING), @Key("callback.invalidArguments"), @Key("callback.badReturnType"), @Key("callback.badModifier"), @Key("callback.invalidArguments"), @Key("aroundInvoke.missing"), @Key("callback.missing"), @Key(value = "callback.sessionSynchronization.invalidUse", count = 2) })
public EjbJar test() throws Exception {
final EjbJar ejbJar = new EjbJar();
final StatelessBean testBean = ejbJar.addEnterpriseBean(new StatelessBean("TestStateless", TestBean.class));
testBean.addAroundInvoke("wrongMethod");
testBean.addPostConstruct("wrongMethod");
ejbJar.addEnterpriseBean(new SingletonBean("TestSingleton", TestBean.class));
ejbJar.addEnterpriseBean(new StatefulBean("FooStateful", FooBean.class));
ejbJar.addEnterpriseBean(new StatefulBean("BarStateful", BarBean.class));
final StatefulBean starBean = ejbJar.addEnterpriseBean(new StatefulBean("StarStateful", StarBean.class));
starBean.setAfterBeginMethod(new NamedMethod("myAfterBegin"));
starBean.setBeforeCompletionMethod(new NamedMethod("myBeforeCompletion"));
starBean.setAfterCompletionMethod(new NamedMethod("myAfterCompletion"));
return ejbJar;
}
use of org.apache.openejb.jee.SingletonBean in project tomee by apache.
the class RsInterceptorInjectionTest method service.
@Module
public static SingletonBean service() throws Exception {
final SingletonBean bean = new SingletonBean(RsInjection.class);
bean.setLocalBean(new Empty());
return bean;
}
use of org.apache.openejb.jee.SingletonBean in project tomee by apache.
the class RsInjectionTest method service.
@Module
public static SingletonBean service() throws Exception {
final SingletonBean bean = new SingletonBean(RsInjection.class);
bean.setLocalBean(new Empty());
return bean;
}
use of org.apache.openejb.jee.SingletonBean 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;
}
use of org.apache.openejb.jee.SingletonBean 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;
}
Aggregations