pull request https://github.com/arquillian/arquillian-container-glassfish/pull/5
I also have an idea of using this to develop an arquillian extension for embedded glassfish that would allow easy testing of ejbs requiring security roles against a jdbc realm in the embedded derby that is shipped with embedded glassfish.
The process would be
#1 Provide an annotation with parameters for realm name, username, password and a list of roles.
Process the annotation and set up the security realm before the test run :
#2 Use the commandRunner to create a jdbc connection pool using the embedded derby database.
#3 Use the commandRunner to create a datasource
#4 Use that data source to create the user and group tables
#5 Populate tables with user and roles from the annotation
#6 Use the commandRunner to create create-auth-realm
run the tests ....
There was a bug http://java.net/jira/browse/GLASSFISH-16277 in embedded glassfish that prevented asadmin commands requiring a password file to work.
This has been fixed now but is only available in glassfish 3.1.1 b07 onwards.
The problem at the moment is that the command create-auth-realm requires a password file and this does not work with the version of embedded glassfish 3.1 currently used arquillian.