openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1362885 - /openwebbeans/trunk/webbeans-test/cditest-owb/src/main/java/org/apache/webbeans/cditest/owb/CdiTestOpenWebBeansContainer.java
Date Wed, 18 Jul 2012 11:25:49 GMT
Author: struberg
Date: Wed Jul 18 11:25:49 2012
New Revision: 1362885

URL: http://svn.apache.org/viewvc?rev=1362885&view=rev
Log:
OWB-667 also fix getBeans() usage in CdiTest container 

Modified:
    openwebbeans/trunk/webbeans-test/cditest-owb/src/main/java/org/apache/webbeans/cditest/owb/CdiTestOpenWebBeansContainer.java

Modified: openwebbeans/trunk/webbeans-test/cditest-owb/src/main/java/org/apache/webbeans/cditest/owb/CdiTestOpenWebBeansContainer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-test/cditest-owb/src/main/java/org/apache/webbeans/cditest/owb/CdiTestOpenWebBeansContainer.java?rev=1362885&r1=1362884&r2=1362885&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-test/cditest-owb/src/main/java/org/apache/webbeans/cditest/owb/CdiTestOpenWebBeansContainer.java
(original)
+++ openwebbeans/trunk/webbeans-test/cditest-owb/src/main/java/org/apache/webbeans/cditest/owb/CdiTestOpenWebBeansContainer.java
Wed Jul 18 11:25:49 2012
@@ -40,7 +40,6 @@ import org.apache.webbeans.context.Conte
 import org.apache.webbeans.context.type.ContextTypes;
 import org.apache.webbeans.logger.WebBeansLoggerFacade;
 import org.apache.webbeans.spi.ContainerLifecycle;
-import org.apache.webbeans.util.InjectionExceptionUtils;
 
 /**
  * OpenWebBeans specific implementation of {@link CdiTestContainer}.
@@ -235,18 +234,7 @@ public class CdiTestOpenWebBeansContaine
     throws ResolutionException 
     {
         Set<Bean<?>> beans = getBeanManager().getBeans(type, qualifiers);
-        if (beans == null || beans.isEmpty()) 
-        {
-            InjectionExceptionUtils.throwBeanNotFoundException(type, qualifiers);
-        }
-
-        if (beans.size() > 1) 
-        {
-            InjectionExceptionUtils.throwAmbiguousResolutionException(beans, type, null,
qualifiers);
-        }
-
-        @SuppressWarnings("unchecked")
-        Bean<T> bean = (Bean<T>)beans.iterator().next();
+        Bean<?> bean = getBeanManager().resolve(beans);
 
         @SuppressWarnings("unchecked")
         T instance = (T) getBeanManager().getReference(bean, type, getBeanManager().createCreationalContext(bean));
@@ -256,9 +244,12 @@ public class CdiTestOpenWebBeansContaine
     public Object getInstance(String name)
     throws ResolutionException 
     {
-        //X getBeanManager().getELResolver();
-        // TODO implement
-        return null;
+        Set<Bean<?>> beans = getBeanManager().getBeans(name);
+        Bean<?> bean = getBeanManager().resolve(beans);
+
+        @SuppressWarnings("unchecked")
+        Object instance = getBeanManager().getReference(bean, bean.getBeanClass(), getBeanManager().createCreationalContext(bean));
+        return instance;
     }
 
 }



Mime
View raw message