Hi Leanne,

Without knowing in detail your scenario and/or requirement, you can check
out  EJB injection examples here:
http://tomee.apache.org/tomee-8.0/examples/injection-of-ejbs.html
http://tomee.apache.org/tomee-8.0/examples/lookup-of-ejbs.html

The source of  each example you will find on TomEE website[1] can be
obtained here:
https://github.com/apache/tomee/tree/master/examples

[1] http://tomee.apache.org/tomee-8.0/examples/

El lun., 28 ene. 2019 a las 7:18, Leanne (<yklimem...@gmail.com>) escribió:

> Hi,
> I need to perform Junit test using OpenEjb and CDI, and have created below
> junit test class to inject MobileLocal and NetworkSwitch ejb, appreciate
> the
> advice for below queries.  Thanks in advance, Leanne
>
> 1) Am i right to say that i need to place a beans.xml file in
> src/main/resources/META-INF of my IDE (Eclipse) project folder, so that
> OpenEjb EJBContainer in test case class is able to search the ejb classes,
> i.e. when i run the Junit test case class ?
>
> 2) Do i need to generate the jar which contain below ejb classes and
> beans.xml in jar and place the jar in classpath, so that EJBcontainer able
> to search in classpath, or EjbContainer will search the ejb classes in
> target clasess folder in IDE project ?
>
> public class NewTest extends TestCase {
>     @EJB
>     private MobileLocal mobile;
>
>     @Before
>     public void setUp() throws Exception {
>         EJBContainer.createEJBContainer().getContext().bind("inject",
>         this);
>     }
> ...
> }
>
> @Stateless
> public class MobileLocal {
>
>     @Inject
>     private NetworkSwitch nwSwitch;
>
> ...
> }
>
>
>
> --
> Sent from:
> http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html
>


-- 
Atentamente:
César Hernández Mendoza.

Reply via email to