Hi Stephen,

the splitting of both implementations in src/main/java and src/test/java is clear. But the problem is how can i load the TestSessionManager instead of BusinessSessionManager
in my tests. Both implement SessionManagerLocal which is used by the beans.

I think they get both deployed, because they in the same project (different source folders).
So how can i guarantee that the tests use the TestSessionManager?

Ehm, this is much the same to your P.S. :-) But howto configure openejb? Is there a property / wiki or whatever. I don't know which search term to use (I did already but didn't find anything related)

Cheers
Per

I would refactor how you package up these things.

You would put the SessionManagerImpl in one module

You can then have SessionManagerTestImpl (because Test*.java and *Test.java
will be picked up by surefire as JUnit test cases) in src/test/java of the
module which uses SessionManager, and do not depend on the module with the
real SessionManagerImpl...

Then finally when you package everything up, as SessionManagerTestImpl is in
src/test/java then there is no fear of it being in your final EAR

-Stephen

P.S.

If you have more confidence you can configure openejb to wire up
SessionManagerTestImpl for the test cases where you need it and use
SessionManagerImpl for the test cases where you don't... you'd still keep
SessionManagerTestImpl in src/test/java, but you'd be relying on your
configuration of openejb to ensure that your test cases get the correct
SessionManager injected per their requirements (the advantage is that you
wouldn't end up with an EJB module per EJB ;-) )

On 18 February 2010 08:13, Per Newgro<[email protected]>  wrote:

Hi *,

this is not realy a openejb question but anyway.

I have following scenario. After login a "business"-session will be created
for userId
with language and current date in it (has nothing to do with http-sessions
or so).
The session is created by singleton bean SessionManager which is storing
the session
in a map. Internally the session manager sets the current date (new
Date()).
For testing issues i would like to preset the current date. But because the
session times
out after date change i can't manipulate it. So a setter for current date
is impossible.

What i would like to do is to exchange the session manager implementation
by a
test session manager implementation in which i could implement an
appripriate behavior
for test.

So how can i guarantee that my tests are using the TestSessionManager and
the business
client the SessionManager? Is there something like
"IgnoreBeanXYWhileDeployForMyTest"?

Cheers
Per


   *


Reply via email to