Hello!

I'm trying to write tests for my EJB3's that uses Java security roles and JAAS. 
When I run my tests, I get exceptions with "jaas not bound" since the 
embedded-ejb hasn't set up the JAAS stuff.

I found this wiki page:
http://wiki.jboss.org/wiki/Wiki.jsp?page=EmbeddedJaasSecurityManagerService

...that describes how to set up JAAS in embedded JBoss EJB3. I have added the 
jar into my classpath, but I don't know where to add the needed Java code.

I have tried to override "SeamTest.init" like this:

public void init() throws Exception {
    logger.debug("### MY INIT ###");
    EJB3StandaloneBootstrap.deployXmlResource("security-deployment.xml");
    super.init();
}

...but this gives me the following stack trace:

java.lang.NullPointerException
        at 
org.jboss.seam.contexts.WebApplicationContext.get(WebApplicationContext.java:47)
        at 
org.jboss.seam.contexts.WebApplicationContext.get(WebApplicationContext.java:80)
        at org.jboss.seam.core.Init.instance(Init.java:50)
        at org.jboss.seam.Component.getInstanceFromFactory(Component.java:1283)
        at org.jboss.seam.Component.getInstance(Component.java:1260)
        at org.jboss.seam.Component.getInstance(Component.java:1253)
        at org.jboss.seam.Component.getInstance(Component.java:1235)
        at org.jboss.seam.core.Manager.instance(Manager.java:303)
        at org.jboss.seam.contexts.Lifecycle.endSession(Lifecycle.java:187)
        at org.jboss.seam.mock.SeamTest.end(SeamTest.java:297)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:552)
        at 
org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:318)
        at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:152)
        at org.testng.internal.Invoker.invokeMethod(Invoker.java:483)
        at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:778)
        at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:105)
        at org.testng.TestRunner.privateRun(TestRunner.java:682)
        at org.testng.TestRunner.run(TestRunner.java:566)
        at org.testng.SuiteRunner.privateRun(SuiteRunner.java:220)
        at org.testng.SuiteRunner.run(SuiteRunner.java:146)
        at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:713)
        at org.testng.TestNG.runSuitesLocally(TestNG.java:676)
        at 
org.apache.maven.surefire.testng.TestNGExecutor.executeTestNG(TestNGExecutor.java:64)
        at 
org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at 
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:225)
        at 
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:747)

myFirstTest  Time elapsed: 0.182 sec  <<< FAILURE!
java.lang.RuntimeException: java.lang.IllegalArgumentException: Null kernel
        at 
org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.deployXmlResource(EJB3StandaloneBootstrap.java:95)
        at 
no.schibstedsok.wp.ejb3.entity.PersonCorrectionTest.init(PersonCorrectionTest.java:25)
        at 
no.schibstedsok.wp.ejb3.entity.PersonCorrectionTest.myFirstTest(PersonCorrectionTest.java:33)


What are the status on JAAS in SeamTests? Has anybody got it working or isn't 
SeamTest ready for it yet?

Thanks for advice :)

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3982636#3982636

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3982636
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to