The GlassFish LoginModules are not written to directly invoke the CallbackHandler to obtain username/password. Instead they are obtained from the Subject as a PasswordCredential. This is because they do not interface with the client directly.
BTW, may i know why you intend to test something like LDAPRealm of glassfish. This is a proprietary GF feature. I can understand other things such as annotations, depl-descriptors etc.
If you do want to test the LoginModule then you would have to mimic the way GlassFish runtime initializes them.
[Message sent by forum member 'kumarjayanti' (kumarjayanti)]
http://forums.java.net/jive/thread.jspa?messageID=316014