[jboss-dev-forums] [JBoss AS7 Development] - Re: Running AS7 embedded in Arquillian

Kabir Khan do-not-reply at jboss.com
Mon Nov 22 17:44:10 EST 2010


Kabir Khan [http://community.jboss.org/people/kabir.khan%40jboss.com] created the discussion

"Re: Running AS7 embedded in Arquillian"

To view the discussion, visit: http://community.jboss.org/message/572308#572308

--------------------------------------------------------------
I have got AS started up in arquillian using the embedded stuff I've been working on, the test class currently needs these annotations:

@RunWith(Arquillian.*class*)
@Run(+AS_CLIENT+)
@ModuleTestSetup(
        testModule=@ModuleDef(
                name="test.module",
                packages={@PackageResource(directory="target/classes", packages={"org.jboss.arquillian.container.jboss.embedded_7"}),
                        @PackageResource(directory="target/test-classes", packages={"org.jboss.arquillian.container.test.jboss.embedded_7"})},
                dependencies= {@Dependency("javax.servlet.api")}),
        tcclModule=@ModuleDef (
                name="test.demos.tccl",
                dependencies= {@Dependency("org.jboss.logging"), @Dependency("org.jboss.logmanager")})
)
@ClassFactory(JBossEmbeddedClassFactoryProvider.*class*)
*public* *class* JBossEmbeddedContainerTestCase


The @ClassFactory annotation is a signal to the Arquillian which now does this

*public* Arquillian(Class<?> klass) *throws* InitializationError
   {
*super*(+getTestClass+(klass));
*try*
      {
         // first time we're being initialized
*if*(+deployableTest+.get() == *null*)
 
         ....
   }

The default behaviour of getTestClass() is to just return the original class. If @ClassFactory is there, it uses JBossEmbeddedClassFactoryProvider to set up the modules from @ModuleTestSetup, and then loads up the test class loaded from modules returns that. I need this hook, but how it is set up now was just a quick hack, so Aslak if you have any preferences on how to configure this please let me know.

I got around the java.util.logging.Logging issues by setting the tcclModule's classloader as the thread context classloader in JBossEmbeddedClassFactoryProvider.getTestClass() so it gets initialized properly.

I have not deployed anything yet but will look at that tomorrow along with tidying up the module setup, which I think when running in this framework is a bit too verbose at the moment. I am hoping that we can just define the dependencies for the test deployments and then to be able to generate each deployment's manifest.mf from the annotations.
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/572308#572308]

Start a new discussion in JBoss AS7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20101122/f229b0d9/attachment.html 


More information about the jboss-dev-forums mailing list