jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Lybarger" <Mark.Lybar...@CBC-Companies.com>
Subject how to mock TuxedoConnectionFactory for catus tests
Date Wed, 21 Apr 2004 13:24:37 GMT
I'd like to run my stateless session EJB tests w/o dependancy on the data returned from a tuxedo
call the EJB makes.  I'd like control in my tests over the data returned from the call.

There's two main objects being used: 
weblogic.wtc.gwt.TuxedoConnection, 
and weblogic.wtc.gwt.TuxedoConnectionFactory

My EJB's get the factory during their create from the IC as:

factory = ( TuxedoConnectionFactory ) new InitialContext().lookup( "tuxedo.services.TuxedoConnection"
);

(note, I'm not sure why it's getting a new IC here, as the setSessionContext has already been
called at the point of the ejbCreate, correct?)

Then, when it needs to make a call in a business method, it does so as:

connection = factory.getTuxedoConnection();
...
reply = connection.tpcall( "TuxedoServiceName", inputData, 0 );

The easy way seems to be to have the IC be able to give a MockTuxedoConnectionFactory during
my tests which return a MockConnection object, which returns the data I mock up.

I'm just not sure if it's possible from a ServletTestCase to be able to force this to happen?
 Any suggestions/ideas would be most appreciated.


Mime
View raw message