tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aede van der Weij (JIRA)" <j...@apache.org>
Subject [jira] Updated: (OPENEJB-1103) Inject fields in subclasses that extend class with LocalClient annotation.
Date Wed, 11 Nov 2009 14:17:39 GMT

     [ https://issues.apache.org/jira/browse/OPENEJB-1103?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Aede van der Weij updated OPENEJB-1103:
---------------------------------------

    Issue Type: Bug  (was: Improvement)

> Inject fields in subclasses that extend class with LocalClient annotation.
> --------------------------------------------------------------------------
>
>                 Key: OPENEJB-1103
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1103
>             Project: OpenEJB
>          Issue Type: Bug
>    Affects Versions: 3.1.2
>         Environment: openejb-core 3.1.2
> Maven version: 2.0.9
> Java version: 1.5.0_12
> OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
> testng 5.8
>            Reporter: Aede van der Weij
>            Priority: Minor
>
> I am not sure whether this is an improvement or a bug. The method org.apache.openejb.client.inject(Object)
will detect whether a class or super class has the annotation LocalClient. In case only the
super class is annotated the fields of the subclass are not injected.
> public abstract class MyBaseClass {
>   Context context;
>   @BeforeClass
>   public void initContainer() {
>     //do stuff
>     Properties props = new Properties();
>     	props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
>     	context = new InitialContext(props);
>   }
> }
> public class MyTest extends MyBaseClass {
>   @EJB
>   MyEjbLocal myEjbBean;
>   @Test
>   public void testMyEjb() {
>     Assert.assertNotNull(myEjbBean, "Expected a MyEjbLocal"); 
>   }
> }
> The above test will fail. I am using testng but this will also work with junit 4. My
first though was that this mechanism should be working, but either my assumptions are wrong
or the code could be improved.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message