openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r948875 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/component/ test/java/org/apache/webbeans/newtests/interceptors/dependent/
Date Thu, 27 May 2010 16:12:18 GMT
Author: gerdogdu
Date: Thu May 27 16:12:18 2010
New Revision: 948875

URL: http://svn.apache.org/viewvc?rev=948875&view=rev
Log:
[OWB-387] DependentContext Interceptor Double Call for PostConstruct

Added:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleBean.java
  (with props)
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleTest.java
  (with props)
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentSuperBean.java
  (with props)
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/MyExtraSuper.java
  (with props)
Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java?rev=948875&r1=948874&r2=948875&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java
Thu May 27 16:12:18 2010
@@ -139,7 +139,7 @@ public abstract class AbstractInjectionT
             //Means that Dependent Bean has interceptor/decorator
             if(JavassistProxyFactory.isProxyInstance(result))
             {
-                afterConstructor(instance, creationalContext);
+                //afterConstructor(instance, creationalContext);
                 dependentProxy = result;
                 isDependentProxy = true;
             }

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleBean.java?rev=948875&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleBean.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleBean.java
Thu May 27 16:12:18 2010
@@ -0,0 +1,41 @@
+/*
+ * 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.dependent;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Named;
+
+@Named("org.apache.webbeans.newtests.interceptors.dependent.DependentLifecycleBean")
+public class DependentLifecycleBean extends DependentSuperBean
+{
+    public static int value = 0;
+    
+    @PostConstruct
+    public void postConstruct()
+    {
+        value++;
+    }
+    
+    @PreDestroy
+    public void preDestroy()
+    {
+        value --;
+    }
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleTest.java?rev=948875&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleTest.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleTest.java
Thu May 27 16:12:18 2010
@@ -0,0 +1,72 @@
+/*
+ * 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.dependent;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+public class DependentLifecycleTest extends AbstractUnitTest
+{
+
+    @Test
+    @SuppressWarnings("unchecked")
+    public void testLifecycle()
+    {
+        Collection<URL> beanXmls = new ArrayList<URL>();
+        
+        Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+        beanClasses.add(DependentLifecycleBean.class);
+        
+        startContainer(beanClasses, beanXmls);        
+        
+        Set<Bean<?>> beans = getBeanManager().getBeans("org.apache.webbeans.newtests.interceptors.dependent.DependentLifecycleBean");
+        Assert.assertNotNull(beans);        
+        Bean<DependentLifecycleBean> bean = (Bean<DependentLifecycleBean>)beans.iterator().next();
+        
+        CreationalContext<DependentLifecycleBean> ctx = getBeanManager().createCreationalContext(bean);
+
+        Object reference = getBeanManager().getReference(bean, DependentLifecycleBean.class,
ctx);
+        Assert.assertNotNull(reference);
+        
+        Assert.assertTrue(reference instanceof DependentLifecycleBean);
+
+        Assert.assertEquals(1, DependentLifecycleBean.value);
+        Assert.assertTrue(DependentSuperBean.SC);
+        Assert.assertTrue(MyExtraSuper.SC);
+                        
+        ctx.release();
+        
+        shutDownContainer();
+        
+        Assert.assertEquals(0, DependentLifecycleBean.value);
+        Assert.assertFalse(DependentSuperBean.SC);
+        Assert.assertFalse(MyExtraSuper.SC);
+        
+    }
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentSuperBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentSuperBean.java?rev=948875&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentSuperBean.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentSuperBean.java
Thu May 27 16:12:18 2010
@@ -0,0 +1,40 @@
+/*
+ * 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.dependent;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+
+public class DependentSuperBean extends MyExtraSuper
+{
+    public static boolean SC = false;
+    
+    @PostConstruct
+    public void myPostConstruct()
+    {
+        SC = true;
+    }
+    
+    @PreDestroy
+    public void myPreDestroy()
+    {
+        SC = false;
+    }
+
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentSuperBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/MyExtraSuper.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/MyExtraSuper.java?rev=948875&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/MyExtraSuper.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/MyExtraSuper.java
Thu May 27 16:12:18 2010
@@ -0,0 +1,40 @@
+/*
+ * 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.dependent;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+
+public class MyExtraSuper
+{
+    public static boolean SC = false;
+    
+    @PostConstruct
+    public void myEctraPostConstruct()
+    {
+        SC = true;
+    }
+    
+    @PreDestroy
+    public void myEctraPreDestroy()
+    {
+        SC = false;
+    }
+
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/MyExtraSuper.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message