use of org.apache.openejb.assembler.classic.OpenEjbConfiguration in project tomee by apache.
the class ConfigurationFactoryTest method testConfigurationFactoryBooleanDynamicDeployerOpenEjbConfiguration.
@Test
public void testConfigurationFactoryBooleanDynamicDeployerOpenEjbConfiguration() throws OpenEJBException {
final boolean offline = false;
final DynamicDeployer dynamicDeployer = null;
final OpenEjbConfiguration openEjbConfiguration = new OpenEjbConfiguration();
final ConfigurationFactory factory = new ConfigurationFactory(offline, dynamicDeployer, openEjbConfiguration);
assertEquals(openEjbConfiguration, factory.getOpenEjbConfiguration());
}
use of org.apache.openejb.assembler.classic.OpenEjbConfiguration in project tomee by apache.
the class DeploymentsElementTest method deploymentsFile_Jars_Order.
/**
* <Deployments dir="myapps"/>
* <p/>
* Two ejb jars
* <p/>
* Order should be guaranteed to be the same as
* they are declared in the openejb.xml
* <p/>
* To test, the jars are named intentionally in an order
* that would naturally sort to be the reverse.
*
* @throws Exception
*/
@Test
public void deploymentsFile_Jars_Order() throws Exception {
final Server server = new Server();
{
// Jar one
final File jar = server.deploymentsFile("2000.jar");
Archives.jarArchive(jar, null, Yellow.class);
}
{
// Jar two
final File jar = server.deploymentsFile("1000.jar");
Archives.jarArchive(jar, null, Orange.class);
}
final OpenEjbConfiguration configuration = server.init();
assertEquals(2, configuration.containerSystem.applications.size());
assertEquals("2000", configuration.containerSystem.applications.get(0).appId);
assertEquals("1000", configuration.containerSystem.applications.get(1).appId);
final AppInfo yellow = configuration.containerSystem.applications.get(0);
assertEquals(1, yellow.ejbJars.size());
assertEquals(1, yellow.ejbJars.get(0).enterpriseBeans.size());
assertEquals("Yellow", yellow.ejbJars.get(0).enterpriseBeans.get(0).ejbName);
final AppInfo orange = configuration.containerSystem.applications.get(1);
assertEquals(1, orange.ejbJars.size());
assertEquals(1, orange.ejbJars.get(0).enterpriseBeans.size());
assertEquals("Orange", orange.ejbJars.get(0).enterpriseBeans.get(0).ejbName);
}
use of org.apache.openejb.assembler.classic.OpenEjbConfiguration in project tomee by apache.
the class DeploymentsElementTest method deploymentsDir_Ear_Unpacked_ApplicationXml.
/**
* <Deployments dir="myapps"/>
* <p/>
* EAR file extracted
* Application.xml
*
* @throws Exception
*/
@Test
public void deploymentsDir_Ear_Unpacked_ApplicationXml() throws Exception {
final Server server = new Server();
final File apps = server.deploymentsDir("myapps");
final String appName = "deploymentsDir_Ear_Unpacked_ApplicationXml";
final File ear = new File(server.getBase(), appName + ".ear");
{
final Map<String, Object> contents = new HashMap<String, Object>();
contents.put("foo.jar", Archives.jarArchive(Orange.class));
contents.put("META-INF/application.xml", "<application><module><ejb>foo.jar</ejb></module></application>");
Archives.jarArchive(ear, contents);
}
Zips.unzip(ear, Files.mkdir(apps, appName));
final OpenEjbConfiguration configuration = server.init();
assertEquals(1, configuration.containerSystem.applications.size());
assertEquals(1, configuration.containerSystem.applications.get(0).ejbJars.size());
assertEquals(1, configuration.containerSystem.applications.get(0).ejbJars.get(0).enterpriseBeans.size());
assertEquals("Orange", configuration.containerSystem.applications.get(0).ejbJars.get(0).enterpriseBeans.get(0).ejbName);
}
use of org.apache.openejb.assembler.classic.OpenEjbConfiguration in project tomee by apache.
the class DeploymentsElementTest method invalidFile_notAFile.
@Test
public void invalidFile_notAFile() throws Exception {
exceptions.expect(RuntimeException.class);
exceptions.expectMessage("Deployments file=");
exceptions.expectMessage("Not a file");
exceptions.expectMessage("myapp.jar");
final Server server = new Server();
final File file = server.deploymentsFile("myapp.jar");
Files.delete(file);
Files.mkdir(file);
final OpenEjbConfiguration configuration = server.init();
assertEquals(0, configuration.containerSystem.applications.size());
}
use of org.apache.openejb.assembler.classic.OpenEjbConfiguration in project tomee by apache.
the class DeploymentsElementTest method invalidDir_doesNotExist.
/**
* We do not treat this as a failure case due to backwards compatibility
*
* @throws Exception
*/
@Test
public void invalidDir_doesNotExist() throws Exception {
final Server server = new Server();
final File dir = server.deploymentsDir("myapps");
Files.delete(dir);
final OpenEjbConfiguration configuration = server.init();
assertEquals(0, configuration.containerSystem.applications.size());
}
Aggregations