[webbeans-commits] Webbeans SVN: r755 - in ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test: beans and 1 other directory.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Sat Jan 3 13:59:17 EST 2009


Author: dallen6
Date: 2009-01-03 13:59:16 -0500 (Sat, 03 Jan 2009)
New Revision: 755

Added:
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/BeanWithInjectionPointMetadata.java
Removed:
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/ConstructorInjectionPoint.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/FieldInjectionPoint.java
Modified:
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InjectionPointTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/ConstructorInjectionPointBean.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/FieldInjectionPointBean.java
Log:
Refactoring of injection point metadata tests.

Modified: 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-03 16:43:35 UTC (rev 754)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InjectionPointTest.java	2009-01-03 18:59:16 UTC (rev 755)
@@ -19,6 +19,8 @@
 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;
@@ -28,9 +30,10 @@
 import javax.webbeans.manager.Bean;
 
 import org.jboss.webbeans.binding.CurrentBinding;
-import org.jboss.webbeans.test.beans.ConstructorInjectionPoint;
+import org.jboss.webbeans.context.DependentContext;
+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.FieldInjectionPoint;
 import org.jboss.webbeans.test.beans.FieldInjectionPointBean;
 import org.jboss.webbeans.test.mock.MockWebBeanDiscovery;
 import org.testng.annotations.Test;
@@ -48,74 +51,114 @@
    @SpecAssertion(section = "5.11")
    public void testGetInstance()
    {
-      webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, FieldInjectionPoint.class));
+      webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
       webBeansBootstrap.boot();
 
       // Get an instance of the bean which has another bean injected into it
-      FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
-      FieldInjectionPoint beanWithInjectionPoint = beanWithInjectedBean.injectedBean;
-      assert beanWithInjectionPoint.injectedMetadata != null;
-      assert beanWithInjectionPoint.injectedMetadata.getInstance().equals(beanWithInjectedBean);
+      try
+      {
+         DependentContext.INSTANCE.setActive(true);
+         FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+         BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+         assert beanWithInjectionPoint.getInjectedMetadata() != null;
+         assert beanWithInjectionPoint.getInjectedMetadata().getInstance().equals(beanWithInjectedBean);
+      }
+      finally
+      {
+         DependentContext.INSTANCE.setActive(false);
+      }
    }
 
    @Test(groups = { "broken", "injectionPoint" })
    @SpecAssertion(section = "5.11")
    public void testGetBean()
    {
-      webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, FieldInjectionPoint.class));
+      webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
       webBeansBootstrap.boot();
 
       // Get an instance of the bean which has another bean injected into it
-      FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
-      FieldInjectionPoint beanWithInjectionPoint = beanWithInjectedBean.injectedBean;
-      assert beanWithInjectionPoint.injectedMetadata != null;
+      try
+      {
+         DependentContext.INSTANCE.setActive(true);
+         FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+         BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+         assert beanWithInjectionPoint.getInjectedMetadata() != null;
 
-      Set<Bean<FieldInjectionPointBean>> theBean = manager.resolveByType(FieldInjectionPointBean.class);
-      assert beanWithInjectionPoint.injectedMetadata.getBean().equals(theBean);
+         Set<Bean<FieldInjectionPointBean>> theBean = manager.resolveByType(FieldInjectionPointBean.class);
+         assert beanWithInjectionPoint.getInjectedMetadata().getBean().equals(theBean);
+      }
+      finally
+      {
+         DependentContext.INSTANCE.setActive(false);
+      }
    }
 
    @Test(groups = { "broken", "injectionPoint" })
    @SpecAssertion(section = "5.11")
    public void testGetType()
    {
-      webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, FieldInjectionPoint.class));
+      webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
       webBeansBootstrap.boot();
 
       // Get an instance of the bean which has another bean injected into it
-      FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
-      FieldInjectionPoint beanWithInjectionPoint = beanWithInjectedBean.injectedBean;
-      assert beanWithInjectionPoint.injectedMetadata != null;
-      assert beanWithInjectionPoint.injectedMetadata.getType().equals(FieldInjectionPointBean.class);
+      try
+      {
+         DependentContext.INSTANCE.setActive(true);
+         FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+         BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+         assert beanWithInjectionPoint.getInjectedMetadata() != null;
+         assert beanWithInjectionPoint.getInjectedMetadata().getType().equals(FieldInjectionPointBean.class);
+      }
+      finally
+      {
+         DependentContext.INSTANCE.setActive(false);
+      }
    }
 
    @Test(groups = { "broken", "injectionPoint" })
    @SpecAssertion(section = "5.11")
    public void testGetBindingTypes()
    {
-      webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, FieldInjectionPoint.class));
+      webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
       webBeansBootstrap.boot();
 
       // Get an instance of the bean which has another bean injected into it
