use of org.apache.openejb.assembler.classic.AppInfo 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);
}
use of org.apache.openejb.assembler.classic.AppInfo 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);
}
use of org.apache.openejb.assembler.classic.AppInfo 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);
}
use of org.apache.openejb.assembler.classic.AppInfo 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);
}
use of org.apache.openejb.assembler.classic.AppInfo in project tomee by apache.
the class EarModuleNamesTest method testIdEjbJar.
@Test
public void testIdEjbJar() throws Exception {
final File appsDir = Files.tmpdir();
final Assembler assembler = new Assembler();
final ConfigurationFactory factory = new ConfigurationFactory();
final File ear = new File(appsDir, "testIdEjbJar.ear");
final Map<String, Object> metaInf = new HashMap<String, Object>();
metaInf.put("META-INF/ejb-jar.xml", "<ejb-jar id=\"testIdEjbJar\" />");
final File ejbJar = Archives.jarArchive(metaInf, "testIdEjbJar", Orange.class);
final Map<String, Object> contents = new HashMap<String, Object>();
contents.put("green.jar", ejbJar);
Archives.jarArchive(ear, contents);
final AppInfo appInfo = factory.configureApplication(ear);
assertEquals(appInfo.ejbJars.size(), 1);
assertEquals("testIdEjbJar", appInfo.ejbJars.get(0).moduleId);
}
Aggregations