[jboss-user] [EJB 3.0] - Re: EJB3 unit tests, how?

wolfc do-not-reply at jboss.com
Wed Jun 3 14:17:48 EDT 2009


For AS 5.1 you can use the EJB 3.1 Embeddable prototype http://www.jboss.org/community/wiki/EJB31Embeddable

The latest version can also deploy datasources and JPA entities.
      Properties properties = new Properties();
  |       container = EJBContainer.createEJBContainer(properties);
  |       
  |       on(container).deploy(
  |             deployment(resource("explicit/ds-deployers-beans.xml")),
  |             deployment("default-ds",
  |                NonXADataSourceDeploymentMetaData.class,
  |                localDataSource()
  |                   .connectionURL("jdbc:hsqldb:mem:defaultdb")
  |                   .driverClass("org.jboss.ejb3.embedded.test.common.HSQLDBService")
  |                   .jndiName("java:/DefaultDS")
  |                   .user("sa")
  |                   .password("")
  |                   .getMetaData()
  |             ));
  | 
  |       on(container).deploy(
  |             deployment(
  |                   pkg("org.jboss.ejb3.embedded.test.stateless"), 
  |                   persistence(
  |                         unit("tempdb")
  |                            .jtaDataSource("java:/DefaultDS")
  |                            .property("hibernate.hbm2ddl.auto", "create-drop")
  |                            )));
  | 

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4235087#4235087

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4235087



More information about the jboss-user mailing list