jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mahfouz, Ayman" <ayman.mahf...@citigroup.com>
Subject RE: Testing MDB
Date Mon, 24 May 2004 22:33:51 GMT
Sounds good except for that:
- JMS provides only interfaces, so he will have to fully implement the
message interface to be actually able to instantiate a message. A mock
implementation should do.
- If you are going to adopt this approach then you do not even need
Cactus. You can instantiate the MDB in a regular JUnit test and invoke
onMessage. Unless of course you are using other container resources like

-----Original Message-----
From: J. B. Rainsberger [mailto:jbrains@rogers.com] 
Sent: Monday, May 24, 2004 2:46 PM
To: Cactus Users List
Subject: Re: Testing MDB

Jayaraman.Dorai@transplace.com wrote:
> I have a message bean which creates a set of data in the database
> parsing the xml . In the setUp() the message is sent to this MDB. And
> the testXXX() I test to see if the records are properly created and in
> tearDown() those records created are deleted, so that the test data
in the
> xml is reusable.
> The problem is that when the testXXX() are being executed the MDB's
> might not have been done with the creation and so the test fails,
while the
> MDB did not fail at all.
> Is there any suggested approach to test this MDB? Reading the archive/
> documentation also did not help on how to code the above scenario. Is
> kind of testing possible or am I way off?
> Also, is there any documentation on how to use the JMSRedirector?

I don't recommend this approach.

Instead, create the appropriate Message object yourself, then simply 
invoke onMessage(). (If you need to, fake it.) Avoid sending the Message

through the EJB container to eliminate an unnecessary layer of

Good luck.
J. B. Rainsberger,
Diaspar Software Services
http://www.diasparsoftware.com :: +1 416 791-8603
Let's write software that people understand

To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-user-help@jakarta.apache.org

View raw message