openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1363031 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/container/ test/java/org/apache/webbeans/test/ test/java/org/apache/webbeans/test/mock/ test/java/org/apache/webbeans/test/unittests/disposal/ test/java/org/...
Date Wed, 18 Jul 2012 18:03:42 GMT
Author: struberg
Date: Wed Jul 18 18:03:42 2012
New Revision: 1363031

URL: http://svn.apache.org/viewvc?rev=1363031&view=rev
Log:
OWB-681 get rid of deprecated methods in BeanManagerImpl

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/TestContext.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/disposal/DisposalTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/DisposalInjectedComponentTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/primitive/PrimitiveProducerTest.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=1363031&r1=1363030&r2=1363031&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 Jul 18 18:03:42 2012
@@ -94,8 +94,6 @@ import org.apache.webbeans.util.ClassUti
 import org.apache.webbeans.util.WebBeansUtil;
 import org.apache.webbeans.xml.WebBeansXMLConfigurator;
 
-import static org.apache.webbeans.util.InjectionExceptionUtils.throwAmbiguousResolutionExceptionForBeanName;
-
 /**
  * Implementation of the {@link BeanManager} contract of the web beans
  * container.
@@ -480,31 +478,6 @@ public class BeanManagerImpl implements 
     }
     
     @Deprecated
-    public Object getInstanceByName(String name, CreationalContext<?> creationalContext)
-    {
-        AbstractOwbBean<?> component = null;
-        Object object = null;
-
-        Set<Bean<?>> set = injectionResolver.implResolveByName(name);
-        if (set.isEmpty())
-        {
-            return null;
-        }
-
-        if (set.size() > 1)
-        {
-            throwAmbiguousResolutionExceptionForBeanName(set, name);
-        }
-
-        component = (AbstractOwbBean<?>) set.iterator().next();
-
-        object = getInstance(component, creationalContext);
-
-        return object;
-    }
-    
-    
-    @Deprecated
     public <T> T getInstanceToInject(InjectionPoint injectionPoint, CreationalContext<?>
context)
     {
         return (T)getInjectableReference(injectionPoint, context);

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java?rev=1363031&r1=1363030&r2=1363031&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
Wed Jul 18 18:03:42 2012
@@ -418,7 +418,8 @@ public abstract class TestContext implem
      */
     protected Object getInstanceByName(String name)
     {
-        return manager.getInstanceByName(name);
+        Bean<?> bean = manager.resolve(manager.getBeans(name));
+        return manager.getReference(bean, Object.class, manager.createCreationalContext(bean));
     }
 
     /**

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java?rev=1363031&r1=1363030&r2=1363031&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java
Wed Jul 18 18:03:42 2012
@@ -141,11 +141,6 @@ public class MockManager implements Bean
         return manager.getInstance(bean,null);
     }
 
-    public Object getInstanceByName(String name)
-    {
-        return manager.getInstanceByName(name,null);
-    }
-
     public <T> T getInstanceByType(Class<T> type, Annotation... bindingTypes)
     {
         return manager.getInstanceByType(type, bindingTypes);

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/disposal/DisposalTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/disposal/DisposalTest.java?rev=1363031&r1=1363030&r2=1363031&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/disposal/DisposalTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/disposal/DisposalTest.java
Wed Jul 18 18:03:42 2012
@@ -54,7 +54,7 @@ public class DisposalTest extends TestCo
         defineManagedBean(Disposal1.class);
 
         @SuppressWarnings("unchecked")
-        List<Integer> list = (List<Integer>) getManager().getInstanceByName("createBinding1");
+        List<Integer> list = (List<Integer>) getInstanceByName("createBinding1");
         Assert.assertNotNull(list);
         Assert.assertTrue(list.size() == 1);
         contextFactory.destroyRequestContext(null);

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/DisposalInjectedComponentTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/DisposalInjectedComponentTest.java?rev=1363031&r1=1363030&r2=1363031&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/DisposalInjectedComponentTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/DisposalInjectedComponentTest.java
Wed Jul 18 18:03:42 2012
@@ -66,7 +66,7 @@ public class DisposalInjectedComponentTe
 
         Assert.assertEquals(2, comps.size());
 
-        Object producerResult = getManager().getInstanceByName("service");
+        Object producerResult = getInstanceByName("service");
         
         IService producverService = (IService)producerResult;
         

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/primitive/PrimitiveProducerTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/primitive/PrimitiveProducerTest.java?rev=1363031&r1=1363030&r2=1363031&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/primitive/PrimitiveProducerTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/producer/primitive/PrimitiveProducerTest.java
Wed Jul 18 18:03:42 2012
@@ -48,7 +48,7 @@ public class PrimitiveProducerTest exten
         defineManagedBean(PrimitiveProducer.class);
         defineManagedBean(PrimitiveConsumer.class);
         
-        PrimitiveConsumer consumer = (PrimitiveConsumer) getManager().getInstanceByName("primitiveConsumer");
+        PrimitiveConsumer consumer = (PrimitiveConsumer) getInstanceByName("primitiveConsumer");
         
         Assert.assertEquals(56.7f, consumer.getSalary());
         



Mime
View raw message