Re: EJB3 Testing

"Petar Tahchiev" <[email protected]> Wed, 21 May 2008 14:25:17 +0300
Newsgroups gmane.comp.jakarta.cactus.user
Message-ID <[email protected]>
Hi Johannes,

sorry for my late response.
I am not sure if these threads will help you:

http://www.caucho.com/support/resin-interest/0506/0025.html
http://biese.wordpress.com/2008/02/20/how-to-call-ejb3-from-jsp-servlet-and-stand-alone-application/

HTH, Petar.

2008/5/21, Johannes Harms <[email protected]>:
>
> 1.) Can Cactus be used within an EJB3 / Java Enterprise 5 Environment?
>
> I guess, the answer given in the mailing list is also true for me, right?
> [quote Petar Tahchiev]:  First no, Cactus currently does not support J2EE
> 1.5.
> http://www.mail-archive.com/[email protected]/msg07439.html
>
> But then, does this mean Cactus is of no use for me?  I would not mind if
> Cactus is unable to start and stop Glassfish, or to undeploy and deploy my
> application, I can do this myself. I would be happy to have Cactus run
> inside my Glassfish container, and I could then run the tests by hand using
> my webbrowser.
>
> To demonstrate this possibility, I wrote a sample application using
> http://jakarta.apache.org/cactus/writing/howto_ejb_j2eeri.html and
> http://jakarta.apache.org/cactus/integration/integration_browser.html
> as guidelines. I can now call
> http://localhost:8080/Sukkulent-war/ServletTestRunner?suite=sukkulent.web.MyTestsuite&xsl=cactus-report.xsl and
> I get a nice report.
>
>
> 2.) How can my Cactus TestSuite get a reference to an EJB3 Session bean?
>
> Even though I am happy to have the above mentionned sample application
> running, I am still having difficulties. The one thing that is not working
> is this: My Cactus Testcase cannot reference my EJBs. The usual @EJB
> injection simply does not work...
>
> public class MyTestsuite extends ServletTestCase {
>    private MySessionBeanLocal mysessionbean;
>    // ...
>    @Override
>    public void setUp() {
>        // TODO: How can I get a reference to my EJB Session Bean?
>    }
>
>    public void testXXX() throws Exception {
>        assertNotNull(mysessionbean);
>    }
> }
>
> How can my Cactus Testcase get a reference to MySessionBean? I would
> preferably use the local interface since the rest of my application does not
> need remote interfaces... Please help!
>
>
>
>
>
>
> On 19.05.2008, at 22:32, Johannes Harms wrote:
>
>  Could you help me to find out if Cactus is right for me?
>>
>> (I am sorry if my questions seem stupid, please don't be offended! I am
>> new to Cactus and relatively new to the Java Enterprise World. I did search
>> through the mailing lists and I have read some of the documentation..)
>>
>> 1.) Does Cactus support EJB3 testing?
>> Can I run Cactus Tests inside the Glassfish server to test my EJBs?
>> Can I use the annotation-based Java Enterprise Dependency Injection to get
>> references to my EJBs? E.g could I inject @EJB private EJB myEJB; into my
>> Cactus test case? Although not necessary (I could use JNDI instead to lookup
>> the EJB), it would be very convenient.
>>
>> 2.) Given my situation, would you recommend Cactus?
>> For our project, we are using Glassfish, EJB3 and JSF to provide a
>> webbased interface for database-driven application. I am looking for a
>> solution to testing our EJB business logic (mainly EJB3 Entity Beans and
>> stateless Session Beans). Because the business logic EJBs make use of
>> dependency injection (injection of other EJBs, of the PersistenceContext and
>> the SessionContext), I would prefer the tests to run in the EJB component's
>> natural environment instead of a mocked test environment. This is how I came
>> to search for in-Container testing strategies and found the Cactus
>> Project...
>>
>> thank you and with kind regards,
>> Johannes (from Austria)
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
Regards, Petar!
Karlovo, Bulgaria.

EOOXML Objections
http://www.grokdoc.net/index.php/EOOXML_objections

Public PGP Key at:
https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611
Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611