JBoss Community

Re: Running AS7 embedded in Arquillian

created by Kabir Khan in JBoss AS7 Development - View the full discussion

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

Start a new discussion in JBoss AS7 Development at Community