openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1429160 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/component/creation/ main/java/org/apache/webbeans/config/ main/java/org/apache/webbeans/container/ main/java/org/apache/webbeans/intercept/ main/java/org/apa...
Date Fri, 04 Jan 2013 22:15:05 GMT
Author: struberg
Date: Fri Jan  4 22:15:04 2013
New Revision: 1429160

URL: http://svn.apache.org/viewvc?rev=1429160&view=rev
Log:
OWB-749 move interceptor stuff to InterceptorManager

no reason to pollute the BeanManager with everything ;)

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorComparator.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptorBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptorResolutionTest.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/intercept/webbeans/ShoppingCardInterceptorTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/strict/XMLSpecStrictTest.java
    openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/resolution/InterceptorResolutionTest.xml

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java?rev=1429160&r1=1429159&r2=1429160&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
Fri Jan  4 22:15:04 2013
@@ -297,7 +297,7 @@ public class ManagedBeanCreatorImpl<T> e
         Class<?> clazz = injectionTargetEvent.getAnnotatedType().getJavaClass();
         AnnotatedType annotatedType = injectionTargetEvent.getAnnotatedType();
 
-        if (webBeansContext.getInterceptorsManager().isInterceptorEnabled(clazz))
+        if (webBeansContext.getInterceptorsManager().isInterceptorClassEnabled(clazz))
         {
             ManagedBean<T> component;
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java?rev=1429160&r1=1429159&r2=1429160&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
Fri Jan  4 22:15:04 2013
@@ -345,7 +345,7 @@ public class BeansDeployer
         beans.clear();
         
         //Adding interceptors to validate
-        List<javax.enterprise.inject.spi.Interceptor<?>> interceptors = manager.getInterceptors();
+        List<javax.enterprise.inject.spi.Interceptor<?>> interceptors = webBeansContext.getInterceptorsManager().getInterceptors();
         for(javax.enterprise.inject.spi.Interceptor interceptor : interceptors)
         {
             WebBeansInterceptorBean wbInt = (WebBeansInterceptorBean)interceptor;

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=1429160&r1=1429159&r2=1429160&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
Fri Jan  4 22:15:04 2013
@@ -131,9 +131,6 @@ public class BeanManagerImpl implements 
     /**Deployment archive beans*/
     private Set<Bean<?>> deploymentBeans = new CopyOnWriteArraySet<Bean<?>>();
 
-    /**Activity interceptors*/
-    private List<Interceptor<?>> webBeansInterceptors = new ArrayList<Interceptor<?>>();
-    
     /**Normal scoped cache proxies*/
     private Map<Contextual<?>, Object> cacheProxies = new ConcurrentHashMap<Contextual<?>,
Object>();
 
@@ -389,7 +386,7 @@ public class BeanManagerImpl implements 
      * @param bean
      * @throws DefinitionException if the id is not unique.
      */
-    protected void addPassivationInfo(OwbBean<?> bean) throws DefinitionException
+    public void addPassivationInfo(OwbBean<?> bean) throws DefinitionException
     {
         String id = bean.getId();
         if(id != null)
@@ -411,7 +408,8 @@ public class BeanManagerImpl implements 
         return this;
 
     }
-    
+
+    //X TODO move to InterceptorsManager
     public void addCustomInterceptorClass(Class<?> clazz)
     {
         Asserts.nullCheckForClass(clazz);
@@ -496,22 +494,6 @@ public class BeanManagerImpl implements 
         return this;
     }
 
-    
-    public BeanManager addInterceptor(Interceptor interceptor)
-    {
-        webBeansInterceptors.add(interceptor);
-        if (interceptor instanceof OwbBean)
-        {
-            OwbBean<?> owbBean = (OwbBean<?>)interceptor;
-            if(owbBean.isPassivationCapable())
-            {
-                addPassivationInfo((OwbBean)interceptor);
-            }
-            
-        }       
-        return this;
-    }
-
     /**
      * {@inheritDoc}
      */
@@ -567,11 +549,6 @@ public class BeanManagerImpl implements 
         return deploymentBeans;
     }
 
-    public List<Interceptor<?>> getInterceptors()
-    {
-        return webBeansInterceptors;
-    }
-
     public Set<Decorator<?>> getDecorators()
     {
         return webBeansDecorators;
@@ -1113,7 +1090,7 @@ public class BeanManagerImpl implements 
         producers.clear();
         passivationBeans.clear();
         webBeansDecorators.clear();
-        webBeansInterceptors.clear();
+        webBeansContext.getInterceptorsManager().getInterceptors().clear();
     }
 
     public void clearCacheProxies()

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorComparator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorComparator.java?rev=1429160&r1=1429159&r2=1429160&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorComparator.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorComparator.java
Fri Jan  4 22:15:04 2013
@@ -28,11 +28,11 @@ import org.apache.webbeans.intercept.web
 public class InterceptorComparator<T> implements Comparator<Interceptor<T>>
 {
 
-    private final WebBeansContext webBeansContext;
+    private final InterceptorsManager interceptorsManager;
 
     public InterceptorComparator(WebBeansContext webBeansContext)
     {
-        this.webBeansContext = webBeansContext;
+        this.interceptorsManager = webBeansContext.getInterceptorsManager();
     }
 
     public int compare(Interceptor<T> o1, Interceptor<T> o2)
@@ -49,7 +49,7 @@ public class InterceptorComparator<T> im
             Class<?> o1Clazz = src.getClazz();
             Class<?> o2Clazz = target.getClazz();
 
-            return webBeansContext.getInterceptorsManager().compare(o1Clazz, o2Clazz);
+            return interceptorsManager.compare(o1Clazz, o2Clazz);
 
         }
     }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java?rev=1429160&r1=1429159&r2=1429160&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java
