james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernd Fondermann" <bernd.fonderm...@googlemail.com>
Subject Re: Mocking LDAPServer
Date Fri, 22 Dec 2006 20:57:56 GMT
On 12/20/06, Norman Maurer <nm@byteaction.de> wrote:
> Hi all,
>
> anyone of you have an idea howto mock a ldapserver for
> UsersLDAPRepository tests? I not found any usefull information yet..
>  Maybe we can use apacheDS and start it from junit test. But im not sure..

That would not be a mock up. That would be testing apacheDS.

Maybe you could try the following:
make DirContext injectable into UsersLDAPRepository, so you don't have to use
   ctx = new InitialDirContext(env);
in method initialize() which is half the trick,
implement the DirContext as DirContextMock,
make all methods throw RuntimeException("not implemented for testing"),
only implement those which are called from UsersLDAPRepository
make setters to inject the needed result at test time (or return
hardcoded default if sufficient)
at setUp()-time, put all the required data into the mock
and test...

does that make sense?

  Bernd


>
> bye
> Norman
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message