<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Re: Running AS7 embedded in Arquillian
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/kabir.khan%40jboss.com">Kabir Khan</a> in <i>JBoss AS7 Development</i> - <a href="http://community.jboss.org/message/572308#572308">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>I have got AS started up in arquillian using the embedded stuff I've been working on, the test class currently needs these annotations:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier;">@RunWith(Arquillian.<strong>class</strong>)</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier; color: #3400d4;">@Run(<em>AS_CLIENT</em>)</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier; color: #777777;">@ModuleTestSetup(</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier;">        testModule=@ModuleDef(</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier;">                name="test.module",</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier; color: #5b00ff;">                packages={@PackageResource(directory="target/classes", packages={"org.jboss.arquillian.container.jboss.embedded_7"}),</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier; color: #5b00ff;">                        @PackageResource(directory="target/test-classes", packages={"org.jboss.arquillian.container.test.jboss.embedded_7"})},</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier;">                dependencies= {@Dependency("javax.servlet.api")}),</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier;">        tcclModule=@ModuleDef (</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier;">                name="test.demos.tccl",</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier; color: #5b00ff;">                dependencies= {@Dependency("org.jboss.logging"), @Dependency("org.jboss.logmanager")})</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier;">)</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier;">@ClassFactory(JBossEmbeddedClassFactoryProvider.<strong>class</strong>)</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier;"><strong>public</strong> <strong>class</strong> JBossEmbeddedContainerTestCase</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier;">The @ClassFactory annotation is a signal to the Arquillian which now does this</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier;">   <strong>public</strong> Arquillian(Class<?> klass) <strong>throws</strong> InitializationError</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier;">   {</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier;">      <strong>super</strong>(<em>getTestClass</em>(klass));</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier;">      <strong>try</strong></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier;">      {</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier; color: #2e9670;">         // first time we're being initialized</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier;">         <strong>if</strong>(<em>deployableTest</em>.get() == <strong>null</strong>)</p><div> </div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier;">         ....</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier;">   }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier;">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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier;">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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier;">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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><div> </div></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/572308#572308">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss AS7 Development at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>