use of org.apache.openejb.assembler.classic.EjbJarInfo in project tomee by apache.
the class EjbModuleIdTest method testModuleNameAndId.
@Test
public void testModuleNameAndId() throws Exception {
final Map<String, String> map = new HashMap<String, String>();
map.put("META-INF/ejb-jar.xml", "<ejb-jar id=\"orangeId\"><module-name>orangeName</module-name></ejb-jar>");
final File file = Archives.jarArchive(map, "test", OrangeBean.class);
final Assembler assembler = new Assembler();
final ConfigurationFactory factory = new ConfigurationFactory();
final AppInfo appInfo = factory.configureApplication(file);
final EjbJarInfo ejbJarInfo = appInfo.ejbJars.get(0);
assertEquals("orangeName", ejbJarInfo.moduleName);
}
use of org.apache.openejb.assembler.classic.EjbJarInfo in project tomee by apache.
the class InheritenceTest method test.
public void test() throws Exception {
final Assembler assembler = new Assembler();
final ConfigurationFactory config = new ConfigurationFactory();
assembler.createProxyFactory(config.configureService(ProxyFactoryInfo.class));
assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
assembler.createContainer(config.configureService(StatefulSessionContainerInfo.class));
final EjbJar ejbJar = new EjbJar();
ejbJar.addEnterpriseBean(new StatefulBean(Color.class));
ejbJar.addEnterpriseBean(new StatefulBean(Red.class));
final EjbJarInfo ejbJarInfo = config.configureApplication(ejbJar);
final StatefulBeanInfo expected = (StatefulBeanInfo) ejbJarInfo.enterpriseBeans.get(0);
final StatefulBeanInfo actual = (StatefulBeanInfo) ejbJarInfo.enterpriseBeans.get(1);
assertEquals("transactionType", expected.transactionType, actual.transactionType);
assertEquals("runAs", expected.runAs, actual.runAs);
assertEquals("businessLocal", expected.businessLocal, actual.businessLocal);
assertEquals("businessRemote", expected.businessRemote, actual.businessRemote);
assertEquals("local", expected.local, actual.local);
assertEquals("localHome", expected.localHome, actual.localHome);
assertEquals("remote", expected.remote, actual.remote);
assertEquals("home", expected.home, actual.home);
assertEquals("timeout", expected.timeoutMethod, actual.timeoutMethod);
assertCallbackInfos("postActivate", expected.postActivate, actual.postActivate);
assertCallbackInfos("prePassivate", expected.prePassivate, actual.prePassivate);
assertCallbackInfos("postConstruct", expected.postConstruct, actual.postConstruct);
assertCallbackInfos("preDestroy", expected.preDestroy, actual.preDestroy);
assertCallbackInfos("preDestroy", expected.aroundInvoke, actual.aroundInvoke);
assertRemoveMethodInfos("removeMethods", expected.removeMethods, actual.removeMethods);
assertInitMethodInfos("initMethods", expected.initMethods, actual.initMethods);
assertSecurityRoleReferenceInfos("securityRoleReferences", expected.securityRoleReferences, actual.securityRoleReferences);
// comp/ComponentName is different
assertEquals(1, expected.jndiEnc.envEntries.size());
assertEquals(1, actual.jndiEnc.envEntries.size());
assertEquals("comp/ComponentName", expected.jndiEnc.envEntries.get(0).referenceName);
assertEquals("Color", expected.jndiEnc.envEntries.get(0).value);
assertEquals("comp/ComponentName", actual.jndiEnc.envEntries.get(0).referenceName);
assertEquals("Red", actual.jndiEnc.envEntries.get(0).value);
expected.jndiEnc.envEntries.clear();
actual.jndiEnc.envEntries.clear();
assertEquals("jndiEnc", expected.jndiEnc, actual.jndiEnc);
}
Aggregations