Hi maybe try "openejb.additional.include" property and pass module name (often jar prefix or folder name when using maven, with eclipse I guess it should be WebContent or my_apps_test). It supports a comma separated value (openejb.additional.include=mysuperdependency,WebContent,...) Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau
2014-11-04 21:19 GMT+00:00 slawek <[email protected]>: > Hello, > I'm going to add tests to my legacy application. I create simple test like: > > public class TestServices > { > private static EJBContainer container; > > @BeforeClass > public static void start() > { > Properties p = new Properties(); > p.put("log4j.category.OpenEJB", "debug"); > p.put("openejb.validation.output.level", "verbose"); > > //p.put("openejb.deployments.classpath.include", > "file:/d:/dev/workspace/my_apps_test/WebContent/WEB-INF/classes/"); > //p.put("openejb.deployments.classpath.include", > "file:/d:///dev/workspace/my_apps_test/WebContent/WEB-INF/classes/"); > //p.put("openejb.deployments.classpath.filter.descriptors", > "true"); > //p.put("openejb.deployments.classpath.exclude", ""); > > //connection to db > p.put("myTestDb", "new://Resource?type=DataSource"); > p.put("myTestDb.JdbcDriver", "oracle.jdbc.OracleDriver"); > p.put("myTestDb.JdbcUrl", > "dbc:oracle:thin:@unix_server:1521:mytestdb"); > p.put("myTestDb.UserName", "user"); > p.put("myTestDb.Password", "passwd"); > p.put("myTestDb.JtaManaged", "true"); > > container = EJBContainer.createEJBContainer(p); > } > > @AfterClass > public static void stop() > { > container.close(); > } > > @Test > public void sayHelloTest() throws NamingException > { > Context context = container.getContext(); > Services services = (Services) > context.lookup("java:global/WEB-INF/Services"); > > org.junit.Assert.assertEquals("Hello, I'm ejb", > services.sayHello()); > } > > @Test > public void znadzOsobeTest() throws NamingException > { > Context context = container.getContext(); > Services services = (Services) > context.lookup("java:global/WEB-INF/Services"); > > org.junit.Assert.assertEquals("Michael", > services.getLoginName("michaelLogin")); > } > } > > I start this test from eclipse, where tomee server (similar to production) > is set as Server Runtime and add to libraries. Now, when I start junit test > in eclipse, this tomee is using as server. Unfortunatelly this server has > some specific modification in libs according to internal sso framework. So I > would like to not use it in test, to avoid it I tried: > 1. use openejb.deployments.classpath.include and exclude (like i commend > code) to use only my modules - but it doesn't work - modules to tests are > not founded. > 2. change Server Runtime to antoher "clear" tomee instance in eclipse > project setting and then start test - this solution works. But I would like > to set path to server in my code, not to change it manually in eclipse. > > I was looking how to solve this problem few hours, but found nothing. > > Best Regards > sw > > > > > ----- > Best Regards > sw > -- > View this message in context: > http://tomee-openejb.979440.n4.nabble.com/EJBContainer-and-tests-tp4672761.html > Sent from the TomEE Users mailing list archive at Nabble.com.
