openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bergm...@apache.org
Subject svn commit: r1203853 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/util/ test/java/org/apache/webbeans/newtests/decorators/simple/
Date Fri, 18 Nov 2011 21:35:51 GMT
Author: bergmark
Date: Fri Nov 18 21:35:50 2011
New Revision: 1203853

URL: http://svn.apache.org/viewvc?rev=1203853&view=rev
Log:
[OWB-630] Do not resolve @Delegate injection points when checking WebBeansUtil.isPassivationCapableDependency

Added:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/OtherLog.java
  (with props)
Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/LogDecorator.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/SimpleDecoratorTest.java

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=1203853&r1=1203852&r2=1203853&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 Nov 18 21:35:50 2011
@@ -2766,6 +2766,11 @@ public final class WebBeansUtil
 
     public boolean isPassivationCapableDependency(InjectionPoint injectionPoint)
     {
+        //Don't attempt to get an instance of the delegate injection point
+        if (injectionPoint.isDelegate())
+        {
+            return true;
+        }
         InjectionResolver instance = webBeansContext.getBeanManagerImpl().getInjectionResolver();
 
         Bean<?> bean = instance.getInjectionPointBean(injectionPoint);

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/LogDecorator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/LogDecorator.java?rev=1203853&r1=1203852&r2=1203853&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/LogDecorator.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/LogDecorator.java
Fri Nov 18 21:35:50 2011
@@ -18,6 +18,8 @@
  */
 package org.apache.webbeans.newtests.decorators.simple;
 
+import java.io.Serializable;
+
 import javax.decorator.Decorator;
 import javax.decorator.Delegate;
 import javax.inject.Inject;
@@ -25,8 +27,10 @@ import javax.inject.Named;
 
 @Named("org.apache.webbeans.newtests.decorators.simple.LogDecorator")
 @Decorator
-public class LogDecorator implements ILog{
+public class LogDecorator implements ILog, Serializable {
 
+    private static final long serialVersionUID = 1L;
+    
     public static String MESSAGE = ""; 
     private @Inject @Delegate ILog ilog;
     

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/OtherLog.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/OtherLog.java?rev=1203853&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/OtherLog.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/OtherLog.java
Fri Nov 18 21:35:50 2011
@@ -0,0 +1,37 @@
+/*
+ * 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.decorators.simple;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+
+@SessionScoped
+public class OtherLog implements ILog, Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public void log(String logMessage)
+    {
+        System.out.println("other :" + logMessage);
+    }
+
+}
+

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/OtherLog.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/SimpleDecoratorTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/SimpleDecoratorTest.java?rev=1203853&r1=1203852&r2=1203853&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/SimpleDecoratorTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/decorators/simple/SimpleDecoratorTest.java
Fri Nov 18 21:35:50 2011
@@ -69,4 +69,24 @@ public class SimpleDecoratorTest extends
         
         shutDownContainer();
     }
+    
+    /**
+     * Ensure that if we have multiple beans that can resolve to the @Delegate injection
point we don't report an error
+     * even if one of those beans has a passivating scope.
+     */
+    @Test
+    public void testDecorateTwoBeans(){
+        Collection<Class<?>> classes = new ArrayList<Class<?>>();
+        classes.add(LogDecorator.class);
+        classes.add(MyLog.class);
+        classes.add(OtherLog.class);
+        
+
+        Collection<String> xmls = new ArrayList<String>();
+        xmls.add(getXmlPath(PACKAGE_NAME, "SimpleDecoratorTest"));
+
+        startContainer(classes, xmls);
+        
+        shutDownContainer();
+    }
 }



Mime
View raw message