[webbeans-commits] Webbeans SVN: r1046 - tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint and 1 other directory.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Sat Jan 17 14:58:13 EST 2009
Author: dallen6
Date: 2009-01-17 14:58:13 -0500 (Sat, 17 Jan 2009)
New Revision: 1046
Added:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InjectionPointTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/Animal.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/AnimalStereotype.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/AnimalStereotypeAnnotationLiteral.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/BeanWithInjectionPointMetadata.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/ConstructorInjectionPointBean.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/FieldInjectionPointBean.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/InjectionPointTest.java
Removed:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InjectionPointTest.java
Log:
Ported the injection point metadata tests from RI to TCK.
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InjectionPointTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InjectionPointTest.java 2009-01-17 19:46:43 UTC (rev 1045)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InjectionPointTest.java 2009-01-17 19:58:13 UTC (rev 1046)
@@ -1,313 +0,0 @@
-/*
- * 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.test;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.webbeans.Current;
-import javax.webbeans.Dependent;
-import javax.webbeans.InjectionPoint;
-import javax.webbeans.Standard;
-import javax.webbeans.manager.Bean;
-
-import org.jboss.webbeans.binding.CurrentBinding;
-import org.jboss.webbeans.tck.impl.SpecAssertion;
-import org.jboss.webbeans.tck.impl.SpecVersion;
-import org.jboss.webbeans.test.annotations.AnimalStereotype;
-import org.jboss.webbeans.test.beans.BeanWithInjectionPointMetadata;
-import org.jboss.webbeans.test.beans.ConstructorInjectionPointBean;
-import org.jboss.webbeans.test.beans.FieldInjectionPointBean;
-import org.jboss.webbeans.test.bindings.AnimalStereotypeAnnotationLiteral;
-import org.jboss.webbeans.test.mock.MockWebBeanDiscovery;
-import org.testng.annotations.Test;
-
-/**
- * Injection point metadata tests
- *
- * @author David Allen
- *
- */
- at SpecVersion("20081222")
-public class InjectionPointTest extends AbstractTest
-{
-
- @Test(groups = { "injectionPoint" })
- @SpecAssertion(section = "5.11")
- public void testGetBean()
- {
- webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
- webBeansBootstrap.boot();
-
- // Get an instance of the bean which has another bean injected into it
- try
- {
- activateDependentContext();
- FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
- BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
- assert beanWithInjectionPoint.getInjectedMetadata() != null;
-
- Set<Bean<FieldInjectionPointBean>> resolvedBeans = manager.resolveByType(FieldInjectionPointBean.class);
- assert resolvedBeans.size() == 1;
- assert beanWithInjectionPoint.getInjectedMetadata().getBean().equals(resolvedBeans.iterator().next());
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-
- @Test(groups = { "injectionPoint" })
- @SpecAssertion(section = "5.11")
- public void testGetType()
- {
- webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
- webBeansBootstrap.boot();
-
- // Get an instance of the bean which has another bean injected into it
- try
- {
- activateDependentContext();
- FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
- BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
- assert beanWithInjectionPoint.getInjectedMetadata() != null;
- assert beanWithInjectionPoint.getInjectedMetadata().getType().equals(BeanWithInjectionPointMetadata.class);
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-
- @Test(groups = { "injectionPoint" })
- @SpecAssertion(section = "5.11")
- public void testGetBindingTypes()
- {
- webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
- webBeansBootstrap.boot();
-
- // Get an instance of the bean which has another bean injected into it
- try
- {
- activateDependentContext();
- FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
- BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
- assert beanWithInjectionPoint.getInjectedMetadata() != null;
- Set<Annotation> bindingTypes = beanWithInjectionPoint.getInjectedMetadata().getBindings();
- assert bindingTypes.size() == 1;
- assert Current.class.isAssignableFrom(bindingTypes.iterator().next().annotationType());
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-
- @Test(groups = { "injectionPoint" })
- @SpecAssertion(section = "5.11")
- public void testGetMemberField()
- {
- webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
- webBeansBootstrap.boot();
-
- // Get an instance of the bean which has another bean injected into it
- try
- {
- activateDependentContext();
- FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
- BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
- assert beanWithInjectionPoint.getInjectedMetadata() != null;
- assert Field.class.isAssignableFrom(beanWithInjectionPoint.getInjectedMetadata().getMember().getClass());
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-
- @Test(groups = { "stub", "injectionPoint" })
- @SpecAssertion(section = "5.11")
- public void testGetMemberMethod()
- {
- assert false;
- }
-
- @Test(groups = { "injectionPoint" })
- @SpecAssertion(section = "5.11")
- public void testGetMemberConstructor()
- {
- webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(ConstructorInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
- webBeansBootstrap.boot();
-
- // Get an instance of the bean which has another bean injected into it
- try
- {
- activateDependentContext();
- ConstructorInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(ConstructorInjectionPointBean.class, new CurrentBinding());
- BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
- assert beanWithInjectionPoint.getInjectedMetadata() != null;
- assert Constructor.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" })
- @SpecAssertion(section = "5.11")
- public void testGetAnnotation()
- {
- webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
- webBeansBootstrap.boot();
-
- // Get an instance of the bean which has another bean injected into it
- try
- {
- activateDependentContext();
- FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
- BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
- assert beanWithInjectionPoint.getInjectedMetadata() != null;
- assert beanWithInjectionPoint.getInjectedMetadata().getAnnotation(AnimalStereotype.class) != null;
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-
- @Test(groups = { "injectionPoint" })
- @SpecAssertion(section = "5.11")
- public void testGetAnnotations()
- {
- webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
- webBeansBootstrap.boot();
-
- // Get an instance of the bean which has another bean injected into it
- try
- {
- activateDependentContext();
- FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
- BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
- assert beanWithInjectionPoint.getInjectedMetadata() != null;
- Set<Annotation> annotations = new HashSet<Annotation>(Arrays.asList(beanWithInjectionPoint.getInjectedMetadata().getAnnotations()));
- assert annotations.size() > 0;
- assert annotations.contains(new CurrentBinding());
- assert annotations.contains(new AnimalStereotypeAnnotationLiteral());
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-
- @Test(groups = { "injectionPoint" })
- @SpecAssertion(section = "5.11")
- public void testStandardDeployment()
- {
- webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
- webBeansBootstrap.boot();
-
- // Get an instance of the bean which has another bean injected into it
- try
- {
- activateDependentContext();
- FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
- BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
- assert beanWithInjectionPoint.getInjectedMetadata() != null;
- assert beanWithInjectionPoint.getInjectedMetadata().getClass().isAnnotationPresent(Standard.class);
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-
- @Test(groups = { "injectionPoint" })
- @SpecAssertion(section = "5.11")
- public void testDependentScope()
- {
- webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
- webBeansBootstrap.boot();
-
- // Get an instance of the bean which has another bean injected into it
- try
- {
- activateDependentContext();
- FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
- BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
- assert beanWithInjectionPoint.getInjectedMetadata() != null;
- assert beanWithInjectionPoint.getInjectedMetadata().getClass().isAnnotationPresent(Dependent.class);
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-
- @Test(groups = { "injectionPoint" })
- @SpecAssertion(section = "5.11")
- public void testApiTypeInjectionPoint()
- {
- webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
- webBeansBootstrap.boot();
-
- // Get an instance of the bean which has another bean injected into it
- try
- {
- activateDependentContext();
- FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
- BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
- assert beanWithInjectionPoint.getInjectedMetadata() != null;
- assert InjectionPoint.class.isAssignableFrom(beanWithInjectionPoint.getInjectedMetadata().getClass());
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-
- @Test(groups = { "injectionPoint" })
- @SpecAssertion(section = "5.11")
- public void testCurrentBinding()
- {
- webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
- webBeansBootstrap.boot();
-
- // Get an instance of the bean which has another bean injected into it
- try
- {
- activateDependentContext();
- FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
- BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
- assert beanWithInjectionPoint.getInjectedMetadata() != null;
- assert beanWithInjectionPoint.getInjectedMetadata().getBindings().contains(new CurrentBinding());
- }
- finally
- {
- deactivateDependentContext();
- }
- }
-}
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InjectionPointTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InjectionPointTest.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InjectionPointTest.java 2009-01-17 19:58:13 UTC (rev 1046)
@@ -0,0 +1,313 @@
+/*
+ * 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.test;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.webbeans.Current;
+import javax.webbeans.Dependent;
+import javax.webbeans.InjectionPoint;
+import javax.webbeans.Standard;
+import javax.webbeans.manager.Bean;
+
+import org.jboss.webbeans.binding.CurrentBinding;
+import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.jboss.webbeans.tck.impl.SpecVersion;
+import org.jboss.webbeans.test.annotations.AnimalStereotype;
+import org.jboss.webbeans.test.beans.BeanWithInjectionPointMetadata;
+import org.jboss.webbeans.test.beans.ConstructorInjectionPointBean;
+import org.jboss.webbeans.test.beans.FieldInjectionPointBean;
+import org.jboss.webbeans.test.bindings.AnimalStereotypeAnnotationLiteral;
+import org.jboss.webbeans.test.mock.MockWebBeanDiscovery;
+import org.testng.annotations.Test;
+
+/**
+ * Injection point metadata tests
+ *
+ * @author David Allen
+ *
+ */
+ at SpecVersion("20081222")
+public class InjectionPointTest extends AbstractTest
+{
+
+ @Test(groups = { "injectionPoint" })
+ @SpecAssertion(section = "5.11")
+ public void testGetBean()
+ {
+ webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
+ webBeansBootstrap.boot();
+
+ // Get an instance of the bean which has another bean injected into it
+ try
+ {
+ activateDependentContext();
+ FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+ BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+ assert beanWithInjectionPoint.getInjectedMetadata() != null;
+
+ Set<Bean<FieldInjectionPointBean>> resolvedBeans = manager.resolveByType(FieldInjectionPointBean.class);
+ assert resolvedBeans.size() == 1;
+ assert beanWithInjectionPoint.getInjectedMetadata().getBean().equals(resolvedBeans.iterator().next());
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "injectionPoint" })
+ @SpecAssertion(section = "5.11")
+ public void testGetType()
+ {
+ webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
+ webBeansBootstrap.boot();
+
+ // Get an instance of the bean which has another bean injected into it
+ try
+ {
+ activateDependentContext();
+ FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+ BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+ assert beanWithInjectionPoint.getInjectedMetadata() != null;
+ assert beanWithInjectionPoint.getInjectedMetadata().getType().equals(BeanWithInjectionPointMetadata.class);
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "injectionPoint" })
+ @SpecAssertion(section = "5.11")
+ public void testGetBindingTypes()
+ {
+ webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
+ webBeansBootstrap.boot();
+
+ // Get an instance of the bean which has another bean injected into it
+ try
+ {
+ activateDependentContext();
+ FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+ BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+ assert beanWithInjectionPoint.getInjectedMetadata() != null;
+ Set<Annotation> bindingTypes = beanWithInjectionPoint.getInjectedMetadata().getBindings();
+ assert bindingTypes.size() == 1;
+ assert Current.class.isAssignableFrom(bindingTypes.iterator().next().annotationType());
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "injectionPoint" })
+ @SpecAssertion(section = "5.11")
+ public void testGetMemberField()
+ {
+ webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
+ webBeansBootstrap.boot();
+
+ // Get an instance of the bean which has another bean injected into it
+ try
+ {
+ activateDependentContext();
+ FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+ BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+ assert beanWithInjectionPoint.getInjectedMetadata() != null;
+ assert Field.class.isAssignableFrom(beanWithInjectionPoint.getInjectedMetadata().getMember().getClass());
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "stub", "injectionPoint" })
+ @SpecAssertion(section = "5.11")
+ public void testGetMemberMethod()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "injectionPoint" })
+ @SpecAssertion(section = "5.11")
+ public void testGetMemberConstructor()
+ {
+ webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(ConstructorInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
+ webBeansBootstrap.boot();
+
+ // Get an instance of the bean which has another bean injected into it
+ try
+ {
+ activateDependentContext();
+ ConstructorInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(ConstructorInjectionPointBean.class, new CurrentBinding());
+ BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+ assert beanWithInjectionPoint.getInjectedMetadata() != null;
+ assert Constructor.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" })
+ @SpecAssertion(section = "5.11")
+ public void testGetAnnotation()
+ {
+ webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
+ webBeansBootstrap.boot();
+
+ // Get an instance of the bean which has another bean injected into it
+ try
+ {
+ activateDependentContext();
+ FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+ BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+ assert beanWithInjectionPoint.getInjectedMetadata() != null;
+ assert beanWithInjectionPoint.getInjectedMetadata().getAnnotation(AnimalStereotype.class) != null;
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "injectionPoint" })
+ @SpecAssertion(section = "5.11")
+ public void testGetAnnotations()
+ {
+ webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
+ webBeansBootstrap.boot();
+
+ // Get an instance of the bean which has another bean injected into it
+ try
+ {
+ activateDependentContext();
+ FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+ BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+ assert beanWithInjectionPoint.getInjectedMetadata() != null;
+ Set<Annotation> annotations = new HashSet<Annotation>(Arrays.asList(beanWithInjectionPoint.getInjectedMetadata().getAnnotations()));
+ assert annotations.size() > 0;
+ assert annotations.contains(new CurrentBinding());
+ assert annotations.contains(new AnimalStereotypeAnnotationLiteral());
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "injectionPoint" })
+ @SpecAssertion(section = "5.11")
+ public void testStandardDeployment()
+ {
+ webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
+ webBeansBootstrap.boot();
+
+ // Get an instance of the bean which has another bean injected into it
+ try
+ {
+ activateDependentContext();
+ FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+ BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+ assert beanWithInjectionPoint.getInjectedMetadata() != null;
+ assert beanWithInjectionPoint.getInjectedMetadata().getClass().isAnnotationPresent(Standard.class);
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "injectionPoint" })
+ @SpecAssertion(section = "5.11")
+ public void testDependentScope()
+ {
+ webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
+ webBeansBootstrap.boot();
+
+ // Get an instance of the bean which has another bean injected into it
+ try
+ {
+ activateDependentContext();
+ FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+ BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+ assert beanWithInjectionPoint.getInjectedMetadata() != null;
+ assert beanWithInjectionPoint.getInjectedMetadata().getClass().isAnnotationPresent(Dependent.class);
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "injectionPoint" })
+ @SpecAssertion(section = "5.11")
+ public void testApiTypeInjectionPoint()
+ {
+ webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
+ webBeansBootstrap.boot();
+
+ // Get an instance of the bean which has another bean injected into it
+ try
+ {
+ activateDependentContext();
+ FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+ BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+ assert beanWithInjectionPoint.getInjectedMetadata() != null;
+ assert InjectionPoint.class.isAssignableFrom(beanWithInjectionPoint.getInjectedMetadata().getClass());
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "injectionPoint" })
+ @SpecAssertion(section = "5.11")
+ public void testCurrentBinding()
+ {
+ webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
+ webBeansBootstrap.boot();
+
+ // Get an instance of the bean which has another bean injected into it
+ try
+ {
+ activateDependentContext();
+ FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+ BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+ assert beanWithInjectionPoint.getInjectedMetadata() != null;
+ assert beanWithInjectionPoint.getInjectedMetadata().getBindings().contains(new CurrentBinding());
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+}
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/Animal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/Animal.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/Animal.java 2009-01-17 19:58:13 UTC (rev 1046)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.tck.tests.lookup.injectionpoint;
+
+interface Animal
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/Animal.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/AnimalStereotype.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/AnimalStereotype.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/AnimalStereotype.java 2009-01-17 19:58:13 UTC (rev 1046)
@@ -0,0 +1,21 @@
+package org.jboss.webbeans.tck.tests.lookup.injectionpoint;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.webbeans.RequestScoped;
+import javax.webbeans.Stereotype;
+
+ at Stereotype(requiredTypes=Animal.class)
+ at Target( { TYPE, METHOD, FIELD })
+ at Retention(RUNTIME)
+ at RequestScoped
+ at interface AnimalStereotype
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/AnimalStereotype.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/AnimalStereotypeAnnotationLiteral.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/AnimalStereotypeAnnotationLiteral.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/AnimalStereotypeAnnotationLiteral.java 2009-01-17 19:58:13 UTC (rev 1046)
@@ -0,0 +1,8 @@
+package org.jboss.webbeans.tck.tests.lookup.injectionpoint;
+
+import javax.webbeans.AnnotationLiteral;
+
+class AnimalStereotypeAnnotationLiteral extends AnnotationLiteral<AnimalStereotype> implements AnimalStereotype
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/AnimalStereotypeAnnotationLiteral.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/BeanWithInjectionPointMetadata.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/BeanWithInjectionPointMetadata.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/BeanWithInjectionPointMetadata.java 2009-01-17 19:58:13 UTC (rev 1046)
@@ -0,0 +1,37 @@
+/*
+ * 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.tests.lookup.injectionpoint;
+
+import javax.webbeans.Current;
+import javax.webbeans.InjectionPoint;
+
+/**
+ * Test bean with injection point on the constructor of the bean
+ *
+ * @author David Allen
+ *
+ */
+class BeanWithInjectionPointMetadata
+{
+ @Current
+ private InjectionPoint injectedMetadata;
+
+ public InjectionPoint getInjectedMetadata()
+ {
+ return injectedMetadata;
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/BeanWithInjectionPointMetadata.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/ConstructorInjectionPointBean.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/ConstructorInjectionPointBean.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/ConstructorInjectionPointBean.java 2009-01-17 19:58:13 UTC (rev 1046)
@@ -0,0 +1,42 @@
+/*
+ * 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.tests.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
+ *
+ */
+class ConstructorInjectionPointBean
+{
+ private BeanWithInjectionPointMetadata injectedBean;
+
+ @Initializer
+ public ConstructorInjectionPointBean(@Current BeanWithInjectionPointMetadata injectedBean)
+ {
+ this.injectedBean = injectedBean;
+ }
+
+ public BeanWithInjectionPointMetadata getInjectedBean()
+ {
+ return injectedBean;
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/ConstructorInjectionPointBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/FieldInjectionPointBean.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/FieldInjectionPointBean.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/FieldInjectionPointBean.java 2009-01-17 19:58:13 UTC (rev 1046)
@@ -0,0 +1,40 @@
+/*
+ * 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.tests.lookup.injectionpoint;
+
+import javax.webbeans.Current;
+import javax.webbeans.RequestScoped;
+
+/**
+ * Test bean to inject another bean which uses injection point metadata in a
+ * field
+ *
+ * @author David Allen
+ *
+ */
+ at RequestScoped
+class FieldInjectionPointBean
+{
+ @Current @AnimalStereotype
+ private BeanWithInjectionPointMetadata injectedBean;
+
+ public BeanWithInjectionPointMetadata getInjectedBean()
+ {
+ return injectedBean;
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/FieldInjectionPointBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/InjectionPointTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/InjectionPointTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/InjectionPointTest.java 2009-01-17 19:58:13 UTC (rev 1046)
@@ -0,0 +1,298 @@
+/*
+ * 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.tests.lookup.injectionpoint;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.webbeans.Current;
+import javax.webbeans.Dependent;
+import javax.webbeans.InjectionPoint;
+import javax.webbeans.Standard;
+import javax.webbeans.manager.Bean;
+
+import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.jboss.webbeans.tck.impl.SpecVersion;
+import org.jboss.webbeans.tck.impl.literals.CurrentBinding;
+import org.jboss.webbeans.tck.tests.AbstractTest;
+import org.testng.annotations.Test;
+
+/**
+ * Injection point metadata tests
+ *
+ * @author David Allen
+ *
+ */
+ at SpecVersion("20081222")
+public class InjectionPointTest extends AbstractTest
+{
+
+ @Test(groups = { "injectionPoint" })
+ @SpecAssertion(section = "5.11")
+ public void testGetBean()
+ {
+ deployBeans(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class);
+
+ // Get an instance of the bean which has another bean injected into it
+ try
+ {
+ activateDependentContext();
+ FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+ BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+ assert beanWithInjectionPoint.getInjectedMetadata() != null;
+
+ Set<Bean<FieldInjectionPointBean>> resolvedBeans = manager.resolveByType(FieldInjectionPointBean.class);
+ assert resolvedBeans.size() == 1;
+ assert beanWithInjectionPoint.getInjectedMetadata().getBean().equals(resolvedBeans.iterator().next());
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "injectionPoint" })
+ @SpecAssertion(section = "5.11")
+ public void testGetType()
+ {
+ deployBeans(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class);
+
+ // Get an instance of the bean which has another bean injected into it
+ try
+ {
+ activateDependentContext();
+ FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+ BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+ assert beanWithInjectionPoint.getInjectedMetadata() != null;
+ assert beanWithInjectionPoint.getInjectedMetadata().getType().equals(BeanWithInjectionPointMetadata.class);
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "injectionPoint" })
+ @SpecAssertion(section = "5.11")
+ public void testGetBindingTypes()
+ {
+ deployBeans(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class);
+
+ // Get an instance of the bean which has another bean injected into it
+ try
+ {
+ activateDependentContext();
+ FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+ BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+ assert beanWithInjectionPoint.getInjectedMetadata() != null;
+ Set<Annotation> bindingTypes = beanWithInjectionPoint.getInjectedMetadata().getBindings();
+ assert bindingTypes.size() == 1;
+ assert Current.class.isAssignableFrom(bindingTypes.iterator().next().annotationType());
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "injectionPoint" })
+ @SpecAssertion(section = "5.11")
+ public void testGetMemberField()
+ {
+ deployBeans(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class);
+
+ // Get an instance of the bean which has another bean injected into it
+ try
+ {
+ activateDependentContext();
+ FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+ BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+ assert beanWithInjectionPoint.getInjectedMetadata() != null;
+ assert Field.class.isAssignableFrom(beanWithInjectionPoint.getInjectedMetadata().getMember().getClass());
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "stub", "injectionPoint" })
+ @SpecAssertion(section = "5.11")
+ public void testGetMemberMethod()
+ {
+ assert false;
+ }
+
+ @Test(groups = { "injectionPoint" })
+ @SpecAssertion(section = "5.11")
+ public void testGetMemberConstructor()
+ {
+ deployBeans(ConstructorInjectionPointBean.class, BeanWithInjectionPointMetadata.class);
+
+ // Get an instance of the bean which has another bean injected into it
+ try
+ {
+ activateDependentContext();
+ ConstructorInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(ConstructorInjectionPointBean.class, new CurrentBinding());
+ BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+ assert beanWithInjectionPoint.getInjectedMetadata() != null;
+ assert Constructor.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" })
+ @SpecAssertion(section = "5.11")
+ public void testGetAnnotation()
+ {
+ deployBeans(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class);
+
+ // Get an instance of the bean which has another bean injected into it
+ try
+ {
+ activateDependentContext();
+ FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+ BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+ assert beanWithInjectionPoint.getInjectedMetadata() != null;
+ assert beanWithInjectionPoint.getInjectedMetadata().getAnnotation(AnimalStereotype.class) != null;
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "injectionPoint" })
+ @SpecAssertion(section = "5.11")
+ public void testGetAnnotations()
+ {
+ deployBeans(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class);
+
+ // Get an instance of the bean which has another bean injected into it
+ try
+ {
+ activateDependentContext();
+ FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+ BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+ assert beanWithInjectionPoint.getInjectedMetadata() != null;
+ Set<Annotation> annotations = new HashSet<Annotation>(Arrays.asList(beanWithInjectionPoint.getInjectedMetadata().getAnnotations()));
+ assert annotations.size() > 0;
+ assert annotations.contains(new CurrentBinding());
+ assert annotations.contains(new AnimalStereotypeAnnotationLiteral());
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "injectionPoint" })
+ @SpecAssertion(section = "5.11")
+ public void testStandardDeployment()
+ {
+ deployBeans(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class);
+
+ // Get an instance of the bean which has another bean injected into it
+ try
+ {
+ activateDependentContext();
+ FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+ BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+ assert beanWithInjectionPoint.getInjectedMetadata() != null;
+ assert beanWithInjectionPoint.getInjectedMetadata().getClass().isAnnotationPresent(Standard.class);
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "injectionPoint" })
+ @SpecAssertion(section = "5.11")
+ public void testDependentScope()
+ {
+ deployBeans(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class);
+
+ // Get an instance of the bean which has another bean injected into it
+ try
+ {
+ activateDependentContext();
+ FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+ BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+ assert beanWithInjectionPoint.getInjectedMetadata() != null;
+ assert beanWithInjectionPoint.getInjectedMetadata().getClass().isAnnotationPresent(Dependent.class);
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "injectionPoint" })
+ @SpecAssertion(section = "5.11")
+ public void testApiTypeInjectionPoint()
+ {
+ deployBeans(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class);
+
+ // Get an instance of the bean which has another bean injected into it
+ try
+ {
+ activateDependentContext();
+ FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+ BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+ assert beanWithInjectionPoint.getInjectedMetadata() != null;
+ assert InjectionPoint.class.isAssignableFrom(beanWithInjectionPoint.getInjectedMetadata().getClass());
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+
+ @Test(groups = { "injectionPoint" })
+ @SpecAssertion(section = "5.11")
+ public void testCurrentBinding()
+ {
+ deployBeans(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class);
+
+ // Get an instance of the bean which has another bean injected into it
+ try
+ {
+ activateDependentContext();
+ FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+ BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+ assert beanWithInjectionPoint.getInjectedMetadata() != null;
+ assert beanWithInjectionPoint.getInjectedMetadata().getBindings().contains(new CurrentBinding());
+ }
+ finally
+ {
+ deactivateDependentContext();
+ }
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/lookup/injectionpoint/InjectionPointTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the weld-commits
mailing list