Issue Details (XML | Word | Printable)

Key: OPENEJB-1024
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: David Blevins
Reporter: David Blevins
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
OpenEJB

TestCase Dependency Injection via @LocalClient

Created: 12/May/09 06:08 AM   Updated: 26/May/09 05:33 PM
Return to search
Component/s: None
Affects Version/s: None
Fix Version/s: 3.1.1

Time Tracking:
Not Specified

Issue Links:
Reference
 

Resolution Date: 26/May/09 05:33 PM


 Description  « Hide
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);
    }
}

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
David Blevins made changes - 12/May/09 06:12 AM
Field Original Value New Value
Link This issue relates to OPENEJB-1025 [ OPENEJB-1025 ]
David Blevins made changes - 26/May/09 05:33 PM
Resolution Fixed [ 1 ]
Status Open [ 1 ] Closed [ 6 ]