Unit testing remote EJB bean with security
-
18-06-2021 - |
質問
This question is similar to Java EE declarative security, acquiring reference to a secured bean from application client but is more specific.
I can unit test my local beans with the Glassfish embedded container. For the remote beans I have written application clients. This was a viable solution until security was applied at the remote beans. Now I encountered the problem of authenticating an application client towards Glassfish 3.1.1.
The phenomenon:
- Testing the remote bean without security with an application client is all right.
- The approach to use security with the application of ProgrammaticLogin does not work and I am not sure it is the correct way to solve the issue in unit tests. (See the attached link at the beginning.)
Question:
- How do you think unit testing with security with remote beans should be done?
- Where does one need to place the glassfish-ejb-jar.xml? (Maybe this is erronous in my case and this is the reason that the ProgrammaticLogin does not work.)
解決
I continued to search for more information on the internet and I encountered the following blog: http://www-02.imixs.com/roller/ralphsjavablog/entry/junit_and_glassfish_3_1.
- It answers how to test EJB 3.1 on Glassfish 3.1.1 without any third party tool. It is a little tricky.
- The security settings I have not yet tried but there is also an example with regard to this.
所属していません StackOverflow