7 Replies Latest reply on May 18, 2011 6:22 AM by aslak

    Why is the Archive always deployed as test.war?

    mwtemple

      When I create a test and do something like this:

       

      @Deployment

         public static JavaArchive createTestArchive() {

            JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "MyTest.jar")

               .addClasses(TemperatureConverter.class)

               .addAsManifestResource(

                  EmptyAsset.INSTANCE,

                  ArchivePaths.create("beans.xml"));

       

            return archive;

         }

       

      It always deploys as test.war, not "MyTest.jar" shown above... I see:

      [org.jboss.profileservice.management.upload.remoting.DeployHandler] invoke, payload: {DeploymentTargetID=names=[test.war], clientAddress=/127.0.0.1}, parameter: start

        • 2. Re: Why is the Archive always deployed as test.war?
          rop

          Hi,

           

          I was also figuring over this "test.war" filename...

           

          Is it possible to change it to something else in your project-setup?

           

          If I have, for example, a build-server building several related projects in parallel using the jboss-remote-6 container, it seems there will be conflict-problems, if different project-builds try to deploy different "test.war" artifacts at the same time, wont it?

           

          Is there a way to resolve this?

          • 3. Why is the Archive always deployed as test.war?
            magnus.smith

            Have you tried setting the deployment name in @Deployment(name="..")

             

            I have not tried it with a jar deployment but when I create a war archive and set the deploymentExportPath in arquillian.xml then the war file produced is named in the following way

             

            _DEFAULT__ + 'Deployment Name' + 'Web archive name' .war

             

            where 'Deployment Name' is the one in @Deployment(name="..") and 'Web archive name' is the one specified in Shrinkwrap

            • 4. Why is the Archive always deployed as test.war?
              rop

              Hi Magnus,

               

              I tried your tip, and I can see that the war-file built in the target-directory get different names, as specified by @Deployment(name="..").

               

              But when it is deployed to JBoss, it still shows up in the JBoss deploy-directory as "test.war".

               

              Any further ideas?

               

               

              Magnus Smith wrote:

               

              Have you tried setting the deployment name in @Deployment(name="..")

               

              I have not tried it with a jar deployment but when I create a war archive and set the deploymentExportPath in arquillian.xml then the war file produced is named in the following way

               

              _DEFAULT__ + 'Deployment Name' + 'Web archive name' .war

               

              where 'Deployment Name' is the one in @Deployment(name="..") and 'Web archive name' is the one specified in Shrinkwrap

              • 5. Re: Why is the Archive always deployed as test.war?
                rop

                Still didnt find a solution to this...

                 

                Is there any way possible to have several parallell project-builds on a build-server (like Hudson) sharing a common JBoss-instance or installation for Arquillian-testing?

                Without getting a conflict on this filename "test.war"?

                • 6. Re: Why is the Archive always deployed as test.war?
                  aslak

                  test.war is the default name used by the Servlet Protocol when it needs to wrap the deployment to add the Arquillian Servlets for incontainer testing.

                  (this name should have been random, but due to some limitations in the EJBEnricher it's still hardcoded as test.war)

                   

                  In general terms Arquillian supports a Archive with any name, but for now, if you want to 'override' test.war, you need to define your @Deployment to be a WebArchive. That way the Servlet Protocol does not need to wrap the deployment but rather just add it self to it, and the original name will be used.

                   

                  ShrinkWrap.create(WebArchive.class) will generate a WebArchive with UUID + ".war" as name.

                  • 7. Re: Why is the Archive always deployed as test.war?
                    aslak

                    The @Deployment.name is only used for refering to a deployment using the manual Deployer api or targeting a @Test method to a specific Deployment when using multi deployment using @OperatesOnDeployment(name)