4 Replies Latest reply on Nov 26, 2008 12:47 PM by Scott Stark

    InterceptorSimpleIfaceDeploymentTestCase

    Scott Stark Master

      I added a test of intercepting a bean which implements an interface, but I can't get the exact behavior I'm looking for. I want to only intercept the iPOJO interface methods on beans implementing iPOJO. To get interception I had to specify all methods on beans implementation iPOJO. The commented out interceptor element fails:

      <deployment xmlns="urn:jboss:bean-deployer:2.0">
      
       <bean name="AspectManager" class="org.jboss.aop.AspectManager">
       <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
       </bean>
      
       <interceptor xmlns="urn:jboss:aop-beans:1.0" class="org.jboss.test.microcontainer.beans.TestInterceptor"/>
       <!-- This works -->
       <bind xmlns="urn:jboss:aop-beans:1.0" pointcut="execution(* $instanceof{org.jboss.test.microcontainer.beans.iPOJO}->*(..))">
       <interceptor-ref name="org.jboss.test.microcontainer.beans.TestInterceptor"/>
       </bind>
       <!-- This does not work?
       <bind xmlns="urn:jboss:aop-beans:1.0" pointcut="execution(* $instanceof{org.jboss.test.microcontainer.beans.iPOJO}->$implements(org.jboss.test.microcontainer.beans.iPOJO))">
       <interceptor-ref name="org.jboss.test.microcontainer.beans.TestInterceptor"/>
       </bind>
       -->
      
       <bean name="Bean" class="org.jboss.test.microcontainer.beans.POJO"/>
      
      </deployment>
      


      I'm following the syntax from the ref guide:
      http://www.jboss.org/jbossaop/docs/2.0.0.GA/docs/aspect-framework/reference/en/html/pointcuts.html

      What's wrong with that expression or this usage?

      The test is in the jboss-aop-mc-int project as org.jboss.test.microcontainer.beans.test.InterceptorSimpleIfaceDeploymentTestCase