On Dec 28, 2006, at 2:34 AM, Mohammad Nour El-Din wrote:

Hi Dave...

Here are my thoughts regarding your dreams :), As you know the new JUnit framework supports annotated test cases, which means that you annotate the test case class that you want the framework's test runner to identify as test cases and run them, so my idea is to make use of this idea and create a customized test runner that checks for @EJB annotated fields and initialize
appropriately. This customized test runner will be initialized by the
appropriate properties by which it can create an initial context to use it
to lookup the required resources according to the available annotated
fields, this customized test runner will play like a very simple container
for test cases.

That's definitely a neat idea. It's essentially and app client container that runs test's instead of a "main" class.

I wonder if there's something we can do for environments like eclipse, intellij or maven that have their own test runners. Maybe it's kind of lame but we could have people pass us a reference to their test case instance in the initial context properties, e.g. something like:

    protected void setUp() throws Exception {
        Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory"); properties.set("openejb.<some-property-not-sure-what-to-call- it>", this);
        InitialContext ctx = new InitialContext(properties);
    }

In fact, the thing passed in doesn't even have to implement test case, could be any class someone wants us to inject references into.

-David


On 12/28/06, David Blevins <[EMAIL PROTECTED]> wrote:

Not sure how we'd pull it off, but it would be cool to have @EJB
injection for test cases.  Instead of test cases using JNDI to lookup
beans and then test them as we do now, the idea would be that the
test case need only have an @EJB annotation on a field.

Something like that would obviously require some deep hooks or a
specialized test runner or special test case class, but anyway ... a
guy can dream.

-David




--
Thanks
- Mohammad Nour

Reply via email to