[jboss-cvs] aop-mc-int/src/tests/org/jboss/test/microcontainer/support ...

Kabir Khan kkhan at jboss.com
Tue Jul 11 09:36:37 EDT 2006


  User: kkhan   
  Date: 06/07/11 09:36:37

  Modified:    src/tests/org/jboss/test/microcontainer/support     
                        InterceptorWithDependency.java
  Added:       src/tests/org/jboss/test/microcontainer/support     
                        InterceptorWithNestedAnnotationDependency.java
                        Containing.java NestedAnnotatedSimpleBeanImpl.java
                        Contained.java
  Log:
  [JBAOP-239] Tests for dependencies coming from nested annotations on class
  
  Revision  Changes    Path
  1.2       +4 -2      aop-mc-int/src/tests/org/jboss/test/microcontainer/support/InterceptorWithDependency.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: InterceptorWithDependency.java
  ===================================================================
  RCS file: /cvsroot/jboss/aop-mc-int/src/tests/org/jboss/test/microcontainer/support/InterceptorWithDependency.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- InterceptorWithDependency.java	17 Apr 2006 10:07:40 -0000	1.1
  +++ InterceptorWithDependency.java	11 Jul 2006 13:36:37 -0000	1.2
  @@ -27,13 +27,13 @@
    * A Interceptor with a dependency.
    * 
    * @author <a href="adrian at jboss.com">Adrian Brock</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public class InterceptorWithDependency extends AbstractInterceptor
   {
      public static SimpleBean intercepted = null;
      
  -   private static SimpleBean bean;
  +   private SimpleBean bean;
      
      public SimpleBean getSimpleBean()
      {
  @@ -49,7 +49,9 @@
      public Object invoke(Invocation invocation) throws Throwable
      {
         log.debug("InterceptorWithDependency: " + invocation);
  +      System.out.println("-----> bean " + bean);
         intercepted = bean;
  +      System.out.println("-----> intercepted " + intercepted);
         return invocation.invokeNext();
      }
   }
  
  
  
  1.1      date: 2006/07/11 13:36:37;  author: kkhan;  state: Exp;aop-mc-int/src/tests/org/jboss/test/microcontainer/support/InterceptorWithNestedAnnotationDependency.java
  
  Index: InterceptorWithNestedAnnotationDependency.java
  ===================================================================
  /*
    * JBoss, Home of Professional Open Source
    * Copyright 2005, JBoss Inc., and individual contributors as indicated
    * by the @authors tag. See the copyright.txt in the distribution for a
    * full listing of individual contributors.
    *
    * This is free software; you can redistribute it and/or modify it
    * under the terms of the GNU Lesser General Public License as
    * published by the Free Software Foundation; either version 2.1 of
    * the License, or (at your option) any later version.
    *
    * This software is distributed in the hope that it will be useful,
    * but WITHOUT ANY WARRANTY; without even the implied warranty of
    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    * Lesser General Public License for more details.
    *
    * You should have received a copy of the GNU Lesser General Public
    * License along with this software; if not, write to the Free
    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
    */
  package org.jboss.test.microcontainer.support;
  
  import org.jboss.aop.joinpoint.Invocation;
  import org.jboss.dependency.spi.Controller;
  
  /**
   * A Interceptor with a dependency from an annotation
   * 
   * @author <a href="adrian at jboss.com">Adrian Brock</a>
   * @version $Revision: 1.1 $
   */
  public class InterceptorWithNestedAnnotationDependency extends AbstractInterceptor
  {
     public static final String SRC_CLASS = "class";
     public static final String SRC_METHOD = "method";
  
     public static SimpleBean intercepted1 = null;
     public static SimpleBean intercepted2 = null;
     public static SimpleBean intercepted3 = null;
     
     private static Controller controller;
     
     public void setController(Controller controller)
     {
        this.controller = controller;
     }
  
     public Object invoke(Invocation invocation) throws Throwable
     {
        log.debug("InterceptorWithNestedAnnotationDependency: " + invocation);
        Containing annotation = (Containing) invocation.resolveClassAnnotation(Containing.class);
        if (annotation == null)
        {
           annotation = (Containing) invocation.resolveAnnotation(Containing.class);
        }
  
        if (annotation != null)
        {
           intercepted1 = (SimpleBean) controller.getInstalledContext(annotation.dependency().data()).getTarget();
           TestAnnotationDependency[] dependencies = annotation.contained().dependencies();
           intercepted2 = (SimpleBean) controller.getInstalledContext(dependencies[0].data()).getTarget();
           intercepted3 = (SimpleBean) controller.getInstalledContext(dependencies[1].data()).getTarget();
        }      
        return invocation.invokeNext();
     }
  }
  
  
  
  1.1      date: 2006/07/11 13:36:37;  author: kkhan;  state: Exp;aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Containing.java
  
  Index: Containing.java
  ===================================================================
  /*
  * JBoss, Home of Professional Open Source
  * Copyright 2005, JBoss Inc., and individual contributors as indicated
  * by the @authors tag. See the copyright.txt in the distribution for a
  * full listing of individual contributors.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */ 
  package org.jboss.test.microcontainer.support;
  
  import java.lang.annotation.Retention;
  import java.lang.annotation.RetentionPolicy;
  
  /**
   * 
   * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
   * @version $Revision: 1.1 $
   */
  @Retention(RetentionPolicy.RUNTIME)
  public @interface Containing {
     TestAnnotationDependency dependency();
     Contained contained();
  }
  
  
  
  1.1      date: 2006/07/11 13:36:37;  author: kkhan;  state: Exp;aop-mc-int/src/tests/org/jboss/test/microcontainer/support/NestedAnnotatedSimpleBeanImpl.java
  
  Index: NestedAnnotatedSimpleBeanImpl.java
  ===================================================================
  /*
  * JBoss, Home of Professional Open Source
  * Copyright 2005, JBoss Inc., and individual contributors as indicated
  * by the @authors tag. See the copyright.txt in the distribution for a
  * full listing of individual contributors.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */ 
  package org.jboss.test.microcontainer.support;
  
  /**
   * 
   * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
   * @version $Revision: 1.1 $
   */
  @Test
  @Containing(dependency=@TestAnnotationDependency(data="Dependency1"), contained=@Contained(dependencies= {@TestAnnotationDependency(data="Dependency2"), @TestAnnotationDependency(data="Dependency3")}))
  public class NestedAnnotatedSimpleBeanImpl extends SimpleBeanImpl
  {
  
  }
  
  
  
  1.1      date: 2006/07/11 13:36:37;  author: kkhan;  state: Exp;aop-mc-int/src/tests/org/jboss/test/microcontainer/support/Contained.java
  
  Index: Contained.java
  ===================================================================
  /*
  * JBoss, Home of Professional Open Source
  * Copyright 2005, JBoss Inc., and individual contributors as indicated
  * by the @authors tag. See the copyright.txt in the distribution for a
  * full listing of individual contributors.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */ 
  package org.jboss.test.microcontainer.support;
  
  import java.lang.annotation.Retention;
  import java.lang.annotation.RetentionPolicy;
  
  /**
   * 
   * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
   * @version $Revision: 1.1 $
   */
  @Retention(RetentionPolicy.RUNTIME)
  public @interface Contained {
     TestAnnotationDependency[] dependencies();
  }
  
  
  



More information about the jboss-cvs-commits mailing list