2 Replies Latest reply on Oct 3, 2012 2:58 AM by Charles Moulliard

    Place @Deployment in a different class

    Charles Moulliard Newbie



      I would like to know if it is possible to implement the following scenario. The @Deployment annotation is not added in the Junit Class containing CDI annotations and @Run(Arquillian.class) but in a subclass.


      Why : According to the container used to run the Unit Test, I would like to use a different archive (JAR, WAR, ....) with different librairies.


      Basically, we should have the parent class which will look like this :



      public class IntegrationTest {



          MyRoutes config;




          MockEndpoint result;



          public void integrationTest() throws Exception {





      and the @Deployment will be added in a subclass


      To test with Weld, we could create a Configurator class in a package "weld"


      public class Configurator extends IntegrationTest {


          @Deployment(testable = false)


          public static JavaArchive buildArchive() {


              JavaArchive jar =  ShrinkWrap.create(JavaArchive.class)





                      .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");


              return jar;



      and to test with JBossAS :


      public class Configurator extends IntegrationTest {




          public static Archive<?> createTestArchive() {


              JavaArchive jarTest = ShrinkWrap.create(JavaArchive.class)



                      .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");


              File[] libs = Maven.resolver()







              return ShrinkWrap

                      .create(WebArchive.class, "test.war")





      Unfortunately, if I create the project like that, it does not work


      Any ideas are welcome ?