[webbeans-commits] Webbeans SVN: r1180 - tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/lookup/injectionpoint.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Thu Jan 22 12:16:21 EST 2009


Author: dallen6
Date: 2009-01-22 12:16:21 -0500 (Thu, 22 Jan 2009)
New Revision: 1180

Added:
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/lookup/injectionpoint/MethodInjectionPointBean.java
Modified:
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/lookup/injectionpoint/InjectionPointTest.java
Log:
Added remaining injection point metadata test.

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/lookup/injectionpoint/InjectionPointTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/lookup/injectionpoint/InjectionPointTest.java	2009-01-22 17:15:10 UTC (rev 1179)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/lookup/injectionpoint/InjectionPointTest.java	2009-01-22 17:16:21 UTC (rev 1180)
@@ -19,6 +19,7 @@
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
+import java.lang.reflect.Method;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
@@ -134,11 +135,30 @@
       }
    }
 
-   @Test(groups = { "stub", "injectionPoint" })
+   @Test(groups = { "injectionPoint" })
    @SpecAssertion(section = "5.11")
    public void testGetMemberMethod()
    {
-      assert false;
+      deployBeans(MethodInjectionPointBean.class, BeanWithInjectionPointMetadata.class);
+
+      // Get an instance of the bean which has another bean injected into it
+      try
+      {
+         activateDependentContext();
+         MethodInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(MethodInjectionPointBean.class, new CurrentBinding());
+         BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+         assert beanWithInjectionPoint.getInjectedMetadata() != null;
+         assert Method.class.isAssignableFrom(beanWithInjectionPoint.getInjectedMetadata().getMember().getClass());
+
+         // Since the type and bindings must correspond to the parameter, check
+         // them
+         assert beanWithInjectionPoint.getInjectedMetadata().getType().equals(BeanWithInjectionPointMetadata.class);
+         assert beanWithInjectionPoint.getInjectedMetadata().getBindings().contains(new CurrentBinding());
+      }
+      finally
+      {
+         deactivateDependentContext();
+      }
    }
 
    @Test(groups = { "injectionPoint" })

Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/lookup/injectionpoint/MethodInjectionPointBean.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/lookup/injectionpoint/MethodInjectionPointBean.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/lookup/injectionpoint/MethodInjectionPointBean.java	2009-01-22 17:16:21 UTC (rev 1180)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.tck.unit.lookup.injectionpoint;
+
+import javax.webbeans.Current;
+import javax.webbeans.Initializer;
+
+/**
+ * Test bean to inject a bean using injection point metadata into a constructor
+ * 
+ * @author David Allen
+ *
+ */
+public class MethodInjectionPointBean
+{
+   private BeanWithInjectionPointMetadata injectedBean;
+
+   @Initializer
+   public void methodWithInjectedMetadata(@Current BeanWithInjectionPointMetadata injectedBean)
+   {
+      this.injectedBean = injectedBean;
+   }
+   
+   public BeanWithInjectionPointMetadata getInjectedBean()
+   {
+      return injectedBean;
+   }
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/lookup/injectionpoint/MethodInjectionPointBean.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain




More information about the weld-commits mailing list