openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1796370 - in /openwebbeans/trunk: webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ webbeans-impl/src/test/java/org/apache/webbeans/test/decorators/tests/ webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/...
Date Sat, 27 May 2017 08:05:31 GMT
Author: struberg
Date: Sat May 27 08:05:30 2017
New Revision: 1796370

URL: http://svn.apache.org/viewvc?rev=1796370&view=rev
Log:
OWB-1182 Decorators and Interceptors with non-Dependent scope now leads to Exception per spec

Added:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/broken/BrokenInterceptorTest.java
      - copied, changed from r1796369, openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/broken/BrokenTest.java
Removed:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/broken/BrokenTest.java
Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanAttributesBuilder.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/decorators/tests/BrokenDecoratorTest.java
    openwebbeans/trunk/webbeans-tck/standalone-suite.xml

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanAttributesBuilder.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanAttributesBuilder.java?rev=1796370&r1=1796369&r2=1796370&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanAttributesBuilder.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanAttributesBuilder.java
Sat May 27 08:05:30 2017
@@ -369,6 +369,17 @@ public abstract class BeanAttributesBuil
             }
         }
 
+        if (found && annotated.getAnnotation(Interceptor.class) != null &&
scope != Dependent.class)
+        {
+            throw new WebBeansConfigurationException("An Interceptor must declare any other
Scope than @Dependent: " + ClassUtil.getClass(annotated.getBaseType()).getName());
+        }
+
+        if (found && annotated.getAnnotation(Decorator.class) != null &&
scope != Dependent.class)
+        {
+            throw new WebBeansConfigurationException("A Decorator must declare any other
Scope than @Dependent: " + ClassUtil.getClass(annotated.getBaseType()).getName());
+        }
+
+
         if (!found && declaringClass != null && !hasDeclaredNonInheritedScope(declaringClass))
         {
             defineScope(declaringClass.getSuperclass(), onlyScopedBeans, errorMessage);

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/decorators/tests/BrokenDecoratorTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/decorators/tests/BrokenDecoratorTest.java?rev=1796370&r1=1796369&r2=1796370&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/decorators/tests/BrokenDecoratorTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/decorators/tests/BrokenDecoratorTest.java
Sat May 27 08:05:30 2017
@@ -37,8 +37,8 @@ public class BrokenDecoratorTest extends
 {
     public static final String PACKAGE_NAME = BrokenDecoratorTest.class.getPackage().getName();
 
-    @Test
-    public void testWarnings()
+    @Test(expected = WebBeansConfigurationException.class)
+    public void testDecoratorWithNonDependentScope()
     {
         Collection<Class<?>> classes = new ArrayList<Class<?>>();
         classes.add(SomeBrokenDecorated.class);
@@ -50,10 +50,6 @@ public class BrokenDecoratorTest extends
         xmls.add(getXmlPath(PACKAGE_NAME, "BrokenDecoratorTest"));
 
         startContainer(classes, xmls);
-
-
-
-        shutDownContainer();
     }
 
     @Test(expected = WebBeansConfigurationException.class)

Copied: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/broken/BrokenInterceptorTest.java
(from r1796369, openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/broken/BrokenTest.java)
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/broken/BrokenInterceptorTest.java?p2=openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/broken/BrokenInterceptorTest.java&p1=openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/broken/BrokenTest.java&r1=1796369&r2=1796370&rev=1796370&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/broken/BrokenTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/broken/BrokenInterceptorTest.java
Sat May 27 08:05:30 2017
@@ -21,20 +21,20 @@ package org.apache.webbeans.test.interce
 import java.util.ArrayList;
 import java.util.Collection;
 
+import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.test.AbstractUnitTest;
 import org.junit.Test;
 
-public class BrokenTest extends AbstractUnitTest
+public class BrokenInterceptorTest extends AbstractUnitTest
 {
 
-    public static final String PACKAGE_NAME = BrokenTest.class.getPackage().getName();
+    public static final String PACKAGE_NAME = BrokenInterceptorTest.class.getPackage().getName();
 
     @Test
     public void testWarnings()
     {
         Collection<Class<?>> classes = new ArrayList<Class<?>>();
         classes.add(BrokenBean.class);
-        classes.add(BrokenScope.class);
         classes.add(BrokenAlternative.class);
         classes.add(BrokenName.class);
         
@@ -47,4 +47,10 @@ public class BrokenTest extends Abstract
         
     }
 
+    @Test(expected = WebBeansConfigurationException.class)
+    public void testBrokenScopeOnInterceptor()
+    {
+        startContainer(BrokenScope.class);
+    }
+
 }

Modified: openwebbeans/trunk/webbeans-tck/standalone-suite.xml
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-tck/standalone-suite.xml?rev=1796370&r1=1796369&r2=1796370&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-tck/standalone-suite.xml (original)
+++ openwebbeans/trunk/webbeans-tck/standalone-suite.xml Sat May 27 08:05:30 2017
@@ -73,7 +73,11 @@
             </class>
 
             <!-- https://issues.jboss.org/browse/CDITCK-432 -->
-            <class name="org.jboss.cdi.tck.tests.decorators.builtin.event.complex.ComplexEventDecoratorTest"/>
+            <class name="org.jboss.cdi.tck.tests.decorators.builtin.event.complex.ComplexEventDecoratorTest">
+                <methods>
+                    <exclude name=".*"/>
+                </methods>
+            </class>
 
 
 <!--



Mime
View raw message