[jboss-cvs] JBossAS SVN: r90406 - in projects/microcontainer/branches/Branch_2_0/kernel/src/test: resources/org/jboss/test/kernel/deployment/test and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jun 18 06:16:21 EDT 2009


Author: jaikiran
Date: 2009-06-18 06:16:21 -0400 (Thu, 18 Jun 2009)
New Revision: 90406

Added:
   projects/microcontainer/branches/Branch_2_0/kernel/src/test/java/org/jboss/test/kernel/deployment/support/container/InjectWrapperMethodAnnotationPlugin.java
Modified:
   projects/microcontainer/branches/Branch_2_0/kernel/src/test/java/org/jboss/test/kernel/deployment/support/container/TestSessionBean.java
   projects/microcontainer/branches/Branch_2_0/kernel/src/test/resources/org/jboss/test/kernel/deployment/test/BeanContainerInjectionTestCase.xml
Log:
JBKERNEL-35 Testcase updated to test for method level annotation plugins

Added: projects/microcontainer/branches/Branch_2_0/kernel/src/test/java/org/jboss/test/kernel/deployment/support/container/InjectWrapperMethodAnnotationPlugin.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/test/java/org/jboss/test/kernel/deployment/support/container/InjectWrapperMethodAnnotationPlugin.java	                        (rev 0)
+++ projects/microcontainer/branches/Branch_2_0/kernel/src/test/java/org/jboss/test/kernel/deployment/support/container/InjectWrapperMethodAnnotationPlugin.java	2009-06-18 10:16:21 UTC (rev 90406)
@@ -0,0 +1,46 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.kernel.deployment.support.container;
+
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.kernel.plugins.annotations.MethodAnnotationPlugin;
+
+/**
+ * InjectWrapperMethodAnnotationPlugin
+ *
+ * A {@link MethodAnnotationPlugin} for {@link Inject} annotation
+ * 
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class InjectWrapperMethodAnnotationPlugin extends MethodAnnotationPlugin<Inject>
+{
+
+   /**
+    * Constructor
+    */
+   public InjectWrapperMethodAnnotationPlugin()
+   {
+      super(Inject.class);
+   }
+
+}

Modified: projects/microcontainer/branches/Branch_2_0/kernel/src/test/java/org/jboss/test/kernel/deployment/support/container/TestSessionBean.java
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/test/java/org/jboss/test/kernel/deployment/support/container/TestSessionBean.java	2009-06-18 10:11:14 UTC (rev 90405)
+++ projects/microcontainer/branches/Branch_2_0/kernel/src/test/java/org/jboss/test/kernel/deployment/support/container/TestSessionBean.java	2009-06-18 10:16:21 UTC (rev 90406)
@@ -35,6 +35,9 @@
 
    @Inject(bean = KernelConstants.KERNEL_CONTROLLER_NAME)
    private Controller controller;
+   
+   // Will be injected by method level @Inject
+   private Controller oneMoreController;
 
    public void validate()
    {
@@ -42,5 +45,13 @@
          throw new RuntimeException("Other is null");
       if (controller == null)
          throw new RuntimeException("Controller is null");
+      if (oneMoreController == null)
+    	  throw new RuntimeException("Other controller is null - Method level @Inject did not work");
    }
+   
+   @Inject (bean = KernelConstants.KERNEL_CONTROLLER_NAME)
+   public void setOneMoreController(Controller cont)
+   {
+	   this.oneMoreController = cont;
+   }
 }

Modified: projects/microcontainer/branches/Branch_2_0/kernel/src/test/resources/org/jboss/test/kernel/deployment/test/BeanContainerInjectionTestCase.xml
===================================================================
--- projects/microcontainer/branches/Branch_2_0/kernel/src/test/resources/org/jboss/test/kernel/deployment/test/BeanContainerInjectionTestCase.xml	2009-06-18 10:11:14 UTC (rev 90405)
+++ projects/microcontainer/branches/Branch_2_0/kernel/src/test/resources/org/jboss/test/kernel/deployment/test/BeanContainerInjectionTestCase.xml	2009-06-18 10:16:21 UTC (rev 90406)
@@ -3,6 +3,8 @@
 <deployment xmlns="urn:jboss:bean-deployer:2.0">
 
   <bean name="InjectPlugin" class="org.jboss.test.kernel.deployment.support.container.InjectWrapperFieldAnnotationPlugin"/>
+  
+  <bean name="InjectMethodAnnotationPlugin" class="org.jboss.test.kernel.deployment.support.container.InjectWrapperMethodAnnotationPlugin"/>
 
   <bean name="EJBPlugin" class="org.jboss.test.kernel.deployment.support.container.EJBAnnotationPlugin">
     <property name="prefix">java:env/comp</property>




More information about the jboss-cvs-commits mailing list