Search in sources :

Example 46 with EjbJarInfo

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);
}
Also used : HashMap(java.util.HashMap) Assembler(org.apache.openejb.assembler.classic.Assembler) File(java.io.File) EjbJarInfo(org.apache.openejb.assembler.classic.EjbJarInfo) AppInfo(org.apache.openejb.assembler.classic.AppInfo) Test(org.junit.Test)

Example 47 with EjbJarInfo

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);
}
Also used : StatefulSessionContainerInfo(org.apache.openejb.assembler.classic.StatefulSessionContainerInfo) ProxyFactoryInfo(org.apache.openejb.assembler.classic.ProxyFactoryInfo) TransactionServiceInfo(org.apache.openejb.assembler.classic.TransactionServiceInfo) StatefulBeanInfo(org.apache.openejb.assembler.classic.StatefulBeanInfo) StatefulBean(org.apache.openejb.jee.StatefulBean) Assembler(org.apache.openejb.assembler.classic.Assembler) SecurityServiceInfo(org.apache.openejb.assembler.classic.SecurityServiceInfo) EjbJarInfo(org.apache.openejb.assembler.classic.EjbJarInfo) EjbJar(org.apache.openejb.jee.EjbJar)

Aggregations

EjbJarInfo (org.apache.openejb.assembler.classic.EjbJarInfo)47 Assembler (org.apache.openejb.assembler.classic.Assembler)29 EjbJar (org.apache.openejb.jee.EjbJar)21 EnterpriseBeanInfo (org.apache.openejb.assembler.classic.EnterpriseBeanInfo)17 AppInfo (org.apache.openejb.assembler.classic.AppInfo)16 SecurityServiceInfo (org.apache.openejb.assembler.classic.SecurityServiceInfo)16 TransactionServiceInfo (org.apache.openejb.assembler.classic.TransactionServiceInfo)16 HashMap (java.util.HashMap)14 ConfigurationFactory (org.apache.openejb.config.ConfigurationFactory)14 ProxyFactoryInfo (org.apache.openejb.assembler.classic.ProxyFactoryInfo)13 BeanContext (org.apache.openejb.BeanContext)11 File (java.io.File)10 InitialContext (javax.naming.InitialContext)10 StatelessBean (org.apache.openejb.jee.StatelessBean)10 LocalInitialContextFactory (org.apache.openejb.core.LocalInitialContextFactory)9 ArrayList (java.util.ArrayList)8 WebAppInfo (org.apache.openejb.assembler.classic.WebAppInfo)8 Test (org.junit.Test)8 EjbDeployment (org.apache.openejb.jee.oejb3.EjbDeployment)7 Properties (java.util.Properties)6