[arquillian-issues] [JBoss JIRA] (ARQ-592) Bind CommandRunner to JNDI when GlassFish Embedded Container starts
Magnus Smith (Commented) (JIRA)
jira-events at lists.jboss.org
Tue Oct 11 05:55:16 EDT 2011
[ https://issues.jboss.org/browse/ARQ-592?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12633760#comment-12633760 ]
Magnus Smith commented on ARQ-592:
----------------------------------
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.
> Bind CommandRunner to JNDI when GlassFish Embedded Container starts
> -------------------------------------------------------------------
>
> Key: ARQ-592
> URL: https://issues.jboss.org/browse/ARQ-592
> Project: Arquillian
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Components: GlassFish Containers
> Reporter: Magnus Smith
> Assignee: Magnus Smith
>
> It would be really useful if the Glassfish CommandRunner could be bound to jndi when the embedded container is started.
>
> Looks like it would just be a case of adding
> {code:java|borderStyle=solid}
> CommandRunner commandRunner = glassfish.getCommandRunner();
> new InitialContext().bind("org.glassfish.embeddable.CommandRunner", commandRunner);
> {code}
>
>
> to the start method on the GlassfishContainer and then unbinding it on the stop method.
>
> Then in the test class we could use
> {code:java|borderStyle=solid}
> @Resource(mappedName = "org.glassfish.embeddable.CommandRunner")
> CommandRunner commandRunner;
> {code}
>
>
> This would open up all the glassfish admin commands from test classes.
> api [http://embedded-glassfish.java.net/nonav/apidocs/org/glassfish/embeddable/CommandRunner.html]
> asadmin [http://download.oracle.com/docs/cd/E18930_01/html/821-2416/giobi.html#scrolltoc]
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the arquillian-issues
mailing list