Search in sources :

Example 71 with Assembler

use of org.apache.openejb.assembler.classic.Assembler in project tomee by apache.

the class EarModuleNamesTest method testDefaultIdWebapp.

@Test
public void testDefaultIdWebapp() throws Exception {
    final File appsDir = Files.tmpdir();
    final Assembler assembler = new Assembler();
    final ConfigurationFactory factory = new ConfigurationFactory();
    final File ear = new File(appsDir, "testDefaultIdWebapp.ear");
    final Map<String, Object> contents = new HashMap<String, Object>();
    contents.put("testDefaultIdWebapp.war", Archives.jarArchive(Orange.class));
    Archives.jarArchive(ear, contents);
    final AppInfo appInfo = factory.configureApplication(ear);
    assertEquals(appInfo.ejbJars.size(), 1);
    assertEquals("testDefaultIdWebapp", appInfo.webApps.get(0).moduleId);
}
Also used : HashMap(java.util.HashMap) Assembler(org.apache.openejb.assembler.classic.Assembler) File(java.io.File) AppInfo(org.apache.openejb.assembler.classic.AppInfo) Test(org.junit.Test)

Example 72 with Assembler

use of org.apache.openejb.assembler.classic.Assembler in project tomee by apache.

the class EarModuleNamesTest method testModuleNameEjbJar.

@Test
public void testModuleNameEjbJar() throws Exception {
    final File appsDir = Files.tmpdir();
    final Assembler assembler = new Assembler();
    final ConfigurationFactory factory = new ConfigurationFactory();
    final File ear = new File(appsDir, "testModuleNameEjbJar.ear");
    final Map<String, Object> contents = new HashMap<String, Object>();
    final Map<String, Object> metaInf = new HashMap<String, Object>();
    metaInf.put("META-INF/ejb-jar.xml", "<ejb-jar><module-name>orange</module-name></ejb-jar>");
    final File ejbJar = Archives.jarArchive(metaInf, "orange", Orange.class);
    contents.put("green.jar", ejbJar);
    Archives.jarArchive(ear, contents);
    final AppInfo appInfo = factory.configureApplication(ear);
    assertEquals(appInfo.ejbJars.size(), 1);
    assertEquals("orange", appInfo.ejbJars.get(0).moduleId);
}
Also used : HashMap(java.util.HashMap) Assembler(org.apache.openejb.assembler.classic.Assembler) File(java.io.File) AppInfo(org.apache.openejb.assembler.classic.AppInfo) Test(org.junit.Test)

Example 73 with Assembler

use of org.apache.openejb.assembler.classic.Assembler in project tomee by apache.

the class EjbModuleIdTest method testId.

@Test
public void testId() throws Exception {
    final Map<String, String> map = new HashMap<String, String>();
    map.put("META-INF/ejb-jar.xml", "<ejb-jar id=\"orange\"/>");
    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("orange", 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 74 with Assembler

use of org.apache.openejb.assembler.classic.Assembler in project tomee by apache.

the class EjbModuleIdTest method testInvalidNames.

/**
 * OPENEJB-1366
 *
 * @throws Exception
 */
@Test
public void testInvalidNames() throws Exception {
    final Map<String, String> map = new HashMap<String, String>();
    map.put("META-INF/ejb-jar.xml", "<ejb-jar/>");
    final List<String> dirs = new ArrayList<String>();
    dirs.add("orangeDir");
    // invalid
    dirs.add("classes");
    // invalid
    dirs.add("test-classes");
    // invalid
    dirs.add("target");
    // invalid
    dirs.add("build");
    // invalid
    dirs.add("dist");
    // invalid
    dirs.add("bin");
    final File file = Archives.fileArchive(map, dirs, 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("orangeDir", ejbJarInfo.moduleName);
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) 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 75 with Assembler

use of org.apache.openejb.assembler.classic.Assembler in project tomee by apache.

the class EjbModuleIdTest method testModuleName.

@Test
public void testModuleName() throws Exception {
    final Map<String, String> map = new HashMap<String, String>();
    map.put("META-INF/ejb-jar.xml", "<ejb-jar><module-name>orange</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("orange", 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)

Aggregations

Assembler (org.apache.openejb.assembler.classic.Assembler)171 EjbJar (org.apache.openejb.jee.EjbJar)88 ConfigurationFactory (org.apache.openejb.config.ConfigurationFactory)84 SecurityServiceInfo (org.apache.openejb.assembler.classic.SecurityServiceInfo)76 TransactionServiceInfo (org.apache.openejb.assembler.classic.TransactionServiceInfo)76 StatelessBean (org.apache.openejb.jee.StatelessBean)56 InitialContext (javax.naming.InitialContext)50 File (java.io.File)49 AppInfo (org.apache.openejb.assembler.classic.AppInfo)47 Properties (java.util.Properties)42 HashMap (java.util.HashMap)39 ProxyFactoryInfo (org.apache.openejb.assembler.classic.ProxyFactoryInfo)39 ContainerSystem (org.apache.openejb.spi.ContainerSystem)35 EjbJarInfo (org.apache.openejb.assembler.classic.EjbJarInfo)29 LocalInitialContextFactory (org.apache.openejb.core.LocalInitialContextFactory)29 InitContextFactory (org.apache.openejb.core.ivm.naming.InitContextFactory)29 Test (org.junit.Test)29 EjbModule (org.apache.openejb.config.EjbModule)27 StatelessSessionContainerInfo (org.apache.openejb.assembler.classic.StatelessSessionContainerInfo)22 Map (java.util.Map)21