Fri Jan  4 22:15:04 2013
@@ -18,12 +18,14 @@
  */
 package org.apache.webbeans.intercept;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
 
 import javax.enterprise.inject.spi.AnnotatedType;
-import javax.interceptor.Interceptor;
+import javax.enterprise.inject.spi.Interceptor;
 
+import org.apache.webbeans.component.OwbBean;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
@@ -34,27 +36,30 @@ import org.apache.webbeans.util.Asserts;
  */
 public class InterceptorsManager
 {
-    private List<Class<?>> enabledInterceptors = new CopyOnWriteArrayList<Class<?>>();
     private final WebBeansContext webBeansContext;
+    private final BeanManagerImpl beanManager;
 
-    private final BeanManagerImpl manager;
+    private List<Class<?>> enabledInterceptorClasses = new CopyOnWriteArrayList<Class<?>>();
+
+    /**Active interceptors*/
+    private List<Interceptor<?>> webBeansInterceptors = new ArrayList<Interceptor<?>>();
 
     public InterceptorsManager(WebBeansContext webBeansContext)
     {
         this.webBeansContext = webBeansContext;
-        manager = webBeansContext.getBeanManagerImpl();
+        beanManager = webBeansContext.getBeanManagerImpl();
     }
 
     /**
      * Add a certain class to the enabled interceptors list.
      */
-    public void addNewInterceptor(Class<?> interceptorClazz)
+    public void addNewInterceptorClass(Class<?> interceptorClazz)
     {
         Asserts.nullCheckForClass(interceptorClazz, "interceptorClazz can not be null");
 
-        if (!enabledInterceptors.contains(interceptorClazz))
+        if (!enabledInterceptorClasses.contains(interceptorClazz))
         {
-            enabledInterceptors.add(interceptorClazz);
+            enabledInterceptorClasses.add(interceptorClazz);
         }
     }
 
@@ -66,13 +71,13 @@ public class InterceptorsManager
         Asserts.assertNotNull(src, "src parameter can not be  null");
         Asserts.assertNotNull(target, "target parameter can not be null");
 
-        int srcIndex = enabledInterceptors.indexOf(src);
+        int srcIndex = enabledInterceptorClasses.indexOf(src);
         if (srcIndex == -1)
         {
             throw new IllegalArgumentException(src.getName() + " is not an enabled interceptor!");
         }
 
-        int targetIndex = enabledInterceptors.indexOf(target);
+        int targetIndex = enabledInterceptorClasses.indexOf(target);
         if (targetIndex == -1)
         {
             throw new IllegalArgumentException(target.getName() + " is not an enabled interceptor!");
@@ -96,21 +101,43 @@ public class InterceptorsManager
     /**
      * Check if the given interceptor class is in the list of enabled interceptors.
      */
-    public boolean isInterceptorEnabled(Class<?> interceptorClazz)
+    public boolean isInterceptorClassEnabled(Class<?> interceptorClazz)
     {
         Asserts.nullCheckForClass(interceptorClazz, "interceptorClazz can not be null");
 
-        return enabledInterceptors.contains(interceptorClazz);
+        return enabledInterceptorClasses.contains(interceptorClazz);
+    }
+
+
+    public void addInterceptor(Interceptor interceptor)
+    {
+        webBeansInterceptors.add(interceptor);
+        if (interceptor instanceof OwbBean)
+        {
+            OwbBean<?> owbBean = (OwbBean<?>)interceptor;
+            if(owbBean.isPassivationCapable())
+            {
+                beanManager.addPassivationInfo((OwbBean)interceptor);
+            }
+
+        }
     }
-    
+
+
+    public List<Interceptor<?>> getInterceptors()
+    {
+        return webBeansInterceptors;
+    }
+
     public void validateInterceptorClasses()
     {
-        for(Class<?> interceptorClass : enabledInterceptors)
+        for(Class<?> interceptorClass : enabledInterceptorClasses)
         {
             AnnotatedType<?> annotatedType = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(interceptorClass);
 
             // Validate decorator classes
-            if(!annotatedType.isAnnotationPresent(Interceptor.class) && !manager.containsCustomInterceptorClass(interceptorClass))
+            if(!annotatedType.isAnnotationPresent(javax.interceptor.Interceptor.class) &&
+               !beanManager.containsCustomInterceptorClass(interceptorClass))
             {
                 throw new WebBeansConfigurationException("Given class : " + interceptorClass
+ " is not a interceptor class");
             }   

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java?rev=1429160&r1=1429159&r2=1429160&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
Fri Jan  4 22:15:04 2013
@@ -114,7 +114,7 @@ public final class WebBeansInterceptorCo
         }
 
 
-        delegate.getWebBeansContext().getBeanManagerImpl().addInterceptor(interceptor);
+        delegate.getWebBeansContext().getInterceptorsManager().addInterceptor(interceptor);
 
     }
 
@@ -390,7 +390,7 @@ public final class WebBeansInterceptorCo
     {
         Set<Interceptor<?>> set = new HashSet<Interceptor<?>>();
 
-        Iterator<Interceptor<?>> it = webBeansContext.getBeanManagerImpl().getInterceptors().iterator();
+        Iterator<Interceptor<?>> it = webBeansContext.getInterceptorsManager().getInterceptors().iterator();
         WebBeansInterceptorBean<?> interceptor;
 
         List<Class<? extends Annotation>> bindingTypes = new ArrayList<Class<?
extends Annotation>>();

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptorBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptorBean.java?rev=1429160&r1=1429159&r2=1429160&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptorBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptorBean.java
Fri Jan  4 22:15:04 2013
@@ -65,6 +65,7 @@ import java.util.logging.Level;
  * </p>
  * 
  * @version $Rev$ $Date$
+ * @deprecated this should get replaced via a new version which does <b>not</b>
delegate to a ManagedBean!
  */
 public class WebBeansInterceptorBean<T> extends AbstractOwbBean<T> implements
OwbInterceptor<T>
 {
@@ -74,8 +75,13 @@ public class WebBeansInterceptorBean<T> 
     /** Interceptor class */
     private Class<?> clazz;
 
-    /**Delegate Bean*/
+    /**
+     * The Delegate Bean.
+     * OWB currently scans any &#064;Interceptor class as standard bean and then 'wraps'
+     * it with this Bean. Imo this is wrong as an InterceptorBean has different rules alltogether.
+     */
     private AbstractInjectionTargetBean<T> delegateBean;
+
     private final WebBeansContext webBeansContext;
 
     public WebBeansInterceptorBean(AbstractInjectionTargetBean<T> delegateBean)

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java?rev=1429160&r1=1429159&r2=1429160&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java
Fri Jan  4 22:15:04 2013
@@ -34,6 +34,7 @@ import org.apache.webbeans.config.OWBLog
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.decorator.WebBeansDecorator;
+import org.apache.webbeans.intercept.InterceptorsManager;
 import org.apache.webbeans.intercept.custom.CustomInterceptorBean;
 import org.apache.webbeans.logger.WebBeansLoggerFacade;
 import org.apache.webbeans.portable.events.generics.GProcessBean;
@@ -106,7 +107,8 @@ public class AfterBeanDiscoveryImpl impl
                 }                
             }
 
-            beanManager.addInterceptor(interceptor);
+            InterceptorsManager interceptorsManager = webBeansContext.getInterceptorsManager();
+            interceptorsManager.addInterceptor(interceptor);
             webBeansContext.getBeanManagerImpl().addCustomInterceptorClass(bean.getBeanClass());
         }
         

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=1429160&r1=1429159&r2=1429160&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Fri Jan  4 22:15:04 2013
@@ -2576,7 +2576,7 @@ public final class WebBeansUtil
         {
             return true;
         }
-        else if(webBeansContext.getInterceptorsManager().isInterceptorEnabled(annotatedType.getJavaClass()))
+        else if(webBeansContext.getInterceptorsManager().isInterceptorClassEnabled(annotatedType.getJavaClass()))
         {
             return true;
         }
@@ -2695,7 +2695,7 @@ public final class WebBeansUtil
     public <T> void defineInterceptor(AnnotatedType<T> annotatedType)
     {
         Class<?> clazz = annotatedType.getJavaClass();
-        if (webBeansContext.getInterceptorsManager().isInterceptorEnabled(clazz))
+        if (webBeansContext.getInterceptorsManager().isInterceptorClassEnabled(clazz))
         {
             ManagedBean<T> delegate = null;
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java?rev=1429160&r1=1429159&r2=1429160&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
Fri Jan  4 22:15:04 2013
@@ -322,14 +322,14 @@ public final class WebBeansXMLConfigurat
                 interceptorsInFile.add(clazz);
 
                 boolean isBDAScanningEnabled=(scanner!=null && scanner.isBDABeansXmlScanningEnabled());
-                if ((!isBDAScanningEnabled && manager.isInterceptorEnabled(clazz))
||
+                if ((!isBDAScanningEnabled && manager.isInterceptorClassEnabled(clazz))
||
                         (isBDAScanningEnabled && !scanner.getBDABeansXmlScanner().addInterceptor(clazz,
fileName)))
                 {
                     logger.warning( "Interceptor class : " + child.getTextContent().trim()
+ " is already defined");
                 }
                 else
                 {
-                    manager.addNewInterceptor(clazz);
+                    manager.addNewInterceptorClass(clazz);
                 }
             }
 

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptorResolutionTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptorResolutionTest.java?rev=1429160&r1=1429159&r2=1429160&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptorResolutionTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptorResolutionTest.java
Fri Jan  4 22:15:04 2013
@@ -25,6 +25,7 @@ import java.util.Collection;
 import org.apache.webbeans.intercept.InterceptorResolution;
 import org.apache.webbeans.newtests.AbstractUnitTest;
 import org.apache.webbeans.newtests.interceptors.factory.beans.ClassInterceptedClass;
+import org.apache.webbeans.test.component.intercept.webbeans.TransactionalInterceptor;
 import org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional;
 
 
@@ -46,8 +47,9 @@ public class InterceptorResolutionTest  
         Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
         beanClasses.add(ClassInterceptedClass.class);
         beanClasses.add(Transactional.class);
+        beanClasses.add(TransactionalInterceptor.class);
 
-        startContainer(beanClasses, null);
+        startContainer(beanClasses, beanXmls);
 
         InterceptorResolution ir = new InterceptorResolution(getWebBeansContext());
         AnnotatedType<ClassInterceptedClass> annotatedType = getBeanManager().createAnnotatedType(ClassInterceptedClass.class);
@@ -55,7 +57,7 @@ public class InterceptorResolutionTest  
         InterceptorResolution.BeanInterceptorInfo interceptorInfo = ir.calculateInterceptorInfo(annotatedType);
         Assert.assertNotNull(interceptorInfo);
 
-/*X TODO implement!
+/*X
         Assert.assertNotNull(interceptorInfo.getInterceptors());
         Assert.assertEquals(1, interceptorInfo.getInterceptors().size());
 
@@ -63,8 +65,6 @@ public class InterceptorResolutionTest  
 
         Assert.assertNotNull(interceptorInfo.getMethodsInfo());
 */
-
-
         shutDownContainer();
     }
 }

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=1429160&r1=1429159&r2=1429160&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
Fri Jan  4 22:15:04 2013
@@ -294,7 +294,7 @@ public abstract class TestContext implem
         WebBeansContext webBeansContext = WebBeansContext.getInstance();
         webBeansContext.getManagedBeanConfigurator().checkManagedBeanCondition(clazz);
 
-        webBeansContext.getInterceptorsManager().addNewInterceptor(clazz);
+        webBeansContext.getInterceptorsManager().addNewInterceptorClass(clazz);
         AnnotatedType annotatedType = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(clazz);
         webBeansContext.getInterceptorUtil().checkInterceptorConditions(annotatedType);
         component = webBeansContext.getManagedBeanConfigurator().define(clazz, WebBeansType.INTERCEPTOR,
webBeansContext.getAnnotatedElementFactory().newAnnotatedType(clazz));
@@ -435,7 +435,7 @@ public abstract class TestContext implem
      */
     protected void initializeInterceptorType(Class<?> interceptorClazz)
     {
-        WebBeansContext.getInstance().getInterceptorsManager().addNewInterceptor(interceptorClazz);
+        WebBeansContext.getInstance().getInterceptorsManager().addNewInterceptorClass(interceptorClazz);
 
     }
 

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=1429160&r1=1429159&r2=1429160&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
Fri Jan  4 22:15:04 2013
@@ -108,12 +108,6 @@ public class MockManager implements Bean
         return manager.addDecorator(decorator);
     }
 
