5 Replies Latest reply on Apr 7, 2014 8:57 AM by asotobu

    Arquillian-extension-Moco

    asotobu

      Hello,

       

      I am developing an arquillian extension. Concretly I am developing the arquillian-extension-moco (https://github.com/arquillian/arquillian-extension-moco). This extension in summary contains a LoadableExtension which registers an ApplicationArchiveProcessor and ArchiveAppender in client side. Inside ArchiveAppender I am adding a RemoteLoadableExtension for container side.

       

      There is one test which tries to test the extension. The problem is that if I run in remote Wildfly or TomEE it works (an exception is thrown in Moco framework but is "normal"), but if I run in embed mode then RemoteLoadableExtension is not executed so extension doesn't work properly. There is no exception so it is not possible (or at least I can't) to know what is happening. For sure the problem is on the extension, but I don't know why it works in remote and not in embed.

       

      As note in pom.xml there is one profile for each mode. I will try to test with embed wildfly but maybe one of you can find anything that I am doing wrong.

       

      Thank you so much.

      Alex.

        • 1. Re: Arquillian-extension-Moco
          asotobu

          I have tried with Wildfly embedded and it works so could it be a problem with TomEE embed container? Any idea?

          • 2. Re: Arquillian-extension-Moco
            asotobu

            Romain Mani-Bucau has noted me that I will need to add <defaultProtocol type="Servlet 3.0" /> to make the embed mode working in arquillian.xml. Thank you so much

             

            Anyway is there any way to automatically add it and don't force users to add it manually?

            • 3. Re: Arquillian-extension-Moco
              kpiwko

              Glad that you finally resolved that! I've tried to view events via -Darquillian.debug, but I wasn't able to figure out something significant.

               

              Every container has a default protocol. WildFly was recently switched to have Servlet 3.0 as default. Embedded TomEE has Local as default:

               

              https://github.com/apache/tomee/blob/trunk/arquillian/arquillian-tomee-embedded/src/main/java/org/apache/openejb/arquillian/embedded/EmbeddedTomEEContainer.java

               

              Maybe that's something what could be changed, if you file a JIRA for TomEE ;-)

               

              Karel

              1 of 1 people found this helpful
              • 4. Re: Arquillian-extension-Moco
                asotobu

                Cool!! only one question that maybe you have found developing arquillian-spacelift. Moco under the covers it uses a Netty server which opens threads and socket connections. The problem is that it opens correctly, but when I stopped, next trace error is thrown: The web application [/a0831135-4abd-4cb7-87b5-32d087d03f0f] appears to have started a thread named [nioEventLoopGroup-3-4] but has failed to stop it. This is very likely to create a memory leak.

                 

                It happens with all containers. The funny thing is that if I debug it then it doesn't happen and of course if I run Moco outside container it works. I have opened an issue to Moco folks to see if they can offer some help but maybe you have found something similar which can clarify if I am doing something wrong.

                 

                Thank you so much.

                • 5. Re: Arquillian-extension-Moco
                  asotobu

                  For example it also works if I add a thread.sleep

                   

                  public void executeAfterClass(@Observes(precedence = 25) AfterClass afterClass) {

                  if(jsonRunner != null) {

                    try {

                         jsonRunner.stop();

                         Thread.sleep(3000);

                    }catch(Exception e) {

                         System.out.println("DE");

                    }

                  }

                  }

                   

                  so it seems netty takes some time asynchronously to kill the threads. Is there something from Arquillian part that can be done? Apart of sleeping the current thread of course.