1 Reply Latest reply on Jun 28, 2013 12:19 PM by aslak

    Auxiliary Archives in EAR or testable war? (Warp related)

    robert.panzer

      Hi Arquillian Devs,

       

      I am currently trying to get into Warp and stumbled upon the fact that EARs do not seem to be supported.

      If I am not totally wrong the reason is that the requests over the CommandBus are answered with 404.

       

      I've debugged into the code and found that the arquillian-warp.jar is added as a library to the ear instead of the war so that the servlet is not deployed. (Protocol is Servlet 3.0)

       

      In arquillian-core I've found this code in ServletDeploymentPackager and wondered why it should not be a good idea to add these archives to the war?

       

         private Archive<?> handleArchive(EnterpriseArchive applicationArchive, Collection<Archive<?>> auxiliaryArchives, JavaArchive protocol, Processor processor, TestDeployment testDeployment)

         {

            Map<ArchivePath, Node> applicationArchiveWars = applicationArchive.getContent(Filters.include(".*\\.war"));

            if(applicationArchiveWars.size() == 1)

            {

               ArchivePath warPath = applicationArchiveWars.keySet().iterator().next();

               try

               {

                  handleArchive(

                        applicationArchive.getAsType(WebArchive.class, warPath),

                        new ArrayList<Archive<?>>(), // reuse the War handling, but Auxiliary Archives should be added to the EAR, not the WAR ??? Why

                        protocol,

                        processor);

               }

               catch (IllegalArgumentException e)

               {

                  throw new IllegalArgumentException("Can not manipulate war's that are not of type " + WebArchive.class, e);

               }

            }

       

      I've tried adding the auxiliary jars to the embedded war and the warp test case worked with an ear!

       

      From a naive users point of view that makes sense as the test cases on the server are initiated in the embedded war.

       

      Does that make sense to you?

       

      If you think this approach is ok, I would like to prepare a pull request for this.

       

      Kind regards,

      Robert

        • 1. Re: Auxiliary Archives in EAR or testable war? (Warp related)
          aslak

          AuxilliaryArchives are mostly infrastructure classes, to have global access acorss multiple wars etc, we place them in ear/lib. With a war they are in WEB-INF/lib.

           

          I think Warp currently assumes it will be deployed in a War so it can use Servlet 3.0 web-fragment to be discovered by the container.

           

          It should hook in somewhere else to register that. Perhabs as a ProtocolProcessor.