use of org.apache.openejb.jee.EjbJar$JAXB in project tomee by apache.
the class AutoConfigTest method testFirstMatching.
@Test
public void testFirstMatching() throws Exception {
final ConfigurationFactory cf = new ConfigurationFactory();
final AutoConfig ac = new AutoConfig(cf);
final AppModule appModule = new AppModule(new EjbModule(new EjbJar()));
for (final String s : list) {
appModule.getResources().add(new Resource(s, "DataSource"));
}
final AutoConfig.AppResources resources = new AutoConfig.AppResources(appModule, Collections.<ContainerInfo>emptyList());
final Method m = ac.getClass().getDeclaredMethod("firstMatching", String.class, String.class, Properties.class, AutoConfig.AppResources.class);
m.setAccessible(true);
for (final String s : list) {
final String prefix = s.substring(0, s.indexOf('/'));
final String result = (String) m.invoke(ac, prefix, "DataSource", new Properties(), resources);
Assert.assertTrue(result.startsWith(prefix));
}
String result = (String) m.invoke(ac, "abc-jkl-uvw-jkl-web", "DataSource", new Properties(), resources);
Assert.assertEquals("abc-jkl-uvw-jkl-web/jdbc/appmgr-jta", result);
result = (String) m.invoke(ac, "jdbc", "DataSource", new Properties(), resources);
Assert.assertEquals("jdbc/appmgr-jta", result);
}
use of org.apache.openejb.jee.EjbJar$JAXB 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.jee.EjbJar$JAXB in project tomee by apache.
the class ConfigurationFactoryTest method testConfigureApplicationEjbJar.
@Test
public void testConfigureApplicationEjbJar() throws OpenEJBException {
// Just to find out whether the validationDisabled message shows up
SystemInstance.get().setProperty(ConfigurationFactory.VALIDATION_SKIP_PROPERTY, "true");
final boolean offline = true;
final ConfigurationFactory factory = new ConfigurationFactory(offline);
final String id = "testConfigureApplicationEjbJar";
final EjbJar ejbJar = new EjbJar(id);
// no real classes engaged so disable metadata (annotation) processing
ejbJar.setMetadataComplete(true);
final EjbJarInfo info = factory.configureApplication(ejbJar);
// not much to assert
assertEquals(id, info.moduleName);
}
use of org.apache.openejb.jee.EjbJar$JAXB 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.jee.EjbJar$JAXB in project tomee by apache.
the class CheckNoBusinessMethodTest method noBusinessMethod.
@Keys({ @Key(value = "no.busines.method.case", count = 4), @Key(value = "no.busines.method.args", count = 4), @Key(value = "no.busines.method", count = 4) })
public EjbJar noBusinessMethod() throws OpenEJBException {
// System.setProperty("openejb.validation.output.level", "VERBOSE");
final EjbJar ejbJar = new EjbJar();
final StatelessBean stateLessLocal = new StatelessBean(FooStatelessSession.class);
stateLessLocal.setLocalHome("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooLocalHome");
stateLessLocal.setLocal("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooLocal");
final StatefulBean statefulLocal = new StatefulBean(FooStatefulSession.class);
statefulLocal.setLocalHome("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooLocalHome");
statefulLocal.setLocal("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooLocal");
final StatelessBean stateLessRemote = new StatelessBean(FooRemoteStatelessSession.class);
stateLessRemote.setHome("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooRemoteHome");
stateLessRemote.setRemote("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooRemote");
final StatefulBean statefulRemote = new StatefulBean(FooRemoteStatefulSession.class);
statefulRemote.setHome("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooRemoteHome");
statefulRemote.setRemote("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooRemote");
ejbJar.addEnterpriseBean(stateLessLocal);
ejbJar.addEnterpriseBean(statefulLocal);
ejbJar.addEnterpriseBean(stateLessRemote);
ejbJar.addEnterpriseBean(statefulRemote);
return ejbJar;
}
Aggregations