openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1594520 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/container/BeanManagerImpl.java test/java/org/apache/webbeans/test/instance/InstanceIteratorTest.java
Date Wed, 14 May 2014 08:51:53 GMT
Author: struberg
Date: Wed May 14 08:51:53 2014
New Revision: 1594520

URL: http://svn.apache.org/r1594520
Log:
OWB-956 use beanclass as default for the injection type

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/instance/InstanceIteratorTest.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=1594520&r1=1594519&r2=1594520&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
Wed May 14 08:51:53 2014
@@ -680,7 +680,11 @@ public class BeanManagerImpl extends Abs
             }
             
         }
-                
+        else
+        {
+            beanType = bean.getBeanClass();
+        }
+
         //Scope is normal
         if (isNormalScope(bean.getScope()))
         {

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/instance/InstanceIteratorTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/instance/InstanceIteratorTest.java?rev=1594520&r1=1594519&r2=1594520&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/instance/InstanceIteratorTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/instance/InstanceIteratorTest.java
Wed May 14 08:51:53 2014
@@ -18,10 +18,12 @@
  */
 package org.apache.webbeans.test.instance;
 
+import junit.framework.Assert;
 import org.apache.webbeans.test.AbstractUnitTest;
 import org.junit.Test;
 
 import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.RequestScoped;
 import javax.enterprise.inject.Any;
 import javax.enterprise.inject.Instance;
 import javax.enterprise.inject.Produces;
@@ -62,6 +64,30 @@ public class InstanceIteratorTest extend
         assertEquals(3, count); //contextual instances: Bean1, Bean2, 2nd instance of Bean1
exposed by the producer
     }
 
+    @Test
+    public void testInstanceIteratorWithoutImpl()
+    {
+        startContainer(InstanceIteratorHolder.class);
+
+        InstanceIteratorHolder instanceIteratorHolder = getInstance(InstanceIteratorHolder.class);
+        assertNotNull(instanceIteratorHolder);
+
+        Assert.assertFalse(instanceIteratorHolder.iterateOverContracts());
+    }
+
+    @Test
+    public void testInstanceIteratorWithImpl()
+    {
+        startContainer(InstanceIteratorHolder.class, Bean1.class);
+
+        InstanceIteratorHolder instanceIteratorHolder = getInstance(InstanceIteratorHolder.class);
+        assertNotNull(instanceIteratorHolder);
+
+        Assert.assertTrue(instanceIteratorHolder.iterateOverContracts());
+    }
+
+
+
     public static class InstanceHolder
     {
         @Inject
@@ -75,6 +101,25 @@ public class InstanceIteratorTest extend
         }
     }
 
+    @RequestScoped
+    public static class InstanceIteratorHolder
+    {
+        @Inject
+        @Any
+        private Instance<ShardContract> instances;
+
+        public boolean iterateOverContracts()
+        {
+            boolean foundSomething = false;
+            for (ShardContract contract: instances)
+            {
+                foundSomething = true;
+            }
+
+            return foundSomething;
+        }
+    }
+
     @Target({TYPE, METHOD, PARAMETER})
     @Retention(RUNTIME)
     @Qualifier



Mime
View raw message