-    public BeanManager addInterceptor(Interceptor<?> interceptor)
-    {
-        manager.addInterceptor(interceptor);
-        return this;
-    }
-
     public void fireEvent(Object event, Annotation... bindings)
     {
         manager.fireEvent(event, bindings);

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/ShoppingCardInterceptorTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/ShoppingCardInterceptorTest.java?rev=1429160&r1=1429159&r2=1429160&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/ShoppingCardInterceptorTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/webbeans/ShoppingCardInterceptorTest.java
Fri Jan  4 22:15:04 2013
@@ -53,7 +53,7 @@ public class ShoppingCardInterceptorTest
         webBeansContext.getContextFactory().initSessionContext(null);
 
         // Interceptors must explicitly get enabled via XML. We fake this:
-        webBeansContext.getInterceptorsManager().addNewInterceptor(TransactionalInterceptor.class);
+        webBeansContext.getInterceptorsManager().addNewInterceptorClass(TransactionalInterceptor.class);
         
         defineInterceptor(TransactionalInterceptor.class);
         

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/strict/XMLSpecStrictTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/strict/XMLSpecStrictTest.java?rev=1429160&r1=1429159&r2=1429160&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/strict/XMLSpecStrictTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/strict/XMLSpecStrictTest.java
Fri Jan  4 22:15:04 2013
@@ -58,7 +58,7 @@ public class XMLSpecStrictTest extends T
         WebBeansXMLConfigurator configurator = new WebBeansXMLConfigurator();
         configurator.configureSpecSpecific(stream, "interceptors.xml");
 
-        boolean enable = WebBeansContext.getInstance().getInterceptorsManager().isInterceptorEnabled(DummyInterceptor.class);
+        boolean enable = WebBeansContext.getInstance().getInterceptorsManager().isInterceptorClassEnabled(DummyInterceptor.class);
         Assert.assertTrue(enable);
     }
     

Modified: openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/resolution/InterceptorResolutionTest.xml
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/resolution/InterceptorResolutionTest.xml?rev=1429160&r1=1429159&r2=1429160&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/resolution/InterceptorResolutionTest.xml
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/interceptors/resolution/InterceptorResolutionTest.xml
Fri Jan  4 22:15:04 2013
@@ -19,6 +19,6 @@ under the License.
 -->
 <beans>
    <interceptors>
-      <class>org.apache.webbeans.test.component.intercept.webbeans.bindings.Transactional</class>
+      <class>org.apache.webbeans.test.component.intercept.webbeans.TransactionalInterceptor</class>
    </interceptors>
 </beans>



Mime
View raw message