openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r883083 - in /incubator/openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/component/ main/java/org/apache/webbeans/container/ main/java/org/apache/webbeans/intercept/ main/java/org/apache/webbeans/intercept/ejb/ main/java/...
Date Sun, 22 Nov 2009 14:31:26 GMT
Author: gerdogdu
Date: Sun Nov 22 14:31:25 2009
New Revision: 883083

URL: http://svn.apache.org/viewvc?rev=883083&view=rev
Log:
Update interceptor for supporting overriden lifecycle methods.

Added:
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/LifecycleInheritedOverridenTest.java
  (with props)
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/SubClassInheritedBean.java
  (with props)
Modified:
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractBean.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/Boot.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorData.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/LifecycleInheritanceTest.java
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/SubClassBean.java

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractBean.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractBean.java?rev=883083&r1=883082&r2=883083&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractBean.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractBean.java
Sun Nov 22 14:31:25 2009
@@ -612,38 +612,50 @@
      */    
     public String toString()
     {
-        StringBuilder builder = new StringBuilder();
-        builder.append("{\n");        
-        builder.append("\tName : "+ getName() +", WebBeans Type: "+ getWebBeansType() + "\n");
-        builder.append("\tAPI Types:\n");
-        builder.append("\t[\n");
+        StringBuilder builder = new StringBuilder();        
+        builder.append("Name:"+ getName() +",WebBeans Type:"+ getWebBeansType());
+        builder.append(",API Types:[");
         
+        int size = getTypes().size();
+        int index = 1;
         for(Type clazz : getTypes())
         {
             if(clazz instanceof Class)
             {
-                builder.append("\t\t\t"+((Class<?>)clazz).getName()+ "\n");    
+                builder.append(((Class<?>)clazz).getName());    
             }
             else
             {
                 Class<?> rawType = (Class<?>)((ParameterizedType)clazz).getRawType();
-                builder.append("\t\t\t"+rawType.getName()+ "\n");
+                builder.append(rawType.getName());
             }
-                        
+            
+            if(index < size)
+            {
+                builder.append(",");
+            }
+            
+            index++;                        
         }
         
-        builder.append("\t]\n");
-        builder.append("\t,\n");
-        builder.append("\tQualifiers:\n");
-        builder.append("\t[\n");
+        builder.append("],");
+        builder.append("Qualifiers:[");
         
+        size = getQualifiers().size();
+        index = 1;
         for(Annotation ann : getQualifiers())
         {
-            builder.append("\t\t\t"+ann.annotationType().getName()+"\n");
+            builder.append(ann.annotationType().getName());
+            
+            if(index < size)
+            {
+                builder.append(",");
+            }
+            
+            index++;
         }
         
-        builder.append("\t]\n");
-        builder.append("}\n");
+        builder.append("]");
         
         return builder.toString();
     }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/Boot.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/Boot.java?rev=883083&r1=883082&r2=883083&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/Boot.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/Boot.java
Sun Nov 22 14:31:25 2009
@@ -13,6 +13,8 @@
  */
 package org.apache.webbeans.container;
 
