6 Replies Latest reply on Oct 6, 2010 5:58 PM by Dan Allen

    Problems encountered running Weld's tests-arquillian against the hierarchical deployment model in JBAS

    Marius Bogoevici Expert

      After moving from the flat deployment model in JBAS to the hierarchical model, a number of tests from tests-arquillian start failing

       

      One example is

      org.jboss.weld.tests.interceptors.ejb.EnterpriseBeanInterceptionTest.

       

      In this case, the arquillian deployment has the following structure:

       

      test.ear

      + lib/

      + <generated-name>.jar - contains META-INF/beans.xml and test classes

      + test.war

         +WEB-INF/lib/arquillian-protocol.jar

       

      In this deployment structure, a BDA will be created for the EJB-JAR, but not for test.war. As a result, a BeanManager is not injected in the test class, which ultimately fails with a NPE.

       

      A solution would be to simply add beans.xml to test.war/WEB-INF. I tried changing the deploy() method to:

       

      {code:java}@Deployment

      public static Archive<?> deploy() { return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")   .addModule(      ShrinkWrap.create(BeanArchive.class)         .intercept(Goalkeeper.class, Defender.class, Referee.class)         .addPackage(EnterpriseBeanInterceptionTest.class.getPackage())      )   .addModule(ShrinkWrap.create(WebArchive.class, "test.war").addWebResource(EmptyAsset.INSTANCE, "beans.xml")); }{code}

       

      but this does not seem to work: the generated test.war from within test.ear still does not contain the beans.xml file.