use of org.apache.openejb.assembler.classic.AppInfo in project tomee by apache.
the class AltDDPrefixTest method testPersistenceUnitWithAllDD.
/**
* OPENEJB-1059: altdd does not work with a persistence.xml when no embedded
* in EjbModule/Client module.
*
* @throws Exception if something wrong happen
*/
public void testPersistenceUnitWithAllDD() throws Exception {
System.out.println("*** testPersistenceUnitWithAllDD ***");
final Assembler assmbler = new Assembler();
// TODO should be better to add a remove property method
SystemInstance.get().getProperties().remove("openejb.altdd.prefix");
DeploymentLoader.reloadAltDD();
final ConfigurationFactory factory = new ConfigurationFactory();
final URL resource = AltDDPrefixTest.class.getClassLoader().getResource("altddPU1");
final File file = URLs.toFile(resource);
final AppInfo appInfo = factory.configureApplication(file);
assertNotNull(appInfo);
assertEquals(0, appInfo.ejbJars.size());
assertEquals(1, appInfo.persistenceUnits.size());
final PersistenceUnitInfo info = appInfo.persistenceUnits.get(0);
// a space must be present before hashcode
assertTrue(info.id.startsWith("unit "));
}
use of org.apache.openejb.assembler.classic.AppInfo in project tomee by apache.
the class AppPathsTest method _testMixedCaseMetaInf.
/**
* Seems like this may not be a feature that can be supported on
* all platforms. Seems to work on the mac VM, but not the linux vm.
*
* @throws Exception
*/
public void _testMixedCaseMetaInf() throws Exception {
final Assembler assmbler = new Assembler();
final ConfigurationFactory factory = new ConfigurationFactory();
final URL resource = AppPathsTest.class.getClassLoader().getResource("mixedcase");
final File file = URLs.toFile(resource);
final AppInfo appInfo = factory.configureApplication(file);
assertNotNull(appInfo);
assertEquals(1, appInfo.ejbJars.size());
final EjbJarInfo ejbJar = appInfo.ejbJars.get(0);
// was the footest.ejb-jar.xml picked up
assertEquals("EjbJar.enterpriseBeans", 1, ejbJar.enterpriseBeans.size());
}
use of org.apache.openejb.assembler.classic.AppInfo in project tomee by apache.
the class ApplicationPropertiesTest method testConflictingFiles.
/**
* A child module META-INF/application.properties sets color to white
* <p/>
* In the root ear META-INF/application.properties color is set to orange
* <p/>
* The root ear META-INF/application.properties wins
*
* @throws Exception
*/
public void testConflictingFiles() 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> moduleFiles = new HashMap<String, String>();
moduleFiles.put("META-INF/ejb-jar.xml", "<ejb-jar id=\"fooModule\"/>");
moduleFiles.put("META-INF/application.properties", "color=white");
final File module = Archives.jarArchive(moduleFiles, "fooModule", WidgetBean.class);
final Map<String, String> appFiles = new HashMap<String, String>();
appFiles.put("META-INF/application.xml", "" + "<application id=\"fooApp\">\n" + " <module>\n" + " <ejb>" + module.getName() + "</ejb>\n" + " </module>\n" + "</application>");
appFiles.put("META-INF/application.properties", "color=orange");
final File app = Archives.fileArchive(appFiles);
assertTrue(module.renameTo(new File(app, module.getName())));
final AppInfo appInfo = config.configureApplication(app);
assembler.createApplication(appInfo);
}
final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
assertContexts(containerSystem);
}
use of org.apache.openejb.assembler.classic.AppInfo in project tomee by apache.
the class ApplicationPropertiesTest method testOverrideReplace.
public void testOverrideReplace() 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("fooApp.color", "orange");
final Map<String, String> map = new HashMap<String, String>();
map.put("META-INF/ejb-jar.xml", "<ejb-jar id=\"fooModule\"/>");
map.put("META-INF/application.properties", "color=white");
final File module = Archives.fileArchive(map, WidgetBean.class);
final AppModule appModule = config.loadApplication(this.getClass().getClassLoader(), "fooApp", Arrays.asList(module));
final AppInfo appInfo = config.configureApplication(appModule);
assembler.createApplication(appInfo);
}
final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
assertContexts(containerSystem);
}
use of org.apache.openejb.assembler.classic.AppInfo in project tomee by apache.
the class ApplicationPropertiesTest method testOverrideUnprefixedVsPrefixedTomEE.
public void testOverrideUnprefixedVsPrefixedTomEE() 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("tomee.fooApp.color", "orange");
SystemInstance.get().getProperties().put("fooApp.color", "green");
final Map<String, String> map = new HashMap<String, String>();
map.put("META-INF/ejb-jar.xml", "<ejb-jar id=\"fooModule\"/>");
final File module = Archives.fileArchive(map, WidgetBean.class);
final AppModule appModule = config.loadApplication(this.getClass().getClassLoader(), "fooApp", Arrays.asList(module));
final AppInfo appInfo = config.configureApplication(appModule);
assembler.createApplication(appInfo);
}
final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
assertContexts(containerSystem);
}
Aggregations