I love @LocalClient, first of all.

I would like to suggest two things:

   1. Could you make LocalClient be inheritable?
   2. Whether you do that or not, could you make it so that if a unit test,
   say, that is annotated with @LocalClient does NOT at the moment have any
   @EJB or @Resource annotations--could you make it so that the build does not
   fail in this case?

Regarding #2, I have a TestCase that is annotated with @LocalClient.  I
haven't yet gotten around to putting in @EJB annotations.  I get a test
failure with the following stack:

javax.naming.NamingException: Unable to find injection meta-data for
foobar.TestCaseFoobar.  Ensure that class was annotated with
@org.apache.openejb.api.LocalClient and was successfully discovered and
deployed.  See http://openejb.apache.org/3.0/local-client-injection.html
    at
org.apache.openejb.client.LocalInitialContext.inject(LocalInitialContext.java:251)
    at
org.apache.openejb.client.LocalInitialContext.bind(LocalInitialContext.java:225)
    at javax.naming.InitialContext.bind(InitialContext.java:400)
    at
junit.openejb.AbstractOpenEJBTestCase.initializeContext(AbstractOpenEJBTestCase.java:104)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
    at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
    at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
    at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
    at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:165)
    at org.apache.maven.surefire.Surefire.run(Surefire.java:107)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:289)
    at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1005)

It seems like this scenario should be allowed.  Or perhaps this is
indicative of some other error?

Thanks,
Laird

Reply via email to