3 Replies Latest reply on Nov 18, 2011 1:26 PM by gvagenas

    Problem with observer service

    gvagenas

      Based on the Lifecycle extension from showcase, i have an extension that provides @BeforeDeploy.

       

      I register the class that implements LoadbleExtension with org.jboss.arquillian.core.spi.LoadableExtension at the META-INF/services and i can see on debuging that the observer is registered on the extensions.

       

      I am testing with tomcat-embedded-6 and my test case creates a web archive with:

      1. a servlet class
      2. weld-servlet 1.1.2.Final artifact
      3. proper web.xml (defines the servlet and the weld listener)
      4. proper context.xml (defines the BeanManager)
      5. beans.xml

       

      So even though the setup seems ok to me, i have a method in my test case class which is annotated with @BeforeDeploy but is never get called.

       

      Any idea on what could be wrong over here?

       

      Is there documentation for the SPI provided be Arquillian?

       

      Regards

      George

        • 1. Re: Problem with observer service
          gvagenas

          Further debugging on the issue revealed that in the method that observes for BeforeDeploy event

          public void executeBeforeDeploy(@Observes BeforeDeploy event, TestClass testClass) never gets invoked because the type

          TestClass cannot be resolved in any of the active context, specificaly the method org.jboss.arquillian.core.impl.ManagerImpl.resolve(Class<T>) returns null when trying to resolve org.jboss.arquillian.test.spi.TestClass so method  org.jboss.arquillian.core.impl.ObserverImpl.invoke(Manager, Object) doesn't invoke the observer's method, since arguments contain null.

           

          The test class of my project is registered in the active context org.jboss.arquillian.test.impl.context.ClassContextImpl

           

          Do you think this is a bug or something is configured wrong from my side?

          • 2. Re: Problem with observer service
            aslak

            Your using CR5 I would assume. The exposure of TestClass in the ClassContext is not currently released, it's fixed in the master branch.

             

            https://github.com/arquillian/arquillian-core/commit/36280458801ede978cf8d75cdae5609c1cb884bf

            • 3. Re: Problem with observer service
              gvagenas

              You are right that was the issue, now its working fine.

               

              Thanks

              George