-      FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
-      FieldInjectionPoint beanWithInjectionPoint = beanWithInjectedBean.injectedBean;
-      assert beanWithInjectionPoint.injectedMetadata != null;
-      Set<Annotation> bindingTypes = beanWithInjectionPoint.injectedMetadata.getBindingTypes();
-      assert bindingTypes.size() == 1;
-      assert bindingTypes.iterator().next().equals(Current.class);
+      try
+      {
+         DependentContext.INSTANCE.setActive(true);
+         FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+         BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+         assert beanWithInjectionPoint.getInjectedMetadata() != null;
+         Set<Annotation> bindingTypes = beanWithInjectionPoint.getInjectedMetadata().getBindingTypes();
+         assert bindingTypes.size() == 1;
+         assert bindingTypes.iterator().next().equals(Current.class);
+      }
+      finally
+      {
+         DependentContext.INSTANCE.setActive(false);
+      }
    }
 
    @Test(groups = { "broken", "injectionPoint" })
    @SpecAssertion(section = "5.11")
    public void testGetMemberField()
    {
-      webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, FieldInjectionPoint.class));
+      webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
       webBeansBootstrap.boot();
 
       // Get an instance of the bean which has another bean injected into it
-      FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
-      FieldInjectionPoint beanWithInjectionPoint = beanWithInjectedBean.injectedBean;
-      assert beanWithInjectionPoint.injectedMetadata != null;
-      assert Field.class.isAssignableFrom(beanWithInjectionPoint.injectedMetadata.getMember().getClass());
+      try
+      {
+         DependentContext.INSTANCE.setActive(true);
+         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
+      {
+         DependentContext.INSTANCE.setActive(false);
+      }
    }
 
    @Test(groups = { "stub", "injectionPoint" })
@@ -129,83 +172,156 @@
    @SpecAssertion(section = "5.11")
    public void testGetMemberConstructor()
    {
-      webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(ConstructorInjectionPointBean.class, ConstructorInjectionPoint.class));
+      webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(ConstructorInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
       webBeansBootstrap.boot();
 
       // Get an instance of the bean which has another bean injected into it
-      ConstructorInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(ConstructorInjectionPointBean.class, new CurrentBinding());
-      ConstructorInjectionPoint beanWithInjectionPoint = beanWithInjectedBean.injectedBean;
-      assert beanWithInjectionPoint.injectedMetadata != null;
-      assert Constructor.class.isAssignableFrom(beanWithInjectionPoint.injectedMetadata.getMember().getClass());
+      try
+      {
+         DependentContext.INSTANCE.setActive(true);
+         ConstructorInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(ConstructorInjectionPointBean.class, new CurrentBinding());
+         BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+         assert beanWithInjectionPoint.getInjectedMetadata() != null;
+         assert Constructor.class.isAssignableFrom(beanWithInjectionPoint.getInjectedMetadata().getMember().getClass());
+      }
+      finally
+      {
+         DependentContext.INSTANCE.setActive(false);
+      }
    }
 
-   @Test(groups = { "stub", "injectionPoint" })
+   @Test(groups = { "broken", "injectionPoint" })
    @SpecAssertion(section = "5.11")
    public void testGetAnnotation()
    {
-      assert false;
+      webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
+      webBeansBootstrap.boot();
+
+      // Get an instance of the bean which has another bean injected into it
+      try
+      {
+         DependentContext.INSTANCE.setActive(true);
+         FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+         BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+         assert beanWithInjectionPoint.getInjectedMetadata() != null;
+         assert beanWithInjectionPoint.getInjectedMetadata().getAnnotation(AnimalStereotype.class) != null;
+      }
+      finally
+      {
+         DependentContext.INSTANCE.setActive(false);
+      }
    }
 
