use of org.apache.openejb.jee.StatelessBean in project tomee by apache.
the class InvalidInterfacesTest method test1.
@Keys({ @Key(value = "interface.beanOnlyAnnotation", type = KeyType.WARNING), @Key(value = "interfaceMethod.beanOnlyAnnotation", type = KeyType.WARNING), @Key("aroundInvoke.invalidArguments") })
public EjbJar test1() {
SystemInstance.get().setProperty("openejb.strict.interface.declaration", "true");
final EjbJar ejbJar = new EjbJar();
ejbJar.addEnterpriseBean(new StatelessBean(DBean.class));
return ejbJar;
}
use of org.apache.openejb.jee.StatelessBean in project tomee by apache.
the class InvalidInterfacesTest method test2.
@Keys({ @Key(value = "ann.remoteOrLocal.converse.parent", count = 2) })
public EjbJar test2() {
SystemInstance.get().setProperty("openejb.strict.interface.declaration", "true");
final EjbJar ejbJar = new EjbJar();
ejbJar.addEnterpriseBean(new StatelessBean(EBean.class));
ejbJar.addEnterpriseBean(new StatelessBean(FBean.class));
return ejbJar;
}
use of org.apache.openejb.jee.StatelessBean in project tomee by apache.
the class InvalidInterfacesTest method testCorrectInterfaces.
@Keys
public EjbJar testCorrectInterfaces() throws Exception {
final EjbJar ejbJar = new EjbJar();
final StatelessBean bean = ejbJar.addEnterpriseBean(new StatelessBean(FooBean.class));
bean.setHomeAndRemote(FooEJBHome.class, FooEJBObject.class);
bean.setHomeAndLocal(FooEJBLocalHome.class, FooEJBLocalObject.class);
bean.addBusinessLocal(FooLocal.class.getName());
bean.addBusinessRemote(FooRemote.class.getName());
return ejbJar;
}
use of org.apache.openejb.jee.StatelessBean in project tomee by apache.
the class UberInterfaceTest method test.
public void test() throws Exception {
System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName());
final ConfigurationFactory config = new ConfigurationFactory();
final Assembler assembler = new Assembler();
assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
final EjbJar ejbJar = new EjbJar();
final StatelessBean bean = ejbJar.addEnterpriseBean(new StatelessBean(SuperBean.class));
final EjbJarInfo ejbJarInfo = config.configureApplication(ejbJar);
final EnterpriseBeanInfo beanInfo = ejbJarInfo.enterpriseBeans.get(0);
assertEquals(asList(Everything.class.getName()), beanInfo.businessLocal);
assertEquals(asList(Everything.class.getName()), beanInfo.businessRemote);
assertEquals(Everything.class.getName(), beanInfo.serviceEndpoint);
assembler.createApplication(ejbJarInfo);
final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
final BeanContext deployment = containerSystem.getBeanContext(beanInfo.ejbDeploymentId);
assertEquals(asList(Everything.class), deployment.getBusinessLocalInterfaces());
assertEquals(asList(Everything.class), deployment.getBusinessRemoteInterfaces());
assertEquals(Everything.class, deployment.getServiceEndpointInterface());
final InitialContext context = new InitialContext();
final Everything local = (Everything) context.lookup("SuperBeanLocal");
final Everything remote = (Everything) context.lookup("SuperBeanRemote");
final Reference reference = new Reference("test");
assertEquals(reference, local.echo(reference));
// pass by reference
assertSame(reference, local.echo(reference));
assertEquals(reference, remote.echo(reference));
// pass by value
assertNotSame(reference, remote.echo(reference));
}
use of org.apache.openejb.jee.StatelessBean in project tomee by apache.
the class LocalClientTest method setUp.
public void setUp() throws OpenEJBException, NamingException, IOException {
// avoid linkage error on mac, only used for tests so don't need to add it in Core
JULLoggerFactory.class.getName();
final ConfigurationFactory config = new ConfigurationFactory();
final Assembler assembler = new Assembler();
assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
final AppModule app = new AppModule(this.getClass().getClassLoader(), "test-app");
final Persistence persistence = new Persistence(new org.apache.openejb.jee.jpa.unit.PersistenceUnit("foo-unit"));
app.addPersistenceModule(new PersistenceModule("root", persistence));
final EjbJar ejbJar = new EjbJar();
ejbJar.addEnterpriseBean(new StatelessBean(SuperBean.class));
app.getEjbModules().add(new EjbModule(ejbJar));
final ClientModule clientModule = new ClientModule(null, app.getClassLoader(), app.getJarLocation(), null, null);
clientModule.getLocalClients().add(this.getClass().getName());
app.getClientModules().add(clientModule);
assembler.createApplication(config.configureApplication(app));
}
Aggregations