[jboss-cvs] JBossAS SVN: r101337 - in projects/kernel/branches/jsr330/kernel/src: test/java/org/jboss/test/kernel and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Feb 23 12:09:40 EST 2010
Author: kabir.khan at jboss.com
Date: 2010-02-23 12:09:39 -0500 (Tue, 23 Feb 2010)
New Revision: 101337
Added:
projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/
projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/
projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/Bean.java
projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanA.java
projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanB.java
projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableConstructorAndParameter.java
projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableConstructorAndQualifiedParameter.java
projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableConstructorNoParameters.java
projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableField.java
projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableMethod.java
projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableMethodAndQualifiedParameter.java
projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableProperty.java
projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectablePropertyQualifiedOnParameter.java
projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectablePropertyQualifiedOnSetter.java
projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableQualifiedField.java
projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/QualifierA.java
projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/QualifierB.java
projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/SomeAnnotation.java
projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/test/
projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/test/Jsr330TestCase.java
Modified:
projects/kernel/branches/jsr330/kernel/src/main/java/org/jboss/kernel/plugins/annotations/BasicBeanAnnotationAdapter.java
Log:
@javax.inject.Inject support
Modified: projects/kernel/branches/jsr330/kernel/src/main/java/org/jboss/kernel/plugins/annotations/BasicBeanAnnotationAdapter.java
===================================================================
--- projects/kernel/branches/jsr330/kernel/src/main/java/org/jboss/kernel/plugins/annotations/BasicBeanAnnotationAdapter.java 2010-02-23 16:20:15 UTC (rev 101336)
+++ projects/kernel/branches/jsr330/kernel/src/main/java/org/jboss/kernel/plugins/annotations/BasicBeanAnnotationAdapter.java 2010-02-23 17:09:39 UTC (rev 101337)
@@ -25,6 +25,7 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+
/**
* Basic bean annotation handler.
*
@@ -64,6 +65,7 @@
*/
// constructor
addAnnotationPlugin(new ConstructorParameterAnnotationPlugin(adapters));
+ addAnnotationPlugin(new Jsr330InjectConstructorAnnotationPlugin(adapters));
// property
addAnnotationPlugin(InjectAnnotationPlugin.INSTANCE);
addAnnotationPlugin(StringValueAnnotationPlugin.INSTANCE);
@@ -78,6 +80,7 @@
addAnnotationPlugin(MapValueAnnotationPlugin.INSTANCE);
addAnnotationPlugin(PropertyInstallCallbackAnnotationPlugin.INSTANCE);
addAnnotationPlugin(PropertyUninstallCallbackAnnotationPlugin.INSTANCE);
+ addAnnotationPlugin(Jsr330InjectAnnotationPlugin.INSTANCE);
// method
addAnnotationPlugin(new FactoryMethodAnnotationPlugin(adapters));
addAnnotationPlugin(new CreateLifecycleAnnotationPlugin(adapters));
@@ -88,11 +91,13 @@
addAnnotationPlugin(new MethodUninstallCallbackAnnotationPlugin());
addAnnotationPlugin(new InstallMethodParameterAnnotationPlugin(adapters));
addAnnotationPlugin(new UninstallMethodParameterAnnotationPlugin(adapters));
+ addAnnotationPlugin(new Jsr330InjectMethodAnnotationPlugin(adapters));
// field
addAnnotationPlugin(InjectFieldAnnotationPlugin.INSTANCE);
addAnnotationPlugin(ValueFactoryFieldAnnotationPlugin.INSTANCE);
addAnnotationPlugin(InstallFieldCallbackAnnotationPlugin.INSTANCE);
addAnnotationPlugin(UninstallFieldCallbackAnnotationPlugin.INSTANCE);
+ addAnnotationPlugin(new Jsr330InjectFieldAnnotationPlugin());
//Qualifiers
addMetaAnnotationPlugin(SuppliedQualifierAnnotationPlugin.INSTANCE);
Added: projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/Bean.java
===================================================================
--- projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/Bean.java (rev 0)
+++ projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/Bean.java 2010-02-23 17:09:39 UTC (rev 101337)
@@ -0,0 +1,32 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.jsr330.support;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class Bean
+{
+
+}
Added: projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanA.java
===================================================================
--- projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanA.java (rev 0)
+++ projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanA.java 2010-02-23 17:09:39 UTC (rev 101337)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.jsr330.support;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at QualifierA
+public class BeanA extends Bean
+{
+
+}
Added: projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanB.java
===================================================================
--- projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanB.java (rev 0)
+++ projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanB.java 2010-02-23 17:09:39 UTC (rev 101337)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.jsr330.support;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at QualifierB
+public class BeanB extends Bean
+{
+
+}
Added: projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableConstructorAndParameter.java
===================================================================
--- projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableConstructorAndParameter.java (rev 0)
+++ projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableConstructorAndParameter.java 2010-02-23 17:09:39 UTC (rev 101337)
@@ -0,0 +1,51 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.jsr330.support;
+
+import javax.inject.Inject;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class BeanWithInjectableConstructorAndParameter
+{
+ Bean bean;
+
+ public BeanWithInjectableConstructorAndParameter()
+ {
+ }
+
+ @Inject
+ public BeanWithInjectableConstructorAndParameter(Bean bean)
+ {
+ this.bean = bean;
+ }
+
+
+ public Bean getBean()
+ {
+ return bean;
+ }
+
+}
Added: projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableConstructorAndQualifiedParameter.java
===================================================================
--- projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableConstructorAndQualifiedParameter.java (rev 0)
+++ projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableConstructorAndQualifiedParameter.java 2010-02-23 17:09:39 UTC (rev 101337)
@@ -0,0 +1,51 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.jsr330.support;
+
+import javax.inject.Inject;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class BeanWithInjectableConstructorAndQualifiedParameter
+{
+ Bean bean;
+
+ public BeanWithInjectableConstructorAndQualifiedParameter()
+ {
+ }
+
+ @Inject
+ public BeanWithInjectableConstructorAndQualifiedParameter(@QualifierA Bean bean)
+ {
+ this.bean = bean;
+ }
+
+
+ public Bean getBean()
+ {
+ return bean;
+ }
+
+}
Added: projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableConstructorNoParameters.java
===================================================================
--- projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableConstructorNoParameters.java (rev 0)
+++ projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableConstructorNoParameters.java 2010-02-23 17:09:39 UTC (rev 101337)
@@ -0,0 +1,43 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.jsr330.support;
+
+import javax.inject.Inject;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class BeanWithInjectableConstructorNoParameters
+{
+ @Inject
+ public BeanWithInjectableConstructorNoParameters()
+ {
+
+ }
+
+ public BeanWithInjectableConstructorNoParameters(Bean bean)
+ {
+
+ }
+}
Added: projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableField.java
===================================================================
--- projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableField.java (rev 0)
+++ projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableField.java 2010-02-23 17:09:39 UTC (rev 101337)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.jsr330.support;
+
+import javax.inject.Inject;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class BeanWithInjectableField
+{
+ @Inject
+ public Bean bean;
+}
Added: projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableMethod.java
===================================================================
--- projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableMethod.java (rev 0)
+++ projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableMethod.java 2010-02-23 17:09:39 UTC (rev 101337)
@@ -0,0 +1,45 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.jsr330.support;
+
+import javax.inject.Inject;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class BeanWithInjectableMethod
+{
+ Bean bean;
+
+ public Bean getBean()
+ {
+ return bean;
+ }
+
+ @Inject
+ public void install(Bean bean)
+ {
+ this.bean = bean;
+ }
+}
Added: projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableMethodAndQualifiedParameter.java
===================================================================
--- projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableMethodAndQualifiedParameter.java (rev 0)
+++ projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableMethodAndQualifiedParameter.java 2010-02-23 17:09:39 UTC (rev 101337)
@@ -0,0 +1,45 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.jsr330.support;
+
+import javax.inject.Inject;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class BeanWithInjectableMethodAndQualifiedParameter
+{
+ Bean bean;
+
+ public Bean getBean()
+ {
+ return bean;
+ }
+
+ @Inject
+ public void install(@QualifierA Bean bean)
+ {
+ this.bean = bean;
+ }
+}
Added: projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableProperty.java
===================================================================
--- projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableProperty.java (rev 0)
+++ projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableProperty.java 2010-02-23 17:09:39 UTC (rev 101337)
@@ -0,0 +1,47 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.jsr330.support;
+
+import javax.inject.Inject;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class BeanWithInjectableProperty
+{
+ private Bean bean;
+
+ public Bean getBean()
+ {
+ return bean;
+ }
+
+ @Inject
+ public void setBean(Bean bean)
+ {
+ this.bean = bean;
+ }
+
+
+}
Added: projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectablePropertyQualifiedOnParameter.java
===================================================================
--- projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectablePropertyQualifiedOnParameter.java (rev 0)
+++ projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectablePropertyQualifiedOnParameter.java 2010-02-23 17:09:39 UTC (rev 101337)
@@ -0,0 +1,47 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.jsr330.support;
+
+import javax.inject.Inject;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class BeanWithInjectablePropertyQualifiedOnParameter
+{
+ private Bean bean;
+
+ public Bean getBean()
+ {
+ return bean;
+ }
+
+ @Inject
+ public void setBean(@QualifierA Bean bean)
+ {
+ this.bean = bean;
+ }
+
+
+}
Added: projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectablePropertyQualifiedOnSetter.java
===================================================================
--- projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectablePropertyQualifiedOnSetter.java (rev 0)
+++ projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectablePropertyQualifiedOnSetter.java 2010-02-23 17:09:39 UTC (rev 101337)
@@ -0,0 +1,48 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.jsr330.support;
+
+import javax.inject.Inject;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class BeanWithInjectablePropertyQualifiedOnSetter
+{
+ private Bean bean;
+
+ public Bean getBean()
+ {
+ return bean;
+ }
+
+ @Inject
+ @QualifierA
+ public void setBean(Bean bean)
+ {
+ this.bean = bean;
+ }
+
+
+}
Added: projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableQualifiedField.java
===================================================================
--- projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableQualifiedField.java (rev 0)
+++ projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/BeanWithInjectableQualifiedField.java 2010-02-23 17:09:39 UTC (rev 101337)
@@ -0,0 +1,34 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.jsr330.support;
+
+import javax.inject.Inject;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class BeanWithInjectableQualifiedField
+{
+ @Inject @QualifierB public Bean bean;
+}
Added: projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/QualifierA.java
===================================================================
--- projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/QualifierA.java (rev 0)
+++ projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/QualifierA.java 2010-02-23 17:09:39 UTC (rev 101337)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.jsr330.support;
+
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at java.lang.annotation.Documented
+ at java.lang.annotation.Retention(RetentionPolicy.RUNTIME)
+ at javax.inject.Qualifier
+public @interface QualifierA
+{
+
+}
Added: projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/QualifierB.java
===================================================================
--- projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/QualifierB.java (rev 0)
+++ projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/QualifierB.java 2010-02-23 17:09:39 UTC (rev 101337)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.jsr330.support;
+
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at java.lang.annotation.Documented
+ at java.lang.annotation.Retention(RetentionPolicy.RUNTIME)
+ at javax.inject.Qualifier
+public @interface QualifierB
+{
+
+}
Added: projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/SomeAnnotation.java
===================================================================
--- projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/SomeAnnotation.java (rev 0)
+++ projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/support/SomeAnnotation.java 2010-02-23 17:09:39 UTC (rev 101337)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.jsr330.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 $
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface SomeAnnotation {
+
+}
Added: projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/test/Jsr330TestCase.java
===================================================================
--- projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/test/Jsr330TestCase.java (rev 0)
+++ projects/kernel/branches/jsr330/kernel/src/test/java/org/jboss/test/kernel/jsr330/test/Jsr330TestCase.java 2010-02-23 17:09:39 UTC (rev 101337)
@@ -0,0 +1,352 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.jsr330.test;
+
+import junit.framework.Test;
+
+import org.jboss.beans.info.spi.BeanAccessMode;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.test.kernel.jsr330.support.Bean;
+import org.jboss.test.kernel.jsr330.support.BeanA;
+import org.jboss.test.kernel.jsr330.support.BeanB;
+import org.jboss.test.kernel.jsr330.support.BeanWithInjectableConstructorAndParameter;
+import org.jboss.test.kernel.jsr330.support.BeanWithInjectableConstructorAndQualifiedParameter;
+import org.jboss.test.kernel.jsr330.support.BeanWithInjectableConstructorNoParameters;
+import org.jboss.test.kernel.jsr330.support.BeanWithInjectableField;
+import org.jboss.test.kernel.jsr330.support.BeanWithInjectableMethod;
+import org.jboss.test.kernel.jsr330.support.BeanWithInjectableMethodAndQualifiedParameter;
+import org.jboss.test.kernel.jsr330.support.BeanWithInjectableProperty;
+import org.jboss.test.kernel.jsr330.support.BeanWithInjectablePropertyQualifiedOnParameter;
+import org.jboss.test.kernel.jsr330.support.BeanWithInjectablePropertyQualifiedOnSetter;
+import org.jboss.test.kernel.jsr330.support.BeanWithInjectableQualifiedField;
+import org.jboss.test.kernel.jsr330.support.SomeAnnotation;
+import org.jboss.test.kernel.junit.MicrocontainerTest;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class Jsr330TestCase extends MicrocontainerTest
+{
+ public Jsr330TestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(Jsr330TestCase.class);
+ }
+
+ public void testInjectableConstructorNoParameters() throws Throwable
+ {
+ BeanMetaDataBuilder bean1Builder = BeanMetaDataBuilder.createBuilder("bean1", Bean.class.getName());
+ KernelControllerContext bean1Context = deploy(bean1Builder.getBeanMetaData());
+
+ BeanMetaDataBuilder bean2Builder = BeanMetaDataBuilder.createBuilder("bean2", BeanWithInjectableConstructorNoParameters.class.getName());
+ KernelControllerContext bean2Context = deploy(bean2Builder.getBeanMetaData());
+
+ try
+ {
+ assertBean("bean1", Bean.class);
+ assertBean("bean2", BeanWithInjectableConstructorNoParameters.class);
+
+ }
+ finally
+ {
+ undeploy(bean1Context);
+ undeploy(bean2Context);
+ }
+ }
+
+ public void testInjectableConstructorAndParameterNoInstanceMetaData() throws Throwable
+ {
+ BeanMetaDataBuilder bean1Builder = BeanMetaDataBuilder.createBuilder("bean1", Bean.class.getName());
+ KernelControllerContext bean1Context = deploy(bean1Builder.getBeanMetaData());
+
+ BeanMetaDataBuilder bean2Builder = BeanMetaDataBuilder.createBuilder("bean2", BeanWithInjectableConstructorAndParameter.class.getName());
+ KernelControllerContext bean2Context = deploy(bean2Builder.getBeanMetaData());
+
+ try
+ {
+ Bean bean = assertBean("bean1", Bean.class);
+ BeanWithInjectableConstructorAndParameter tgt = assertBean("bean2", BeanWithInjectableConstructorAndParameter.class);
+ assertNotNull(tgt.getBean());
+ assertSame(bean, tgt.getBean());
+ }
+ finally
+ {
+ undeploy(bean1Context);
+ undeploy(bean2Context);
+ }
+ }
+
+ public void testInjectableConstructorAndParameterWithInstanceMetaData() throws Throwable
+ {
+ BeanMetaDataBuilder bean1Builder = BeanMetaDataBuilder.createBuilder("bean1", Bean.class.getName());
+ KernelControllerContext bean1Context = deploy(bean1Builder.getBeanMetaData());
+
+ BeanMetaDataBuilder bean2Builder = BeanMetaDataBuilder.createBuilder("bean2", BeanWithInjectableConstructorAndParameter.class.getName());
+ bean2Builder.addAnnotation("@" + SomeAnnotation.class.getName());
+ KernelControllerContext bean2Context = deploy(bean2Builder.getBeanMetaData());
+
+ try
+ {
+ Bean bean = assertBean("bean1", Bean.class);
+ BeanWithInjectableConstructorAndParameter tgt = assertBean("bean2", BeanWithInjectableConstructorAndParameter.class);
+ assertNotNull(tgt.getBean());
+ assertSame(bean, tgt.getBean());
+ }
+ finally
+ {
+ undeploy(bean1Context);
+ undeploy(bean2Context);
+ }
+ }
+
+ public void testInjectableConstructorAndQualifierParameter() throws Throwable
+ {
+ BeanMetaDataBuilder bean1Builder = BeanMetaDataBuilder.createBuilder("bean1", Bean.class.getName());
+ KernelControllerContext bean1Context = deploy(bean1Builder.getBeanMetaData());
+
+ BeanMetaDataBuilder beanABuilder = BeanMetaDataBuilder.createBuilder("beanA", BeanA.class.getName());
+ KernelControllerContext beanAContext = deploy(beanABuilder.getBeanMetaData());
+
+ BeanMetaDataBuilder beanBBuilder = BeanMetaDataBuilder.createBuilder("beanB", BeanB.class.getName());
+ KernelControllerContext beanBContext = deploy(beanBBuilder.getBeanMetaData());
+
+ BeanMetaDataBuilder bean2Builder = BeanMetaDataBuilder.createBuilder("bean2", BeanWithInjectableConstructorAndQualifiedParameter.class.getName());
+ bean2Builder.addAnnotation("@" + SomeAnnotation.class.getName());
+ KernelControllerContext bean2Context = deploy(bean2Builder.getBeanMetaData());
+
+ try
+ {
+ assertNotSame(assertBean("bean1", Bean.class), assertBean("beanA", Bean.class));
+ assertNotSame(assertBean("beanA", Bean.class), assertBean("beanB", Bean.class));
+
+ BeanWithInjectableConstructorAndQualifiedParameter tgt = assertBean("bean2", BeanWithInjectableConstructorAndQualifiedParameter.class);
+ assertNotNull(tgt.getBean());
+ assertSame(assertBean("beanA", Bean.class), tgt.getBean());
+ }
+ finally
+ {
+ undeploy(bean1Context);
+ undeploy(beanAContext);
+ undeploy(beanBContext);
+ undeploy(bean2Context);
+ }
+ }
+
+ public void testInjectableField() throws Throwable
+ {
+ BeanMetaDataBuilder bean1Builder = BeanMetaDataBuilder.createBuilder("bean1", Bean.class.getName());
+ KernelControllerContext bean1Context = deploy(bean1Builder.getBeanMetaData());
+
+ BeanMetaDataBuilder bean2Builder = BeanMetaDataBuilder.createBuilder("bean2", BeanWithInjectableField.class.getName());
+ bean2Builder.setAccessMode(BeanAccessMode.FIELDS);
+ KernelControllerContext bean2Context = deploy(bean2Builder.getBeanMetaData());
+
+ try
+ {
+ Bean bean = assertBean("bean1", Bean.class);
+ BeanWithInjectableField tgt = assertBean("bean2", BeanWithInjectableField.class);
+ assertNotNull(tgt.bean);
+ assertSame(bean, tgt.bean);
+ }
+ finally
+ {
+ undeploy(bean1Context);
+ undeploy(bean2Context);
+ }
+ }
+
+ public void testInjectableQualifiedField() throws Throwable
+ {
+ BeanMetaDataBuilder bean1Builder = BeanMetaDataBuilder.createBuilder("bean1", Bean.class.getName());
+ KernelControllerContext bean1Context = deploy(bean1Builder.getBeanMetaData());
+
+ BeanMetaDataBuilder beanABuilder = BeanMetaDataBuilder.createBuilder("beanA", BeanA.class.getName());
+ KernelControllerContext beanAContext = deploy(beanABuilder.getBeanMetaData());
+
+ BeanMetaDataBuilder beanBBuilder = BeanMetaDataBuilder.createBuilder("beanB", BeanB.class.getName());
+ KernelControllerContext beanBContext = deploy(beanBBuilder.getBeanMetaData());
+
+ BeanMetaDataBuilder bean2Builder = BeanMetaDataBuilder.createBuilder("bean2", BeanWithInjectableQualifiedField.class.getName());
+ bean2Builder.setAccessMode(BeanAccessMode.FIELDS);
+ KernelControllerContext bean2Context = deploy(bean2Builder.getBeanMetaData());
+
+ try
+ {
+ Bean bean = assertBean("beanB", Bean.class);
+ BeanWithInjectableQualifiedField tgt = assertBean("bean2", BeanWithInjectableQualifiedField.class);
+ assertNotNull(tgt.bean);
+ assertSame(bean, tgt.bean);
+ }
+ finally
+ {
+ undeploy(bean1Context);
+ undeploy(beanAContext);
+ undeploy(beanBContext);
+ undeploy(bean2Context);
+ }
+ }
+
+ public void testInjectableProperty() throws Throwable
+ {
+ BeanMetaDataBuilder bean1Builder = BeanMetaDataBuilder.createBuilder("bean1", Bean.class.getName());
+ KernelControllerContext bean1Context = deploy(bean1Builder.getBeanMetaData());
+
+ BeanMetaDataBuilder bean2Builder = BeanMetaDataBuilder.createBuilder("bean2", BeanWithInjectableProperty.class.getName());
+ KernelControllerContext bean2Context = deploy(bean2Builder.getBeanMetaData());
+
+ try
+ {
+ Bean bean = assertBean("bean1", Bean.class);
+ BeanWithInjectableProperty tgt = assertBean("bean2", BeanWithInjectableProperty.class);
+ assertNotNull(tgt.getBean());
+ assertSame(bean, tgt.getBean());
+ }
+ finally
+ {
+ undeploy(bean1Context);
+ undeploy(bean2Context);
+ }
+ }
+
+ public void testInjectablePropertyQualifiedOnParameter() throws Throwable
+ {
+ BeanMetaDataBuilder bean1Builder = BeanMetaDataBuilder.createBuilder("bean1", Bean.class.getName());
+ KernelControllerContext bean1Context = deploy(bean1Builder.getBeanMetaData());
+
+ BeanMetaDataBuilder beanABuilder = BeanMetaDataBuilder.createBuilder("beanA", BeanA.class.getName());
+ KernelControllerContext beanAContext = deploy(beanABuilder.getBeanMetaData());
+
+ BeanMetaDataBuilder beanBBuilder = BeanMetaDataBuilder.createBuilder("beanB", BeanB.class.getName());
+ KernelControllerContext beanBContext = deploy(beanBBuilder.getBeanMetaData());
+
+ BeanMetaDataBuilder bean2Builder = BeanMetaDataBuilder.createBuilder("bean2", BeanWithInjectablePropertyQualifiedOnParameter.class.getName());
+ bean2Builder.setAccessMode(BeanAccessMode.FIELDS);
+ KernelControllerContext bean2Context = deploy(bean2Builder.getBeanMetaData());
+
+ try
+ {
+ Bean bean = assertBean("beanA", Bean.class);
+ BeanWithInjectablePropertyQualifiedOnParameter tgt = assertBean("bean2", BeanWithInjectablePropertyQualifiedOnParameter.class);
+ assertNotNull(tgt.getBean());
+ assertSame(bean, tgt.getBean());
+ }
+ finally
+ {
+ undeploy(bean1Context);
+ undeploy(beanAContext);
+ undeploy(beanBContext);
+ undeploy(bean2Context);
+ }
+ }
+
+
+ public void testInjectablePropertyQualifiedOnSetter() throws Throwable
+ {
+ BeanMetaDataBuilder bean1Builder = BeanMetaDataBuilder.createBuilder("bean1", Bean.class.getName());
+ KernelControllerContext bean1Context = deploy(bean1Builder.getBeanMetaData());
+
+ BeanMetaDataBuilder beanABuilder = BeanMetaDataBuilder.createBuilder("beanA", BeanA.class.getName());
+ KernelControllerContext beanAContext = deploy(beanABuilder.getBeanMetaData());
+
+ BeanMetaDataBuilder beanBBuilder = BeanMetaDataBuilder.createBuilder("beanB", BeanB.class.getName());
+ KernelControllerContext beanBContext = deploy(beanBBuilder.getBeanMetaData());
+
+ BeanMetaDataBuilder bean2Builder = BeanMetaDataBuilder.createBuilder("bean2", BeanWithInjectablePropertyQualifiedOnSetter.class.getName());
+ bean2Builder.setAccessMode(BeanAccessMode.FIELDS);
+ KernelControllerContext bean2Context = deploy(bean2Builder.getBeanMetaData());
+
+ try
+ {
+ Bean bean = assertBean("beanA", Bean.class);
+ BeanWithInjectablePropertyQualifiedOnSetter tgt = assertBean("bean2", BeanWithInjectablePropertyQualifiedOnSetter.class);
+ assertNotNull(tgt.getBean());
+ assertSame(bean, tgt.getBean());
+ }
+ finally
+ {
+ undeploy(bean1Context);
+ undeploy(beanAContext);
+ undeploy(beanBContext);
+ undeploy(bean2Context);
+ }
+ }
+
+ public void testInjectableMethod() throws Throwable
+ {
+ BeanMetaDataBuilder bean1Builder = BeanMetaDataBuilder.createBuilder("bean1", Bean.class.getName());
+ KernelControllerContext bean1Context = deploy(bean1Builder.getBeanMetaData());
+
+ BeanMetaDataBuilder bean2Builder = BeanMetaDataBuilder.createBuilder("bean2", BeanWithInjectableMethod.class.getName());
+ KernelControllerContext bean2Context = deploy(bean2Builder.getBeanMetaData());
+
+ try
+ {
+ Bean bean = assertBean("bean1", Bean.class);
+ BeanWithInjectableMethod tgt = assertBean("bean2", BeanWithInjectableMethod.class);
+ assertNotNull(tgt.getBean());
+ assertSame(bean, tgt.getBean());
+ }
+ finally
+ {
+ undeploy(bean1Context);
+ undeploy(bean2Context);
+ }
+ }
+
+ public void testInjectableMethodWithQualifiers() throws Throwable
+ {
+ BeanMetaDataBuilder bean1Builder = BeanMetaDataBuilder.createBuilder("bean1", Bean.class.getName());
+ KernelControllerContext bean1Context = deploy(bean1Builder.getBeanMetaData());
+
+ BeanMetaDataBuilder beanABuilder = BeanMetaDataBuilder.createBuilder("beanA", BeanA.class.getName());
+ KernelControllerContext beanAContext = deploy(beanABuilder.getBeanMetaData());
+
+ BeanMetaDataBuilder beanBBuilder = BeanMetaDataBuilder.createBuilder("beanB", BeanB.class.getName());
+ KernelControllerContext beanBContext = deploy(beanBBuilder.getBeanMetaData());
+
+ BeanMetaDataBuilder bean2Builder = BeanMetaDataBuilder.createBuilder("bean2", BeanWithInjectableMethodAndQualifiedParameter.class.getName());
+ bean2Builder.setAccessMode(BeanAccessMode.FIELDS);
+ KernelControllerContext bean2Context = deploy(bean2Builder.getBeanMetaData());
+
+ try
+ {
+ Bean bean = assertBean("beanA", Bean.class);
+ BeanWithInjectableMethodAndQualifiedParameter tgt = assertBean("bean2", BeanWithInjectableMethodAndQualifiedParameter.class);
+ assertNotNull(tgt.getBean());
+ assertSame(bean, tgt.getBean());
+ }
+ finally
+ {
+ undeploy(bean1Context);
+ undeploy(beanAContext);
+ undeploy(beanBContext);
+ undeploy(bean2Context);
+ }
+ }
+}
More information about the jboss-cvs-commits
mailing list