use of org.apache.openejb.config.EjbModule in project tomee by apache.
the class AsynchTest method testSessionContext.
@Test
public void testSessionContext() throws Exception {
// Build the application
final AppModule app = new AppModule(this.getClass().getClassLoader(), "testcanceltask");
final EjbJar ejbJar = new EjbJar();
ejbJar.addEnterpriseBean(new StatelessBean(TestBeanB.class));
app.getEjbModules().add(new EjbModule(ejbJar));
final AppInfo appInfo = config.configureApplication(app);
assembler.createApplication(appInfo);
final InitialContext context = new InitialContext();
final TestBean test = (TestBean) context.lookup("TestBeanBLocal");
test.testA(Thread.currentThread().getId());
Assert.assertEquals("testA was never executed", "testA", test.getLastInvokeMethod());
final Future<String> future = test.testB(Thread.currentThread().getId());
Thread.sleep(1000L);
Assert.assertFalse(future.cancel(true));
Assert.assertFalse(future.isCancelled());
Assert.assertFalse(future.isDone());
Thread.sleep(3000L);
Assert.assertTrue(future.isDone());
Assert.assertEquals("testB was never executed", "testB", test.getLastInvokeMethod());
test.testC(Thread.currentThread().getId());
Assert.assertEquals("testC was never executed", "testC", test.getLastInvokeMethod());
test.testD(Thread.currentThread().getId());
Thread.sleep(3000L);
Assert.assertEquals("testD was never executed", "testD", test.getLastInvokeMethod());
}
use of org.apache.openejb.config.EjbModule in project tomee by apache.
the class AppModuleBuilder method anAppModule.
public AppModuleBuilder anAppModule() {
ejbModule = new EjbModule(getClass().getClassLoader(), "FakeEjbJar", "fake.jar", ejbJar, null);
ejbModule.setOpenejbJar(openEJBJar);
return this;
}
use of org.apache.openejb.config.EjbModule in project tomee by apache.
the class EjbObjectInputStreamTest method testShouldAllowPrimitiveArraysToBeSerialized.
@Test
public void testShouldAllowPrimitiveArraysToBeSerialized() throws Exception {
final EjbJar ejbJar = new EjbJar();
final StatelessBean statelessBean = new StatelessBean(TestBean.class);
ejbJar.addEnterpriseBean(statelessBean);
final AppModule app = new AppModule(this.getClass().getClassLoader(), "Test");
final EjbModule ejbModule = new EjbModule(ejbJar);
ejbModule.setModuleId("EjbModule");
app.getEjbModules().add(ejbModule);
assembler.createApplication(config.configureApplication(app));
final TestRemote testBean = (TestRemote) context.lookup("TestBeanRemote");
assertEquals('J', testBean.getChar());
assertEquals("Hello", new String(testBean.getCharArray()));
assertEquals("test", new String(testBean.getCharArrayArray()[0]));
assertEquals("run", new String(testBean.getCharArrayArray()[1]));
assertEquals(1, testBean.getIntArray()[0]);
assertEquals(2, testBean.getIntArray()[1]);
assertEquals(true, testBean.getBooleanArray()[0]);
assertEquals(false, testBean.getBooleanArray()[1]);
assertEquals(0xD, testBean.getByteArray()[0]);
assertEquals(0xE, testBean.getByteArray()[1]);
assertEquals(0xA, testBean.getByteArray()[2]);
assertEquals(0xD, testBean.getByteArray()[3]);
assertEquals(0xB, testBean.getByteArray()[4]);
assertEquals(0xE, testBean.getByteArray()[5]);
assertEquals(0xE, testBean.getByteArray()[6]);
assertEquals(0xF, testBean.getByteArray()[7]);
assertEquals(1, testBean.getShortArray()[0]);
assertEquals(2, testBean.getShortArray()[1]);
assertEquals(1.1f, testBean.getFloatArray()[0], 0.001);
assertEquals(2.2f, testBean.getFloatArray()[1], 0.001);
assertEquals(5L, testBean.getLongArray()[0]);
assertEquals(6L, testBean.getLongArray()[1]);
assertEquals(1.1, testBean.getDoubleArray()[0], 0.001);
assertEquals(2.2, testBean.getDoubleArray()[1], 0.001);
}
use of org.apache.openejb.config.EjbModule in project tomee by apache.
the class EjbRefTest method ear.
private void ear(final EjbJar... ejbJars) throws OpenEJBException, NamingException, IOException {
final AppModule app = new AppModule(this.getClass().getClassLoader(), "classpath-" + ejbJars.hashCode());
for (final EjbJar ejbJar : ejbJars) {
app.getEjbModules().add(new EjbModule(ejbJar));
}
assembler.createApplication(config.configureApplication(app));
}
use of org.apache.openejb.config.EjbModule in project tomee by apache.
the class ResourcePropertyLeakTest method application.
@Module
public AppModule application() {
final EjbModule ejbModule = new EjbModule(new EjbJar());
final AppModule appModule = new AppModule(Thread.currentThread().getContextClassLoader(), null);
appModule.getEjbModules().add(ejbModule);
return appModule;
}
Aggregations