-   @Test(groups = { "stub", "injectionPoint" })
+   @Test(groups = { "broken", "injectionPoint" })
    @SpecAssertion(section = "5.11")
    public void testGetAnnotations()
    {
-      assert false;
+      webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
+      webBeansBootstrap.boot();
+
+      // Get an instance of the bean which has another bean injected into it
+      try
+      {
+         DependentContext.INSTANCE.setActive(true);
+         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(Current.class);
+         assert annotations.contains(AnimalStereotype.class);
+      }
+      finally
+      {
+         DependentContext.INSTANCE.setActive(false);
+      }
    }
 
    @Test(groups = { "broken", "injectionPoint" })
    @SpecAssertion(section = "5.11")
    public void testStandardDeployment()
    {
-      webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, FieldInjectionPoint.class));
+      webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
       webBeansBootstrap.boot();
 
       // Get an instance of the bean which has another bean injected into it
-      FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
-      FieldInjectionPoint beanWithInjectionPoint = beanWithInjectedBean.injectedBean;
-      assert beanWithInjectionPoint.injectedMetadata != null;
-      assert beanWithInjectionPoint.injectedMetadata.getBean().getDeploymentType().equals(Standard.class);
+      try
+      {
+         DependentContext.INSTANCE.setActive(true);
+         FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+         BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+         assert beanWithInjectionPoint.getInjectedMetadata() != null;
+         assert beanWithInjectionPoint.getInjectedMetadata().getBean().getDeploymentType().equals(Standard.class);
+      }
+      finally
+      {
+         DependentContext.INSTANCE.setActive(false);
+      }
    }
 
    @Test(groups = { "broken", "injectionPoint" })
    @SpecAssertion(section = "5.11")
    public void testDependentScope()
    {
-      webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, FieldInjectionPoint.class));
+      webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
       webBeansBootstrap.boot();
 
       // Get an instance of the bean which has another bean injected into it
-      FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
-      FieldInjectionPoint beanWithInjectionPoint = beanWithInjectedBean.injectedBean;
-      assert beanWithInjectionPoint.injectedMetadata != null;
-      assert beanWithInjectionPoint.injectedMetadata.getBean().getScopeType().equals(Dependent.class);
+      try
+      {
+         DependentContext.INSTANCE.setActive(true);
+         FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+         BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+         assert beanWithInjectionPoint.getInjectedMetadata() != null;
+         assert beanWithInjectionPoint.getInjectedMetadata().getBean().getScopeType().equals(Dependent.class);
+      }
+      finally
+      {
+         DependentContext.INSTANCE.setActive(false);
+      }
    }
 
    @Test(groups = { "broken", "injectionPoint" })
    @SpecAssertion(section = "5.11")
    public void testApiTypeInjectionPoint()
    {
-      webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, FieldInjectionPoint.class));
+      webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
       webBeansBootstrap.boot();
 
       // Get an instance of the bean which has another bean injected into it
-      FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
-      FieldInjectionPoint beanWithInjectionPoint = beanWithInjectedBean.injectedBean;
-      assert beanWithInjectionPoint.injectedMetadata != null;
-      assert beanWithInjectionPoint.injectedMetadata.getBean().getTypes().contains(InjectionPoint.class);
+      try
+      {
+         DependentContext.INSTANCE.setActive(true);
+         FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+         BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+         assert beanWithInjectionPoint.getInjectedMetadata() != null;
+         assert beanWithInjectionPoint.getInjectedMetadata().getBean().getTypes().contains(InjectionPoint.class);
+      }
+      finally
+      {
+         DependentContext.INSTANCE.setActive(false);
+      }
    }
 
    @Test(groups = { "broken", "injectionPoint" })
    @SpecAssertion(section = "5.11")
    public void testCurrentBinding()
    {
-      webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, FieldInjectionPoint.class));
+      webBeansBootstrap.setWebBeanDiscovery(new MockWebBeanDiscovery(FieldInjectionPointBean.class, BeanWithInjectionPointMetadata.class));
       webBeansBootstrap.boot();
 
       // Get an instance of the bean which has another bean injected into it
