use of org.apache.openejb.assembler.classic.Assembler in project tomee by apache.
the class BeanPropertiesTest method testOverrideFromModuleProperties.
public void testOverrideFromModuleProperties() throws Exception {
final ConfigurationFactory config = new ConfigurationFactory();
final Assembler assembler = new Assembler();
{
// setup the system
assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
}
{
final Map<String, String> map = new HashMap<String, String>();
map.put("META-INF/openejb-jar.xml", "<openejb-jar>\n" + " <ejb-deployment ejb-name=\"WidgetBean\">\n" + " <properties>\n" + " color=white\n" + " </properties>\n" + " </ejb-deployment>\n" + "</openejb-jar>");
map.put("META-INF/module.properties", "WidgetBean.color=orange");
final File app = Archives.fileArchive(map, WidgetBean.class);
assembler.createApplication(config.configureApplication(app));
}
final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
assertContexts(containerSystem);
}
use of org.apache.openejb.assembler.classic.Assembler in project tomee by apache.
the class BeanPropertiesTest method testOverrideAdd.
public void testOverrideAdd() throws Exception {
final ConfigurationFactory config = new ConfigurationFactory();
final Assembler assembler = new Assembler();
{
// setup the system
assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
}
{
SystemInstance.get().getProperties().put("WidgetBean.color", "orange");
final Map<String, String> map = new HashMap<String, String>();
final File app = Archives.fileArchive(map, WidgetBean.class);
assembler.createApplication(config.configureApplication(app));
}
final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
assertContexts(containerSystem);
}
use of org.apache.openejb.assembler.classic.Assembler in project tomee by apache.
the class BusinessInterfacesTest method setUp.
@Override
protected void setUp() throws Exception {
final Assembler assembler = new Assembler();
config = new ConfigurationFactory();
ejbModule = new EjbModule(new EjbJar());
ejbModule.setOpenejbJar(new OpenejbJar());
ejbJar = ejbModule.getEjbJar();
strict(false);
}
use of org.apache.openejb.assembler.classic.Assembler in project tomee by apache.
the class DefaultDataSourceTest method test.
/**
* Default DataSource should be a JtaManaged DataSource
*
* @throws Exception
*/
public void test() throws Exception {
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 SingletonBean(MyBean.class));
assembler.createApplication(config.configureApplication(new EjbModule(ejbJar)));
final OpenEjbConfiguration configuration = SystemInstance.get().getComponent(OpenEjbConfiguration.class);
final ResourceInfo resourceInfo = configuration.facilities.resources.get(0);
assertEquals("Default JDBC Database", resourceInfo.id);
assertEquals("true", resourceInfo.properties.getProperty("JtaManaged"));
}
use of org.apache.openejb.assembler.classic.Assembler 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