use of org.apache.openejb.jee.StatelessBean in project tomee by apache.
the class CheckInvalidInterceptorTest method test1.
@Keys({ @Key(value = "interceptor.unused", count = 2, type = KeyType.WARNING), @Key("aroundInvoke.invalidArguments") })
public EjbJar test1() {
final EjbJar ejbJar = new EjbJar();
ejbJar.addEnterpriseBean(new StatelessBean(BarBean.class));
final Interceptor unused = ejbJar.addInterceptor(new org.apache.openejb.jee.Interceptor(UnusedInterceptor.class));
final Interceptor unused1 = ejbJar.addInterceptor(new org.apache.openejb.jee.Interceptor(UnusedInterceptor1.class));
final Interceptor used = ejbJar.addInterceptor(new org.apache.openejb.jee.Interceptor(UsedInterceptor.class));
final List<InterceptorBinding> interceptorBindings = ejbJar.getAssemblyDescriptor().getInterceptorBinding();
final InterceptorBinding binding = new InterceptorBinding("BarBean", used);
interceptorBindings.add(binding);
return ejbJar;
}
use of org.apache.openejb.jee.StatelessBean in project tomee by apache.
the class CheckInvalidSecurityAnnotationsTest method test.
@Keys({ @Key("conflictingSecurityAnnotations"), @Key("permitAllAndRolesAllowedOnClass") })
public EjbJar test() throws Exception {
final EjbJar ejbJar = new EjbJar();
ejbJar.addEnterpriseBean(new StatelessBean(FooBean.class));
return ejbJar;
}
use of org.apache.openejb.jee.StatelessBean in project tomee by apache.
the class CheckInvalidTransactionAttributeTest method xml.
@Keys(@Key(value = "xml.invalidTransactionAttribute", type = KeyType.WARNING))
public EjbJar xml() throws SecurityException, NoSuchMethodException {
final EjbJar ejbJar = new EjbJar();
final StatelessBean bean = ejbJar.addEnterpriseBean(new StatelessBean(CheeseEjb.class));
bean.setTransactionType(TransactionType.BEAN);
final ContainerTransaction tx = new ContainerTransaction();
tx.getMethod().add(new Method(bean.getEjbName(), CheeseEjb.class.getMethod("sayCheesePlease", null)));
tx.setTransAttribute(TransAttribute.REQUIRED);
ejbJar.getAssemblyDescriptor().getContainerTransaction().add(tx);
return ejbJar;
}
use of org.apache.openejb.jee.StatelessBean in project tomee by apache.
the class BasicInjectionTest method app.
@Module
@Classes(cdi = true, value = { Configuration.class })
public StatelessBean app() throws Exception {
final StatelessBean bean = new StatelessBean(WidgetBean.class);
bean.setLocalBean(new Empty());
return bean;
}
use of org.apache.openejb.jee.StatelessBean in project tomee by apache.
the class CdiDecoratorTest method setUp.
@Before
public void setUp() throws Exception {
final ConfigurationFactory config = new ConfigurationFactory();
final Assembler assembler = new Assembler();
assembler.createProxyFactory(config.configureService(ProxyFactoryInfo.class));
assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
assembler.createContainer(config.configureService(StatelessSessionContainerInfo.class));
final EjbJar ejbJar = new EjbJar();
ejbJar.addEnterpriseBean(new StatelessBean("HelloOne", RedBean.class));
ejbJar.addEnterpriseBean(new StatelessBean("HelloTwo", RedBean.class));
ejbJar.addEnterpriseBean(new StatelessBean(OrangeBean.class));
final Beans beans = new Beans();
beans.addInterceptor(OrangeCdiInterceptor.class);
beans.addDecorator(OrangeOneDecorator.class);
beans.addDecorator(OrangeTwoDecorator.class);
beans.addManagedClass(YellowBean.class);
final EjbModule module = new EjbModule(ejbJar);
module.setBeans(beans);
assembler.createApplication(config.configureApplication(module));
final Properties properties = new Properties(System.getProperties());
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, InitContextFactory.class.getName());
ctx = new InitialContext(properties);
}
Aggregations