openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1594302 - in /openwebbeans/branches/owb_1.2.x: webbeans-impl/src/main/java/org/apache/webbeans/container/ webbeans-impl/src/test/java/org/apache/webbeans/newtests/instance/ webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/
Date Tue, 13 May 2014 17:50:51 GMT
Author: struberg
Date: Tue May 13 17:50:51 2014
New Revision: 1594302

URL: http://svn.apache.org/r1594302
Log:
OWB-956 proxy type should be beanclass if not explicitely given

Modified:
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/instance/InstanceIteratorTest.java
    openwebbeans/branches/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansEjbPlugin.java

Modified: openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=1594302&r1=1594301&r2=1594302&view=diff
==============================================================================
--- openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
(original)
+++ openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
Tue May 13 17:50:51 2014
@@ -694,8 +694,6 @@ public class BeanManagerImpl extends Abs
             creationalContext = webBeansContext.getCreationalContextFactory().wrappedCreationalContext(creationalContext,
bean);
         }
 
-
-
         //Check type if bean type is given
         if(beanType != null)
         {
@@ -704,7 +702,10 @@ public class BeanManagerImpl extends Abs
             {
                 throw new IllegalArgumentException("Given bean type : " + beanType + " is
not applicable for the bean instance : " + bean);
             }
-            
+        }
+        else
+        {
+            beanType = bean.getBeanClass();
         }
                 
         //Scope is normal

Modified: openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/instance/InstanceIteratorTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/instance/InstanceIteratorTest.java?rev=1594302&r1=1594301&r2=1594302&view=diff
==============================================================================
--- openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/instance/InstanceIteratorTest.java
(original)
+++ openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/instance/InstanceIteratorTest.java
Tue May 13 17:50:51 2014
@@ -22,6 +22,7 @@ import org.apache.webbeans.newtests.Abst
 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;
@@ -29,6 +30,7 @@ import javax.inject.Inject;
 import javax.inject.Qualifier;
 import java.lang.annotation.Retention;
 import java.lang.annotation.Target;
+import junit.framework.Assert;
 
 import static java.lang.annotation.ElementType.*;
 import static java.lang.annotation.RetentionPolicy.RUNTIME;
@@ -62,6 +64,17 @@ public class InstanceIteratorTest extend
         assertEquals(3, count); //contextual instances: Bean1, Bean2, 2nd instance of Bean1
exposed by the producer
     }
 
+    @Test
+    public void testInstanceWithoutImpl()
+    {
+        startContainer(InstanceIteratorHolder.class, Bean1.class);
+
+        InstanceIteratorHolder instanceIteratorHolder = getInstance(InstanceIteratorHolder.class);
+        assertNotNull(instanceIteratorHolder);
+
+        Assert.assertTrue(instanceIteratorHolder.iterateOverContracts());
+    }
+
     public static class InstanceHolder
     {
         @Inject
@@ -75,6 +88,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

Modified: openwebbeans/branches/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansEjbPlugin.java
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansEjbPlugin.java?rev=1594302&r1=1594301&r2=1594302&view=diff
==============================================================================
--- openwebbeans/branches/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansEjbPlugin.java
(original)
+++ openwebbeans/branches/owb_1.2.x/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansEjbPlugin.java
Tue May 13 17:50:51 2014
@@ -84,7 +84,7 @@ public interface OpenWebBeansEjbPlugin e
      * Returns session bean proxy.
      * 
      * @param bean session bean
-     * @param proxy interface
+     * @param iface interface
      * @return session bean proxy
      */
     public Object getSessionBeanProxy(Bean<?> bean, Class<?> iface, CreationalContext<?>
creationalContext);



Mime
View raw message