TestCase Dependency Injection via @LocalClient
----------------------------------------------
Key: OPENEJB-1024
URL: https://issues.apache.org/jira/browse/OPENEJB-1024
Project: OpenEJB
Issue Type: New Feature
Reporter: David Blevins
Assignee: David Blevins
Fix For: 3.1.1
Basic example:
@LocalClient
public class MoviesTest extends TestCase {
@EJB
private Movies movies;
@Resource
private UserTransaction userTransaction;
@PersistenceContext
private EntityManager entityManager;
public void setUp() throws Exception {
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
p.put("movieDatabase", "new://Resource?type=DataSource");
p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
InitialContext initialContext = new InitialContext(p);
// Here's the fun part
initialContext.bind("inject", this);
}
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.