use of org.apache.openejb.assembler.classic.EjbJarInfo in project tomee by apache.
the class MappedNameTest method test.
public void test() throws Exception {
System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName());
final ConfigurationFactory config = new ConfigurationFactory();
final Assembler assembler = new Assembler();
assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
final EjbJar ejbJar = new EjbJar();
ejbJar.addEnterpriseBean(new StatelessBean(GreenBean.class));
ejbJar.addEnterpriseBean(new StatelessBean(RedBean.class));
final EjbModule ejbModule = new EjbModule(ejbJar, new OpenejbJar());
ejbModule.getOpenejbJar().addEjbDeployment(new EjbDeployment(null, "foo/bar/baz/Green", "GreenBean"));
ejbModule.getOpenejbJar().addEjbDeployment(new EjbDeployment(null, "foo/bar/baz/Red", "RedBean"));
final EjbJarInfo info = config.configureApplication(ejbModule);
assembler.createApplication(info);
final InitialContext initialContext = new InitialContext();
final Color green = (Color) initialContext.lookup("foo/bar/baz/GreenLocal");
final Color red = (Color) initialContext.lookup("foo/bar/baz/RedLocal");
red.test();
}
use of org.apache.openejb.assembler.classic.EjbJarInfo in project tomee by apache.
the class EjbModuleIdTest method testSystemProperty.
/**
* OPENEJB-1555
*
* @throws Exception
*/
@Test
public void testSystemProperty() 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();
SystemInstance.get().setProperty(file.getName() + ".moduleId", "orangeSystem");
final AppInfo appInfo = factory.configureApplication(file);
final EjbJarInfo ejbJarInfo = appInfo.ejbJars.get(0);
assertEquals("orangeSystem", ejbJarInfo.moduleName);
}
use of org.apache.openejb.assembler.classic.EjbJarInfo 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.EjbJarInfo 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.EjbJarInfo 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);
}
Aggregations