use of org.apache.openejb.assembler.classic.Assembler in project tomee by apache.
the class AnnotationDeployerTest method badMainClassFormatTest.
@Test
public /**
* For https://issues.apache.org/jira/browse/OPENEJB-1063
*/
void badMainClassFormatTest() throws Exception {
final ConfigurationFactory config = new ConfigurationFactory();
final Assembler assembler = new Assembler();
final AppModule app = new AppModule(this.getClass().getClassLoader(), "test-app");
final ClientModule clientModule = new ClientModule(null, app.getClassLoader(), app.getJarLocation(), null, null);
// change "." --> "/" to check that main class is changed by the AnnotationDeployer
final String mainClass = MyMainClass.class.getName().replaceAll("\\.", "/");
clientModule.setMainClass(mainClass);
app.getClientModules().add(clientModule);
final AppInfo appInfo = config.configureApplication(app);
assembler.createApplication(appInfo);
final ClientInfo clientInfo = appInfo.clients.get(0);
Assert.assertNotNull(clientInfo);
Assert.assertEquals(MyMainClass.class.getName(), clientInfo.mainClass);
}
use of org.apache.openejb.assembler.classic.Assembler in project tomee by apache.
the class ApplicationPropertiesTest method test.
public void test() 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/application.properties", "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 ApplicationPropertiesTest 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("fooApp.color", "orange");
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);
}
use of org.apache.openejb.assembler.classic.Assembler in project tomee by apache.
the class ApplicationPropertiesTest method testOverrideUnprefixedVsPrefixedOpenEJB.
public void testOverrideUnprefixedVsPrefixedOpenEJB() 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("openejb.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);
}
use of org.apache.openejb.assembler.classic.Assembler in project tomee by apache.
the class ApplicationWideTest method testShouldCreateAResourceAndNotRemoveOnUndeploy.
public void testShouldCreateAResourceAndNotRemoveOnUndeploy() throws Exception {
final EjbModule ejbModule = new EjbModule(new EjbJar(), new OpenejbJar());
final EjbJar ejbJar = ejbModule.getEjbJar();
ejbJar.addEnterpriseBean(new StatelessBean(EchoBean.class));
final AppModule appModule = new AppModule(ejbModule);
final Container container = new Container();
container.setId("My Container");
container.setCtype("STATELESS");
container.getProperties().setProperty("ApplicationWide", "true");
appModule.getContainers().add(container);
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 AppInfo appInfo = config.configureApplication(appModule);
assembler.createApplication(appInfo);
{
final ContainerSystem containerSystem = assembler.getContainerSystem();
final org.apache.openejb.Container appContainer = containerSystem.getContainer(ejbModule.getModuleId() + "/My Container");
assertNotNull(appContainer);
}
assembler.destroyApplication(appInfo);
{
final ContainerSystem containerSystem = assembler.getContainerSystem();
final org.apache.openejb.Container appContainer = containerSystem.getContainer(ejbModule.getModuleId() + "/My Container");
assertNotNull(appContainer);
}
}
Aggregations