+import javax.enterprise.inject.spi.BeanManager;
+
 /**
  * Container boot process.
  * 
@@ -21,5 +23,8 @@
  */
 public class Boot
 {
+    /**BeanManager instance unique to deployment*/
+    private BeanManager beanManager;
 
+    
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorData.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorData.java?rev=883083&r1=883082&r2=883083&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorData.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorData.java
Sun Nov 22 14:31:25 2009
@@ -65,6 +65,8 @@
      * @return the list of around invoke methods
      */
     public Method getAroundInvoke();
+    
+    public Method getInterceptor();
 
     /**
      * Sets the interceptor method.
@@ -142,4 +144,6 @@
     public void setWebBeansInterceptor(Interceptor<?> webBeansInterceptor);
 
     public Interceptor<?> getWebBeansInterceptor();
+    
+    public boolean isLifecycleInterceptor();
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java?rev=883083&r1=883082&r2=883083&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java
Sun Nov 22 14:31:25 2009
@@ -252,5 +252,34 @@
     {
         this.webBeansInterceptor = webBeansInterceptor;
     }
+    
+    public Method getInterceptor()
+    {
+        if(aroundInvoke != null)
+        {
+            return aroundInvoke;
+        }
+        else if(postConstruct != null)
+        {
+            return postConstruct;
+        }
+        else if(preDestroy != null)
+        {
+            return preDestroy;
+        }
+        
+        else return null;
+    }
+
+    @Override
+    public boolean isLifecycleInterceptor()
+    {
+        if(this.preDestroy != null || this.postConstruct != null)
+        {
+            return true;
+        }
+        
+        return false;
+    }
 
 }
\ No newline at end of file

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java?rev=883083&r1=883082&r2=883083&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
Sun Nov 22 14:31:25 2009
@@ -228,12 +228,17 @@
 
             Object t = intc.getInterceptorInstance();
             
+            //In bean class
             if (t == null)
             {
-                t = target;
-                
+                t = target;                
                 result = method.invoke(t, new Object[] {});
+                
+                //Continue to call others
+                proceedCommonAnnots(datas, type);                
+                
             }
+            //In interceptor class
             else
             {
                 result = method.invoke(t, new Object[] { this });

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java?rev=883083&r1=883082&r2=883083&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java
Sun Nov 22 14:31:25 2009
@@ -15,6 +15,7 @@
 
 import java.lang.reflect.Method;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 
 import javax.annotation.PostConstruct;
@@ -65,11 +66,130 @@
 
         }
 
-        configureBeanAnnots(clazz, stack);
+        configureBeanAnnots(clazz, stack);        
+        checkInheritedButOverridenMethod(clazz, stack);        
     }
-
-    /*
-     * Configure interceptor class
+    
+    /**
+     * Return true if given candidate is listed in interceptors list. 
+     * @param mainClass bean class
+     * @param candidateClass interceptor candidate class
+     * @return true if given candidate is listed in interceptors list
+     */
+    private static boolean checkGivenClassIsInInterceptorList(Class<?> mainClass, Class<?>
candidateClass)
+    {
+        if (AnnotationUtil.hasClassAnnotation(mainClass, Interceptors.class))
+        {
+            Interceptors incs = mainClass.getAnnotation(Interceptors.class);
+            Class<?>[] intClasses = incs.value();
+            
+            for (Class<?> intClass : intClasses)
+            {
+                if(intClass.equals(candidateClass))
+                {
+                    return true;
+                }
+                else
+                {
+                    if(checkInInterceptorHierarchy(intClass, candidateClass))
+                    {
+                        return true;
+                    }
+                }
+            }
+        }
+        
+        return false;
+    }
+    
+    /**
+     * Return true if candidate class is a super class of given interceptor class.
+     * @param interceptorClass interceptor class
+     * @param candidateClass candaite class
+     * @return true if candidate class is a super class of given interceptor class
+     */
+    private static boolean checkInInterceptorHierarchy(Class<?> interceptorClass, Class<?>
candidateClass)
+    {
+        Class<?> superClassInterceptor = interceptorClass.getSuperclass();
+        if(superClassInterceptor != null && !superClassInterceptor.equals(Object.class))
+        {
+            if(superClassInterceptor.equals(candidateClass))
+            {
+                return true;
+            }
+            
+            else
+            {
+                return checkInInterceptorHierarchy(superClassInterceptor, candidateClass);
+            }
+        }
+        
+        return false;
+    }
+    
+    /**
+     * Remove bean inherited but overriden lifecycle interceptor method from
+     * its stack list.
+     * @param clazz bean class
+     * @param stack bean interceptor stack
+     */
+    private static void checkInheritedButOverridenMethod(Class<?> clazz,List<InterceptorData>
stack)
+    {
+        Iterator<InterceptorData> it = stack.iterator();
+        while(it.hasNext())
+        {
+            InterceptorData interceptorData = it.next();
+            
+            if(interceptorData.isLifecycleInterceptor())
+            {
+                if(removeInheritedButOverridenInterceptor(clazz, interceptorData))
+                {
+                    it.remove();
+                }                
+            }
+        }
+    }
+    
+    /**
+     * @see EJBInterceptorConfig#checkInheritedButOverridenMethod(Class, List)  
+     */
+    private static boolean removeInheritedButOverridenInterceptor(Class<?> clazz, InterceptorData
interceptorData)
+    {    
+        Method interceptor = interceptorData.getInterceptor();
+        Class<?> declaringClass = interceptor.getDeclaringClass();
+        
+        //Not look for Interceptor classes
+        if(checkGivenClassIsInInterceptorList(clazz, declaringClass))
+        {
+            return false;
+        }
+        
+        if(!declaringClass.equals(clazz))
+        {
+            Method found = ClassUtil.getDeclaredMethod(clazz,interceptor.getName(), interceptor.getParameterTypes());
               
+            if(found != null)
+            {
+                return true;
+            }
+            else
+            {
+                Class<?> superClass = clazz.getSuperclass();
+                if(superClass != null && !superClass.equals(Object.class))
+                {
+                    return removeInheritedButOverridenInterceptor(superClass, interceptorData);
  
+                }            
+            }            
+        }
+                
+        return false;
+    }
+    
+    /**
+     * Configure {@link Interceptors} on bean class.
+     * @param clazz bean class
+     * @param stack interceptor stack of bean
+     * @param isMethod if interceptor definition is on the bean
+     * @param m if isMethod true, then it is intercepted method
      */
     private static void configureInterceptorAnnots(Class<?> clazz, List<InterceptorData>
stack, boolean isMethod, Method m)
     {
@@ -86,9 +206,11 @@
         WebBeansUtil.configureInterceptorMethods(null, clazz, PreDestroy.class, true, isMethod,
stack, m, false);
 
     }
-
-    /*
-     * Configure bean class
+    
+    /**
+     * Configure bean class defined interceptors.
+     * @param clazz bean class
+     * @param stack interceptor stack
      */
     private static void configureBeanAnnots(Class<?> clazz, List<InterceptorData>
stack)
     {
@@ -124,9 +246,11 @@
         WebBeansUtil.configureInterceptorMethods(null, clazz, PreDestroy.class, false, false,
stack, null, false);
 
     }
-
-    /*
-     * Super class annots.
+    
+    /**
+     * Configures super classes interceptors.
+     * @param list super classes
+     * @param stack interceptor stack
      */
     private static void configureBeanSuperClassAnnots(List<Class<?>> list, List<InterceptorData>
stack)
     {

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java?rev=883083&r1=883082&r2=883083&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
Sun Nov 22 14:31:25 2009
@@ -1847,4 +1847,16 @@
         
         return false;
     }
+    
+    public static Method getDeclaredMethod(Class<?> clazz, String methodName, Class<?>[]
parameters)
+    {
+        try
+        {
+            return clazz.getDeclaredMethod(methodName, parameters);
+            
+        }catch(NoSuchMethodException e)
+        {
+            return null;
+        }
+    }
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=883083&r1=883082&r2=883083&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Sun Nov 22 14:31:25 2009
@@ -928,7 +928,9 @@
      * @param isDefinedWithWebBeans if interceptor is defined with WebBeans
      *            spec, not EJB spec
      */
-    public static void configureInterceptorMethods(Interceptor<?> webBeansInterceptor,
Class<?> clazz, Class<? extends Annotation> annotation, boolean definedInInterceptorClass,
boolean definedInMethod, List<InterceptorData> stack, Method annotatedInterceptorClassMethod,
boolean isDefinedWithWebBeans)
+    public static void configureInterceptorMethods(Interceptor<?> webBeansInterceptor,
Class<?> clazz, Class<? extends Annotation> annotation, 
+                                                    boolean definedInInterceptorClass, boolean
definedInMethod, List<InterceptorData> stack, 
+                                                    Method annotatedInterceptorClassMethod,
boolean isDefinedWithWebBeans)
     {
         InterceptorData intData = null;
         Method method = null;

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/LifecycleInheritanceTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/LifecycleInheritanceTest.java?rev=883083&r1=883082&r2=883083&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/LifecycleInheritanceTest.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/LifecycleInheritanceTest.java
Sun Nov 22 14:31:25 2009
@@ -13,14 +13,45 @@
  */
 package org.apache.webbeans.newtests.interceptors.lifecycle.inheritance;
 
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
 import org.junit.Test;
 
-public class LifecycleInheritanceTest
+public class LifecycleInheritanceTest extends AbstractUnitTest
 {
     
     @Test
     public void testLifecycle()
     {
+        Collection<Class<?>> classes = new ArrayList<Class<?>>();
+        classes.add(SubClassBean.class);
+        classes.add(SuperClassBean.class);
+        
+        startContainer(classes);
+        
+        BeanManager manager = getBeanManager();
+        Bean<?> subClassBean = manager.getBeans(SubClassBean.class, new Annotation[0]).iterator().next();
+        
+        Object subClassInstance = manager.getReference(subClassBean, SubClassBean.class,
manager.createCreationalContext(subClassBean));
+        
+        Assert.assertTrue(subClassInstance instanceof SubClassBean);
+        SubClassBean beanInstance = (SubClassBean)subClassInstance;
+        beanInstance.business();
+        
+        Assert.assertTrue(SubClassBean.POST_CONSTRUCT);
+        Assert.assertTrue(SuperClassBean.POST_CONSTRUCT);
+        
+        shutDownContainer();
         
+        Assert.assertTrue(SubClassBean.PRE_DESTOY);
+        Assert.assertTrue(SuperClassBean.PRE_DESTOY);
     }
 }

Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/LifecycleInheritedOverridenTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/LifecycleInheritedOverridenTest.java?rev=883083&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/LifecycleInheritedOverridenTest.java
(added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/LifecycleInheritedOverridenTest.java
Sun Nov 22 14:31:25 2009
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
+ * or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.apache.webbeans.newtests.interceptors.lifecycle.inheritance;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Before;
+import org.junit.Test;
+
+public class LifecycleInheritedOverridenTest extends AbstractUnitTest
+{
+    @Before
+    public void before()
+    {
+        SubClassBean.POST_CONSTRUCT = false;
+        SubClassBean.PRE_DESTOY = false;
+        
+        SuperClassBean.POST_CONSTRUCT = false;
+        SuperClassBean.PRE_DESTOY = false;        
+    }
+    
+    @Test
+    public void testInheritedOverridenMethods()
+    {
+        Collection<Class<?>> classes = new ArrayList<Class<?>>();
+        classes.add(SubClassBean.class);
+        classes.add(SubClassInheritedBean.class);
+        
+        startContainer(classes);
+        
+        BeanManager manager = getBeanManager();
+        Bean<?> subClassBean = manager.getBeans(SubClassInheritedBean.class, new Annotation[0]).iterator().next();
+        
+        Object subClassInstance = manager.getReference(subClassBean, SubClassInheritedBean.class,
manager.createCreationalContext(subClassBean));
+        
+        Assert.assertTrue(subClassInstance instanceof SubClassInheritedBean);
+        SubClassInheritedBean beanInstance = (SubClassInheritedBean)subClassInstance;
+        beanInstance.business();
+                
+        Assert.assertFalse(SubClassInheritedBean.POST_CONSTRUCT);
+        Assert.assertFalse(SubClassInheritedBean.POST_CONSTRUCT);
+        
+        Assert.assertTrue(SubClassBean.POST_CONSTRUCT);
+        Assert.assertTrue(SubClassBean.POST_CONSTRUCT);
+        
+        Assert.assertFalse(SuperClassBean.POST_CONSTRUCT);
+        Assert.assertFalse(SuperClassBean.POST_CONSTRUCT);
+        
+        shutDownContainer();
+        
+        Assert.assertFalse(SubClassInheritedBean.PRE_DESTOY);
+        Assert.assertFalse(SubClassInheritedBean.PRE_DESTOY);
+        
+        Assert.assertTrue(SubClassBean.PRE_DESTOY);
+        Assert.assertTrue(SubClassBean.PRE_DESTOY);
+        
+        Assert.assertFalse(SuperClassBean.PRE_DESTOY);
+        Assert.assertFalse(SuperClassBean.PRE_DESTOY);
+        
+    }
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/LifecycleInheritedOverridenTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/SubClassBean.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/SubClassBean.java?rev=883083&r1=883082&r2=883083&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/SubClassBean.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/SubClassBean.java
Sun Nov 22 14:31:25 2009
@@ -28,14 +28,19 @@
         
     }
     
+    public void business()
+    {
+        
+    }
+    
     @PostConstruct
-    public void postConstruct()
+    public void postConstruct1()
     {
         POST_CONSTRUCT = true;
     }
     
     @PreDestroy
-    public void preDestroy()
+    public void preDestroy1()
     {
         PRE_DESTOY = true;
     }

Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/SubClassInheritedBean.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/SubClassInheritedBean.java?rev=883083&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/SubClassInheritedBean.java
(added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/SubClassInheritedBean.java
Sun Nov 22 14:31:25 2009
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
+ * or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.apache.webbeans.newtests.interceptors.lifecycle.inheritance;
+
+import javax.enterprise.context.RequestScoped;
+
+@RequestScoped
+public class SubClassInheritedBean extends SubClassBean
+{
+    public static boolean POST_CONSTRUCT = false;
+    public static boolean PRE_DESTOY = false;
+    
+    public SubClassInheritedBean()
+    {
+        
+    }
+    
+    public void business()
+    {
+        
+    }
+    
+    public void postConstruct()
+    {
+        POST_CONSTRUCT = true;
+    }
+    
+    public void preDestroy()
+    {
+        PRE_DESTOY = true;
+    }
+ 
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/inheritance/SubClassInheritedBean.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message