[webbeans-commits] Webbeans SVN: r2195 - ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Tue Mar 24 17:17:58 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-03-24 17:17:57 -0400 (Tue, 24 Mar 2009)
New Revision: 2195

Added:
   ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/IntegerCollectionInjection.java
   ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/NoParameterizedCollectionInjection.java
   ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedCollectionInjection.java
Modified:
   ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedProducer.java
   ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedProducerTest.java
Log:
WBRI-194

Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/IntegerCollectionInjection.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/IntegerCollectionInjection.java	                        (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/IntegerCollectionInjection.java	2009-03-24 21:17:57 UTC (rev 2195)
@@ -0,0 +1,45 @@
+package org.jboss.webbeans.test.unit.implementation.producer.field;
+
+import java.util.Collection;
+
+import javax.inject.Current;
+import javax.inject.Initializer;
+
+public class IntegerCollectionInjection
+{
+
+   private Collection<Integer> value;
+
+   @Current
+   private Collection<Integer> fieldInjection;
+
+   private Collection<Integer> setterInjection;
+
+   @Initializer
+   public void init(Collection<Integer> setterInjection)
+   {
+      this.setterInjection = setterInjection;
+   }
+
+   @Initializer
+   public IntegerCollectionInjection(Collection<Integer> com)
+   {
+      this.value = com;
+   }
+
+   public Collection<Integer> getValue()
+   {
+      return value;
+   }
+
+   public Collection<Integer> getFieldInjection()
+   {
+      return fieldInjection;
+   }
+
+   public Collection<Integer> getSetterInjection()
+   {
+      return setterInjection;
+   }
+
+}


Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/IntegerCollectionInjection.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/NoParameterizedCollectionInjection.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/NoParameterizedCollectionInjection.java	                        (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/NoParameterizedCollectionInjection.java	2009-03-24 21:17:57 UTC (rev 2195)
@@ -0,0 +1,45 @@
+package org.jboss.webbeans.test.unit.implementation.producer.field;
+
+import java.util.Collection;
+
+import javax.inject.Current;
+import javax.inject.Initializer;
+
+public class NoParameterizedCollectionInjection
+{
+
+   private Collection value;
+
+   @Current
+   private Collection fieldInjection;
+
+   private Collection setterInjection;
+
+   @Initializer
+   public void init(Collection setterInjection)
+   {
+      this.setterInjection = setterInjection;
+   }
+
+   @Initializer
+   public NoParameterizedCollectionInjection(Collection com)
+   {
+      this.value = com;
+   }
+
+   public Collection getValue()
+   {
+      return value;
+   }
+
+   public Collection getFieldInjection()
+   {
+      return fieldInjection;
+   }
+
+   public Collection getSetterInjection()
+   {
+      return setterInjection;
+   }
+
+}


Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/NoParameterizedCollectionInjection.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedCollectionInjection.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedCollectionInjection.java	                        (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedCollectionInjection.java	2009-03-24 21:17:57 UTC (rev 2195)
@@ -0,0 +1,45 @@
+package org.jboss.webbeans.test.unit.implementation.producer.field;
+
+import java.util.Collection;
+
+import javax.inject.Current;
+import javax.inject.Initializer;
+
+public class ParameterizedCollectionInjection
+{
+
+   private Collection<String> value;
+
+   @Current
+   private Collection<String> fieldInjection;
+
+   private Collection<String> setterInjection;
+
+   @Initializer
+   public void init(Collection<String> setterInjection)
+   {
+      this.setterInjection = setterInjection;
+   }
+
+   @Initializer
+   public ParameterizedCollectionInjection(Collection<String> com)
+   {
+      this.value = com;
+   }
+
+   public Collection<String> getValue()
+   {
+      return value;
+   }
+
+   public Collection<String> getFieldInjection()
+   {
+      return fieldInjection;
+   }
+
+   public Collection<String> getSetterInjection()
+   {
+      return setterInjection;
+   }
+
+}


Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedCollectionInjection.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedProducer.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedProducer.java	2009-03-24 21:17:22 UTC (rev 2194)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedProducer.java	2009-03-24 21:17:57 UTC (rev 2195)
@@ -1,5 +1,6 @@
 package org.jboss.webbeans.test.unit.implementation.producer.field;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
@@ -9,9 +10,23 @@
 {
 
    @Produces
-   public List<String> create()
+   public List<String> createStringList()
    {
       return Arrays.asList("aaa", "bbb");
    }
 
+   @Produces
+   public List createList()
+   {
+      return Arrays.asList(1, 2, 3);
+   }
+
+   @Produces
+   public ArrayList<Integer> createIntegerList()
+   {
+      List<Integer> list = Arrays.asList(1, 2, 3, 4);
+      ArrayList<Integer> arrayList = new ArrayList<Integer>();
+      arrayList.addAll(list);
+      return arrayList;
+   }
 }

Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedProducerTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedProducerTest.java	2009-03-24 21:17:22 UTC (rev 2194)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedProducerTest.java	2009-03-24 21:17:57 UTC (rev 2195)
@@ -1,5 +1,6 @@
 package org.jboss.webbeans.test.unit.implementation.producer.field;
 
+import java.util.Collection;
 import java.util.List;
 
 import javax.inject.TypeLiteral;
@@ -13,9 +14,11 @@
 {
 
    @Test
-   public void testInjectManagerProducer()
+   public void testParameterizedListInjection()
    {
-      assert manager.getInstanceByType(new TypeLiteral<List<String>>(){}).size() == 2;
+      assert manager.getInstanceByType(new TypeLiteral<List<String>>()
+      {
+      }).size() == 2;
 
       ParameterizedListInjection item = manager.getInstanceByType(ParameterizedListInjection.class);
       assert item.getFieldInjection().size() == 2;
@@ -23,4 +26,42 @@
       assert item.getSetterInjection().size() == 2;
 
    }
+
+   @Test
+   public void testParameterizedCollectionInjection()
+   {
+      assert manager.getInstanceByType(new TypeLiteral<Collection<String>>()
+      {
+      }).size() == 2;
+
+      ParameterizedCollectionInjection item = manager.getInstanceByType(ParameterizedCollectionInjection.class);
+      assert item.getFieldInjection().size() == 2;
+      assert item.getValue().size() == 2;
+      assert item.getSetterInjection().size() == 2;
+
+   }
+
+   @Test
+   public void testNoParameterizedCollectionInjection()
+   {
+      assert manager.getInstanceByType(Collection.class).size() == 3;
+
+      NoParameterizedCollectionInjection item = manager.getInstanceByType(NoParameterizedCollectionInjection.class);
+      assert item.getFieldInjection().size() == 3;
+      assert item.getValue().size() == 3;
+      assert item.getSetterInjection().size() == 3;
+
+   }
+   
+   @Test
+   public void testIntegerCollectionInjection()
+   {
+      assert manager.getInstanceByType(new TypeLiteral<Collection<Integer>>(){}).size() == 4;
+
+      IntegerCollectionInjection item = manager.getInstanceByType(IntegerCollectionInjection.class);
+      assert item.getFieldInjection().size() == 4;
+      assert item.getValue().size() == 4;
+      assert item.getSetterInjection().size() == 4;
+
+   }
 }




More information about the weld-commits mailing list