-      FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
-      FieldInjectionPoint beanWithInjectionPoint = beanWithInjectedBean.injectedBean;
-      assert beanWithInjectionPoint.injectedMetadata != null;
-      assert beanWithInjectionPoint.injectedMetadata.getBean().getBindingTypes().contains(Current.class);
+      try
+      {
+         DependentContext.INSTANCE.setActive(true);
+         FieldInjectionPointBean beanWithInjectedBean = manager.getInstanceByType(FieldInjectionPointBean.class, new CurrentBinding());
+         BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
+         assert beanWithInjectionPoint.getInjectedMetadata() != null;
+         assert beanWithInjectionPoint.getInjectedMetadata().getBean().getBindingTypes().contains(Current.class);
+      }
+      finally
+      {
+         DependentContext.INSTANCE.setActive(false);
+      }
    }
 }

Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/BeanWithInjectionPointMetadata.java (from rev 753, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/ConstructorInjectionPoint.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/BeanWithInjectionPointMetadata.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/BeanWithInjectionPointMetadata.java	2009-01-03 18:59:16 UTC (rev 755)
@@ -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.test.beans;
+
+import javax.webbeans.Current;
+import javax.webbeans.InjectionPoint;
+
+/**
+ * Test bean with injection point on the constructor of the bean
+ * 
+ * @author David Allen
+ * 
+ */
+public class BeanWithInjectionPointMetadata
+{
+   @Current
+   private InjectionPoint injectedMetadata;
+
+   public InjectionPoint getInjectedMetadata()
+   {
+      return injectedMetadata;
+   }
+}


Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/BeanWithInjectionPointMetadata.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/ConstructorInjectionPoint.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/ConstructorInjectionPoint.java	2009-01-03 16:43:35 UTC (rev 754)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/ConstructorInjectionPoint.java	2009-01-03 18:59:16 UTC (rev 755)
@@ -1,35 +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.beans;
-
-import javax.webbeans.InjectionPoint;
-
-/**
- * Test bean with injection point on the constructor of the bean
- * 
- * @author David Allen
- *
- */
-public class ConstructorInjectionPoint
-{
-   public InjectionPoint injectedMetadata;
-
-   public ConstructorInjectionPoint(InjectionPoint injectionPoint)
-   {
-      injectedMetadata = injectionPoint;
-   }
-}

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/ConstructorInjectionPointBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/ConstructorInjectionPointBean.java	2009-01-03 16:43:35 UTC (rev 754)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/ConstructorInjectionPointBean.java	2009-01-03 18:59:16 UTC (rev 755)
@@ -17,17 +17,24 @@
 package org.jboss.webbeans.test.beans;
 
 import javax.webbeans.Current;
-import javax.webbeans.SessionScoped;
 
 /**
- * Test bean to inject another bean which uses injection point metadata on the constructor
+ * Test bean to inject a bean using injection point metadata into a constructor
  * 
  * @author David Allen
- *
+ * 
  */
- at SessionScoped
 public class ConstructorInjectionPointBean
 {
-   @Current
-   public ConstructorInjectionPoint injectedBean;
+   private BeanWithInjectionPointMetadata injectedBean;
+
+   public ConstructorInjectionPointBean(@Current BeanWithInjectionPointMetadata injectedBean)
+   {
+      this.injectedBean = injectedBean;
+   }
+   
+   public BeanWithInjectionPointMetadata getInjectedBean()
+   {
+      return injectedBean;
+   }
 }

Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/FieldInjectionPoint.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/FieldInjectionPoint.java	2009-01-03 16:43:35 UTC (rev 754)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/FieldInjectionPoint.java	2009-01-03 18:59:16 UTC (rev 755)
@@ -1,34 +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.beans;
-
-import javax.webbeans.Current;
-import javax.webbeans.InjectionPoint;
-
-/**
- * Test bean with injected metadata in a field about where this bean is injected
- * into another bean
- * 
- * @author David Allen
- *
- */
-public class FieldInjectionPoint
-{
-   @Current
-   public InjectionPoint injectedMetadata;
-}

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/FieldInjectionPointBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/FieldInjectionPointBean.java	2009-01-03 16:43:35 UTC (rev 754)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/FieldInjectionPointBean.java	2009-01-03 18:59:16 UTC (rev 755)
@@ -17,11 +17,10 @@
 
 package org.jboss.webbeans.test.beans;
 
-import java.io.Serializable;
-
 import javax.webbeans.Current;
-import javax.webbeans.SessionScoped;
 
+import org.jboss.webbeans.test.annotations.AnimalStereotype;
+
 /**
  * Test bean to inject another bean which uses injection point metadata in a
  * field
@@ -29,11 +28,13 @@
  * @author David Allen
  * 
  */
- at SessionScoped
-public class FieldInjectionPointBean implements Serializable
+public class FieldInjectionPointBean
 {
-   private static final long serialVersionUID = 1L;
+   @Current @AnimalStereotype
+   private BeanWithInjectionPointMetadata injectedBean;
 
-   @Current
-   public FieldInjectionPoint injectedBean;
+   public BeanWithInjectionPointMetadata getInjectedBean()
+   {
+      return injectedBean;
+   }
 }




More information about the weld-commits mailing list