3 Replies Latest reply on Dec 13, 2011 4:28 PM by Radoslav Husar

    Should @OperateOnDeployment + @ArquillianResource work on unmanaged deployments?

    Radoslav Husar Master

      Should it? The code is pretty much self explaining, the commented out /*  */ part does not work:

       

          @Test
          @InSequence(1)
          /*@OperateOnDeployment(DEPLOYMENT1)*/
          public void testGracefulSimpleFailover(/*@ArquillianResource(SimpleServlet.class) URL baseURL*/) throws IOException, InterruptedException {
              // Container is unmanaged, need to start manually.
              controller.start(CONTAINER1);
              deployer.deploy(DEPLOYMENT1);
      
      
              controller.start(CONTAINER2);
              deployer.deploy(DEPLOYMENT2);
      
      
              Thread.sleep(GRACE_TIME_TO_MEMBERSHIP_CHANGE);
      
      
              DefaultHttpClient client = new DefaultHttpClient();
      
      
              // ARQ-674 Ouch, second hardcoded URL will need fixing. ARQ doesnt support @OperateOnDeployment on 2 containers.
              String url1 = "http://127.0.0.1:8080/distributable/simple"; /* baseURL.toString() + "simple"; */
      

       

        testGracefulSimpleFailover(org.jboss.as.test.clustering.unmanaged.ClusteredWebFailoverTestCase): Provider for type class java.net.URL returned a null value: org.jboss.arquillian.container.test.impl.enricher.resource.URLResourceProvider@49d8c528

        • 1. Re: Should @OperateOnDeployment + @ArquillianResource work on unmanaged deployments?
          Aslak Knutsen Master

          You can't operate on a deployment you have not yet deployed (You can't assosiate your self with a deployment context that is not yet created)

           

          hmm, depending a bit on how the rest of the TestClass looks, you probably need to split this up in two @TestMethods.

           

           

              @Test
              @InSequence(1)
              public void testSetup() throws IOException, InterruptedException {
                  // Container is unmanaged, need to start manually.
                  controller.start(CONTAINER1);
                  deployer.deploy(DEPLOYMENT1);
          
          
                  controller.start(CONTAINER2);
                  deployer.deploy(DEPLOYMENT2);
              }
                  
              @Test
              @InSequence(2)
              @OperateOnDeployment(DEPLOYMENT1)
              public void testGracefulSimpleFailover(@ArquillianResource(SimpleServlet.class) URL baseURL) throws IOException, InterruptedException {
          
          
                  DefaultHttpClient client = new DefaultHttpClient();
          
          
                  // ARQ-674 Ouch, second hardcoded URL will need fixing. ARQ doesnt support @OperateOnDeployment on 2 containers.
                  String url1 = "http://127.0.0.1:8080/distributable/simple"; /* baseURL.toString() + "simple"; */
                  
              }
          
          
          • 2. Re: Should @OperateOnDeployment + @ArquillianResource work on unmanaged deployments?
            Aslak Knutsen Master

            Core Master branch has support for @OperateOnDeployment on @ArquillanResource, will be part of CR7 out at the end of the week:

             

             

                @Test
                public void test(@ArquillianResource @OperateOnDeployment("X") URL appX, @ArquillianResource @OperateOnDeployment("Z") URL appZ)
                {
                  ...
                }
            
            1 of 1 people found this helpful
            • 3. Re: Should @OperateOnDeployment + @ArquillianResource work on unmanaged deployments?
              Radoslav Husar Master

              Thanks Aslak, thats what I was after. It does make sense that you cant operate on the deployment which hasnt been deployed. At the same time theoretically you should be able to generate stuff like context URL prior to deployment, but I agree its far from systematic and consistence.

               

              I like the solution with CR7, so I ll redo the test once its out. I hope you ll update AS7 master with it :-)

               

              BTW Here is the concrete example if anyone is interested on this pull request:

              https://github.com/jbossas/jboss-as/pull/882

               

              Thanks,
              Rado