You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Aede van der Weij (JIRA)" <ji...@apache.org> on 2009/11/09 16:19:33 UTC
[jira] Created: (OPENEJB-1103) Inject fields in subclasses that
extend class with LocalClient annotation.
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: Improvement
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.
[jira] Updated: (OPENEJB-1103) Inject fields in subclasses that
extend class with LocalClient annotation.
Posted by "Aede van der Weij (JIRA)" <ji...@apache.org>.
[ 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.
[jira] Updated: (OPENEJB-1103) Inject fields in subclasses that
extend class with LocalClient annotation.
Posted by "Aede van der Weij (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENEJB-1103?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Aede van der Weij updated OPENEJB-1103:
---------------------------------------
Description:
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.
@LocalClient
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.
was:
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.
> 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.
> @LocalClient
> 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.