3 Replies Latest reply on Apr 5, 2006 10:04 AM by Adrian Brock

    Advisor tests

    Adrian Brock Master

      Got another error for you fix :-)

      2006-03-29 16:09:43,511 DEBUG [org.jboss.test.microcontainer.advisor.test.MicrocontainerAdvisedInstanceAdvisorTestCase] ==== setUp org.jboss.test.microcontainer.advisor.test.MicrocontainerAdvisedInstanceAdvisorTestCase ====
      2006-03-29 16:09:43,744 DEBUG [org.jboss.kernel.KernelFactory] Starting JBoss Kernel construction...
      2006-03-29 16:09:44,959 DEBUG [org.jboss.kernel.KernelFactory] Completed JBoss Kernel construction. Duration: 1214 milliseconds
      2006-03-29 16:09:45,216 DEBUG [org.jboss.test.microcontainer.advisor.test.MicrocontainerAdvisedInstanceAdvisorTestCase] Deploying file:/home/ejort/jboss-head/aspects/src/resources/org/jboss/test/microcontainer/advisor/test/MicrocontainerAdvisedInstanceAdvisorTestCase-aop.xml
      2006-03-29 16:09:45,363 DEBUG [org.jboss.test.microcontainer.advisor.test.MicrocontainerAdvisedInstanceAdvisorTestCase] Deploying file:/home/ejort/jboss-head/aspects/src/resources/org/jboss/test/microcontainer/advisor/test/MicrocontainerAdvisedInstanceAdvisorTestCase.xml
      2006-03-29 16:09:48,613 DEBUG [org.jboss.aop.microcontainer.prototype.Aspect] Bound aspect InterceptedAdvice
      2006-03-29 16:09:48,613 DEBUG [org.jboss.aop.microcontainer.prototype.Aspect] Enabling lazy aspect
      2006-03-29 16:09:48,625 DEBUG [org.jboss.aop.microcontainer.prototype.AspectBinding] Bound binding 3j001-awsa7w-eldsp4t7-1-eldsp4uk-3
      2006-03-29 16:09:49,105 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Instantiated: name=Test state=Described
      java.lang.ClassCastException: org.jboss.aop.ClassInstanceAdvisor
       at org.jboss.aop.microcontainer.prototype.AOPMetaDataContext.setTarget(AOPMetaDataContext.java:266)
       at org.jboss.kernel.plugins.dependency.KernelControllerContextActions$InstantiateAction.installAction(KernelControllerContextActions.java:389)
       at org.jboss.kernel.plugins.dependency.KernelControllerContextActions$KernelControllerContextAction.install(KernelControllerContextActions.java:175)
       at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
       at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:226)
       at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:593)
       at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:346)
       at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:438)
       at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:379)
       at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:225)
       at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:151)
       at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBean(AbstractKernelDeployer.java:291)
       at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBeans(AbstractKernelDeployer.java:261)
       at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deploy(AbstractKernelDeployer.java:117)
       at org.jboss.kernel.plugins.deployment.BasicKernelDeployer.deploy(BasicKernelDeployer.java:64)
       at org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer.deploy(BasicXMLDeployer.java:77)
       at org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer.deploy(BasicXMLDeployer.java:146)
       at org.jboss.test.kernel.junit.MicrocontainerTestDelegate.deploy(MicrocontainerTestDelegate.java:182)
       at org.jboss.test.kernel.junit.MicrocontainerTestDelegate.deploy(MicrocontainerTestDelegate.java:253)
       at org.jboss.aop.microcontainer.junit.AOPMicrocontainerTestDelegate.deploy(AOPMicrocontainerTestDelegate.java:65)
       at org.jboss.test.kernel.junit.MicrocontainerTestDelegate.setUp(MicrocontainerTestDelegate.java:76)
       at org.jboss.test.AbstractTestSetup.setUp(AbstractTestSetup.java:57)
      


        • 1. Re: Advisor tests
          Kabir Khan Master

          This test passes if I

          a) update the Aspect to be "injection style" (or add the install stuff to the beanfactory)

          b) use the aop 2 weaving mode.

          I will see about getting it working with the old school weaving as well

          • 2. Re: Advisor tests
            Kabir Khan Master

            This one has been fixed. I reuse the advised class's ClassAdvisor for the proxy instead of creating a new advisor. Also, I make sure that the invocation gets set up to call the internal copy of the original method on the target instance and not the wrapper method with the original name, so that we avoid double invocations.

            • 3. Re: Advisor tests
              Adrian Brock Master

              Thanks, I added a couple of tests for introductions.
              I'm not sure I got the incantention correct, since both fail. :-)

              However, it seems to be recognising it, since if I add the following
              to the advised test it goes into a loop followed by a stack overflow.

               <introduction expr="has(* org.jboss.test.microcontainer.advisor.test.TestObject->*(..))">
               <interfaces>org.jboss.test.microcontainer.advisor.test.TestIntroductionInterface</interfaces>
               </introduction>